Annotation of capa/capa51/pProj/capaParser.h, revision 1.4
1.1 albertel 1: /* <==================================================================> */
2: /* by Isaac Tsai @ 1994 */
3:
4: #ifndef _CAPA_PARSER_H_
5: #define _CAPA_PARSER_H_
6:
7: #include <stdio.h> /* for FILE * */
8: #ifdef DMALLOC
9: #include <dmalloc.h>
10: #endif
11: #ifdef __STDC__ /* sun ansi cc compiler use this flag */
12: #define CAPA_ARG(x) x
13: #else
14: #define CAPA_ARG(x) ()
15: #endif
16:
17: #define CAPA_ERROR(xx) { }
18: #define CAPA_WARNING(xx) { }
19: #define MESSAGE_WARN 1
20: #define MESSAGE_ERROR 2
21:
22:
23: #ifdef SYMBOL_DBUG
24: #define SSDBUG_PR1(xx) { printf(xx); fflush(stdout); }
25: #define SSDBUG_PR2(xx,yy) { printf(xx,yy); fflush(stdout); }
26: #define SSDBUG_PR3(xx,yy,zz) { printf(xx,yy,zz); fflush(stdout); }
27: #else
28: #define SSDBUG_PR1(xx) { }
29: #define SSDBUG_PR2(xx,yy) { }
30: #define SSDBUG_PR3(xx,yy,zz) { }
31:
32: #endif
33:
34:
35:
36: /* Some useful numbers */
37:
1.2 albertel 38: /*#define EIGHT 8*/
39: /*#define SIXTEEN 16*/
1.1 albertel 40: /*#define THIRTY_TWO 32*/
41: /*#define SIXTY_FOUR 64*/
42: #define ONE_TWO_EIGHT 128
43: #define QUARTER_K 256
44: #define HALF_K 512
45: #define ONE_K 1024
46: #define TWO_K 2048
47: #define FOUR_K 4096
48:
49:
50:
51: #define ANSWER_STRING_LENG 81
52: #define MAX_OPENED_FILE 4096 /* maximum number of files opened */
53: #define MAX_SYMB_COUNT 4096 /* symbol table size */
54: #define MAX_FUNC_NAME 256 /* function name length */
55: #define MAX_FUNC_NEST 1024 /* sin(cos(tan(...))) */
56: /*#define MAX_QTEXT_LEN 4096 overall question text in a set *NO LONGER NEEDED */
57: #define WARN_MSG_LENGTH 1024 /* for warning messages */
58:
59:
60: #define ASCII_MODE 1
61: #define TeX_MODE 2
62: #define HTML_MODE 3
63: #define BUBBLE_MODE 4
64:
65: #define ANSWER_STRING_MODE 5 /* used in answers_string() */
66:
67:
68: /* parameters used in array_sorted_index() */
69:
70: #define ASCEND_SORT 1
71: #define DESCEND_SORT 2
72: #define NUMERICAL_SORT 3
73:
74:
75:
76: typedef struct _symbol {
77: char *s_name; /* IDENTIFIER or FUNCTION_ID or ARRAY_ID name */
78: int s_type;
79: int s_array_cnt;
80: int s_argc;
81: struct _argNode *s_argp;
82: struct _treeNode *s_treep;
83: struct _symbol *s_nextp;
1.3 albertel 84: struct _symbol *s_prevp;
1.1 albertel 85: struct _symbol *s_arrayp;
86: struct _pts_list *s_ptslist;
87: int s_access_cnt;
88: int s_distype;
89: char *s_format;
90: union { char *s_sval;
91: long s_ival;
92: double s_rval;
93: } s_val;
94: } Symbol;
95:
96: typedef Symbol *Symbol_p;
97:
98: #define s_int s_val.s_ival
99: #define s_real s_val.s_rval
100: #define s_str s_val.s_sval
101:
102: #define E_FORMAT 1
103: #define F_FORMAT 3
104: #define DEFAULT_FORMAT 9
105:
106: typedef struct _argNode {
107: Symbol *a_sp;
108: int a_idx;
109: struct _argNode *a_next;
110: struct _argNode *a_prev;
111: } ArgNode_t;
112:
1.4 ! albertel 113: #define FIRST_SYMBOLP(aaa) (aaa->a_sp)
1.1 albertel 114: #define SECOND_SYMBOLP(aaa) ( (aaa->a_next)->a_sp )
115: #define THIRD_SYMBOLP(aaa) ( ((aaa->a_next)->a_next)->a_sp )
1.4 ! albertel 116: #define FOURTH_SYMBOLP(aaa) ( (((aaa->a_next)->a_next)->a_next)->a_sp )
! 117: #define FIFTH_SYMBOLP(aaa) ( ((((aaa->a_next)->a_next)->a_next)->a_next)->a_sp )
1.1 albertel 118: #define FIRST_ARGNAME(aaa) ( FIRST_SYMBOLP(aaa)->s_name )
119: #define FIRST_ARGTYPE(aaa) ( FIRST_SYMBOLP(aaa)->s_type )
120: #define FIRST_ARGINT(aaa) ( FIRST_SYMBOLP(aaa)->s_int )
121: #define FIRST_ARGREAL(aaa) ( FIRST_SYMBOLP(aaa)->s_real )
122: #define FIRST_ARGSTR(aaa) ( FIRST_SYMBOLP(aaa)->s_str )
123: #define SECOND_ARGNAME(aaa) ( SECOND_SYMBOLP(aaa)->s_name )
124: #define SECOND_ARGTYPE(aaa) ( SECOND_SYMBOLP(aaa)->s_type)
125: #define SECOND_ARGINT(aaa) ( SECOND_SYMBOLP(aaa)->s_int)
126: #define SECOND_ARGREAL(aaa) ( SECOND_SYMBOLP(aaa)->s_real)
127: #define SECOND_ARGSTR(aaa) ( SECOND_SYMBOLP(aaa)->s_str)
1.4 ! albertel 128: #define THIRD_ARGNAME(aaa) ( THIRD_SYMBOLP(aaa)->s_name )
1.1 albertel 129: #define THIRD_ARGTYPE(aaa) ( THIRD_SYMBOLP(aaa)->s_type)
130: #define THIRD_ARGINT(aaa) ( THIRD_SYMBOLP(aaa)->s_int)
131: #define THIRD_ARGREAL(aaa) ( THIRD_SYMBOLP(aaa)->s_real)
132: #define THIRD_ARGSTR(aaa) ( THIRD_SYMBOLP(aaa)->s_str)
1.4 ! albertel 133: #define FOURTH_ARGTYPE(aaa) ( FOURTH_SYMBOLP(aaa)->s_type)
! 134: #define FOURTH_ARGNAME(aaa) ( FOURTH_SYMBOLP(aaa)->s_name )
! 135: #define FOURTH_ARGINT(aaa) ( FOURTH_SYMBOLP(aaa)->s_int)
! 136: #define FOURTH_ARGREAL(aaa) ( FOURTH_SYMBOLP(aaa)->s_real)
! 137: #define FOURTH_ARGSTR(aaa) ( FOURTH_SYMBOLP(aaa)->s_str)
! 138: #define FIFTH_ARGTYPE(aaa) ( FIFTH_SYMBOLP(aaa)->s_type)
! 139: #define FIFTH_ARGNAME(aaa) ( FIFTH_SYMBOLP(aaa)->s_name )
! 140: #define FIFTH_ARGINT(aaa) ( FIFTH_SYMBOLP(aaa)->s_int)
! 141: #define FIFTH_ARGREAL(aaa) ( FIFTH_SYMBOLP(aaa)->s_real)
! 142: #define FIFTH_ARGSTR(aaa) ( FIFTH_SYMBOLP(aaa)->s_str)
1.1 albertel 143:
144:
145:
146:
147:
148: typedef struct _treeNode {
149: Symbol *t_sp;
150: int t_idx;
151: struct _treeNode *t_left;
152: struct _treeNode *t_right;
153: } TreeNode_t;
154:
155: typedef struct _expNode {
156: int e_type;
157: struct _expNode *e_parentp;
158: struct _expNode *e_lsibp;
159: struct _expNode *e_rsibp;
160: Symbol *e_sp;
161: } ExpNode;
162:
163: typedef ExpNode *ExpNode_p;
164:
165: /* ================================================================ */
166: /* While loop data structure */
167:
168: typedef struct _WhileLoop {
169: int input_idx; /* stores Input_idx */
170: int line_idx; /* stores Current_line[Input_idx] */
171: long int pos_idx; /* stores next line position in the input stream */
172: } WhileLoop_t;
173:
174:
175: /* ================================================================ */
176: /* Warning message data structure */
177:
178: typedef struct _WarnMsg {
179: int warn_type;
180: char *warn_str;
181: struct _WarnMsg *warn_next;
182: } WarnMsg_t;
183:
184:
185:
186:
187:
188:
189: /* ================================================================ */
190:
191: #define SYMBOL_MAXLEN 16 /* unit symbol name length */
192: #define NAME_MAXLEN 48 /* unit name length */
193: #define BASEUNIT_LIMIT 32 /* maximum number of base units */
194: #define ONE_K_SIZE 1024
195:
196: /* ================================================================ */
197:
198: typedef struct _unit_elem {
199: struct _unit_elem *ue_nextp;
200: char ue_symbol[SYMBOL_MAXLEN];
201: int ue_index; /* -1 means this is composite */
202: #define UE_COMPOSITE -1
203: double ue_scale;
204: double ue_exp;
205: } Unit_E;
206:
207: typedef struct _unit_t {
208: char u_symbol[SYMBOL_MAXLEN];
209: char u_name[NAME_MAXLEN];
210: char *u_comment;
211: int u_index;
212: struct _unit_t *u_left;
213: struct _unit_t *u_right;
214: int u_type;
215: #define U_BASE 1
216: #define U_DERIVED 2
217: #define U_PREFIX 3
218: #define U_CONSTANT 4
219: #define U_OP_POWER 5
220: #define U_OP_TIMES 6
221: #define U_OP_PLUS 7
222: #define U_OP_MINUS 8
223: #define U_OP_DIVIDE 9
224: #define U_UNKNOWN 10
225: #define U_DEFAULT 11
226: double u_scale;
227: double u_offset;
228: int u_count;
229: Unit_E *u_list;
230: } Unit_t;
231:
232: #define U_LEFT(x) ((x)->u_left)
233: #define U_RIGHT(x) ((x)->u_right)
234: #define U_SYMB(x) ((x)->u_symbol)
235: #define U_NAME(x) ((x)->u_name)
236: #define U_COUNT(x) ((x)->u_count)
237: #define U_TYPE(x) ((x)->u_type)
238: #define U_SCALE(x) ((x)->u_scale)
239:
240: /* ==================================================================== */
241: /* Answer tolerance sig string */
242: /* int abs/rel */
243: /* real abs/rel [l,u] */
244: /* string cs/ci */
245: /* mc */
246:
247: typedef struct _problem {
248: char *question; /* Question text */
249: char *answer; /* Answer string */
250: char *hint; /* Hint text */
251: char *explain; /* Explain text */
252: char *capaidplus; /* Quizzes extra unique identifier
253: Only set in the first problem */
254: int ans_cnt;
255: int weight;
256: int tol_type;
257: double tolerance;
258: int ans_type; /* Type of answer expecting */
259: int sig_ubound;
260: int sig_lbound;
261: int partial_cdt;
262:
263: int calc; /* calculate correct answers based on
264: formated/unformated exact answer */
265: int tries; /* Number of tries allowed */
266: int show_hint;
267: int show_explain;
268: int show_br; /* web only, <BR> on is by default */
269: int show_ans_box; /* web only, answer box is shown by default */
270: int ans_op; /* ANS_AND or ANS_OR */
271: char *id_list;
272: struct _pts_list *pts_list;
273: char ans_fmt[ANSWER_STRING_LENG];
274: char unit_str[ANSWER_STRING_LENG];
275: Unit_t *ans_unit;
276: struct _answer_info *ans_list;
277: struct _answer_info *ans_list_last;
278: struct _problem *next; /* Pointer to next problem */
279: } Problem_t;
280:
281: #define P_TOLTYPE(p) ((p)->tol_type)
282:
283:
284: typedef struct _pts_list {
285: char *pts_str;
286: int pts_idx;
287: struct _pts_list *pts_next;
288: } PointsList_t;
289:
290:
291:
292: /* Answer related data structure */
293: /*
294: char *ans_str
295: int ans_type
296: int ans_calc
297: int ans_tol_type
298: double ans_tol
299: int ans_sig_ub
300: int ans_sig_lb
301: char *ans_id_list;
302: struct _pts_list *ans_pts_list;
303: char ans_fmt
304: char ans_unit_str
305:
306: */
307: /*
308: some information in the answer specification should be
309: problem-wise, such as problem weight, problem tries
310:
311: */
312:
313: typedef struct _answer_info {
314: char *ans_str; /* correct answer in string form */
315: int ans_type; /* answer type */
316: int ans_calc;
317: int ans_tol_type; /* answer tolerence type */
318: double ans_tol; /* the tolerence itself */
319: int ans_sig_ub;
320: int ans_sig_lb;
321: char *ans_id_list;
322: struct _pts_list *ans_pts_list;
323: char ans_fmt[ANSWER_STRING_LENG];
324: char ans_unit_str[ANSWER_STRING_LENG];
325: Unit_t *ans_unit;
326: struct _answer_info *ans_next;
327: } AnswerInfo_t;
328:
329:
330:
331: /******************************************************************************/
332: /* STRUCTURE FOR A PROBLEM */
333: /******************************************************************************/
334:
335: #define SPEC_TOLERANCE 1
336: #define SPEC_SIG 2
337: #define SPEC_WEIGHT 4
338: #define SPEC_TYPE 8
339: #define SPEC_PCREDIT 16
340: #define SPEC_TRY 32
341: #define SPEC_UNIT 64
342:
343: /* ---------------------------- tol_type -------------------------- */
344: #define TOL_ABSOLUTE 1
345: #define TOL_PERCENTAGE 2
346:
347: /* ------------------------------------------ */
348: #define CALC_UNFORMATED 1
349: #define CALC_FORMATED 2
350:
351: #define CALC_DEFAULT CALC_UNFORMATED /* for answer calculation */
352:
353: /* ---------------------------------------- web option only */
354: #define DO_SHOW 1
355: #define DONOT_SHOW 0
356:
357: #define SHOW_BR_DEFAULT DO_SHOW
358: #define SHOW_ANSBOX_DEFAULT DO_SHOW
359:
360: #define SIG_LB_DEFAULT 0 /* ---- sig_lbound ------- */
361: #define SIG_UB_DEFAULT 15 /* ---- sig_ubound ------- */
362: #define PCREDIT_DEFAULT 0 /* ---- partial_cdt ------ */
363: #define TOL_DEFAULT (0.0) /* ---- tolerance ------- */
364: #define WEIGHT_DEFAULT 1 /* ---- weight ------- */
365: #define NO_LIMIT_TRY (0) /* ---- tries ------- */
366: #define MAX_TRIES 99 /* ---- tries ------------ */
367: #define SHOW_HINT_DEFAULT 1 /* show hints immediately */
368:
369: /* --------------------------- ans_type -------------------------- */
370: #define ANSWER_IS_INTEGER 1
371: #define ANSWER_IS_FLOAT 2
372: #define ANSWER_IS_STRING_CI 3
373: #define ANSWER_IS_STRING_CS 4
374: #define ANSWER_IS_CHOICE 5
375: #define ANSWER_IS_ARITH 6
376: #define ANSWER_IS_SUBJECTIVE 7
377: #define ANSWER_IS_FORMULA 8
378: #define ANSWER_IS_EXTERNAL 9
379:
380: #define YAK 1
381: #define NAY 0
382:
383: /* -------- results given by capa_check_answer() and capa_check_answers() */
384:
385: #define EXACT_ANS 1
386: #define APPROX_ANS 2
387: #define SIG_FAIL 3
388: #define UNIT_FAIL 4
389: #define NO_UNIT 5
390: #define UNIT_OK 6
391: #define INCORRECT 7
392: #define UNIT_NOTNEEDED 8
393: #define ANS_CNT_NOT_MATCH 9
394: #define SUB_RECORDED 10
395: #define BAD_FORMULA 11
396:
397:
398:
399: /* =============================================================== */
400:
401: #define T_SPACE 9
402: #define T_PREFIX 8
403: #define T_NUMBER 7
404: #define T_BASIC_UNIT 6
405: #define T_DERIVED_UNIT 5
406: #define T_LP 4
407: #define T_RP 3
408: #define T_MULTIPLY 2
409: #define T_POWER 1
410: #define T_END 0
411:
412: /* for IFstatus[] */
413:
414: #define IF_FALSE 0
415: #define IF_TRUE 1
416: #define IF_DONT_CARE 2
417:
418: /* for IFcurrent[] */
419: #define RUN_IF_PORTION 1
420: #define RUN_ELSE_PORTION 2
421:
422: /* ================================================================ */
423: /********************** for random(), /MAP(), capa_PIN() */
1.4 ! albertel 424: /* BETA_DIS is used for genbet() */
! 425: /* CHI_DIS is for genchi() */
! 426: /* EXPONENTIAL_DIS genexp() */
! 427: /* GAMMA_DIS gengam() */
! 428: /* MULTI_NORM_DIS genmn() */
! 429: /* NONCEN_CHI_DIS gennch() */
! 430: /* NORMAL_DIS gennor() */
! 431: /* POISSON_DIS long ignpoi(float mu) */
1.1 albertel 432:
433: #define RANDOM_G 1L
434: #define PERMUTATION_G 2L
435: #define PIN_G 3L
436:
1.4 ! albertel 437: #define NORMAL_DIS 10
! 438: #define POISSON_DIS 11
! 439: #define EXPONENTIAL_DIS 12
! 440: #define BETA_DIS 13
! 441: #define GAMMA_DIS 14
! 442: #define CHI_DIS 15
! 443: #define NONCENTRAL_CHI_DIS 16
! 444:
1.1 albertel 445: #define GET_GENERATOR 0L
446: #define SET_GENERATOR 1L
447:
448: #define FORWARD_MAP 0
449: #define REVERSE_MAP 1
450:
451:
452:
453: /* ---------------------------------------------- capaLexerDef.flex */
454: void begin_if_skip CAPA_ARG(());
455: void begin_while_skip CAPA_ARG(());
456: void begin_next_line CAPA_ARG(());
457: void begin_var CAPA_ARG(());
458: void begin_let CAPA_ARG(());
459: void begin_def CAPA_ARG(());
460: void begin_ans CAPA_ARG(());
461: void begin_map CAPA_ARG(());
462: void begin_ignore CAPA_ARG(());
463: void begin_text CAPA_ARG(());
464: void begin_question CAPA_ARG(());
465: void end_problemset CAPA_ARG(());
466: int match_keyword CAPA_ARG((char *key));
467: int match_functionid CAPA_ARG((char *key));
468: void init_funcstack CAPA_ARG(());
469:
470: #ifdef DMALLOC
471: #define strsave(s) strcpy(capa_malloc(strlen(s)+1,1),s)
472: #define capa_malloc(num,sz) memset(calloc(num,sz),'\0',num*sz)
473: #define capa_mfree(p) free(p);
474: #else
475: char *strsave CAPA_ARG((char *s));
476: char *capa_malloc CAPA_ARG((unsigned int num, unsigned int sz));
477: void capa_mfree CAPA_ARG((char *p));
478: #endif
479: void capa_msg CAPA_ARG((int type, char *p));
480: void capa_warn_header CAPA_ARG(());
481: void parse_filename CAPA_ARG((char *line));
482: void parse_import_id CAPA_ARG((char *line));
483: char *parse_endinput CAPA_ARG((char *line));
484: void append_dynamic_buf CAPA_ARG((char *new_str));
485: char* parser_status CAPA_ARG((void));
486: /*------------------------------------------------- capaGrammarDef.y */
487:
488: ExpNode_p mk_node CAPA_ARG((int op, ExpNode_p left, ExpNode_p right));
489: ExpNode_p mk_leaf CAPA_ARG((int type, Symbol_p valp));
490: void append_text CAPA_ARG((char *str));
491: void append_hint CAPA_ARG((char *str));
492: void append_explain CAPA_ARG((char *str));
493: void append_error CAPA_ARG((char *str));
494: void append_warn CAPA_ARG((int type, char *str));
495: Symbol *symbols_op CAPA_ARG((Symbol *a, Symbol *b, int op));
496: char *format_toTeX CAPA_ARG((char *real));
497: char *format_toHTML CAPA_ARG((char *real));
498: void init_answerinfo CAPA_ARG(());
499: void display_var CAPA_ARG((Symbol *s));
500: void assign_answer CAPA_ARG((Symbol *s));
501: void assign_tolerance CAPA_ARG((int tol_type, Symbol *s));
502: void assign_weight CAPA_ARG((Symbol *s));
503: void assign_try_limits CAPA_ARG((Symbol *s));
504: void assign_hint CAPA_ARG((Symbol *s));
505: void assign_units CAPA_ARG((Symbol *s));
506: void assign_sigs CAPA_ARG((int lb, int ub));
507: void assign_id_list CAPA_ARG((Symbol *s));
508: void init_new_prob CAPA_ARG(());
509: void add_answer_cnt CAPA_ARG((int op));
510: void finish_answer_info CAPA_ARG(());
511: void start_question_over CAPA_ARG(());
512:
513: Symbol* get_array_symbol CAPA_ARG((Symbol* name,Symbol* index,int free_symbols));
514: Symbol* build_array_list CAPA_ARG((Symbol* ar_name,int num_elem));
515: /*---------------------------------------------------- capaParserUtils.c */
516: void problem_default CAPA_ARG((Problem_t *p));
517: int comp_name CAPA_ARG((char *a,char *b));
518: int comp_namesymbol CAPA_ARG((char *a, Symbol *b));
519: int itis_empty CAPA_ARG((TreeNode_t *root_p));
520: void print_symb_stat CAPA_ARG(());
521: int preorder_tree CAPA_ARG((TreeNode_t *node_p));
522: int inorder_tree CAPA_ARG((TreeNode_t *node_p));
523: int postorder_tree CAPA_ARG((TreeNode_t *node_p));
524: int destroy_tree CAPA_ARG((TreeNode_t *node_p));
525: int free_symtree CAPA_ARG(());
526: char *btree_search CAPA_ARG((char *key,TreeNode_t **root_pp,int (*compar)()));
527: Symbol *find_identifier CAPA_ARG((register char *name));
528:
529: ArgNode_t *new_arglist CAPA_ARG((Symbol *sp));
530: ArgNode_t *addto_arglist CAPA_ARG((ArgNode_t *argp, Symbol *sp));
531: void walk_arglist CAPA_ARG((ArgNode_t *argp));
532: void free_arglist CAPA_ARG((ArgNode_t *argp));
533: int purge_tree CAPA_ARG((TreeNode_t **root_pp));
534: int calc_sig CAPA_ARG((char *a_num ));
535: int endian CAPA_ARG(());
536: TreeNode_t *new_treenode CAPA_ARG((char *name_p, int type));
537: TreeNode_t *new_formulanode CAPA_ARG((char *name_p, double val));
538:
539: TreeNode_t *t_splay CAPA_ARG((char *name, TreeNode_t *t));
540: void print_array_element CAPA_ARG((Symbol *array_p));
541: Symbol *find_arrayid CAPA_ARG((char *name_p));
542: Symbol *find_array_by_index CAPA_ARG((Symbol *array_p,char *idx_p));
1.3 albertel 543: int free_array CAPA_ARG((char *name_p));
1.1 albertel 544: Symbol *array_min_max CAPA_ARG((char *name_p,int min));
545: Symbol *array_moments CAPA_ARG((char *result_p,char *name_p));
546:
1.4 ! albertel 547: Symbol *gen_random_by_selector CAPA_ARG((char *output_p,int sel,char *seed,int item_cnt,float p1,float p2));
1.1 albertel 548: int setup_formula_id CAPA_ARG((char *v_str, char *pt_str));
549: void free_formula_tree CAPA_ARG(());
550:
551: Symbol *find_formula_id CAPA_ARG((char *name_p));
552: int f_eval_formula CAPA_ARG((double *f_val,char *f_str,char *v_str, char *pt_str));
553:
554: int f_u_parse_formula CAPA_ARG((char *f_str));
555: int f_str_to_numbers CAPA_ARG((double **f_ar, char *n_str));
556: int f_str_to_ids CAPA_ARG((char ***v_ar, char *n_str));
557:
558: PointsList_t *f_gen_pts CAPA_ARG((char *ap, char *bp, int n));
559: PointsList_t *gen_ptslist_str CAPA_ARG((char *range_str ));
560: char *eval_formula_range_str CAPA_ARG((char *f_str,char *var_list,char *range_str));
561:
562: PointsList_t *gen_ptslist CAPA_ARG((Symbol *ap,Symbol *bp,Symbol *np));
563: PointsList_t *new_ptslist CAPA_ARG((Symbol *sp ));
564: void free_ptslist CAPA_ARG((PointsList_t *pts_p)) ;
565: /* ====================================== capaUnit.c */
566:
567: void c_ignorewhite CAPA_ARG((FILE *f));
568: double c_getdouble CAPA_ARG((FILE *f));
569: int c_getint CAPA_ARG((FILE *f));
570: int c_getsec_range CAPA_ARG((FILE *f,int *low,int *high));
571: char *c_getword CAPA_ARG((FILE *f));
572: char *c_getstring CAPA_ARG((FILE *f));
573: char *c_getcomment CAPA_ARG((FILE *f));
574: int c_gettype CAPA_ARG((FILE *f));
575:
576: Unit_t *u_find_symb CAPA_ARG((char *name, Unit_t *t, int *result));
577: void u_find_name CAPA_ARG((Unit_t *t));
578: void print_matches CAPA_ARG((Unit_t *t));
579: double u_squared_diff CAPA_ARG((Unit_t *a, Unit_t *b));
580: double u_sq_diff CAPA_ARG((Unit_t *b));
581:
582: void print_unit_tree CAPA_ARG(());
583: int alphaorder_utree CAPA_ARG((Unit_t *node_p));
584: int inorder_diff CAPA_ARG((Unit_t *node_p));
585: int inorder_utree CAPA_ARG((Unit_t *node_p));
586: int postorder_utree CAPA_ARG((Unit_t *node_p));
587: int postwalk_utree CAPA_ARG((Unit_t *n_p));
588: void process_op CAPA_ARG((int op));
589: void process_utree CAPA_ARG((Unit_t *t));
590: int check_correct_unit CAPA_ARG((char *u_symb,Unit_t *t,double *scale));
591: int free_utree CAPA_ARG((Unit_t *t));
592: int u_postfree CAPA_ARG((Unit_t *t));
593: void print_unit_t CAPA_ARG((Unit_t *t));
594: void u_copy_unit CAPA_ARG((Unit_t *a_p,Unit_t *b_p,double exp_scale));
595: int u_pm_op CAPA_ARG((Unit_t *a_p, Unit_t *b_p, int op));
596:
597: int u_parsepower CAPA_ARG((char *unit_str));
598: double s_scan_number CAPA_ARG((char *buf, int idx, int *r_idx));
599: double s_scan_symbol CAPA_ARG((char *buf,char *symb_p,int idx,int *r_idx));
600: int s_process_symb CAPA_ARG((char *symb_str, Unit_t *cu_p,double exp));
601: Unit_t *u_parse_unit CAPA_ARG((char *unit_str));
602: int comp_unit_symb CAPA_ARG((char *a,char *b));
603: Unit_t *u_splay CAPA_ARG((char *name, Unit_t *t));
604: int u_insert_baseunit CAPA_ARG((char *n_p,char *s_p,char *c_p));
605: int u_insert_derived CAPA_ARG((char *n_p,char *s_p,char *c_p,char *u_p));
606: void u_getunit CAPA_ARG((FILE *f));
607: void simplify_unit CAPA_ARG((Unit_t *u_p));
608: void freelist_unit_e CAPA_ARG((Unit_E *ue_p));
609: int is_units_equal CAPA_ARG((Unit_t *u1_p, Unit_t *u2_p));
610: double units_ratio CAPA_ARG((Unit_t *u1_p, Unit_t *u2_p));
611: Unit_t *p_new_op CAPA_ARG((Unit_t *left_p, int op, Unit_t *right_p));
612: Unit_t *p_new_num CAPA_ARG((Unit_t *left_p, double num, Unit_t *right_p));
613: Unit_t *p_new_unit CAPA_ARG((Unit_t *left_p, Unit_t *right_p));
614: int s_getnext CAPA_ARG(());
615: int s_peeknext CAPA_ARG(());
616: double scan_FLOAT CAPA_ARG(());
617: Unit_t *scan_num_item CAPA_ARG(());
618: Unit_t *scan_unit_item CAPA_ARG(());
619: Unit_t *scan_basic_term CAPA_ARG(());
620: Unit_t *scan_num_term CAPA_ARG(());
621: Unit_t *scan_basic_block CAPA_ARG(());
622: Unit_t *scan_num_block CAPA_ARG(());
623: Unit_t *scan_unit_expr CAPA_ARG(());
624: Unit_t *scan_num_expr CAPA_ARG(());
625: Unit_t *parse_unit_expr CAPA_ARG((char *symb_str));
626: void print_remains CAPA_ARG(());
627: /* ================================================= capaMapExpr.c */
628:
629: int do_map CAPA_ARG((char *seed,ArgNode_t *varp,ArgNode_t *argp,int argc, int dir));
630:
631: /* =============================================== capaFormulaLexer.c -- */
632: double f_get_float CAPA_ARG(());
633: char *f_get_id CAPA_ARG(());
634: int f_peek_next_token CAPA_ARG(());
635: int fml_lex CAPA_ARG(());
636:
637: /* =============================================== capaFormula.y == */
638: int fml_parse CAPA_ARG(());
639: Symbol *f_symbol_pow CAPA_ARG((Symbol *ap, Symbol *bp));
640: /* ====================================================================== */
641:
642: #ifdef __sun
643: #define index(xx,cc) strchr(xx,cc)
644: #define rindex(xx,cc) strrchr(xx,cc)
645: #endif
646:
647: #endif /* _CAPA_PARSER_H_ */
648:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>