1 /*****************************************************************************
2 ** This is part of the CTSim program
3 ** Copyright (C) 1983-2000 Kevin Rosenberg
5 ** $Id: pol.h,v 1.3 2000/05/07 12:46:19 kevin Exp $
7 ** Revision 1.3 2000/05/07 12:46:19 kevin
10 ** Revision 1.2 2000/04/28 14:14:16 kevin
11 ** *** empty log message ***
14 ** This program is free software; you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License (version 2) as
16 ** published by the Free Software Foundation.
18 ** This program is distributed in the hope that it will be useful,
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ** GNU General Public License for more details.
23 ** You should have received a copy of the GNU General Public License
24 ** along with this program; if not, write to the Free Software
25 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 ******************************************************************************/
32 #endif /* __cplusplus */
34 /* codes for pol_usefile */
36 #define P_USE_STR 1 /* use string as input source */
37 #define P_USE_FILE 2 /* use file as input source */
39 /* codes for pol_int and pol_float */
40 /* if in reject catagory, get new number from terminal */
42 #define P_FLTINT 1 /* get a real or integer number */
43 #define P_BFLTINT 2 /* get a real or integer number, clip against bounds */
44 #define P_CBFLTINT 3 /* get real or int, reject if outside bounds */
46 #define P_FLT 4 /* get a real number */
47 #define P_BFLT 5 /* get a real, clip against bounds */
48 #define P_CBFLT 6 /* get a floating, reject if outside bounds */
50 #define P_INT 7 /* get a integer number */
51 #define P_BINT 8 /* get a integer, clip against bounds */
52 #define P_CBINT 9 /* get a integer, reject if outside bounds */
57 #define MAXTOK 200 /* maximum length of a token */
60 #define MAXSKIPWORD 20
61 #define MAXSKIPCHAR 20
63 #define MIN_INT -32768
68 #define TT_STRING 1 /* string token */
69 #define TT_INT 2 /* integer token */
70 #define TT_REAL 3 /* floating point token */
71 #define TT_ALPHA 4 /* alphabetic token */
72 #define TT_ALPNUM 5 /* alphanumeric token */
74 #define TT_SPECLCHAR 7
76 #define TT_EOF 8 /* end of file reached */
77 #define TT_ERROR 9 /* error in token, caused by call to wrong */
78 /* type of token reader */
79 #define TT_BLANK 10 /* white space token. pol_tok() skips these */
80 #define TT_USERTOK 11 /* user defined token */
88 typedef struct symlist SYMBOL;
91 int ready; /* TRUE if token is ready */
92 char tokstr[MAXTOK+1]; /* token string */
93 int type; /* type of token 'TT_' */
94 int code; /* holds code for user defined tokens */
95 double fnum; /* real value of token */
96 int inum; /* integer value of token */
99 typedef struct token_st TOKEN;
103 void pol_skpword(char *w);
104 void pol_skpchar(char *s);
105 int pol_install(char *str, int code);
106 int pol_word(char *search, int nlet);
107 int pol_usertok(char *str, int *code);
108 int pol_string(char *str);
109 int pol_integer(int *n, int typecode, int boundcode, int bb1, int bb2);
110 int pol_float(double *n, double typecode, double boundcode, double bb1, double bb2);
112 void pol_reader(void);
113 void gettext(char *str, int lim);
114 void pol_usefile(int source, char *fn);
115 void pol_closefile(void);
116 int pol_lookchar(void);
117 int pol_inchar(void);
118 void pol_ungetch(int c);
119 int get_inputline(FILE *fp);
120 void set_inputline(char *line);
124 #endif /* __cplusplus */