21#ifndef Minisat_ParseUtils_h
22#define Minisat_ParseUtils_h
36static const int buffer_size = 1048576;
41 unsigned char buf[buffer_size];
45 void assureLookahead() {
48 size =
gzread(in, buf,
sizeof(buf)); } }
53 int operator * ()
const {
return (pos >= size) ? EOF : buf[pos]; }
63static inline bool isEof(StreamBuffer& in) {
return *in == EOF; }
64static inline bool isEof(
const char* in) {
return *in ==
'\0'; }
71static void skipWhitespace(B& in) {
72 while ((*in >= 9 && *in <= 13) || *in == 32)
77static void skipLine(B& in) {
79 if (isEof(in))
return;
80 if (*in ==
'\n') { ++in;
return; }
85static int parseInt(B& in) {
89 if (*in ==
'-') neg =
true, ++in;
90 else if (*in ==
'+') ++in;
91 if (*in <
'0' || *in >
'9') fprintf(stderr,
"PARSE ERROR! Unexpected char: %c\n", *in),
exit(3);
92 while (*in >=
'0' && *in <=
'9')
93 val = val*10 + (*in -
'0'),
95 return neg ? -val : val; }
101static bool match(B& in,
const char* str) {
103 for (i = 0; str[i] !=
'\0'; i++)
114static bool eagerMatch(B& in,
const char* str) {
115 for (; *str !=
'\0'; ++str, ++in)
#define ABC_NAMESPACE_CXX_HEADER_START
#define ABC_NAMESPACE_CXX_HEADER_END
int ZEXPORT gzread(gzFile file, voidp buf, unsigned len)