Annotation of capa/capa51/pProj/capaParser.h, revision 1.13

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.10      albertel  142: #define   SIXTH_SYMBOLP(aaa)    ( (((((aaa->a_next)->a_next)->a_next)->a_next)->a_next)->a_sp )
1.1       albertel  143: #define   FIRST_ARGNAME(aaa)    ( FIRST_SYMBOLP(aaa)->s_name )
                    144: #define   FIRST_ARGTYPE(aaa)    ( FIRST_SYMBOLP(aaa)->s_type )
                    145: #define   FIRST_ARGINT(aaa)     ( FIRST_SYMBOLP(aaa)->s_int )
                    146: #define   FIRST_ARGREAL(aaa)    ( FIRST_SYMBOLP(aaa)->s_real )
                    147: #define   FIRST_ARGSTR(aaa)     ( FIRST_SYMBOLP(aaa)->s_str )
                    148: #define   SECOND_ARGNAME(aaa)   ( SECOND_SYMBOLP(aaa)->s_name )
                    149: #define   SECOND_ARGTYPE(aaa)   ( SECOND_SYMBOLP(aaa)->s_type)
                    150: #define   SECOND_ARGINT(aaa)    ( SECOND_SYMBOLP(aaa)->s_int)
                    151: #define   SECOND_ARGREAL(aaa)   ( SECOND_SYMBOLP(aaa)->s_real)
                    152: #define   SECOND_ARGSTR(aaa)    ( SECOND_SYMBOLP(aaa)->s_str)
1.4       albertel  153: #define   THIRD_ARGNAME(aaa)    ( THIRD_SYMBOLP(aaa)->s_name )
1.1       albertel  154: #define   THIRD_ARGTYPE(aaa)    ( THIRD_SYMBOLP(aaa)->s_type)
                    155: #define   THIRD_ARGINT(aaa)     ( THIRD_SYMBOLP(aaa)->s_int)
                    156: #define   THIRD_ARGREAL(aaa)    ( THIRD_SYMBOLP(aaa)->s_real)
                    157: #define   THIRD_ARGSTR(aaa)     ( THIRD_SYMBOLP(aaa)->s_str)
1.4       albertel  158: #define   FOURTH_ARGTYPE(aaa)   ( FOURTH_SYMBOLP(aaa)->s_type)
                    159: #define   FOURTH_ARGNAME(aaa)   ( FOURTH_SYMBOLP(aaa)->s_name )
                    160: #define   FOURTH_ARGINT(aaa)    ( FOURTH_SYMBOLP(aaa)->s_int)
                    161: #define   FOURTH_ARGREAL(aaa)   ( FOURTH_SYMBOLP(aaa)->s_real)
                    162: #define   FOURTH_ARGSTR(aaa)    ( FOURTH_SYMBOLP(aaa)->s_str)
                    163: #define   FIFTH_ARGTYPE(aaa)    ( FIFTH_SYMBOLP(aaa)->s_type)
                    164: #define   FIFTH_ARGNAME(aaa)    ( FIFTH_SYMBOLP(aaa)->s_name )
                    165: #define   FIFTH_ARGINT(aaa)     ( FIFTH_SYMBOLP(aaa)->s_int)
                    166: #define   FIFTH_ARGREAL(aaa)    ( FIFTH_SYMBOLP(aaa)->s_real)
                    167: #define   FIFTH_ARGSTR(aaa)     ( FIFTH_SYMBOLP(aaa)->s_str)
1.10      albertel  168: #define   SIXTH_ARGTYPE(aaa)    ( SIXTH_SYMBOLP(aaa)->s_type)
                    169: #define   SIXTH_ARGNAME(aaa)    ( SIXTH_SYMBOLP(aaa)->s_name )
                    170: #define   SIXTH_ARGINT(aaa)     ( SIXTH_SYMBOLP(aaa)->s_int)
                    171: #define   SIXTH_ARGREAL(aaa)    ( SIXTH_SYMBOLP(aaa)->s_real)
                    172: #define   SIXTH_ARGSTR(aaa)     ( SIXTH_SYMBOLP(aaa)->s_str)
