-// codes for pol_int and pol_float
-// if in reject catagory, get new number from terminal
-enum {
- P_FLTINT = 1, // get a real or integer number
- P_BFLTINT, // get a real or integer number, clip against bounds
- P_CBFLTINT, // get real or int, reject if outside bounds
- P_FLT, // get a real number
- P_BFLT, // get a real, clip against bounds
- P_CBFLT, // get a floating, reject if outside bounds
- P_INT, // get a integer number
- P_BINT, // get a integer, clip against bounds
- P_CBINT, // get a integer, reject if outside bounds
-};\r
-\r
+ void init ();
+ void addSkipWord (const char* const w);
+ void addSkipChar (int c);
+ void addKeyword (const char* const str, int code);
+ bool readWord (const char *search, int nlet);
+ bool readUserToken (char *str, int *code);
+ bool readString (char *str);
+ bool readInteger (int *n, int typecode, bool boundcode, int bb1, int bb2);
+ bool readFloat (double *n, double typecode, bool boundcode, double bb1, double bb2);
+ bool skipTokens ();
+ void reader ();
+ bool readText (char *str, int lim);
+ void usefile (int source, const char *fn);
+ void closefile ();
+ int lookchar ();
+ int inchar ();
+ void ungetch (int c);
+ int get_inputline (FILE *fp);
+ void set_inputline (const char* const line);
+
+
+ enum {
+ MAXTOK = 200, // maximum length of a token
+ MAXLINE = 1024, // maximum line length
+ MAXIDENT = 20,
+ MAXSKIPWORD = 20,
+ MAXSKIPCHAR = 20,
+ MIN_INT = -2000000000,
+ MAX_INT = 2000000000,
+ };
+
+ // token types
+ enum {
+ TT_STRING = 1, // string token
+ TT_INT, // integer token
+ TT_REAL, // floating point token
+ TT_ALPHA, // alphabetic token
+ TT_ALPNUM, // alphanumeric token
+ TT_NUMALPHA,
+ TT_SPECLCHAR,
+ TT_EOF, // end of file reached
+ TT_ERROR, // error in token, caused by call to wrong type of token reader
+ TT_BLANK, // white space token. pol_tok() skips these
+ TT_USERTOK, // user defined token
+ };
+
+
+private:
+
+ // codes for pol_int and pol_float
+ // if in reject catagory, get new number from terminal
+ enum {
+ P_FLTINT = 1, // get a real or integer number
+ P_BFLTINT, // get a real or integer number, clip against bounds
+ P_CBFLTINT, // get real or int, reject if outside bounds
+ P_FLT, // get a real number
+ P_BFLT, // get a real, clip against bounds
+ P_CBFLT, // get a floating, reject if outside bounds
+ P_INT, // get a integer number
+ P_BINT, // get a integer, clip against bounds
+ P_CBINT, // get a integer, reject if outside bounds
+ };