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

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: 
1.3     ! albertel   13:   printf("hi in caparesponse\n");
        !            14:   
1.1       albertel   15:   /*need to initialize unit parser*/
                     16:   sprintf(filename,"/home/httpd/html/res/adm/include/capa.units");
                     17:   if ((fp=fopen(filename,"r"))==NULL) {
                     18:     /* printf("Error: can't open %s\n",filename);*/
                     19:       return (-1); 
                     20:   }
                     21:   u_getunit(fp);
                     22:   fclose(fp);
                     23: 
1.2       albertel   24:   p.ans_type   = type;
                     25:   p.answer     = correct;
                     26:   p.tol_type   = tol_type;
                     27:   p.tolerance  = tolerance;
                     28:   p.sig_lbound = sig_lbound;
                     29:   p.sig_ubound = sig_ubound;
                     30:   strncpy(p.ans_fmt,ans_fmt,ANSWER_STRING_LENG-1);
                     31:   strncpy(p.unit_str,unit_str,ANSWER_STRING_LENG-1);
                     32:   p.ans_unit   = u_parse_unit(unit_str);
                     33:   p.calc       = calc;
1.1       albertel   34: 
                     35:   /* assign_id_list and assign_pts_list exist in capaGrammerDef.y */
1.2       albertel   36:   p.id_list=NULL;
                     37:   p.pts_list=NULL;
1.1       albertel   38: 
                     39:   result=capa_check_answer(&p,response,&error);
                     40: 
                     41:   if (error!=NULL) {free(error);}
                     42: 
                     43:   return result;
                     44: }

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