1.1       albertel  173: 
                    174: 
                    175: 
                    176: 
                    177: typedef struct _treeNode {
                    178:     Symbol           *t_sp;
                    179:     int               t_idx;
                    180:     struct _treeNode *t_left;
                    181:     struct _treeNode *t_right;
                    182:  } TreeNode_t;
                    183: 
                    184: typedef struct _expNode {
                    185:     int              e_type;
                    186:     struct _expNode *e_parentp;
                    187:     struct _expNode *e_lsibp;
                    188:     struct _expNode *e_rsibp;
                    189:     Symbol          *e_sp;
                    190:  } ExpNode;
                    191:  
                    192: typedef ExpNode  *ExpNode_p;
                    193: 
                    194: /* ================================================================ */
                    195: /*   While loop data structure */
                    196: 
                    197: typedef struct _WhileLoop {
                    198:     int             input_idx; /* stores Input_idx */
                    199:     int             line_idx;  /* stores Current_line[Input_idx] */
                    200:     long int        pos_idx;   /* stores next line position in the input stream */
                    201:  } WhileLoop_t;
                    202: 
                    203: 
                    204: /* ================================================================ */
                    205: /*    Warning message data structure */
                    206: 
                    207: typedef  struct  _WarnMsg {
                    208:     int              warn_type;
                    209:     char            *warn_str;
                    210:     struct _WarnMsg *warn_next;
                    211:   } WarnMsg_t;
                    212: 
                    213: 
                    214: 
                    215: 
                    216: 
                    217: 
                    218: /* ================================================================ */
                    219: 
                    220: #define    SYMBOL_MAXLEN     16      /* unit symbol name length */
                    221: #define    NAME_MAXLEN       48      /* unit name length */
                    222: #define    BASEUNIT_LIMIT    32      /* maximum number of base units */
                    223: #define    ONE_K_SIZE        1024 
                    224: 
                    225: /* ================================================================ */
                    226: 
                    227: typedef  struct  _unit_elem {
                    228:   struct  _unit_elem  *ue_nextp;
                    229:   char    ue_symbol[SYMBOL_MAXLEN];
                    230:   int     ue_index;   /* -1 means this is composite */
                    231: #define          UE_COMPOSITE     -1
                    232:   double  ue_scale;
                    233:   double  ue_exp;
                    234: } Unit_E;
                    235: 
                    236: typedef struct  _unit_t {
                    237:   char       u_symbol[SYMBOL_MAXLEN];
                    238:   char       u_name[NAME_MAXLEN];
                    239:   char      *u_comment;
                    240:   int        u_index;
                    241:   struct _unit_t  *u_left;
                    242:   struct _unit_t  *u_right;
                    243:   int        u_type;
                    244: #define          U_BASE            1
                    245: #define          U_DERIVED         2
                    246: #define          U_PREFIX          3
                    247: #define          U_CONSTANT        4
                    248: #define          U_OP_POWER        5
                    249: #define          U_OP_TIMES        6
                    250: #define          U_OP_PLUS         7
                    251: #define          U_OP_MINUS        8
                    252: #define          U_OP_DIVIDE       9
                    253: #define          U_UNKNOWN         10
                    254: #define          U_DEFAULT         11
                    255:   double     u_scale;
                    256:   double     u_offset;
                    257:   int        u_count;
                    258:   Unit_E    *u_list;
                    259: }  Unit_t;
                    260: 
                    261: #define   U_LEFT(x)   ((x)->u_left)
                    262: #define   U_RIGHT(x)  ((x)->u_right)
                    263: #define   U_SYMB(x)   ((x)->u_symbol)
                    264: #define   U_NAME(x)   ((x)->u_name)
                    265: #define   U_COUNT(x)  ((x)->u_count)
                    266: #define   U_TYPE(x)   ((x)->u_type)
                    267: #define   U_SCALE(x)  ((x)->u_scale)
                    268: 
                    269: /* ==================================================================== */
                    270: /* Answer    tolerance    sig     string   */
                    271: /*  int        abs/rel                     */
                    272: /*  real       abs/rel    [l,u]            */
                    273: /*  string                         cs/ci   */
                    274: /*                                 mc      */
                    275: 
                    276: typedef struct _problem {
                    277:    char               *question;    /* Question text                   */
                    278:    char               *answer;      /* Answer string                   */
                    279:    char               *hint;        /* Hint text                       */
                    280:    char               *explain;     /* Explain text                    */
                    281:    char               *capaidplus;  /* Quizzes extra unique identifier 
                    282:                                        Only set in the first problem   */
                    283:    int                 ans_cnt;     
                    284:    int                 weight;
                    285:    int                 tol_type;
                    286:    double              tolerance;
                    287:    int                 ans_type;    /* Type of answer expecting        */
                    288:    int                 sig_ubound;
                    289:    int                 sig_lbound;
                    290:    int                 partial_cdt;
                    291:    
                    292:    int                 calc;         /* calculate correct answers based on 
                    293:                                        formated/unformated exact answer */
                    294:    int                 tries;       /* Number of tries allowed         */
                    295:    int                 show_hint;
                    296:    int                 show_explain;
                    297:    int                 show_br;      /* web only, <BR> on is by default */
                    298:    int                 show_ans_box; /* web only, answer box is shown by default */
1.5       albertel  299:    int                 verbatim; /* do verbatim protection around answers */
1.1       albertel  300:    int                 ans_op;   /* ANS_AND or ANS_OR */
                    301:    char               *id_list;
                    302:    struct   _pts_list *pts_list;
                    303:    char                ans_fmt[ANSWER_STRING_LENG];
                    304:    char                unit_str[ANSWER_STRING_LENG];
                    305:    Unit_t              *ans_unit;
                    306:    struct _answer_info *ans_list;
                    307:    struct _answer_info *ans_list_last;
                    308:    struct _problem     *next;        /* Pointer to next problem         */
                    309: } Problem_t;
                    310: 
                    311: #define   P_TOLTYPE(p)  ((p)->tol_type)
                    312: 
                    313: 
                    314: typedef struct _pts_list {
                    315:    char     *pts_str;
                    316:    int       pts_idx;
                    317:    struct   _pts_list *pts_next;
                    318: } PointsList_t;
                    319: 
                    320: 
                    321: 
                    322: /* Answer related data structure */
                    323: /* 
                    324:    char     *ans_str
                    325:    int       ans_type
                    326:    int       ans_calc
                    327:    int       ans_tol_type
                    328:    double    ans_tol
                    329:    int       ans_sig_ub
                    330:    int       ans_sig_lb
                    331:    char     *ans_id_list;
                    332:    struct   _pts_list *ans_pts_list;
                    333:    char      ans_fmt
                    334:    char      ans_unit_str
                    335:    
                    336: */
                    337: /* 
                    338:     some information in the answer specification should be 
                    339:     problem-wise, such as problem weight, problem tries
                    340:     
                    341: */
                    342: 
                    343: typedef struct _answer_info {
                    344:    char     *ans_str;           /* correct answer in string form */
                    345:    int       ans_type;          /* answer type */
                    346:    int       ans_calc;
                    347:    int       ans_tol_type;      /* answer tolerence type */
                    348:    double    ans_tol;           /* the tolerence itself */
                    349:    int       ans_sig_ub;
                    350:    int       ans_sig_lb;
                    351:    char     *ans_id_list;
                    352:    struct   _pts_list *ans_pts_list;
                    353:    char      ans_fmt[ANSWER_STRING_LENG];
                    354:    char      ans_unit_str[ANSWER_STRING_LENG];
                    355:    Unit_t   *ans_unit;
                    356:    struct   _answer_info *ans_next;
                    357: } AnswerInfo_t;
                    358: 
                    359: 
                    360: 
                    361: /******************************************************************************/
                    362: /* STRUCTURE FOR A PROBLEM                                                    */
                    363: /******************************************************************************/
                    364: 
                    365: #define    SPEC_TOLERANCE       1
                    366: #define    SPEC_SIG             2
                    367: #define    SPEC_WEIGHT          4
                    368: #define    SPEC_TYPE            8
                    369: #define    SPEC_PCREDIT         16
                    370: #define    SPEC_TRY             32
                    371: #define    SPEC_UNIT            64
                    372: 
                    373: /* ---------------------------- tol_type -------------------------- */
                    374: #define    TOL_ABSOLUTE         1
                    375: #define    TOL_PERCENTAGE       2
                    376: 
                    377: /* ------------------------------------------ */
                    378: #define    CALC_UNFORMATED      1
                    379: #define    CALC_FORMATED        2
                    380: 
                    381: #define    CALC_DEFAULT         CALC_UNFORMATED  /* for answer calculation */
                    382: 
                    383: /* ----------------------------------------  web option only */
                    384: #define    DO_SHOW              1
                    385: #define    DONOT_SHOW           0
                    386: 
