--- parser3/src/include/pa_string.h 2004/03/02 15:54:07 1.158 +++ parser3/src/include/pa_string.h 2004/05/24 12:21:18 1.162 @@ -8,7 +8,7 @@ #ifndef PA_STRING_H #define PA_STRING_H -static const char * const IDENT_STRING_H="$Date: 2004/03/02 15:54:07 $"; +static const char * const IDENT_STRING_H="$Date: 2004/05/24 12:21:18 $"; // includes @@ -108,8 +108,15 @@ public: union Languages { struct { +#ifdef PA_LITTLE_ENDIAN Language lang:8; int is_not_just_lang:sizeof(CORD)*8-8; +#elif defined(PA_BIG_ENDIAN) + int is_not_just_lang:sizeof(CORD)*8-8; + Language lang:8; +#else +# error word endianness not determined for some obscure reason +#endif } opt; CORD langs; @@ -321,11 +328,17 @@ public: return CORD_chr(body, offset, c); } - template void for_each( + template int for_each( + int (*f)(char c, I), + I info) const { + return CORD_iter(body, (CORD_iter_fn)f, (void*)info); + } + + template int for_each( int (*f1)(char c, I), int (*f2)(const char* s, I), I info) const { - CORD_iter5(body, 0, (CORD_iter_fn)f1, (CORD_batched_iter_fn)f2, info); + return CORD_iter5(body, 0, (CORD_iter_fn)f1, (CORD_batched_iter_fn)f2, info); } void set_pos(CORD_pos& pos, size_t index) const { CORD_set_pos(pos, body, index); }