SCM - scan characters under mask.

Usage:

B:
   val = scm( string [, pos, char, count , mask, type] );
C:
   int scm(const char *string [, int pos, int char,
           int count, int mask, int type] );

Where:

string
points to the string of characters to be scanned.
pos
is a number giving the character position where scanning is to begin. A "pos" of zero indicates the initial character of "string", a "pos" of one indicates the next character, and so on. If "pos" is not specified, the default is zero and scanning starts at the beginning of "string".
char
contains the character to scan for. The default "char" is '*e'.
count
is the maximum number of characters to scan. If "count" is not specified, there is no maximum and SCM will scan to the end of memory. If "count" is negative, SCM begins it scan at "pos" in "string" and scans BACKWARDS through "-count" characters.
mask
is a word whose bottom nine bits indicate which bits to exclude from comparison; thus as SCM scans through characters in memory, it will only look at the bit positions in each byte which correspond to zero bits in "mask". It is convenient to say that SCM "sees through the holes" of "mask". Thus if "mask" is 0770, SCM only looks at the bottom three bits of every byte. If "mask" is not specified, the default is zero and SCM looks at the whole of every word.
type
is one of 4, 6, or 9, indicating the number of bits per character. If "type" is not specified, the default is nine bits per character (i.e. ASCII characters).

Description:

SCM searches memory for a given character. Starting at character position "pos" in "string", "count" characters are examined and compared with character "char". If a matching character is found, the scan is stopped. The "val" returned is the position at which the scan stopped (presumably the index of the matching character). If no matching character is found, the "val" returned is "pos + count". This is one position past the last legal character.

Copyright © 2000, Thinkage Ltd.