1.5       albertel  387: #define    DO_VERBATIM          1
                    388: #define    DONOT_VERBATIM       0
                    389: 
1.1       albertel  390: #define    SHOW_BR_DEFAULT      DO_SHOW
1.5       albertel  391: #define    VERBATIM_DEFAULT     DO_VERBATIM
1.1       albertel  392: #define    SHOW_ANSBOX_DEFAULT  DO_SHOW
                    393: 
                    394: #define    SIG_LB_DEFAULT       0        /* ---- sig_lbound ------- */
                    395: #define    SIG_UB_DEFAULT       15       /* ---- sig_ubound ------- */
                    396: #define    PCREDIT_DEFAULT      0        /* ---- partial_cdt ------ */
                    397: #define    TOL_DEFAULT          (0.0)    /* ---- tolerance  ------- */
                    398: #define    WEIGHT_DEFAULT       1        /* ---- weight     ------- */
                    399: #define    NO_LIMIT_TRY         (0)      /* ---- tries      ------- */
                    400: #define    MAX_TRIES            99       /* ---- tries ------------ */
                    401: #define    SHOW_HINT_DEFAULT    1        /* show hints immediately */
                    402: 
                    403: /* ---------------------------  ans_type -------------------------- */
                    404: #define    ANSWER_IS_INTEGER       1
                    405: #define    ANSWER_IS_FLOAT         2
                    406: #define    ANSWER_IS_STRING_CI     3
                    407: #define    ANSWER_IS_STRING_CS     4
                    408: #define    ANSWER_IS_CHOICE        5
                    409: #define    ANSWER_IS_ARITH         6
                    410: #define    ANSWER_IS_SUBJECTIVE    7
                    411: #define    ANSWER_IS_FORMULA       8
                    412: #define    ANSWER_IS_EXTERNAL      9
                    413: 
                    414: #define    YAK                     1
                    415: #define    NAY                     0
                    416: 
                    417: /* -------- results given by capa_check_answer() and capa_check_answers() */
                    418: 
                    419: #define    EXACT_ANS           1
                    420: #define    APPROX_ANS          2 
                    421: #define    SIG_FAIL            3
                    422: #define    UNIT_FAIL           4
                    423: #define    NO_UNIT             5
                    424: #define    UNIT_OK             6
                    425: #define    INCORRECT           7
                    426: #define    UNIT_NOTNEEDED      8
                    427: #define    ANS_CNT_NOT_MATCH   9
                    428: #define    SUB_RECORDED        10
                    429: #define    BAD_FORMULA         11
