version 1.15, 2004/12/23 18:32:50
|
version 1.19, 2005/12/01 22:34:10
|
Line 34 PointsList_t * parse_pts_list (char *pts
|
Line 34 PointsList_t * parse_pts_list (char *pts
|
int done=0; |
int done=0; |
/*fprintf(stderr,"ids %s\n",id_list); |
/*fprintf(stderr,"ids %s\n",id_list); |
fprintf(stderr,"pts %s\n",pts_list);*/ |
fprintf(stderr,"pts %s\n",pts_list);*/ |
while (!done) { |
while (!done && pts_list) { |
int idx; |
int idx; |
/*fprintf(stderr,"pts; %s\n",idx_pts);*/ |
/*fprintf(stderr,"pts; %s\n",idx_pts);*/ |
new=gen_ptslist_str(idx_pts); |
new=gen_ptslist_str(idx_pts); |
Line 97 int caparesponse_capa_check_answer(char
|
Line 97 int caparesponse_capa_check_answer(char
|
if (type == ANSWER_IS_FORMULA) { |
if (type == ANSWER_IS_FORMULA) { |
p.id_list=id_list; |
p.id_list=id_list; |
p.pts_list=parse_pts_list(pts_list); |
p.pts_list=parse_pts_list(pts_list); |
|
// if ( p.id_list == NULL || p.pts_list == NULL) { |
|
// return BAD_FORMULA; |
|
// } |
} |
} |
p.ans_type = type; |
p.ans_type = type; |
p.answer = correct; |
p.answer = correct; |
Line 110 int caparesponse_capa_check_answer(char
|
Line 113 int caparesponse_capa_check_answer(char
|
} |
} |
if (unit_str != NULL && unit_str[0]!='\0') { |
if (unit_str != NULL && unit_str[0]!='\0') { |
strncpy(p.unit_str,unit_str,ANSWER_STRING_LENG-1); |
strncpy(p.unit_str,unit_str,ANSWER_STRING_LENG-1); |
p.ans_unit = u_parse_unit(unit_str); |
//p.ans_unit = u_parse_unit(unit_str); |
|
p.ans_unit = parse_unit_expr(unit_str); |
|
p.ans_unit = process_utree(p.ans_unit); |
|
//print_unit_t(p.ans_unit); |
} else { |
} else { |
p.unit_str[0]='\0'; |
p.unit_str[0]='\0'; |
p.ans_unit=NULL; |
p.ans_unit=NULL; |
Line 144 int caparesponse_get_real_response (char
|
Line 150 int caparesponse_get_real_response (char
|
fclose(fp); |
fclose(fp); |
|
|
if (unit_str != NULL && unit_str[0]!='\0') { |
if (unit_str != NULL && unit_str[0]!='\0') { |
ans_unit = u_parse_unit(unit_str); |
ans_unit = parse_unit_expr(unit_str); |
|
ans_unit = process_utree(ans_unit); |
} else { |
} else { |
ans_unit=NULL; |
ans_unit=NULL; |
} |
} |
Line 156 int caparesponse_get_real_response (char
|
Line 163 int caparesponse_get_real_response (char
|
} |
} |
} |
} |
if( !all_alphabet ) { |
if( !all_alphabet ) { |
|
tmp_unit_str[0] = 0; |
outcome = split_num_unit(answer,&n_part,input,tmp_unit_str); |
outcome = split_num_unit(answer,&n_part,input,tmp_unit_str); |
if( outcome > 1 ) { /* with both num and unit parts or only unit part */ |
if( outcome > 1 ) { /* with both num and unit parts or only unit part */ |
if( ans_unit != NULL ) { |
if( ans_unit != NULL ) { |
Line 180 lphabet, but no number */
|
Line 188 lphabet, but no number */
|
} |
} |
return result; |
return result; |
} |
} |
|
|
|
/* Testing harnass |
|
int main(void) { |
|
int result=0; |
|
char *reterror=NULL; |
|
result= caparesponse_capa_check_answer("10^3","1000", |
|
ANSWER_IS_FORMULA, |
|
TOL_ABSOLUTE,1E-3, |
|
3,5,NULL,NULL, |
|
CALC_UNFORMATED, |
|
"","4", |
|
"rndseed", |
|
&reterror); |
|
fprintf(stderr,"result %d\nreterror: %s\n",result,reterror); |
|
} |
|
*/ |