[Aimmath-commit] AIM/WEB-INF/maple/aim Compile.mpl,1.5,1.6
Brought to you by:
gustav_delius,
npstrick
From: <nps...@us...> - 2003-08-30 21:04:10
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv13233/WEB-INF/maple/aim Modified Files: Compile.mpl Log Message: Corrected stupid mistakes in handling MProc Index: Compile.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Compile.mpl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Compile.mpl 29 Aug 2003 19:41:34 -0000 1.5 --- Compile.mpl 30 Aug 2003 21:04:04 -0000 1.6 *************** *** 635,697 **** fi; ! mproc := eval(x[1]); ! ! # At this point, mproc is a function like f(ans). The following block ! # of code converts it to the function g(attempt,ans) = f(ans). Later ! # blocks will modify g so that it no longer ignores the first argument. ! err := ! traperror( ! codegen[swapargs]( ! codegen[makeparam](attempt,mproc), 1 = 2)); ! if err = lasterror then ! RETURN([ ! cat( ! __("Error while manipulating marking procedure:"), ! "\n<br/>\n",`HTML/Escape`(lasterr),"\n<br/>\n", ! "mproc = \n", ! "<pre>\n",`HTML/Escape`(sprintf("%a",mproc)),"\n</pre>\n"), ! nam,0,lines]); ! else ! mproc := eval(err); ! fi; ! ! # The mproc function will typically contain calls to printf(), ! # `aim/t` and so on, to 'print' feedback strings to be shown to ! # the student. The next block of code modifies mproc so that the ! # strings are captured in attempt['Feedback'] or ! # attempt['AnswerNote'] rather than being printed immediately. ! mproctext := sprintf("%a",eval(mproc)); ! mproctext := ! `aim/Compile/RedirectOutput`("attempt['Feedback']",mproctext); ! mproctext := ! `aim/Compile/Replace`( ! "`aim/SetAnswerNote`(" = "`aim/SetAnswerNote`(attempt,", ! "`aim/SetInvalid`(" = "`aim/SetInvalid`(attempt,", ! mproctext); ! ! y := traperror(`Util/Parse`(mproctext,err,0)); ! ! if err <> NULL then ! RETURN([ ! cat( ! __("Problem while reparsing marking procedure:"), ! "\n<br/>\n",err[1], ! "\n<pre>\n",err[3],"\n</pre>\n"), ! nam,0,lines]); ! else ! mproc := eval(y); ! fi; ! ! # At this point, the function mproc expects two arguments (attempt ! # and ans) and returns the appropriate raw mark. We next modify it ! # so that it only needs one argument (called attempt), it takes ans ! # to be attempt['Answer'], and it inserts the raw mark in the ! # attempt['RawAnswer'] field. ! question['MProc'] := ! subs(MPROC_ = eval(mproc), ! proc(attempt::`aim/Question/Attempt`) ! attempt['RawMark'] := MPROC_(attempt,attempt['Answer']); ! end); ! setans := --- 635,639 ---- fi; ! question['MProc'] := eval(`aim/Compile/ConvertMPROC`(eval(x[1]))); setans := *************** *** 1723,1727 **** proc(x) local y,z; ! global printfunctions; if type(x,function) then if op(0,x) = _Inert_FUNCTION then --- 1665,1669 ---- proc(x) local y,z; ! global `aim/Compile/PrintFunctions`; if type(x,function) then if op(0,x) = _Inert_FUNCTION then *************** *** 1730,1737 **** member(op(0,y),{_Inert_NAME,_Inert_ASSIGNEDNAME}) then z := op(1,y); ! if type([printfunctions[z]],[string]) then return( _Inert_FUNCTION( ! _Inert_ASSIGNEDNAME(printfunctions[z],"PROC"), _Inert_EXPSEQ( _Inert_TABLEREF( --- 1672,1679 ---- member(op(0,y),{_Inert_NAME,_Inert_ASSIGNEDNAME}) then z := op(1,y); ! if type([`aim/Compile/PrintFunctions`[z]],[string]) then return( _Inert_FUNCTION( ! _Inert_ASSIGNEDNAME(`aim/Compile/PrintFunctions`[z],"PROC"), _Inert_EXPSEQ( _Inert_TABLEREF( *************** *** 1869,1873 **** if type(x,function) then if member(op(0,x), {_Inert_LOCAL,_Inert_PARAM, ! _Inert_LEXICAL_LOCAL,_Inert_LEXICAL_PARAM}) then return(t[x]); elif op(0,x) = _Inert_PROC then --- 1811,1815 ---- if type(x,function) then if member(op(0,x), {_Inert_LOCAL,_Inert_PARAM, ! _Inert_LEXICAL_LOCAL,_Inert_LEXICAL_PARAM}) then return(t[x]); elif op(0,x) = _Inert_PROC then |