1.5       albertel  430: #define    WANTED_NUMERIC      12
1.12      albertel  431: #define    UNIT_INVALID_INSTRUCTOR  13
                    432: #define    UNIT_INVALID_STUDENT1    141
                    433: #define    UNIT_INVALID_STUDENT2    142
                    434: #define    UNIT_INVALID_STUDENT3    143
                    435: #define    UNIT_IRRECONCIBLE        15
1.1       albertel  436: 
                    437: /* =============================================================== */
                    438: 
                    439: #define    T_SPACE           9
                    440: #define    T_PREFIX          8
                    441: #define    T_NUMBER          7
                    442: #define    T_BASIC_UNIT      6
                    443: #define    T_DERIVED_UNIT    5
                    444: #define    T_LP              4
                    445: #define    T_RP              3
                    446: #define    T_MULTIPLY        2
                    447: #define    T_POWER           1
                    448: #define    T_END             0
                    449: 
                    450: /* for IFstatus[] */
                    451: 
                    452: #define    IF_FALSE          0
                    453: #define    IF_TRUE           1
                    454: #define    IF_DONT_CARE      2
                    455: 
                    456: /* for IFcurrent[] */
                    457: #define    RUN_IF_PORTION    1
                    458: #define    RUN_ELSE_PORTION  2
                    459: 
                    460: /* ================================================================ */
                    461: /********************** for random(), /MAP(), capa_PIN() */
