version 1.5, 2000/11/29 00:29:43
|
version 1.6, 2001/10/29 21:15:45
|
Line 1
|
Line 1
|
#include <capaCommon.h> |
#include <capaCommon.h> |
|
#include <ranlib.h> |
|
|
|
PointsList_t * parse_pts_list (char *pts_list) { |
|
PointsList_t *new=NULL, *end=NULL, *beforeend=NULL, *rlist=NULL; |
|
char *idx_pts=pts_list; |
|
int done=0; |
|
/*fprintf(stderr,"ids %s\n",id_list); |
|
fprintf(stderr,"pts %s\n",pts_list);*/ |
|
while (!done) { |
|
int idx; |
|
/*fprintf(stderr,"pts; %s\n",idx_pts);*/ |
|
new=gen_ptslist_str(idx_pts); |
|
if (!new) break; |
|
if (!rlist) { rlist=new; } |
|
if (end) { |
|
end->pts_next=new; |
|
idx=end->pts_idx; |
|
} else { |
|
idx=-1; |
|
} |
|
end=new; |
|
while (end) { |
|
idx++; |
|
end->pts_idx=idx; |
|
/*fprintf(stderr,"end is:%d:%d:%s:%d\n",idx,end->pts_idx,end->pts_str, |
|
end->pts_next);*/ |
|
beforeend=end; |
|
end=end->pts_next; |
|
} |
|
end=beforeend; |
|
idx_pts=strchr(idx_pts,';'); |
|
if (idx_pts) { idx_pts++; } else { done=1; } |
|
} |
|
|
|
return rlist; |
|
} |
|
|
int caparesponse_capa_check_answer(char *response,char *correct, |
int caparesponse_capa_check_answer(char *response,char *correct, |
int type,int tol_type,double tolerance, |
int type,int tol_type,double tolerance, |
int sig_lbound,int sig_ubound, |
int sig_lbound,int sig_ubound, |
char *ans_fmt, char *unit_str, |
char *ans_fmt, char *unit_str, |
int calc) |
int calc, char *id_list, char *pts_list, |
|
char *rndseed) |
|
|
{ |
{ |
int result; |
long result,seed1,seed2; |
Problem_t p; |
Problem_t p; |
char *error=NULL,filename[FILE_NAME_LENGTH]; |
char *error=NULL,filename[FILE_NAME_LENGTH]; |
FILE *fp; |
FILE *fp; |
|
|
printf("hi in caparesponse\n"); |
/*fprintf(stderr,"hi in caparesponse\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) { |
Line 19 int caparesponse_capa_check_answer(char
|
Line 58 int caparesponse_capa_check_answer(char
|
} |
} |
u_getunit(fp); |
u_getunit(fp); |
fclose(fp); |
fclose(fp); |
|
/* need to setup random generator (FIXME) should only do this if |
|
it hasn't been yet*/ |
|
phrtsd(rndseed,&seed1,&seed2); |
|
setall(seed1,seed2); |
|
|
|
/* assign_id_list and assign_pts_list exist in capaGrammerDef.y */ |
|
p.id_list=NULL; |
|
p.pts_list=NULL; |
|
|
|
if (type == ANSWER_IS_FORMULA) { |
|
p.id_list=id_list; |
|
p.pts_list=parse_pts_list(pts_list); |
|
} |
p.ans_type = type; |
p.ans_type = type; |
p.answer = correct; |
p.answer = correct; |
p.tol_type = tol_type; |
p.tol_type = tol_type; |
Line 36 int caparesponse_capa_check_answer(char
|
Line 87 int caparesponse_capa_check_answer(char
|
} |
} |
p.calc = calc; |
p.calc = calc; |
|
|
/* assign_id_list and assign_pts_list exist in capaGrammerDef.y */ |
|
p.id_list=NULL; |
|
p.pts_list=NULL; |
|
|
|
result=capa_check_answer(&p,response,&error); |
result=capa_check_answer(&p,response,&error); |
|
|