version 1.9, 2003/05/27 17:01:36
|
version 1.10, 2003/07/01 21:10:43
|
Line 32 PointsList_t * parse_pts_list (char *pts
|
Line 32 PointsList_t * parse_pts_list (char *pts
|
PointsList_t *new=NULL, *end=NULL, *beforeend=NULL, *rlist=NULL; |
PointsList_t *new=NULL, *end=NULL, *beforeend=NULL, *rlist=NULL; |
char *idx_pts=pts_list; |
char *idx_pts=pts_list; |
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) { |
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); |
if (!new) break; |
if (!new) break; |
if (!rlist) { rlist=new; } |
if (!rlist) { rlist=new; } |
Line 50 PointsList_t * parse_pts_list (char *pts
|
Line 50 PointsList_t * parse_pts_list (char *pts
|
while (end) { |
while (end) { |
idx++; |
idx++; |
end->pts_idx=idx; |
end->pts_idx=idx; |
/*fprintf(stderr,"end is:%d:%d:%s:%d\n",idx,end->pts_idx,end->pts_str, |
fprintf(stderr,"end is:%d:%d:%s:%d\n",idx,end->pts_idx,end->pts_str, |
end->pts_next);*/ |
end->pts_next); |
beforeend=end; |
beforeend=end; |
end=end->pts_next; |
end=end->pts_next; |
} |
} |
Line 75 int caparesponse_capa_check_answer(char
|
Line 75 int caparesponse_capa_check_answer(char
|
Problem_t p; |
Problem_t p; |
char *error=NULL,filename[FILE_NAME_LENGTH]; |
char *error=NULL,filename[FILE_NAME_LENGTH]; |
FILE *fp; |
FILE *fp; |
|
fprintf(stderr,"1\n"); |
/* need to initialize unit parser*/ |
/* need to initialize unit parser*/ |
sprintf(filename,"/home/httpd/html/res/adm/includes/capa.units"); |
sprintf(filename,"/home/httpd/html/res/adm/includes/capa.units"); |
if ((fp=fopen(filename,"r"))==NULL) { |
if ((fp=fopen(filename,"r"))==NULL) { |
/* printf("Error: can't open %s\n",filename);*/ |
/* printf("Error: can't open %s\n",filename);*/ |
return (-1); |
return (-1); |
} |
} |
|
fprintf(stderr,"2\n"); |
u_getunit(fp); |
u_getunit(fp); |
|
fprintf(stderr,"3\n"); |
fclose(fp); |
fclose(fp); |
|
fprintf(stderr,"4\n"); |
/* need to setup random generator (FIXME) should only do this if |
/* need to setup random generator (FIXME) should only do this if |
it hasn't been yet*/ |
it hasn't been yet*/ |
phrtsd(rndseed,&seed1,&seed2); |
phrtsd(rndseed,&seed1,&seed2); |
setall(seed1,seed2); |
setall(seed1,seed2); |
|
fprintf(stderr,"5\n"); |
|
|
/* assign_id_list and assign_pts_list exist in capaGrammerDef.y */ |
/* assign_id_list and assign_pts_list exist in capaGrammerDef.y */ |
p.id_list=NULL; |
p.id_list=NULL; |
p.pts_list=NULL; |
p.pts_list=NULL; |
|
fprintf(stderr,"6 -%s-\n",id_list); |
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); |
} |
} |
|
fprintf(stderr,"6\n"); |
p.ans_type = type; |
p.ans_type = type; |
p.answer = correct; |
p.answer = correct; |
p.tol_type = tol_type; |
p.tol_type = tol_type; |
p.tolerance = tolerance; |
p.tolerance = tolerance; |
p.sig_lbound = sig_lbound; |
p.sig_lbound = sig_lbound; |
p.sig_ubound = sig_ubound; |
p.sig_ubound = sig_ubound; |
|
fprintf(stderr,"7\n"); |
|
|
if (ans_fmt != NULL ) { |
if (ans_fmt != NULL ) { |
|
fprintf(stderr,"8\n"); |
strncpy(p.ans_fmt,ans_fmt,ANSWER_STRING_LENG-1); |
strncpy(p.ans_fmt,ans_fmt,ANSWER_STRING_LENG-1); |
} |
} |
|
fprintf(stderr,"9\n"); |
if (unit_str != NULL && unit_str[0]!='\0') { |
if (unit_str != NULL && unit_str[0]!='\0') { |
|
fprintf(stderr,"10\n"); |
strncpy(p.unit_str,unit_str,ANSWER_STRING_LENG-1); |
strncpy(p.unit_str,unit_str,ANSWER_STRING_LENG-1); |
|
fprintf(stderr,"11\n"); |
p.ans_unit = u_parse_unit(unit_str); |
p.ans_unit = u_parse_unit(unit_str); |
|
fprintf(stderr,"12\n"); |
} else { |
} else { |
|
fprintf(stderr,"13\n"); |
p.unit_str[0]='\0'; |
p.unit_str[0]='\0'; |
|
fprintf(stderr,"14\n"); |
p.ans_unit=NULL; |
p.ans_unit=NULL; |
|
fprintf(stderr,"15\n"); |
} |
} |
p.calc = calc; |
p.calc = calc; |
|
|
|
fprintf(stderr,"16 -p.asnwer %s- -response %s-\n",p.answer,response); |
result=capa_check_answer(&p,response,&error); |
result=capa_check_answer(&p,response,&error); |
|
fprintf(stderr,"17\n"); |
|
|
if (error!=NULL) {free(error);} |
if (error!=NULL) {free(error);} |
|
|