1.4       albertel  462: /* BETA_DIS is used for genbet() */
                    463: /* CHI_DIS  is for genchi() */
                    464: /* EXPONENTIAL_DIS    genexp() */
                    465: /* GAMMA_DIS    gengam() */
                    466: /* MULTI_NORM_DIS    genmn() */
                    467: /* NONCEN_CHI_DIS    gennch() */
                    468: /* NORMAL_DIS        gennor() */
                    469: /* POISSON_DIS       long ignpoi(float mu) */
1.1       albertel  470: 
1.10      albertel  471: #define    RANDOM_G            1L
                    472: #define    PERMUTATION_G       2L
                    473: #define    PIN_G               3L
1.1       albertel  474: 
1.4       albertel  475: #define    NORMAL_DIS          10 
                    476: #define    POISSON_DIS         11
                    477: #define    EXPONENTIAL_DIS     12 
                    478: #define    BETA_DIS            13
                    479: #define    GAMMA_DIS           14
                    480: #define    CHI_DIS             15
                    481: #define    NONCENTRAL_CHI_DIS  16
1.6       albertel  482: #define    FORMULA_PICK_POINTS 17
1.10      albertel  483: #define    MULTIVARIATE_NORMAL_DIS  18
1.4       albertel  484: 
1.10      albertel  485: #define    GET_GENERATOR        0L
                    486: #define    SET_GENERATOR        1L
1.1       albertel  487: 
1.10      albertel  488: #define    FORWARD_MAP           0
                    489: #define    REVERSE_MAP           1
1.1       albertel  490: 
                    491: 
                    492: 
                    493: /* ---------------------------------------------- capaLexerDef.flex */ 
                    494: void        begin_if_skip      CAPA_ARG(());
                    495: void        begin_while_skip   CAPA_ARG(());
                    496: void        begin_next_line    CAPA_ARG(());
                    497: void        begin_var          CAPA_ARG(());
                    498: void        begin_let          CAPA_ARG(());
                    499: void        begin_def          CAPA_ARG(()); 
                    500: void        begin_ans          CAPA_ARG(());     
                    501: void        begin_map          CAPA_ARG(()); 
                    502: void        begin_ignore       CAPA_ARG(());    
                    503: void        begin_text         CAPA_ARG(());    
                    504: void        begin_question     CAPA_ARG(());
                    505: void        end_problemset     CAPA_ARG(());
                    506: int         match_keyword      CAPA_ARG((char *key));
                    507: int         match_functionid   CAPA_ARG((char *key));    
                    508: void        init_funcstack     CAPA_ARG(()); 
                    509: 
                    510: #ifdef DMALLOC
                    511: #define strsave(s) strcpy(capa_malloc(strlen(s)+1,1),s)
                    512: #define capa_malloc(num,sz) memset(calloc(num,sz),'\0',num*sz)
                    513: #define capa_mfree(p) free(p);
                    514: #else
                    515: char       *strsave             CAPA_ARG((char *s));          
                    516: char       *capa_malloc         CAPA_ARG((unsigned int num, unsigned int sz));
                    517: void        capa_mfree          CAPA_ARG((char *p));
                    518: #endif
                    519: void        capa_msg            CAPA_ARG((int type, char *p));
                    520: void        capa_warn_header    CAPA_ARG(()); 
                    521: void        parse_filename      CAPA_ARG((char *line));
                    522: void        parse_import_id     CAPA_ARG((char *line));
                    523: char       *parse_endinput      CAPA_ARG((char *line));
                    524: void        append_dynamic_buf  CAPA_ARG((char *new_str));
                    525: char*       parser_status       CAPA_ARG((void));
                    526: /*------------------------------------------------- capaGrammarDef.y */
                    527: 
                    528: ExpNode_p   mk_node             CAPA_ARG((int op, ExpNode_p left, ExpNode_p right));
                    529: ExpNode_p   mk_leaf             CAPA_ARG((int type, Symbol_p valp));
                    530: void        append_text         CAPA_ARG((char *str));
                    531: void        append_hint         CAPA_ARG((char *str));
                    532: void        append_explain      CAPA_ARG((char *str));
                    533: void        append_error        CAPA_ARG((char *str));
                    534: void        append_warn         CAPA_ARG((int type, char *str));
                    535: Symbol     *symbols_op          CAPA_ARG((Symbol *a, Symbol *b, int op));
                    536: char       *format_toTeX        CAPA_ARG((char *real));
                    537: char       *format_toHTML       CAPA_ARG((char *real));
                    538: void        init_answerinfo     CAPA_ARG(());
                    539: void        display_var         CAPA_ARG((Symbol *s));
                    540: void        assign_answer       CAPA_ARG((Symbol *s));
                    541: void        assign_tolerance    CAPA_ARG((int tol_type, Symbol *s));
                    542: void        assign_weight       CAPA_ARG((Symbol *s));
                    543: void        assign_try_limits   CAPA_ARG((Symbol *s));
                    544: void        assign_hint         CAPA_ARG((Symbol *s));
                    545: void        assign_units        CAPA_ARG((Symbol *s));
                    546: void        assign_sigs         CAPA_ARG((int lb, int ub));
                    547: void        assign_id_list      CAPA_ARG((Symbol *s));
                    548: void        init_new_prob       CAPA_ARG(());
                    549: void        add_answer_cnt      CAPA_ARG((int op));
                    550: void        finish_answer_info  CAPA_ARG(());
                    551: void        start_question_over CAPA_ARG(());
                    552: 
                    553: Symbol*     get_array_symbol    CAPA_ARG((Symbol* name,Symbol* index,int free_symbols));
                    554: Symbol*     build_array_list    CAPA_ARG((Symbol* ar_name,int num_elem)); 
                    555: /*---------------------------------------------------- capaParserUtils.c */ 
