From: Davide P.C. <dp...@un...> - 2005-07-04 20:44:43
|
Folks: Over the long weekend, I have been working on a method of making the traditional answer checkers (like std_num_cmp() and fun_cmp()) use the new Parser, and I have a working version of PGanswermacros.pl that implements it. It turns out not to have been as difficult as I thought it might be, and I think I was able to map all the various parameters onto corresponding Parser parameters successfully. Of course, this is a pretty major switch, so there will be some problems, I'm sure. I have created a new subdirectory of the Parser tree that contains the needed files. It is pg/lib/Parser/Legacy, and there is a README file there that explains how to install and use it. You should also update your copy of the Parser and Value packages, as there are some changes within them that I made while working on this. Since PGanswermacros.pl is preloaded (unlike most .pl files), this means that the change has to be made for the whole server at once. I have arranged, however, for the original answer checkers to remain available, and you can switch back on a site-wide, course-wide or problem-by-problem basis. If you turn the new checkers OFF for the site, and ON for problem files that you want to test, you should be able to try this out even on an active system without causing trouble for existing courses. Again, see the README for details. All the changes to PGanswermacros.pl are in NUM_CMP and FUNCTION_CMP, which have been essentially replaced by functions that set up an appropriate Parser context, create a Parser object from the correct answer, and return its answer checker. This effectively turns all the traditional answer checkers into ones that use the new Parser in a backward compatible way so that existing problem files do not need to be modified. Any answer checkers that rely on the standard ones (like the ones in the union_problib) will also be taking advantage of the new Parser. Note, however, that these replacement NUM_CMP() and FUNCTION_CMP() do not necessarily store the same values and fields in the AnswerHash, so code that takes advantage of private data from a checker's AnswerHash may no longer operate correctly. I have not done a huge amount of testing in existing problem files, but I did run through some of the more complicated ones from the Union problem library that used nested answer checkers, and they seem to work OK. Let me know if you try this out, and what results you get. I'm sure it is not a finished product. Davide |