TRTEST - translate and test characters (fast char scan).
Usage:
B:
ret = trtest( string, pos, table [, count [, type] ] );
C:
int trtest(char *string, int pos, void *table,
[int count, [int type]]);
Where:
- string
- points to the string of characters to be scanned.
- pos
- is a character offset position in "string". The
initial character of "string" is in position
zero, the next character is in position one, and so on.
- table
- points to an area in memory containing a decision table
as described below.
- count
- is the maximum number of characters for TRTEST to scan.
If "count" is not specified, there is no
maximum and TRTEST will scan to the end of memory. If
"count" is negative, the scan will begin at
position "pos" in string and proceed BACKWARDS
through -"count" characters.
- type
- is one of 4, 6, or 9, indicating the number of bits per
character in "string". If "type" is
not specified, the default is 9 (indicating ASCII
characters).
- ret
- is the character offset position of the first character
in "string" to have a non-zero entry in
"table". If no such character is found, the
position returned is "count+pos", one position
past the last legal character.
Description:
TRTEST is a moderately powerful scanning routine. Starting at
character position "pos" in string "string",
"count" characters are examined. The value of each
character is used as a subscript into "table". If the
character thus obtained from "table" is non-zero, the
scan is stopped. If "count" is negative, the scan is
done in the reverse direction.
"ret" receives the character position at which the
scan stopped. If no matching character is found, the position
returned is "count + pos", one position past the last
legal character. "table" is always considered to
consist of nine-bit characters.
See Also:
- expl b lib external .trt0, expl b lib external .trt1
- ".trt0" and ".trt1" are useful when
creating translation tables for TRTEST.
Copyright © 1996, Thinkage Ltd.