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