From: samintz
| In order to create a string class or a bitmap of the types, it *still* has
| to be classified many times. How else would you create the bitmap?
If you look at the typical implementation in the Standard C library of the character classification functions underlying TCC's isdigit, isxdigit, etc., you will see that they use a constant array, indexed by the character code, the values of which are in the manner Vince suggested, a bit for decimal digit, another bit for hexadecimal digit, one for lower case letter, one for whitespace, one for punctuation, etc. When classifying a string, you just bit-wise OR the class codes of each character in the string, and evaluate the final result, e.g., @ISDIGIT checks that the only bit set is for decimal digit. That's of course why floating point numbers do not match (ref. your post in TC Support) - they'd also have the bit set for punctuation character from the decimal separator (and possibly from the thousands separator). So this is a much faster test. Look at <ctype.h>. It is unfortunate that Standard C never specified a function which returns the actual table entry, or for a string, the bitwise-OR of them, explicitly, allowing the user to check for custom classes.
--
Steve