1.11      albertel  556: Symbol*     negate              CAPA_ARG((Symbol* symb));
1.1       albertel  557: void        problem_default     CAPA_ARG((Problem_t  *p));
                    558: int         comp_name           CAPA_ARG((char *a,char *b));
                    559: int         comp_namesymbol     CAPA_ARG((char *a, Symbol *b));
                    560: int         itis_empty          CAPA_ARG((TreeNode_t *root_p));
                    561: void        print_symb_stat     CAPA_ARG(());
                    562: int         preorder_tree       CAPA_ARG((TreeNode_t *node_p));
                    563: int         inorder_tree        CAPA_ARG((TreeNode_t *node_p));
                    564: int         postorder_tree      CAPA_ARG((TreeNode_t *node_p));
                    565: int         destroy_tree        CAPA_ARG((TreeNode_t *node_p));
                    566: int         free_symtree        CAPA_ARG(());
                    567: char       *btree_search        CAPA_ARG((char *key,TreeNode_t  **root_pp,int  (*compar)()));
                    568: Symbol     *find_identifier     CAPA_ARG((register char *name));  
                    569: 
                    570: ArgNode_t  *new_arglist         CAPA_ARG((Symbol *sp));
                    571: ArgNode_t  *addto_arglist       CAPA_ARG((ArgNode_t *argp, Symbol *sp));
                    572: void        walk_arglist        CAPA_ARG((ArgNode_t *argp));
                    573: void        free_arglist        CAPA_ARG((ArgNode_t *argp));
                    574: int         purge_tree          CAPA_ARG((TreeNode_t  **root_pp));
                    575: int         calc_sig            CAPA_ARG((char *a_num ));
                    576: int         endian              CAPA_ARG(());
                    577: TreeNode_t *new_treenode        CAPA_ARG((char *name_p, int type));
                    578: TreeNode_t *new_formulanode     CAPA_ARG((char *name_p, double val));
                    579: 
                    580: TreeNode_t *t_splay             CAPA_ARG((char *name, TreeNode_t *t));
                    581: void        print_array_element CAPA_ARG((Symbol *array_p));
                    582: Symbol     *find_arrayid        CAPA_ARG((char *name_p));
                    583: Symbol     *find_array_by_index CAPA_ARG((Symbol *array_p,char *idx_p));
