Annotation of OpenXM_contrib2/asir2000/parse/cpp.h, Revision 1.5
1.2 noro 1: /*
2: * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
3: * All rights reserved.
4: *
5: * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
6: * non-exclusive and royalty-free license to use, copy, modify and
7: * redistribute, solely for non-commercial and non-profit purposes, the
8: * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
9: * conditions of this Agreement. For the avoidance of doubt, you acquire
10: * only a limited right to use the SOFTWARE hereunder, and FLL or any
11: * third party developer retains all rights, including but not limited to
12: * copyrights, in and to the SOFTWARE.
13: *
14: * (1) FLL does not grant you a license in any way for commercial
15: * purposes. You may use the SOFTWARE only for non-commercial and
16: * non-profit purposes only, such as academic, research and internal
17: * business use.
18: * (2) The SOFTWARE is protected by the Copyright Law of Japan and
19: * international copyright treaties. If you make copies of the SOFTWARE,
20: * with or without modification, as permitted hereunder, you shall affix
21: * to all such copies of the SOFTWARE the above copyright notice.
22: * (3) An explicit reference to this SOFTWARE and its copyright owner
23: * shall be made on your publication or presentation in any form of the
24: * results obtained by use of the SOFTWARE.
25: * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
1.3 noro 26: * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.2 noro 27: * for such modification or the source code of the modified part of the
28: * SOFTWARE.
29: *
30: * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
31: * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
32: * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
33: * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
34: * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
35: * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
36: * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
37: * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
38: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
39: * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
40: * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
41: * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
42: * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
43: * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
44: * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
45: * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
46: * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
47: *
1.5 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/parse/cpp.h,v 1.4 2000/12/05 01:24:56 noro Exp $
1.2 noro 49: */
1.1 noro 50: #ifndef _ACCUM_
51: #define _ACCUM_
52:
53: #include <string.h>
54:
55: typedef struct {
1.5 ! noro 56: int have;
! 57: int used;
! 58: char *buf; } ACCUM;
1.1 noro 59:
60: char *init_accum(void);
61: char *accum_result(char *A);
62: char accum_regret(char *A);
63: char *accum_buf(char *A);
64:
65: #endif
66: #ifndef _EXPR_
67: #define _EXPR_
68:
69: typedef struct _node {
1.5 ! noro 70: int leaf;
! 71: char *name;
! 72: struct _node *left;
! 73: struct _node *right;
! 74: int op; } NODE;
1.1 noro 75:
76: NODE *read_expr();
77: NODE *read_expr_p(void);
78:
79: extern int expr_sharp;
80:
81: #endif
82: #ifndef _IF_
83: #define _IF_
84:
85: typedef struct _if {
1.5 ! noro 86: struct _if *next;
! 87: int condstate; } IF;
1.1 noro 88: #define IFSTATE_TRUE 0
89: #define IFSTATE_FALSE 1
90: #define IFSTATE_STAYFALSE 2
91:
92: extern IF *ifstack;
93: extern int n_skipped_ifs;
94:
95: #endif
96: #ifndef _IO_
97: #define _IO_
98:
99: #include <stdio.h>
100:
101: #if 0
102: #define MAX_PUSHBACK 8192
103: #define MAXFILES 20
104: #endif
105: #define MAX_PUSHBACK 512
106: #define MAXFILES 4
107:
108: extern int linefirst;
109: extern int willbefirst;
110:
111: #define outfile cpp_outfile
112: extern FILE *outfile;
113:
114: /*
115: extern int fstackdepth;
116: extern char pushback[_NFILE][MAX_PUSHBACK];
117: extern int npushed[_NFILE];
118: extern FILE *fstack[_NFILE];
119: extern char *fn[_NFILE];
120: extern char *incldir[_NFILE];
121: extern int lineno[_NFILE];
122: */
123:
124: char Get(void);
125: char getnonspace(void);
126: char getnonhspace(void);
127: char getnhsexpand(void);
128: char getexpand(void);
129: char *curfile(void);
130: char **Curfile(void);
131: int curline(void);
132: int *Curline(void);
133: char *curdir(void);
134: char **Curdir(void);
135: char *read_ctrl(void);
136: char *read_ident(void);
137:
138: #endif
139: #ifndef _IS_
140: #define _IS_
141:
142: #include <ctype.h>
143:
144: int ishspace(char c);
145: int isbsymchar(char c);
146: int issymchar(char c);
147:
148: #endif
149: #ifndef _MALLOC_
150: #define _MALLOC_
151:
152: char *malloc(size_t);
153: char *realloc(void *, size_t);
154: char *copyofstr(char *str);
155: char *copyofblk(char *blk, int len);
156: #define NEW(type) ((type *) malloc((int)sizeof(type)))
157: #define OLD(x) free((char *) x)
158: #define check_malloc(ptr) Check_malloc((char *)(ptr))
159:
160: #endif
161: #ifndef _STATS_H_9617d11a_
162: #define _STATS_H_9617d11a_
163:
164: extern int n_defines;
165: extern int n_undefines;
166: extern int n_hits;
167: extern int n_misses;
168:
169: #endif
170: #ifndef _SYMTBL_
171: #define _SYMTBL_
172:
173: typedef struct _def {
1.5 ! noro 174: struct _def *link;
! 175: char *name;
! 176: int nargs;
! 177: unsigned char *repl;
! 178: int how;
1.1 noro 179: #define DEF_PREDEF 0
180: #define DEF_CMDLINE 1
181: #define DEF_DEFINE 2
1.5 ! noro 182: } DEF;
1.1 noro 183:
184: extern DEF **symtbl;
185: extern int symtbl_size;
186: extern int n_in_table;
187:
188: DEF *find_def(char *name);
189:
190: #endif
191: #ifndef unctrl
192: #define unctrl(c) _unctrl[0xff&(int)(c)]
193: #define Unctrl(c) _Unctrl[0xff&(int)(c)]
194: extern char *_unctrl[];
195: extern char *_Unctrl[];
196: #endif
197:
198: void dump_single(DEF *);
199: void dump_expr(NODE *);
200: void do_at(void);
201: void do_debug(void);
202: void read_formals(void);
203: void do_dump(void);
204: void err_head(void);
205: void do_eval(void);
206: int get_quote_char(void);
207: NODE *read_expr_11(void);
208: NODE *read_expr_10(void);
209: NODE *read_expr_9(void);
210: NODE *read_expr_8(void);
211: NODE *read_expr_7(void);
212: NODE *read_expr_6(void);
213: NODE *read_expr_5(void);
214: NODE *read_expr_4(void);
215: NODE *read_expr_3(void);
216: NODE *read_expr_2(void);
217: NODE *read_expr_1(void);
218: NODE *read_expr_0(void);
219: NODE *read_expr_(void);
220: NODE *read_expr_p(void);
221: void iftrue(void);
222: void iffalse(void);
223: void init_include(void);
224: void flush_final_nl(void);
225: void input_mark(void);
226: void input_unmark(void);
227: void input_recover(void);
228: void mark_file_beginning(void);
229: void mark_file_ending(void);
230: void mark_charpushed(void);
231: void mark_get_line(void);
232: void do_line(void);
233: void do_pragma(void);
234: void do_set(void);
235: void do_sharp(void);
236: void flush_sharp_line(void);
237: void init_stats(void);
238: void save_stats(void);
239: void init_symtbl(void);
240: void undef_predefs(void);
241: void do_while(void);
242: void do_endwhile(void);
243: void Check_malloc(char * ptr);
244:
245: void output_ifstate(int state);
246: void out_at(int line, char *file);
247: void outputc(char c);
248: void outputs(char *s);
249: void outputd(int n);
250:
251: void do_at(void);
252: void do_debug(void);
253: void do_define(int sharp, int redef);
254: void do_dump(void);
255: void do_eval(void);
256: void do_if(int expr_sharp);
257: void do_ifdef(int expr_sharp);
258: void do_ifndef(int expr_sharp);
259: void do_else(int expr_sharp);
260: void do_elif(int expr_sharp);
261: void do_endif(int expr_sharp);
262: void do_include(int expr_sharp);
263: void do_line(void);
264: void do_pragma(void);
265: void do_set(void);
266: void do_sharp(void);
267: void do_undef(int expr_sharp);
268: void do_while(void);
269: void do_endwhile(void);
270: int free(char *);
271: void Push(char);
272: void putx(int);
273: void Bcopy(char *from, char *to, int len);
274: void maybe_print(char);
275: void read_include_file(char *,int,int);
276: void mark_got_from_pushback(char);
277: void mark_got_from_file(char);
278: void mark_got(char);
279: void define(char *,int,unsigned char *,int);
280: int undef(char *);
281: void push_new_file(char *,FILE *);
282: void defd(char *,int);
283: void free_expr(NODE *n);
284: int in_false_if(void);
285: int eval_expr(int,int);
286: void abort();
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>