Annotation of loncom/homework/CAPA-converter/capaParser.h, revision 1.1
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:
! 38: /*#define EIGHT 8*/
! 39: /*#define SIXTEEN 16*/
! 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;
! 84: struct _symbol *s_prevp;
! 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:
! 113: #define FIRST_SYMBOLP(aaa) (aaa->a_sp)
! 114: #define SECOND_SYMBOLP(aaa) ( (aaa->a_next)->a_sp )
! 115: #define THIRD_SYMBOLP(aaa) ( ((aaa->a_next)->a_next)->a_sp )
! 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 )
! 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)
! 128: #define THIRD_ARGNAME(aaa) ( THIRD_SYMBOLP(aaa)->s_name )
! 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)
! 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)
! 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 verbatim; /* do verbatim protection around answers */
! 271: int ans_op; /* ANS_AND or ANS_OR */
! 272: char *id_list;
! 273: struct _pts_list *pts_list;
! 274: char ans_fmt[ANSWER_STRING_LENG];
! 275: char unit_str[ANSWER_STRING_LENG];
! 276: Unit_t *ans_unit;
! 277: struct _answer_info *ans_list;
! 278: struct _answer_info *ans_list_last;
! 279: struct _problem *next; /* Pointer to next problem */
! 280: } Problem_t;
! 281:
! 282: #define P_TOLTYPE(p) ((p)->tol_type)
! 283:
! 284:
! 285: typedef struct _pts_list {
! 286: char *pts_str;
! 287: int pts_idx;
! 288: struct _pts_list *pts_next;
! 289: } PointsList_t;
! 290:
! 291:
! 292:
! 293: /* Answer related data structure */
! 294: /*
! 295: char *ans_str
! 296: int ans_type
! 297: int ans_calc
! 298: int ans_tol_type
! 299: double ans_tol
! 300: int ans_sig_ub
! 301: int ans_sig_lb
! 302: char *ans_id_list;
! 303: struct _pts_list *ans_pts_list;
! 304: char ans_fmt
! 305: char ans_unit_str
! 306:
! 307: */
! 308: /*
! 309: some information in the answer specification should be
! 310: problem-wise, such as problem weight, problem tries
! 311:
! 312: */
! 313:
! 314: typedef struct _answer_info {
! 315: char *ans_str; /* correct answer in string form */
! 316: int ans_type; /* answer type */
! 317: int ans_calc;
! 318: int ans_tol_type; /* answer tolerence type */
! 319: double ans_tol; /* the tolerence itself */
! 320: int ans_sig_ub;
! 321: int ans_sig_lb;
! 322: char *ans_id_list;
! 323: struct _pts_list *ans_pts_list;
! 324: char ans_fmt[ANSWER_STRING_LENG];
! 325: char ans_unit_str[ANSWER_STRING_LENG];
! 326: Unit_t *ans_unit;
! 327: struct _answer_info *ans_next;
! 328: } AnswerInfo_t;
! 329:
! 330:
! 331:
! 332: /******************************************************************************/
! 333: /* STRUCTURE FOR A PROBLEM */
! 334: /******************************************************************************/
! 335:
! 336: #define SPEC_TOLERANCE 1
! 337: #define SPEC_SIG 2
! 338: #define SPEC_WEIGHT 4
! 339: #define SPEC_TYPE 8
! 340: #define SPEC_PCREDIT 16
! 341: #define SPEC_TRY 32
! 342: #define SPEC_UNIT 64
! 343:
! 344: /* ---------------------------- tol_type -------------------------- */
! 345: #define TOL_ABSOLUTE 1
! 346: #define TOL_PERCENTAGE 2
! 347:
! 348: /* ------------------------------------------ */
! 349: #define CALC_UNFORMATED 1
! 350: #define CALC_FORMATED 2
! 351:
! 352: #define CALC_DEFAULT CALC_UNFORMATED /* for answer calculation */
! 353:
! 354: /* ---------------------------------------- web option only */
! 355: #define DO_SHOW 1
! 356: #define DONOT_SHOW 0
! 357:
! 358: #define DO_VERBATIM 1
! 359: #define DONOT_VERBATIM 0
! 360:
! 361: #define SHOW_BR_DEFAULT DO_SHOW
! 362: #define VERBATIM_DEFAULT DO_VERBATIM
! 363: #define SHOW_ANSBOX_DEFAULT DO_SHOW
! 364:
! 365: #define SIG_LB_DEFAULT 0 /* ---- sig_lbound ------- */
! 366: #define SIG_UB_DEFAULT 15 /* ---- sig_ubound ------- */
! 367: #define PCREDIT_DEFAULT 0 /* ---- partial_cdt ------ */
! 368: #define TOL_DEFAULT (0.0) /* ---- tolerance ------- */
! 369: #define WEIGHT_DEFAULT 1 /* ---- weight ------- */
! 370: #define NO_LIMIT_TRY (0) /* ---- tries ------- */
! 371: #define MAX_TRIES 99 /* ---- tries ------------ */
! 372: #define SHOW_HINT_DEFAULT 1 /* show hints immediately */
! 373:
! 374: /* --------------------------- ans_type -------------------------- */
! 375: #define ANSWER_IS_INTEGER 1
! 376: #define ANSWER_IS_FLOAT 2
! 377: #define ANSWER_IS_STRING_CI 3
! 378: #define ANSWER_IS_STRING_CS 4
! 379: #define ANSWER_IS_CHOICE 5
! 380: #define ANSWER_IS_ARITH 6
! 381: #define ANSWER_IS_SUBJECTIVE 7
! 382: #define ANSWER_IS_FORMULA 8
! 383: #define ANSWER_IS_EXTERNAL 9
! 384:
! 385: #define YAK 1
! 386: #define NAY 0
! 387:
! 388: /* -------- results given by capa_check_answer() and capa_check_answers() */
! 389:
! 390: #define EXACT_ANS 1
! 391: #define APPROX_ANS 2
! 392: #define SIG_FAIL 3
! 393: #define UNIT_FAIL 4
! 394: #define NO_UNIT 5
! 395: #define UNIT_OK 6
! 396: #define INCORRECT 7
! 397: #define UNIT_NOTNEEDED 8
! 398: #define ANS_CNT_NOT_MATCH 9
! 399: #define SUB_RECORDED 10
! 400: #define BAD_FORMULA 11
! 401: #define WANTED_NUMERIC 12
! 402:
! 403:
! 404:
! 405: /* =============================================================== */
! 406:
! 407: #define T_SPACE 9
! 408: #define T_PREFIX 8
! 409: #define T_NUMBER 7
! 410: #define T_BASIC_UNIT 6
! 411: #define T_DERIVED_UNIT 5
! 412: #define T_LP 4
! 413: #define T_RP 3
! 414: #define T_MULTIPLY 2
! 415: #define T_POWER 1
! 416: #define T_END 0
! 417:
! 418: /* for IFstatus[] */
! 419:
! 420: #define IF_FALSE 0
! 421: #define IF_TRUE 1
! 422: #define IF_DONT_CARE 2
! 423:
! 424: /* for IFcurrent[] */
! 425: #define RUN_IF_PORTION 1
! 426: #define RUN_ELSE_PORTION 2
! 427:
! 428: /* ================================================================ */
! 429: /********************** for random(), /MAP(), capa_PIN() */
! 430: /* BETA_DIS is used for genbet() */
! 431: /* CHI_DIS is for genchi() */
! 432: /* EXPONENTIAL_DIS genexp() */
! 433: /* GAMMA_DIS gengam() */
! 434: /* MULTI_NORM_DIS genmn() */
! 435: /* NONCEN_CHI_DIS gennch() */
! 436: /* NORMAL_DIS gennor() */
! 437: /* POISSON_DIS long ignpoi(float mu) */
! 438:
! 439: #define RANDOM_G 1L
! 440: #define PERMUTATION_G 2L
! 441: #define PIN_G 3L
! 442:
! 443: #define NORMAL_DIS 10
! 444: #define POISSON_DIS 11
! 445: #define EXPONENTIAL_DIS 12
! 446: #define BETA_DIS 13
! 447: #define GAMMA_DIS 14
! 448: #define CHI_DIS 15
! 449: #define NONCENTRAL_CHI_DIS 16
! 450:
! 451: #define GET_GENERATOR 0L
! 452: #define SET_GENERATOR 1L
! 453:
! 454: #define FORWARD_MAP 0
! 455: #define REVERSE_MAP 1
! 456:
! 457:
! 458:
! 459: /* ---------------------------------------------- capaLexerDef.flex */
! 460: void begin_if_skip CAPA_ARG(());
! 461: void begin_while_skip CAPA_ARG(());
! 462: void begin_next_line CAPA_ARG(());
! 463: void begin_var CAPA_ARG(());
! 464: void begin_let CAPA_ARG(());
! 465: void begin_def CAPA_ARG(());
! 466: void begin_ans CAPA_ARG(());
! 467: void begin_map CAPA_ARG(());
! 468: void begin_ignore CAPA_ARG(());
! 469: void begin_text CAPA_ARG(());
! 470: void begin_question CAPA_ARG(());
! 471: void end_problemset CAPA_ARG(());
! 472: int match_keyword CAPA_ARG((char *key));
! 473: int match_functionid CAPA_ARG((char *key));
! 474: void init_funcstack CAPA_ARG(());
! 475:
! 476: #ifdef DMALLOC
! 477: #define strsave(s) strcpy(capa_malloc(strlen(s)+1,1),s)
! 478: #define capa_malloc(num,sz) memset(calloc(num,sz),'\0',num*sz)
! 479: #define capa_mfree(p) free(p);
! 480: #else
! 481: char *strsave CAPA_ARG((char *s));
! 482: char *capa_malloc CAPA_ARG((unsigned int num, unsigned int sz));
! 483: void capa_mfree CAPA_ARG((char *p));
! 484: #endif
! 485: void capa_msg CAPA_ARG((int type, char *p));
! 486: void capa_warn_header CAPA_ARG(());
! 487: void parse_filename CAPA_ARG((char *line));
! 488: void parse_import_id CAPA_ARG((char *line));
! 489: char *parse_endinput CAPA_ARG((char *line));
! 490: void append_dynamic_buf CAPA_ARG((char *new_str));
! 491: char* parser_status CAPA_ARG((void));
! 492: /*------------------------------------------------- capaGrammarDef.y */
! 493:
! 494: ExpNode_p mk_node CAPA_ARG((int op, ExpNode_p left, ExpNode_p right));
! 495: ExpNode_p mk_leaf CAPA_ARG((int type, Symbol_p valp));
! 496: void append_text CAPA_ARG((char *str));
! 497: void append_hint CAPA_ARG((char *str));
! 498: void append_explain CAPA_ARG((char *str));
! 499: void append_error CAPA_ARG((char *str));
! 500: void append_warn CAPA_ARG((int type, char *str));
! 501: Symbol *symbols_op CAPA_ARG((Symbol *a, Symbol *b, int op));
! 502: char *format_toTeX CAPA_ARG((char *real));
! 503: char *format_toHTML CAPA_ARG((char *real));
! 504: void init_answerinfo CAPA_ARG(());
! 505: void display_var CAPA_ARG((Symbol *s));
! 506: void assign_answer CAPA_ARG((Symbol *s));
! 507: void assign_tolerance CAPA_ARG((int tol_type, Symbol *s));
! 508: void assign_weight CAPA_ARG((Symbol *s));
! 509: void assign_try_limits CAPA_ARG((Symbol *s));
! 510: void assign_hint CAPA_ARG((Symbol *s));
! 511: void assign_units CAPA_ARG((Symbol *s));
! 512: void assign_sigs CAPA_ARG((int lb, int ub));
! 513: void assign_id_list CAPA_ARG((Symbol *s));
! 514: void init_new_prob CAPA_ARG(());
! 515: void add_answer_cnt CAPA_ARG((int op));
! 516: void finish_answer_info CAPA_ARG(());
! 517: void start_question_over CAPA_ARG(());
! 518:
! 519: Symbol* get_array_symbol CAPA_ARG((Symbol* name,Symbol* index,int free_symbols));
! 520: Symbol* build_array_list CAPA_ARG((Symbol* ar_name,int num_elem));
! 521: /*---------------------------------------------------- capaParserUtils.c */
! 522: void problem_default CAPA_ARG((Problem_t *p));
! 523: int comp_name CAPA_ARG((char *a,char *b));
! 524: int comp_namesymbol CAPA_ARG((char *a, Symbol *b));
! 525: int itis_empty CAPA_ARG((TreeNode_t *root_p));
! 526: void print_symb_stat CAPA_ARG(());
! 527: int preorder_tree CAPA_ARG((TreeNode_t *node_p));
! 528: int inorder_tree CAPA_ARG((TreeNode_t *node_p));
! 529: int postorder_tree CAPA_ARG((TreeNode_t *node_p));
! 530: int destroy_tree CAPA_ARG((TreeNode_t *node_p));
! 531: int free_symtree CAPA_ARG(());
! 532: char *btree_search CAPA_ARG((char *key,TreeNode_t **root_pp,int (*compar)()));
! 533: Symbol *find_identifier CAPA_ARG((register char *name));
! 534:
! 535: ArgNode_t *new_arglist CAPA_ARG((Symbol *sp));
! 536: ArgNode_t *addto_arglist CAPA_ARG((ArgNode_t *argp, Symbol *sp));
! 537: void walk_arglist CAPA_ARG((ArgNode_t *argp));
! 538: void free_arglist CAPA_ARG((ArgNode_t *argp));
! 539: int purge_tree CAPA_ARG((TreeNode_t **root_pp));
! 540: int calc_sig CAPA_ARG((char *a_num ));
! 541: int endian CAPA_ARG(());
! 542: TreeNode_t *new_treenode CAPA_ARG((char *name_p, int type));
! 543: TreeNode_t *new_formulanode CAPA_ARG((char *name_p, double val));
! 544:
! 545: TreeNode_t *t_splay CAPA_ARG((char *name, TreeNode_t *t));
! 546: void print_array_element CAPA_ARG((Symbol *array_p));
! 547: Symbol *find_arrayid CAPA_ARG((char *name_p));
! 548: Symbol *find_array_by_index CAPA_ARG((Symbol *array_p,char *idx_p));
! 549: int free_array CAPA_ARG((char *name_p));
! 550: Symbol *array_min_max CAPA_ARG((char *name_p,int min));
! 551: Symbol *array_moments CAPA_ARG((char *result_p,char *name_p));
! 552:
! 553: Symbol *gen_random_by_selector CAPA_ARG((char *output_p,int sel,char *seed,int item_cnt,float p1,float p2));
! 554: int setup_formula_id CAPA_ARG((char *v_str, char *pt_str));
! 555: void free_formula_tree CAPA_ARG(());
! 556:
! 557: Symbol *find_formula_id CAPA_ARG((char *name_p));
! 558: int f_eval_formula CAPA_ARG((double *f_val,char *f_str,char *v_str, char *pt_str));
! 559:
! 560: int f_u_parse_formula CAPA_ARG((char *f_str));
! 561: int f_str_to_numbers CAPA_ARG((double **f_ar, char *n_str));
! 562: int f_str_to_ids CAPA_ARG((char ***v_ar, char *n_str));
! 563:
! 564: PointsList_t *f_gen_pts CAPA_ARG((char *ap, char *bp, int n));
! 565: PointsList_t *gen_ptslist_str CAPA_ARG((char *range_str ));
! 566: char *eval_formula_range_str CAPA_ARG((char *f_str,char *var_list,char *range_str));
! 567:
! 568: PointsList_t *gen_ptslist CAPA_ARG((Symbol *ap,Symbol *bp,Symbol *np));
! 569: PointsList_t *new_ptslist CAPA_ARG((Symbol *sp ));
! 570: void free_ptslist CAPA_ARG((PointsList_t *pts_p)) ;
! 571: /* ====================================== capaUnit.c */
! 572:
! 573: void c_ignorewhite CAPA_ARG((FILE *f));
! 574: double c_getdouble CAPA_ARG((FILE *f));
! 575: int c_getint CAPA_ARG((FILE *f));
! 576: int c_getsec_range CAPA_ARG((FILE *f,int *low,int *high));
! 577: char *c_getword CAPA_ARG((FILE *f));
! 578: char *c_getstring CAPA_ARG((FILE *f));
! 579: char *c_getcomment CAPA_ARG((FILE *f));
! 580: int c_gettype CAPA_ARG((FILE *f));
! 581:
! 582: Unit_t *u_find_symb CAPA_ARG((char *name, Unit_t *t, int *result));
! 583: void u_find_name CAPA_ARG((Unit_t *t));
! 584: void print_matches CAPA_ARG((Unit_t *t));
! 585: double u_squared_diff CAPA_ARG((Unit_t *a, Unit_t *b));
! 586: double u_sq_diff CAPA_ARG((Unit_t *b));
! 587:
! 588: void print_unit_tree CAPA_ARG(());
! 589: int alphaorder_utree CAPA_ARG((Unit_t *node_p));
! 590: int inorder_diff CAPA_ARG((Unit_t *node_p));
! 591: int inorder_utree CAPA_ARG((Unit_t *node_p));
! 592: int postorder_utree CAPA_ARG((Unit_t *node_p));
! 593: int postwalk_utree CAPA_ARG((Unit_t *n_p));
! 594: void process_op CAPA_ARG((int op));
! 595: void process_utree CAPA_ARG((Unit_t *t));
! 596: int check_correct_unit CAPA_ARG((char *u_symb,Unit_t *t,double *scale));
! 597: int free_utree CAPA_ARG((Unit_t *t));
! 598: int u_postfree CAPA_ARG((Unit_t *t));
! 599: void print_unit_t CAPA_ARG((Unit_t *t));
! 600: void u_copy_unit CAPA_ARG((Unit_t *a_p,Unit_t *b_p,double exp_scale));
! 601: int u_pm_op CAPA_ARG((Unit_t *a_p, Unit_t *b_p, int op));
! 602:
! 603: int u_parsepower CAPA_ARG((char *unit_str));
! 604: double s_scan_number CAPA_ARG((char *buf, int idx, int *r_idx));
! 605: double s_scan_symbol CAPA_ARG((char *buf,char *symb_p,int idx,int *r_idx));
! 606: int s_process_symb CAPA_ARG((char *symb_str, Unit_t *cu_p,double exp));
! 607: Unit_t *u_parse_unit CAPA_ARG((char *unit_str));
! 608: int comp_unit_symb CAPA_ARG((char *a,char *b));
! 609: Unit_t *u_splay CAPA_ARG((char *name, Unit_t *t));
! 610: int u_insert_baseunit CAPA_ARG((char *n_p,char *s_p,char *c_p));
! 611: int u_insert_derived CAPA_ARG((char *n_p,char *s_p,char *c_p,char *u_p));
! 612: void u_getunit CAPA_ARG((FILE *f));
! 613: void simplify_unit CAPA_ARG((Unit_t *u_p));
! 614: void freelist_unit_e CAPA_ARG((Unit_E *ue_p));
! 615: int is_units_equal CAPA_ARG((Unit_t *u1_p, Unit_t *u2_p));
! 616: double units_ratio CAPA_ARG((Unit_t *u1_p, Unit_t *u2_p));
! 617: Unit_t *p_new_op CAPA_ARG((Unit_t *left_p, int op, Unit_t *right_p));
! 618: Unit_t *p_new_num CAPA_ARG((Unit_t *left_p, double num, Unit_t *right_p));
! 619: Unit_t *p_new_unit CAPA_ARG((Unit_t *left_p, Unit_t *right_p));
! 620: int s_getnext CAPA_ARG(());
! 621: int s_peeknext CAPA_ARG(());
! 622: double scan_FLOAT CAPA_ARG(());
! 623: Unit_t *scan_num_item CAPA_ARG(());
! 624: Unit_t *scan_unit_item CAPA_ARG(());
! 625: Unit_t *scan_basic_term CAPA_ARG(());
! 626: Unit_t *scan_num_term CAPA_ARG(());
! 627: Unit_t *scan_basic_block CAPA_ARG(());
! 628: Unit_t *scan_num_block CAPA_ARG(());
! 629: Unit_t *scan_unit_expr CAPA_ARG(());
! 630: Unit_t *scan_num_expr CAPA_ARG(());
! 631: Unit_t *parse_unit_expr CAPA_ARG((char *symb_str));
! 632: void print_remains CAPA_ARG(());
! 633: /* ================================================= capaMapExpr.c */
! 634:
! 635: int do_map CAPA_ARG((char *seed,ArgNode_t *varp,ArgNode_t *argp,int argc, int dir));
! 636:
! 637: /* =============================================== capaFormulaLexer.c -- */
! 638: double f_get_float CAPA_ARG(());
! 639: char *f_get_id CAPA_ARG(());
! 640: int f_peek_next_token CAPA_ARG(());
! 641: int fml_lex CAPA_ARG(());
! 642:
! 643: /* =============================================== capaFormula.y == */
! 644: int fml_parse CAPA_ARG(());
! 645: Symbol *f_symbol_pow CAPA_ARG((Symbol *ap, Symbol *bp));
! 646: /* ====================================================================== */
! 647:
! 648: #ifdef __sun
! 649: #define index(xx,cc) strchr(xx,cc)
! 650: #define rindex(xx,cc) strrchr(xx,cc)
! 651: #endif
! 652:
! 653: #endif /* _CAPA_PARSER_H_ */
! 654:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>