[LON-CAPA-cvs] cvs: capa /capa51/pProj capaCommon.c capaParser.h

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 28 Jul 2006 06:38:15 -0000


albertel		Fri Jul 28 02:38:15 2006 EDT

  Modified files:              
    /capa/capa51/pProj	capaCommon.c capaParser.h 
  Log:
  - BUG#4810 - numbers not accepted in stringresponse type="mc"
  
  
Index: capa/capa51/pProj/capaCommon.c
diff -u capa/capa51/pProj/capaCommon.c:1.27 capa/capa51/pProj/capaCommon.c:1.28
--- capa/capa51/pProj/capaCommon.c:1.27	Tue Dec 20 14:59:57 2005
+++ capa/capa51/pProj/capaCommon.c	Fri Jul 28 02:38:13 2006
@@ -2936,9 +2936,9 @@
   int      input_len, all_alphabet = 1, idx, ii, type;
   int      outcome=-1, result = INCORRECT;
   int      sig, corr_len;
-  int      choice[ANSWER_STRING_LENG];
+  int      choice[MAX_ASCII];
   char     num_str[ANSWER_STRING_LENG], unit_str[ANSWER_STRING_LENG];
-  char     fmted[ANSWER_STRING_LENG], correctans[ANSWER_STRING_LENG], answer[ANSWER_STRING_LENG];
+  char     fmted[ANSWER_STRING_LENG], correctans[MAX_ASCII], answer[ANSWER_STRING_LENG];
   double   n_part;
   double   given, target, ratio, fmted_target, target_u, target_l, scale=1.0;
   double   delta;
@@ -3040,17 +3040,17 @@
           {
             corr_len = strlen(s); input_len = strlen(ans);
             if( corr_len == input_len ) {
-              for(idx=0;idx<ANSWER_STRING_LENG;idx++) {
+              for(idx=0;idx<MAX_ASCII;idx++) {
 		choice[idx] = 0;correctans[idx] = 0;
 	      }
               result = EXACT_ANS;
               for(ii=0;ii<corr_len; ii++) {
-                idx = toupper(s[ii]) - 'A'; choice[idx] =  1;
+                idx = toupper(s[ii]); choice[idx] =  1;
               }
               for(ii=0;ii<input_len;ii++) {
-                idx = toupper(ans[ii]) - 'A'; correctans[idx] = 1;
+                idx = toupper(ans[ii]); correctans[idx] = 1;
 	      }
-	      for(ii=0;ii<ANSWER_STRING_LENG;ii++) {
+	      for(ii=0;ii<MAX_ASCII;ii++) {
 		if(choice[ii] != correctans[ii] )  result = INCORRECT;
               }
             } else { result = INCORRECT; }
@@ -3101,7 +3101,7 @@
   int     sig_l; 
   int     sig_u;
   char   *fmt;
-  int     choice[ANSWER_STRING_LENG], correctans[ANSWER_STRING_LENG];
+  int     choice[MAX_ASCII], correctans[MAX_ASCII];
   int     ii, idx, corr_len, input_len;
   int     result = INCORRECT, sig, outcome=-1, all_alphabet;
   char    fmted[FORMAT_STRING_LENG];
@@ -3209,18 +3209,18 @@
           {
             corr_len = strlen(correct); input_len = strlen(answer);
             if( corr_len == input_len ) {
-              for(idx=0;idx<ANSWER_STRING_LENG;idx++) {
+              for(idx=0;idx<MAX_ASCII;idx++) {
 		choice[idx] = 0;correctans[idx] = 0;
 	      }
               result = EXACT_ANS;
               for(ii=0;ii<corr_len; ii++) {
-                idx = toupper(correct[ii]) - 'A'; choice[idx] =  1;
+                idx = toupper(correct[ii]); choice[idx] =  1;
               }
               for(ii=0;ii<input_len;ii++) {
-                idx = toupper(answer[ii]) - 'A'; correctans[idx] = 1;
+                idx = toupper(answer[ii]); correctans[idx] = 1;
 	      }
-	      for(ii=0;ii<ANSWER_STRING_LENG;ii++) {
-		if(choice[ii] != correctans[ii] )  result = INCORRECT;
+	      for(ii=0;ii<MAX_ASCII;ii++) {
+		if(choice[ii] != correctans[ii] ) result = INCORRECT;
               }
             } else { result = INCORRECT; }
             break;
Index: capa/capa51/pProj/capaParser.h
diff -u capa/capa51/pProj/capaParser.h:1.13 capa/capa51/pProj/capaParser.h:1.14
--- capa/capa51/pProj/capaParser.h:1.13	Tue Feb 15 17:15:05 2005
+++ capa/capa51/pProj/capaParser.h	Fri Jul 28 02:38:13 2006
@@ -79,7 +79,7 @@
 #define  MAX_FUNC_NEST     1024    /* sin(cos(tan(...)))   */
 /*#define  MAX_QTEXT_LEN     4096     overall question text in a set *NO LONGER NEEDED */
 #define  WARN_MSG_LENGTH   1024    /* for warning messages */
-
+#define  MAX_ASCII          256
 
 #define  ASCII_MODE           1
 #define  TeX_MODE             2