[LON-CAPA-cvs] cvs: loncom /homework/caparesponse caparesponse.c capa/capa51/pProj capaParser.h capaUnit.c
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 15 Feb 2005 22:15:05 -0000
albertel Tue Feb 15 17:15:05 2005 EDT
Modified files:
/capa/capa51/pProj capaParser.h capaUnit.c
/loncom/homework/caparesponse caparesponse.c
Log:
- BUG#3952, the instructor's unit was being parsed by the stupid, but fast unit parser, swapping it out so that the instructor's parser is the same as the one used to parse the students's answer
Index: capa/capa51/pProj/capaParser.h
diff -u capa/capa51/pProj/capaParser.h:1.12 capa/capa51/pProj/capaParser.h:1.13
--- capa/capa51/pProj/capaParser.h:1.12 Fri Mar 26 15:02:03 2004
+++ capa/capa51/pProj/capaParser.h Tue Feb 15 17:15:05 2005
@@ -628,7 +628,7 @@
int postorder_utree CAPA_ARG((Unit_t *node_p));
int postwalk_utree CAPA_ARG((Unit_t *n_p));
void process_op CAPA_ARG((int op));
-void process_utree CAPA_ARG((Unit_t *t));
+Unit_t* process_utree CAPA_ARG((Unit_t *t));
int check_correct_unit CAPA_ARG((char *u_symb,Unit_t *t,double *scale));
int free_utree CAPA_ARG((Unit_t *t));
int u_postfree CAPA_ARG((Unit_t *t));
Index: capa/capa51/pProj/capaUnit.c
diff -u capa/capa51/pProj/capaUnit.c:1.12 capa/capa51/pProj/capaUnit.c:1.13
--- capa/capa51/pProj/capaUnit.c:1.12 Fri Mar 26 15:02:03 2004
+++ capa/capa51/pProj/capaUnit.c Tue Feb 15 17:15:05 2005
@@ -727,22 +727,24 @@
}
}
-void
+Unit_t*
process_utree(Unit_t *t)
{
Ptopidx=0;
postwalk_utree(t);
if( Ptopidx == 1 ) {
- /* printf("Correctly parsed!\n"); */
- printf("Unit:%s\n",Sbuf);
+ //fprintf(stderr,"Correctly parsed!\n");
+ //fprintf(stderr,"Unit:%s\n",Sbuf);
simplify_unit(Pstack[Ptopidx]);
- Pstack[Ptopidx]->u_symbol[0]='\0';
- /*sprintf(Pstack[Ptopidx]->u_symbol,"");*/
+ //Pstack[Ptopidx]->u_symbol[0]='\0';
+ //fprintf(stderr,Pstack[Ptopidx]->u_symbol,"");
print_unit_t(Pstack[Ptopidx]);
- u_find_name(Pstack[Ptopidx]);
- print_matches(Pstack[Ptopidx]);
- free_utree(t);
+ //u_find_name(Pstack[Ptopidx]);
+ //print_matches(Pstack[Ptopidx]);
+ return(Pstack[Ptopidx]);
+ //free_utree(t);
}
+ return(t);
}
/* ============================================================== */
Index: loncom/homework/caparesponse/caparesponse.c
diff -u loncom/homework/caparesponse/caparesponse.c:1.16 loncom/homework/caparesponse/caparesponse.c:1.17
--- loncom/homework/caparesponse/caparesponse.c:1.16 Thu Dec 23 13:36:42 2004
+++ loncom/homework/caparesponse/caparesponse.c Tue Feb 15 17:15:05 2005
@@ -1,6 +1,6 @@
/* The LearningOnline Network with CAPA
* CAPA wrapper code
- * $Id: caparesponse.c,v 1.16 2004/12/23 18:36:42 albertel Exp $
+ * $Id: caparesponse.c,v 1.17 2005/02/15 22:15:05 albertel Exp $
*
* Copyright Michigan State University Board of Trustees
*
@@ -110,7 +110,10 @@
}
if (unit_str != NULL && unit_str[0]!='\0') {
strncpy(p.unit_str,unit_str,ANSWER_STRING_LENG-1);
- p.ans_unit = u_parse_unit(unit_str);
+ //p.ans_unit = u_parse_unit(unit_str);
+ p.ans_unit = parse_unit_expr(unit_str);
+ p.ans_unit = process_utree(p.ans_unit);
+ //print_unit_t(p.ans_unit);
} else {
p.unit_str[0]='\0';
p.ans_unit=NULL;
@@ -144,7 +147,8 @@
fclose(fp);
if (unit_str != NULL && unit_str[0]!='\0') {
- ans_unit = u_parse_unit(unit_str);
+ ans_unit = parse_unit_expr(unit_str);
+ ans_unit = process_utree(ans_unit);
} else {
ans_unit=NULL;
}