1.3       albertel  584: int         free_array          CAPA_ARG((char *name_p));
1.1       albertel  585: Symbol     *array_min_max       CAPA_ARG((char *name_p,int min));
                    586: Symbol     *array_moments       CAPA_ARG((char *result_p,char *name_p));
1.10      albertel  587: Symbol     *gen_multivariate_normal  CAPA_ARG((char *output_p,char *seed,int
                    588: item_cnt,int dimen,char *m_vec_str,char *c_vec_str));
1.4       albertel  589: Symbol     *gen_random_by_selector  CAPA_ARG((char *output_p,int sel,char *seed,int item_cnt,float p1,float p2));
1.1       albertel  590: int         setup_formula_id    CAPA_ARG((char *v_str, char *pt_str));
                    591: void        free_formula_tree   CAPA_ARG(());
                    592: 
                    593: Symbol     *find_formula_id     CAPA_ARG((char *name_p));
                    594: int         f_eval_formula      CAPA_ARG((double *f_val,char *f_str,char *v_str, char *pt_str));
                    595: 
                    596: int         f_u_parse_formula   CAPA_ARG((char *f_str));
                    597: int         f_str_to_numbers    CAPA_ARG((double **f_ar, char *n_str));
                    598: int         f_str_to_ids        CAPA_ARG((char ***v_ar, char *n_str));
                    599: 
                    600: PointsList_t *f_gen_pts         CAPA_ARG((char *ap, char *bp, int n));
                    601: PointsList_t *gen_ptslist_str   CAPA_ARG((char *range_str ));
                    602: char   *eval_formula_range_str  CAPA_ARG((char *f_str,char *var_list,char *range_str));
                    603: 
                    604: PointsList_t *gen_ptslist       CAPA_ARG((Symbol *ap,Symbol *bp,Symbol *np));
                    605: PointsList_t *new_ptslist       CAPA_ARG((Symbol *sp ));
                    606: void          free_ptslist      CAPA_ARG((PointsList_t *pts_p)) ;
                    607: /* ====================================== capaUnit.c */
                    608: 
                    609: void        c_ignorewhite       CAPA_ARG((FILE *f));
                    610: double      c_getdouble         CAPA_ARG((FILE *f));
                    611: int         c_getint            CAPA_ARG((FILE *f));
                    612: int         c_getsec_range      CAPA_ARG((FILE *f,int *low,int *high));
                    613: char       *c_getword           CAPA_ARG((FILE *f));
                    614: char       *c_getstring         CAPA_ARG((FILE *f));
                    615: char       *c_getcomment        CAPA_ARG((FILE *f));
                    616: int         c_gettype           CAPA_ARG((FILE *f));
                    617: 
                    618: Unit_t     *u_find_symb         CAPA_ARG((char *name, Unit_t *t, int *result));
                    619: void        u_find_name         CAPA_ARG((Unit_t *t));
                    620: void        print_matches       CAPA_ARG((Unit_t *t));
                    621: double      u_squared_diff      CAPA_ARG((Unit_t *a, Unit_t *b));
                    622: double      u_sq_diff           CAPA_ARG((Unit_t *b));
                    623: 
                    624: void        print_unit_tree     CAPA_ARG(());
                    625: int         alphaorder_utree    CAPA_ARG((Unit_t *node_p));
                    626: int         inorder_diff        CAPA_ARG((Unit_t *node_p));
                    627: int         inorder_utree       CAPA_ARG((Unit_t *node_p));
                    628: int         postorder_utree     CAPA_ARG((Unit_t *node_p));
                    629: int         postwalk_utree      CAPA_ARG((Unit_t *n_p));
                    630: void        process_op          CAPA_ARG((int op));
