--- parser3/src/include/pa_string.h 2003/09/23 13:53:04 1.145.4.4 +++ parser3/src/include/pa_string.h 2003/09/24 10:49:13 1.145.4.7 @@ -8,7 +8,7 @@ #ifndef PA_STRING_H #define PA_STRING_H -static const char* IDENT_STRING_H="$Date: 2003/09/23 13:53:04 $"; +static const char* IDENT_STRING_H="$Date: 2003/09/24 10:49:13 $"; // includes @@ -20,15 +20,10 @@ extern "C" { // cord's author forgot to #include "cord.h" }; -/// must use simple version, without optimization for short pieces -/// it's much more convinient for iterating. we rely on this here: CORD_block_iter -#define CORD_chars(c, i) CORD_chars_block((c), (i)) -extern "C" CORD CORD_chars_block(char c, size_t i); - // cord extension /* Returns true if x does contain */ /* char not_c at positions i..i+n. Value i,i+n must be < CORD_len(x). */ -int CORD_nnchr(CORD x, size_t i, size_t n, int not_c); +int CORD_range_contains_chr_greater_then(CORD x, size_t i, size_t n, int c); // forwards @@ -149,7 +144,7 @@ public: enum Language { L_UNSPECIFIED=0, ///< no real string has parts of this lange: it's just convinient to check when string's empty // these two must go before others, there are checks for >L_AS_IS - L_CLEAN, ///< clean + L_CLEAN='1', ///< clean L_AS_IS, ///< leave all characters intact L_PASS_APPENDED, @@ -176,7 +171,7 @@ public: union { struct { Language lang:8; - int is_not_just_lang:16-8; + int is_not_just_lang:sizeof(CORD)*8-8; }; CORD langs; }; @@ -266,15 +261,15 @@ public: append(current, src.make_langs(aoffset, alength)); } - /// checks if we have alang all from aoffset to aoffset+alength + /// checks if we have lang<=alang all from aoffset to aoffset+alength bool check_lang(Language alang, size_t aoffset, size_t alength) const { if(alang==L_UNSPECIFIED) // ignore lang? return true; if(is_not_just_lang) - return CORD_nnchr(langs, aoffset, alength, (unsigned)alang)!=0; + return CORD_range_contains_chr_greater_then(langs, aoffset, alength, (unsigned)alang)==0; else - return lang==alang; + return lang<=alang; } template