X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=include%2Fpol.h;fp=include%2Fpol.h;h=54ff9f01435fe8f7dc4f6977dc718084bbb16960;hb=5ec5449357eaae253d6b1026621262480e2efa63;hp=cf5d8e096ae270fef7974ce02e2877bffe8a37fb;hpb=2a3686d3bd1f690d318b81766c261da785cf9b57;p=ctsim.git diff --git a/include/pol.h b/include/pol.h index cf5d8e0..54ff9f0 100644 --- a/include/pol.h +++ b/include/pol.h @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: pol.h,v 1.5 2000/12/20 14:39:09 kevin Exp $ +** $Id: pol.h,v 1.6 2000/12/25 21:54:26 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -19,26 +19,28 @@ ******************************************************************************/ #ifndef __H_POL #define __H_POL + -/* codes for pol_usefile */ - -#define P_USE_STR 1 /* use string as input source */ -#define P_USE_FILE 2 /* use file as input source */ - -/* codes for pol_int and pol_float */ -/* if in reject catagory, get new number from terminal */ - -#define P_FLTINT 1 /* get a real or integer number */ -#define P_BFLTINT 2 /* get a real or integer number, clip against bounds */ -#define P_CBFLTINT 3 /* get real or int, reject if outside bounds */ - -#define P_FLT 4 /* get a real number */ -#define P_BFLT 5 /* get a real, clip against bounds */ -#define P_CBFLT 6 /* get a floating, reject if outside bounds */ +// codes for pol_usefile +enum { + P_USE_STR = 1, // use string as input source + P_USE_FILE, // use file as input source +}; -#define P_INT 7 /* get a integer number */ -#define P_BINT 8 /* get a integer, clip against bounds */ -#define P_CBINT 9 /* get a integer, reject if outside bounds */ +// 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 +}; + #define LETTER 'a' #define DIGIT '0' @@ -51,22 +53,23 @@ #define MIN_INT -32768 #define MAX_INT 32767 - -/* token types */ - -#define TT_STRING 1 /* string token */ -#define TT_INT 2 /* integer token */ -#define TT_REAL 3 /* floating point token */ -#define TT_ALPHA 4 /* alphabetic token */ -#define TT_ALPNUM 5 /* alphanumeric token */ -#define TT_NUMALPHA 6 -#define TT_SPECLCHAR 7 - -#define TT_EOF 8 /* end of file reached */ -#define TT_ERROR 9 /* error in token, caused by call to wrong */ - /* type of token reader */ -#define TT_BLANK 10 /* white space token. pol_tok() skips these */ -#define TT_USERTOK 11 /* user defined token */ + + +// 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 +}; + struct symlist { char *name; @@ -77,16 +80,17 @@ struct symlist { typedef struct symlist SYMBOL; struct token_st { - int ready; /* TRUE if token is ready */ - char tokstr[MAXTOK+1]; /* token string */ - int type; /* type of token 'TT_' */ - int code; /* holds code for user defined tokens */ - double fnum; /* real value of token */ - int inum; /* integer value of token */ + int ready; // TRUE if token is ready + char tokstr[MAXTOK+1]; // token string + int type; // type of token 'TT_' + int code; // holds code for user defined tokens + double fnum; // real value of token + int inum; // integer value of token }; typedef struct token_st TOKEN; + /* pol.c */ void pol_init (void); void pol_skpword (char *w); @@ -106,6 +110,7 @@ int pol_lookchar (void); int pol_inchar (void); void pol_ungetch (int c); int get_inputline (FILE *fp); -void set_inputline (const char const *line); +void set_inputline (const char* const line); + +#endif -#endif