MAINSAIL Language Manual, Section 47.4

previous   next   top   complete contents   complete index   framed top   this page unframed


47.4. scanSet

Figure 47–4. scanSet
BITS
PROCEDURE   scanSet     (STRING scanChars);

scanSet is used to associate characters with a bit that can be used with the PROCEDURE scan.

The BITS value returned by scanSet has a single 1-bit. This bit is associated with the characters of scanChars when used by scan.

There is a limit on the number of bits in use at the same time equal to one less than the number of bits in a BITS value.

Example 47–5. Use of scanSet
BITS letters,digits,lettersAndDigits;
...
letters := scanSet("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
digits  := scanSet("0123456789");

lettersAndDigits := letters!digits

scan can use letters for scanning letters, digits for scanning digits, and lettersAndDigits for scanning letters and digits.

Repeated calls to scanSet for the same scan string return the same scan bit instead of allocating a new scan bit for each call. MAINSAIL keeps track of how often scanSet has been called for a given string. Each time scanRel is called for a given scan bit, its count is decremented, and the scan bit is released only when the decremented count is no longer positive.

$scanSet provides INTEGERs that may be used with scan. Only one INTEGER may be used at a time with scan, but a large number of them are available.

Values returned from scanSet should not be saved in a file or structure image; they are valid only during the current execution.


previous   next   top   complete contents   complete index   framed top   this page unframed

MAINSAIL Language Manual, Section 47.4