version 1.2, 1999/10/13 18:45:28
|
version 1.9, 2000/02/22 18:19:02
|
Line 569 int set;
|
Line 569 int set;
|
} |
} |
funlockstream(fp); fclose(fp); |
funlockstream(fp); fclose(fp); |
if(!found) { |
if(!found) { |
ans_p = capa_malloc(nq+1,1); |
ans_p = capa_malloc(nq+2,1); |
tries_p = capa_malloc(3*nq+2,1); /* space and \0 */ |
tries_p = capa_malloc(3*nq+3,1); /* space and \0 */ |
for(ii=0;ii<nq;ii++) { /* Initialize answer string and tries string */ |
for(ii=0;ii<nq;ii++) { /* Initialize answer string and tries string */ |
ans_p[ii] = '-'; tries_p[3*ii] = ' '; tries_p[3*ii + 1] = '0'; |
ans_p[ii] = '-'; tries_p[3*ii] = ' '; tries_p[3*ii + 1] = '0'; |
if(ii < nq-1) tries_p[3*ii + 2] = ','; |
if(ii < nq-1) tries_p[3*ii + 2] = ','; |
Line 585 int set;
|
Line 585 int set;
|
comma=index(oneline,','); |
comma=index(oneline,','); |
length=((int)(comma-oneline))-(MAX_STUDENT_NUMBER+1); |
length=((int)(comma-oneline))-(MAX_STUDENT_NUMBER+1); |
if (length < nq) { |
if (length < nq) { |
ans_p = capa_malloc(nq+1,1); |
ans_p = capa_malloc(nq+2,1); |
tries_p = capa_malloc(3*nq+2,1); /* space and \0 */ |
tries_p = capa_malloc(3*nq+3,1); /* space and \0 */ |
} else { |
} else { |
ans_p = capa_malloc(length+1,1); |
ans_p = capa_malloc(length+2,1); |
tries_p = capa_malloc(3*length+2,1); /* space and \0 */ |
tries_p = capa_malloc(3*length+3,1); /* space and \0 */ |
} |
} |
sprintf(fmtbuf, "%%%dc",length); |
sprintf(fmtbuf, "%%%dc",length); |
sscanf(oneline + MAX_STUDENT_NUMBER+1,fmtbuf,ans_p); |
sscanf(oneline + MAX_STUDENT_NUMBER+1,fmtbuf,ans_p); |
|
ans_p[length]='\0'; |
sprintf(fmtbuf, "%%%dc",(3*length-1)); |
sprintf(fmtbuf, "%%%dc",(3*length-1)); |
sscanf(oneline + MAX_STUDENT_NUMBER+1+length+1,fmtbuf,tries_p); |
sscanf(oneline + MAX_STUDENT_NUMBER+1+length+1,fmtbuf,tries_p); |
|
tries_p[3*length-1]; |
entry->answers = ans_p; |
entry->answers = ans_p; |
entry->tries = tries_p; |
entry->tries = tries_p; |
entry->e_probs = nq; |
entry->e_probs = nq; |
Line 1357 int capa_check_option(int option,int set
|
Line 1359 int capa_check_option(int option,int set
|
} |
} |
|
|
/*----------------------------------------------------------*/ |
/*----------------------------------------------------------*/ |
/* INPUT: set the X in logX.db */ |
/* INPUT: time the current time */ |
|
/* datetime the datetime string to compare */ |
/* OUTPUT: none */ |
/* OUTPUT: none */ |
/* */ |
/* */ |
/* RETURN: -1 file error */ |
/* RETURN: -1 time is earlier then datetime */ |
/* 0 no login */ |
/* 1 time is later than datetime */ |
/* >0 number of logins in that logX.db file */ |
|
/*----------------------------------------------------------*/ |
/*----------------------------------------------------------*/ |
int |
int |
compare_datetime(time,datetime) |
compare_datetime(time,datetime) |
Line 1391 char *datetime;
|
Line 1393 char *datetime;
|
/* What if: [7,3] date_info */ |
/* What if: [7,3] date_info */ |
/* [3,7] date_info */ |
/* [3,7] date_info */ |
/* 4 date_info */ |
/* 4 date_info */ |
|
/* RETURN: -1 if not pass time */ |
|
/* 1 if pass time (or no time available */ |
int capa_check_date(int which,char *student_number, int section,int set) |
int capa_check_date(int which,char *student_number, int section,int set) |
{ |
{ |
int result; |
int result; |
Line 2997 capa_check_ans(ai,ans) AnswerInfo_t *ai
|
Line 3000 capa_check_ans(ai,ans) AnswerInfo_t *ai
|
result = check_formula_ans(s,ans,ai->ans_id_list,ai->ans_pts_list,tt,to); |
result = check_formula_ans(s,ans,ai->ans_id_list,ai->ans_pts_list,tt,to); |
break; |
break; |
case ANSWER_IS_EXTERNAL: /* Not yet implemented */ |
case ANSWER_IS_EXTERNAL: /* Not yet implemented */ |
|
|
|
|
|
|
break; |
break; |
} |
} |
return (result); |
return (result); |
Line 3078 capa_check_answer(p, answer) Problem_t *
|
Line 3084 capa_check_answer(p, answer) Problem_t *
|
} |
} |
given = n_part * scale; /* convert the given answer into proper scale for units */ |
given = n_part * scale; /* convert the given answer into proper scale for units */ |
sig = calc_sig( input ); |
sig = calc_sig( input ); |
if( (sig < sig_l) || (sig > sig_u) ) { |
if( ((sig < sig_l) || (sig > sig_u)) && (sig!=0)) { |
result = SIG_FAIL; |
result = SIG_FAIL; |
} else { |
} else { |
switch( tol_type ) { |
switch( tol_type ) { |
Line 3150 capa_check_answer(p, answer) Problem_t *
|
Line 3156 capa_check_answer(p, answer) Problem_t *
|
result = check_formula_ans(correct,answer,p->id_list,p->pts_list,tol_type,tol); |
result = check_formula_ans(correct,answer,p->id_list,p->pts_list,tol_type,tol); |
break; |
break; |
case ANSWER_IS_EXTERNAL: /* not yet implemented */ |
case ANSWER_IS_EXTERNAL: /* not yet implemented */ |
|
/* we assume the external program is called through popen() */ |
|
/* and the result will be given back as 0 or 1 to indicate the */ |
|
/* given answer is correct or not */ |
|
/* arguments are given to the program as */ |
|
|
break; |
break; |
|
|
} |
} |
Line 3466 char *key_word;char *value;
|
Line 3477 char *key_word;char *value;
|
fclose(fp); |
fclose(fp); |
|
|
if (done) { |
if (done) { |
|
trim_response_ws(right); /*get rid of leading and trailing spaces*/ |
for(i=0,j=0;i<(strlen(right)+1);i++) { |
for(i=0,j=0;i<(strlen(right)+1);i++) { |
value[j]='\0'; |
value[j]='\0'; |
if (right[i] == '\\' && (i < (strlen(right))) ) { |
if (right[i] == '\\' && (i < (strlen(right))) ) { |