From: Chris S. <san...@us...> - 2005-11-08 09:41:50
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6131/scripts Modified Files: stackAuthor.php stackCAS.php stackQuestion.php Log Message: Changes to implement simp:false in the code. A major update. Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** stackAuthor.php 14 Oct 2005 15:42:27 -0000 1.47 --- stackAuthor.php 8 Nov 2005 09:41:40 -0000 1.48 *************** *** 391,396 **** } ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','','',get_string('stackOptions_edit_resppro','stack'),'','','','','',get_string('stackOptions_edit_out','stack')); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','Floats','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$prefix,$remoteCaller); --- 391,396 ---- } ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','',get_string('stackOptions_edit_out','stack')); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','Floats','SyntaxHint','Simplify','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$prefix,$remoteCaller); Index: stackCAS.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackCAS.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** stackCAS.php 9 Oct 2005 16:20:39 -0000 1.6 --- stackCAS.php 8 Nov 2005 09:41:40 -0000 1.7 *************** *** 21,30 **** // Generates Maxima specific code // We will use a maxima block. ! // BLOCK([v1,...,vk], state1,...statej) $loclistA = ''; $loclistB = ''; $loclistC = ''; ! $cs ='cab:BLOCK([ RANDOM_SEED'; // Now we will add options --- 21,30 ---- // Generates Maxima specific code // We will use a maxima block. ! // block([v1,...,vk], state1,...statej) $loclistA = ''; $loclistB = ''; $loclistC = ''; ! $cs ='cab:block([ random_seed'; // Now we will add options *************** *** 51,58 **** $val = str_replace('?','qmchar',$locv["value"]); $loclistA.= ','.$key; ! $loclistB.= ", print(\"$lk=[ error= [\"), cte(\"$key\",ERRCATCH($key:$val)) "; } ! $cs .= $loclistA.'], RANDOM_SEED:'.$seed.$loclistC; $cs .= ", print(\"[TimeStamp= [ $t ], Locals= [ \") "; --- 51,58 ---- $val = str_replace('?','qmchar',$locv["value"]); $loclistA.= ','.$key; ! $loclistB.= ", print(\"$lk=[ error= [\"), cte(\"$key\",errcatch($key:$val)) "; } ! $cs .= $loclistA.'], random_seed:'.$seed.$loclistC; $cs .= ", print(\"[TimeStamp= [ $t ], Locals= [ \") "; *************** *** 60,64 **** $cs .= ', print("] ]") '; ! $cs .= ", RETURN(true) ); \n"; //echo "<pre>".$cs."</pre>"; --- 60,64 ---- $cs .= ', print("] ]") '; ! $cs .= ", return(true) ); \n"; //echo "<pre>".$cs."</pre>"; *************** *** 172,176 **** $loclistB = ''; $loclistC = ''; ! $cs ='cab:BLOCK([ RANDOM_SEED'; // Now we will add options --- 172,176 ---- $loclistB = ''; $loclistC = ''; ! $cs ='cab:block([ random_seed'; // Now we will add options *************** *** 192,202 **** } ! $cas_cmd = "cab:BLOCK([ ans,str{$loclistA}] {$loclistC}, "; ! $cas_cmd .= " print(\" [TimeStamp= [ $t ], Ans= [ error = [\")"; ! $cas_cmd .= ", cte(\"ans\",ERRCATCH(ans:$exp1)), "; ! ! $cas_cmd .= "str:stack_validate(ans), print(str),"; $fname = $stackAnswerTest[$test]['function']; ! $cas_cmd .= " str:$fname(ans,$exp2), print(str), RETURN(true)); \n"; return $cas_cmd; --- 192,201 ---- } ! $cas_cmd = "cab:block([ ans,str{$loclistA}] {$loclistC}, simp:false,"; ! $cas_cmd .= " print(\"[ Timestamp = [ $t ], Ans= [ error = [\"), cte(\"ans\",errcatch(ans:$exp1)),"; ! $cas_cmd .= " print(\" ValidationError = [ \"), str:stack_validate(ans), print(str),"; ! $cas_cms .= " simp:".$options['simplify'].", "; $fname = $stackAnswerTest[$test]['function']; ! $cas_cmd .= " print(\" AnswerTestError = [ \"), str:$fname(ans,$exp2), print(\" ], \"), print(str), return(true)); \n"; return $cas_cmd; *************** *** 229,232 **** --- 228,239 ---- unset($unp['ValidationFeedBack']); + if ('' != $unp['ValidationError']) { + $unp['Valid'] = 'false'; + $unp['AnswerNote'] = 'ValidationError'; + $unp['Ans']['error'] = $unp['ValidationError']; + } + unset($unp['ValidationError']); + unset($unp['AnswerTestError']); + // Sort out translations of the feedback. if (array_key_exists('FeedBack',$unp)) { *************** *** 290,294 **** $parsed = CASParseCASOutput($varResponse); - //show_array($parsed); --- 297,300 ---- *************** *** 366,376 **** $varResponse = stack_maxima_rawsend($varCommand); - //echo "<pre>".$varResponse."</pre>"; - // Chop off the part up till the first input group. ! $varResponse = strstr($varResponse,"[TimeStamp"); ! $parsed = CASAnsTestParse($varResponse); ! // If we have errors, we need to add blank fields. --- 372,380 ---- $varResponse = stack_maxima_rawsend($varCommand); // Chop off the part up till the first input group. ! $varResponse = strstr($varResponse,"[ Timestamp"); ! $parsed = CASAnsTestParse($varResponse); ! //show_array($parsed); // If we have errors, we need to add blank fields. *************** *** 399,404 **** } } ! ! return $parsed; } --- 403,409 ---- } } ! ! return $parsed; ! } Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** stackQuestion.php 27 Oct 2005 12:34:36 -0000 1.48 --- stackQuestion.php 8 Nov 2005 09:41:40 -0000 1.49 *************** *** 76,79 **** --- 76,84 ---- $stackOptions['Floats']['CAS_TYPE'] = 'ex'; + $stackOptions['Simplify']['type'] = 'list'; + $stackOptions['Simplify']['values'] = array('true','false'); + $stackOptions['Simplify']['default'] = 'true'; + $stackOptions['Simplify']['CAS_KEY'] = 'simp'; + $stackOptions['Simplify']['CAS_TYPE'] = 'ex'; // 'Language'; *************** *** 893,897 **** foreach ($cas_keywords as $cas_kw) { if (in_array($locvar['key'],$stack_cas[$cas_kw])) { ! $errors[$keyvals_name_raw][$locvar['key']] = $locvar['key']." ".get_string('QValidMaximaName','stack',''); } } --- 898,904 ---- foreach ($cas_keywords as $cas_kw) { if (in_array($locvar['key'],$stack_cas[$cas_kw])) { ! if (!in_array($locvar['key'],$stack_cas['functionNameExceptions'])) { ! $errors[$keyvals_name_raw][$locvar['key']] = $locvar['key']." ".get_string('QValidMaximaName','stack',''); ! } } } *************** *** 1381,1385 **** if ( 'SA_factored' == $atest ) { ! $ta = "[$ta,$atest_ops,TRUE]"; } --- 1388,1392 ---- if ( 'SA_factored' == $atest ) { ! $ta = "[$sa,$atest_ops,TRUE]"; } *************** *** 1416,1421 **** $locals[0] = array('key'=>'flsa' , 'value'=>"STACK_float({$sa})"); ! $locals[1] = array('key'=>'flsa' , 'value'=>"abs(STACK_float({$sa}-{$ta}))"); ! $locals[2] = array('key'=>'flta' , 'value'=>"abs(STACK_float({$ta}*{$atest_ops}))"); $seed = 0; --- 1423,1428 ---- $locals[0] = array('key'=>'flsa' , 'value'=>"STACK_float({$sa})"); ! $locals[1] = array('key'=>'flsa' , 'value'=>"ev(abs(STACK_float({$sa}-{$ta})),simp)"); ! $locals[2] = array('key'=>'flta' , 'value'=>"ev(abs(STACK_float({$ta}*{$atest_ops})),simp)"); $seed = 0; *************** *** 1442,1447 **** $locals[0] = array('key'=>'flsa' , 'value'=>"STACK_float({$sa})"); ! $locals[1] = array('key'=>'flsa' , 'value'=>"abs(STACK_float({$sa}-{$ta}))"); ! $locals[2] = array('key'=>'flta' , 'value'=>"abs(STACK_float({$atest_ops}))"); $seed = 0; --- 1449,1454 ---- $locals[0] = array('key'=>'flsa' , 'value'=>"STACK_float({$sa})"); ! $locals[1] = array('key'=>'flsa' , 'value'=>"ev(abs(STACK_float({$sa}-{$ta})),simp)"); ! $locals[2] = array('key'=>'flta' , 'value'=>"ev(abs(STACK_float({$atest_ops})),simp)"); $seed = 0; |