home *** CD-ROM | disk | FTP | other *** search
- # ifndef PRECCX_H
- # define PRECCX_H
- /*
- header file of precc macros
- */
-
- # define __PRECC__ 2.40
-
- # define CBUFFSIZE 4096
- # define NBUFFSIZE 4096
-
- /* start up functions */
- void usage();
- int getkintarg();
-
- /* locals */
- # define CHAR char
- typedef char *characters;
- # define CHARS characters
-
- /* structures */
-
- /* the class of agents */
- typedef struct { /* place to hold info and get it out again */
- CHARS buffer;
- CHARS in;
- CHARS out;
- } AGENT;
- /* methods */
- /* VOID initagent(char[])->(AGENT *) */
- /* char *putagent(char) ->(AGENT *) */
- /* char *nputagent(char *)->(AGENT *) */
- /* char *getagent(char **)->(AGENT *) *//* supply a reference */
- /* char *resetagent ->(AGENT *) */
-
-
- /*
- # define initagent(x,y) x={y,y,y}
- # define putagent(x,y) ((*((x).in)++)=(y),(*((x).in)=0),&(x).in[-1])
- # define nputagent(x,y) ((x).in=p_scpy((x).in,(y)),(x).out)
- # define getagent(x,y) ((*((x).in)++)=0,(y)=(x).out,(x).out=(x).in)
- # define resetagent(x) ((x).out=(x).in=(x).buffer)
- */
-
-
- extern CHAR cbuff[CBUFFSIZE]; /* the general stuff buffer */
- extern AGENT chars;
-
- # define cptr chars.in /* continuity */
- # define nptr chars.out
-
- extern CHAR nbuff[]; /* used to hold vars */
- extern AGENT namE;
- extern AGENT args;
- extern AGENT keys;
-
- /* these are the operations on the name agent */
-
- # undef putchar /* the stdio one */
- # define putchar myputchar
- extern CHARS myputchar(char);
- extern CHARS getname(CHARS *);
- extern CHARS putname(CHARS);
-
- # define RESET {void resetall();resetall();}
-
- # define P_REN(x,y) (printf("\
- STATUS %s(%s){\n\
- PARSER %s;\n\
- return((TOPARSER %s)(%s));\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- GNAME(y),GARGS(y)),UNSETNAME(x))
-
- # define P_AND(x,y,z) (printf("\
- static STATUS %s(%s){\n\
- PARSER %s, %s;\n\
- return p_andparse0n (TOPARSER %s,TOPARSER %s);\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- !is_in(GNAME(z),(char*)plainenv)?GNAME(z):"dummy2",\
- CATFUNCARGS(y),CATFUNCARGS(z)),UNSETNAME(x))
-
- /*********** discontinued ****************************
- # define P_STAR(x,y,z,u) (printf("\
- static STATUS %s(%s){\n\
- PARSER %s, %s;\n\
- PARAM %s;\n\
- return p_starparse0n (TOPARSER %s,TOPARSER %s);\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- !is_in(GNAME(z),(char*)plainenv)?GNAME(z):"dummy2",\
- u,CATFUNCARGS(y),CATFUNCARGS(z)),UNSETNAME(x))
- ******************************************************/
-
- # define P_STAR(x,y,z,u) (printf("\
- static STATUS %s(%s){\n\
- PARSER %s, %s;\n\
- PARAM %s; static STATUS p_tok;\n\
- MARK; p_tok = (TOPARSER %s) (%s);\n\
- if (BADSTATUS(p_tok)) {RELEASE;return p_tok;}\n\
- %s = (PARAM)p_tok; p_tok = (TOPARSER %s) (%s);\n\
- if (BADSTATUS(p_tok)) {REWIND;} else {RELEASE;}\n\
- return p_tok;\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- !is_in(GNAME(z),(char*)plainenv)?GNAME(z):"dummy2",\
- u,GNAME(y),GARGS(y),u,GNAME(z),GARGS(z)),UNSETNAME(x))
-
- # define P_ALT(x,y,z) (printf ("\
- static STATUS %s (%s){\n\
- PARSER %s, %s;\n\
- static STATUS p_tok;\n\
- p_tok = (TOPARSER %s) (%s);\n\
- return (GOODSTATUS(p_tok))?p_tok:(TOPARSER %s) (%s);\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- !is_in(GNAME(z),(char*)plainenv)?GNAME(z):"dummy2",\
- GNAME(y),GARGS(y),GNAME(z),GARGS(z)),UNSETNAME(x))
-
- # define P_ATT(x,y,z,w) (printf("\
- static VOID %s(%s){\n\
- %s\n\
- }\n\
- static STATUS %s(%s){\n\
- PARSER %s;ACTION %s;\n\
- return p_attach0n(TOPARSER %s,%s);\n\
- }\n\
- ",GNAME(z),(char*)environment,(w),\
- GNAME(x),(char*)environment,GNAME(y),GNAME(z),CATFUNCARGS(y),CATFUNCARGS(z)),UNSETNAME(x))
-
- # define P_PRE(x,y,z,w) (printf("\
- static VOID %s(%s){\n\
- %s\n\
- }\n\
- static STATUS %s(%s){\n\
- PARSER %s;ACTION %s;\n\
- return p_prepend0n(%s,%s);\n\
- }\n\
- ",GNAME(z),(char*)environment,(w),\
- GNAME(x),(char*)environment,GNAME(y),GNAME(z),\
- CATFUNCARGS(z),CATFUNCARGS(y)),UNSETNAME(x))
-
- # define P_OPT(x,y) (printf("\
- static STATUS %s(%s){\n\
- PARSER %s;\n\
- return p_option0n(TOPARSER %s);\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- CATFUNCARGS(y)),UNSETNAME(x))
-
- # define P_ATA(x,y) (printf("\
- static STATUS %s(%s){\n\
- return p_atch0(%s);\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- (y)),UNSETNAME(x))
-
- # define P_INF(x,y) (printf("\
- static STATUS %s(%s){\n\
- PARSER %s;\n\
- return p_many0n(TOPARSER %s);\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- CATFUNCARGS(y)),UNSETNAME(x))
-
- # define P_ITR(x,y,z) (printf("\
- static STATUS %s(%s){\n\
- PARSER %s;\n\
- return p_iter0n((int)%s,TOPARSER %s);\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- z,CATFUNCARGS(y)),UNSETNAME(x))
-
- # define P_SOM(x,y) (printf("\
- static STATUS %s(%s){\n\
- PARSER %s;\n\
- return p_some0n(TOPARSER %s);\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- CATFUNCARGS(y)),UNSETNAME(x))
-
- # define P_PHA(x,y) (printf("\
- static STATUS %s(%s){\n\
- PARSER %s;\n\
- return p_hidden0n(TOPARSER %s);\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- CATFUNCARGS(y)),UNSETNAME(x))
-
- # define P_ERR(x,y) (printf("\
- static STATUS %s(%s){\n\
- PARSER %s;\n\
- return p_uerror0n(TOPARSER %s);\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- CATFUNCARGS(y)),UNSETNAME(x))
-
- # define P_UNI(x,y) (printf("\
- static STATUS %s(%s){\n\
- PARSER %s;\n\
- return p_uniq0n(%s);\n\
- }\n\
- ",GNAME(x),(char*)environment,\
- GNAME(y),CATFUNCARGS(y)),UNSETNAME(x))
-
- # define P_LIT(x,y) (printf("\
- static STATUS %s(%s){\n\
- return p_exactly0(%s);\n\
- }\n\
- ",GNAME(x),(char*)environment,(y)),UNSETNAME(x))
-
- # define P_ALI(x,y) (printf("\
- static STATUS %s(%s){\n\
- return p_notexactly0(%s);\n\
- }\n\
- ",GNAME(x),(char*)environment,(y)),UNSETNAME(x))
-
- # define P_RAN(x,y) (printf("\
- static STATUS %s(%s){\n\
- PREDICATE %s;\n\
- return p_range0n(%s);\n\
- }\n\
- ",GNAME(x),(char*)environment,GNAME(y),CATFUNCARGS(y)),UNSETNAME(x))
-
- # define P_TST(x,y) (printf("\
- static STATUS %28%s){\n\
- return p_test0(%s);\n\
- }\n\
- ",GNAME(x),(char*)environment,(y)),UNSETNAME(x))
-
- # define P_HID(x,y,z) (printf("\
- static STATUS %s(%s){\n\
- PREDICATE %s;\n\
- PARSER %s;\n\
- return p_hide0n(TOPARSER %s,%s);\n\
- }\n\
- ",GNAME(x),(char*)environment,GNAME(z),\
- !is_in(GNAME(y),(char*)plainenv)?GNAME(y):"dummy1",\
- CATFUNCARGS(y),CATFUNCARGS(z)),UNSETNAME(x))
-
-
- # endif
-