--- 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 08:02:09 1.145.4.6 @@ -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 08:02:09 $"; // includes @@ -23,12 +23,11 @@ extern "C" { // cord's author forgot to /// 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 @@ -176,7 +175,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 +265,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 @@ -291,7 +290,7 @@ public: if(!langs) return current_length==0; if(is_not_just_lang) - return CORD_len(langs)==current_length; + return !*langs && CORD_len(langs)==current_length; return true; // uncheckable, actually } };