Annotation of loncom/homework/caparesponse/caparesponse.c, revision 1.2

1.1       albertel    1: #include <capaCommon.h>
                      2: int caparesponse_capa_check_answer(char *response,char *correct,
                      3: 				   int type,int tol_type,double tolerance,
                      4: 				   int sig_lbound,int sig_ubound, 
                      5: 				   char *ans_fmt, char *unit_str,
                      6: 				   int calc)
                      7: {
                      8:   int result;
                      9:   Problem_t p;
                     10:   char *error=NULL,filename[FILE_NAME_LENGTH];
                     11:   FILE *fp;
                     12: 
                     13:   /*need to initialize unit parser*/
                     14:   sprintf(filename,"/home/httpd/html/res/adm/include/capa.units");
                     15:   if ((fp=fopen(filename,"r"))==NULL) {
                     16:     /* printf("Error: can't open %s\n",filename);*/
                     17:       return (-1); 
                     18:   }
                     19:   u_getunit(fp);
                     20:   fclose(fp);
                     21: 
1.2     ! albertel   22:   p.ans_type   = type;
        !            23:   p.answer     = correct;
        !            24:   p.tol_type   = tol_type;
        !            25:   p.tolerance  = tolerance;
        !            26:   p.sig_lbound = sig_lbound;
        !            27:   p.sig_ubound = sig_ubound;
        !            28:   strncpy(p.ans_fmt,ans_fmt,ANSWER_STRING_LENG-1);
        !            29:   strncpy(p.unit_str,unit_str,ANSWER_STRING_LENG-1);
        !            30:   p.ans_unit   = u_parse_unit(unit_str);
        !            31:   p.calc       = calc;
1.1       albertel   32: 
                     33:   /* assign_id_list and assign_pts_list exist in capaGrammerDef.y */
1.2     ! albertel   34:   p.id_list=NULL;
        !            35:   p.pts_list=NULL;
1.1       albertel   36: 
                     37: 
                     38:   result=capa_check_answer(&p,response,&error);
                     39: 
                     40:   if (error!=NULL) {free(error);}
                     41: 
                     42:   return result;
                     43: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>