version 1.2, 1999/10/13 20:05:00
|
version 1.4, 2000/02/09 22:10:24
|
Line 14
|
Line 14
|
#include "capaCommon.h" |
#include "capaCommon.h" |
#include "ranlib.h" |
#include "ranlib.h" |
|
|
|
|
char Parse_class[QUARTER_K]; |
char Parse_class[QUARTER_K]; |
int Parse_set; |
int Parse_set; |
int Parse_section; |
int Parse_section; |
char Parse_student_number[MAX_STUDENT_NUMBER+1]; |
char Parse_student_number[MAX_STUDENT_NUMBER+1]; |
char Parse_name[MAX_NAME_CHAR+1]; |
char Parse_name[MAX_NAME_CHAR+1]; |
long capaid_plus_gen; |
long capaid_plus_gen; |
|
int managermode; |
|
|
extern int Parsemode_f; |
extern int Parsemode_f; |
|
|
Line 37 int
|
Line 37 int
|
match_function(func, argc) char *func; int argc; |
match_function(func, argc) char *func; int argc; |
{ |
{ |
if( !strcmp(func,"random") ) return (((argc==2 || argc==3)? RANDOM_F : MIS_ARG_COUNT)); |
if( !strcmp(func,"random") ) return (((argc==2 || argc==3)? RANDOM_F : MIS_ARG_COUNT)); |
|
if( !strcmp(func,"random_normal") ) return (((argc==2 || argc==3)? RANDOM_NORMAL_F : MIS_ARG_COUNT)); |
|
if( !strcmp(func,"random_exponential") ) return (((argc==2 || argc==3)? RANDOM_EXPONENTIAL_F : MIS_ARG_COUNT)); |
|
if( !strcmp(func,"random_beta") ) return (((argc==2 || argc==3)? RANDOM_BETA_F : MIS_ARG_COUNT)); |
if( !strcmp(func,"choose") ) return (CHOOSE_F); |
if( !strcmp(func,"choose") ) return (CHOOSE_F); |
if( !strcmp(func,"tex") ) return (((argc==2)? TEX_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"tex") ) return (((argc==2)? TEX_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"var_in_tex") ) return (VAR_IN_TEX_F); |
if( !strcmp(func,"var_in_tex") ) return (VAR_IN_TEX_F); |
Line 59 match_function(func, argc) char *func; i
|
Line 62 match_function(func, argc) char *func; i
|
if( !strcmp(func,"strlen") ) return (((argc==1)? STRLEN_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"strlen") ) return (((argc==1)? STRLEN_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"get_seed") ) return (((argc==0)? GET_SEED_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"get_seed") ) return (((argc==0)? GET_SEED_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"set_seed") ) return (((argc==1)? SET_SEED_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"set_seed") ) return (((argc==1)? SET_SEED_F: MIS_ARG_COUNT)); |
|
if( !strcmp(func,"init_array") ) return (((argc==1)? INIT_ARRAY_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"array_index") ) return (((argc==1)? ARRAY_INDEX_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"array_index") ) return (((argc==1)? ARRAY_INDEX_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"array_sorted_index") ) return (((argc==2)? ARRAY_SORTED_INDEX_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"array_sorted_index") ) return (((argc==2)? ARRAY_SORTED_INDEX_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"array_max") ) return (((argc==1)? ARRAY_MAX_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"array_max") ) return (((argc==1)? ARRAY_MAX_F: MIS_ARG_COUNT)); |
Line 113 match_function(func, argc) char *func; i
|
Line 117 match_function(func, argc) char *func; i
|
if( !strcmp(func,"is_open") ) return (((argc <2)? IS_OPEN_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"is_open") ) return (((argc <2)? IS_OPEN_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"is_due") ) return (((argc <2)? IS_DUE_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"is_due") ) return (((argc <2)? IS_DUE_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"is_answer") ) return (((argc <2)? IS_ANSWER_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"is_answer") ) return (((argc <2)? IS_ANSWER_F: MIS_ARG_COUNT)); |
|
if( !strcmp(func,"correct") ) return (((argc <3)? CORRECT_F: MIS_ARG_COUNT)); |
|
if( !strcmp(func,"grade") ) return (((argc <3)? GRADE_F: MIS_ARG_COUNT)); |
|
if( !strcmp(func,"tries") ) return (((argc <3)? TRIES_F: MIS_ARG_COUNT)); |
|
if( !strcmp(func,"managermode")) return (((argc==0)? MANAGERMODE_F:MIS_ARG_COUNT)); |
return (UNKNOWN_F); |
return (UNKNOWN_F); |
} |
} |
|
|
Line 814 ArgNode_t *argp;
|
Line 822 ArgNode_t *argp;
|
resultp->s_str = strsave("NOT YET"); |
resultp->s_str = strsave("NOT YET"); |
} break; |
} break; |
|
|
|
case INIT_ARRAY_F: |
|
{ int rr; |
|
|
|
switch( FIRST_ARGTYPE(argp) ) { |
|
case I_VAR: case I_CONSTANT: |
|
case R_VAR: case R_CONSTANT: |
|
resultp->s_type = S_CONSTANT; |
|
resultp->s_str = strsave("<<ARG. OF THIS FUNCTION MUST BE AN ARRAY NAME>>"); |
|
sprintf(tmpS,"init_array()'s arg. must be a name of an array.\n"); |
|
capa_msg(MESSAGE_ERROR,tmpS); |
|
break; |
|
case S_VAR: case S_CONSTANT: /* allows the use of init_array(array[1]) which array[1]="another" */ |
|
rr = free_array(FIRST_ARGSTR(argp)); |
|
resultp->s_type = I_CONSTANT; |
|
resultp->s_int = rr; |
|
break; |
|
case IDENTIFIER: |
|
rr = free_array(FIRST_ARGNAME(argp)); |
|
resultp->s_type = I_CONSTANT; |
|
resultp->s_int = rr; |
|
break; |
|
} |
|
} break; |
case ARRAY_MAX_F: |
case ARRAY_MAX_F: |
case ARRAY_MIN_F: |
case ARRAY_MIN_F: |
{ int min; |
{ int min; |
Line 1499 ArgNode_t *argp;
|
Line 1530 ArgNode_t *argp;
|
resultp->s_int=capa_get_duration(Parse_student_number, |
resultp->s_int=capa_get_duration(Parse_student_number, |
Parse_section,Parse_set); |
Parse_section,Parse_set); |
} break; |
} break; |
|
case MANAGERMODE_F: { resultp->s_type = I_CONSTANT; |
|
resultp->s_int=managermode; |
|
}break; |
|
case CORRECT_F: { |
|
|
|
}break; |
|
|
|
case TRIES_F: { |
|
|
|
}break; |
|
|
|
case GRADE_F: { |
|
|
|
}break; |
|
|
case MIS_ARG_COUNT: |
case MIS_ARG_COUNT: |
{ resultp->s_type = S_CONSTANT; |
{ resultp->s_type = S_CONSTANT; |
resultp->s_str = strsave("<<ARG COUNT>>"); |
resultp->s_str = strsave("<<ARG COUNT>>"); |
sprintf(tmpS,"%s()'s arg. count is not correct.\n",FuncStack[Func_idx].s_name); |
sprintf(tmpS,"%s()'s arg. count is not correct.\n", |
|
FuncStack[Func_idx].s_name); |
capa_msg(MESSAGE_ERROR,tmpS); |
capa_msg(MESSAGE_ERROR,tmpS); |
} break; |
} break; |
case UNKNOWN_F: |
case UNKNOWN_F: |