1.13    ! albertel  631: Unit_t*     process_utree       CAPA_ARG((Unit_t *t));
1.1       albertel  632: int         check_correct_unit  CAPA_ARG((char *u_symb,Unit_t *t,double *scale));
                    633: int         free_utree          CAPA_ARG((Unit_t *t));
                    634: int         u_postfree          CAPA_ARG((Unit_t *t));
                    635: void        print_unit_t        CAPA_ARG((Unit_t *t));
                    636: void        u_copy_unit         CAPA_ARG((Unit_t *a_p,Unit_t *b_p,double exp_scale));
                    637: int         u_pm_op             CAPA_ARG((Unit_t *a_p, Unit_t *b_p, int op));
                    638: 
                    639: int         u_parsepower        CAPA_ARG((char *unit_str));
                    640: double      s_scan_number       CAPA_ARG((char *buf, int idx, int *r_idx));
                    641: double      s_scan_symbol       CAPA_ARG((char *buf,char *symb_p,int idx,int *r_idx));
                    642: int         s_process_symb      CAPA_ARG((char *symb_str, Unit_t  *cu_p,double exp));
                    643: Unit_t     *u_parse_unit        CAPA_ARG((char *unit_str));
                    644: int         comp_unit_symb      CAPA_ARG((char *a,char *b));
                    645: Unit_t     *u_splay             CAPA_ARG((char *name, Unit_t *t));
                    646: int         u_insert_baseunit   CAPA_ARG((char *n_p,char *s_p,char *c_p));
                    647: int         u_insert_derived    CAPA_ARG((char *n_p,char *s_p,char *c_p,char *u_p));
                    648: void        u_getunit           CAPA_ARG((FILE *f));
                    649: void        simplify_unit       CAPA_ARG((Unit_t *u_p));
                    650: void        freelist_unit_e     CAPA_ARG((Unit_E *ue_p));
                    651: int         is_units_equal      CAPA_ARG((Unit_t *u1_p, Unit_t *u2_p));
                    652: double      units_ratio         CAPA_ARG((Unit_t *u1_p, Unit_t *u2_p));
                    653: Unit_t     *p_new_op            CAPA_ARG((Unit_t *left_p, int op, Unit_t *right_p));
                    654: Unit_t     *p_new_num           CAPA_ARG((Unit_t *left_p, double num, Unit_t *right_p));
                    655: Unit_t     *p_new_unit          CAPA_ARG((Unit_t *left_p, Unit_t *right_p));
                    656: int         s_getnext           CAPA_ARG(());
                    657: int         s_peeknext          CAPA_ARG(());
                    658: double      scan_FLOAT          CAPA_ARG(());
                    659: Unit_t     *scan_num_item       CAPA_ARG(());
                    660: Unit_t     *scan_unit_item      CAPA_ARG(());
                    661: Unit_t     *scan_basic_term     CAPA_ARG(());
                    662: Unit_t     *scan_num_term       CAPA_ARG(());
                    663: Unit_t     *scan_basic_block    CAPA_ARG(());
                    664: Unit_t     *scan_num_block      CAPA_ARG(());
                    665: Unit_t     *scan_unit_expr      CAPA_ARG(());
                    666: Unit_t     *scan_num_expr       CAPA_ARG(());
                    667: Unit_t     *parse_unit_expr     CAPA_ARG((char *symb_str));
                    668: void        print_remains       CAPA_ARG(());
                    669: /* =================================================  capaMapExpr.c */
                    670: 
                    671: int         do_map             CAPA_ARG((char *seed,ArgNode_t *varp,ArgNode_t *argp,int argc, int dir));
                    672: 
                    673: /* ===============================================  capaFormulaLexer.c -- */
                    674: double      f_get_float         CAPA_ARG(());
                    675: char       *f_get_id            CAPA_ARG(());
                    676: int         f_peek_next_token   CAPA_ARG(());
                    677: int         fml_lex             CAPA_ARG(());
                    678: 
                    679: /* ===============================================  capaFormula.y      == */
                    680: int         fml_parse           CAPA_ARG(()); 
                    681: Symbol     *f_symbol_pow        CAPA_ARG((Symbol *ap, Symbol *bp));
                    682: /* ====================================================================== */
                    683: 
                    684: #ifdef  __sun
                    685: #define index(xx,cc)  strchr(xx,cc)
                    686: #define rindex(xx,cc) strrchr(xx,cc)
                    687: #endif
                    688: 
                    689: #endif  /* _CAPA_PARSER_H_ */
                    690: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>