[LON-CAPA-cvs] cvs: capa /capa51/pProj capaCommon.c loncom/homework/caparesponse caparesponse.c

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 20 Dec 2005 19:59:58 -0000


albertel		Tue Dec 20 14:59:58 2005 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.c 
    /capa/capa51/pProj	capaCommon.c 
  Log:
  - need outcome to have an intial value
  
  
Index: loncom/homework/caparesponse/caparesponse.c
diff -u loncom/homework/caparesponse/caparesponse.c:1.19 loncom/homework/caparesponse/caparesponse.c:1.20
--- loncom/homework/caparesponse/caparesponse.c:1.19	Thu Dec  1 17:34:10 2005
+++ loncom/homework/caparesponse/caparesponse.c	Tue Dec 20 14:59:52 2005
@@ -1,6 +1,6 @@
 /* The LearningOnline Network with CAPA 
  * CAPA wrapper code
- * $Id: caparesponse.c,v 1.19 2005/12/01 22:34:10 albertel Exp $
+ * $Id: caparesponse.c,v 1.20 2005/12/20 19:59:52 albertel Exp $
  *
  * Copyright Michigan State University Board of Trustees
  *
@@ -134,7 +134,7 @@
 int caparesponse_get_real_response (char* unit_str, char* answer,
 				    double* scaled) {
   //double caparesponse_get_real_response (char* unit_str, char* answer) {
-  int     input_len,all_alphabet,idx,outcome,result;
+  int     input_len,all_alphabet,idx,outcome=-1,result;
   double  n_part,scale=1.0,given,target;
   char    input[ANSWER_STRING_LENG],filename[FILE_NAME_LENGTH],
     tmp_unit_str[ANSWER_STRING_LENG];
@@ -165,6 +165,8 @@
   if( !all_alphabet ) {
     tmp_unit_str[0] = 0;
     outcome = split_num_unit(answer,&n_part,input,tmp_unit_str);
+  }
+  if( outcome > 0 ) {
     if( outcome > 1 ) { /* with both num and unit parts or only unit part */
       if( ans_unit != NULL ) {
 	result = check_correct_unit(tmp_unit_str,ans_unit,&scale);
Index: capa/capa51/pProj/capaCommon.c
diff -u capa/capa51/pProj/capaCommon.c:1.26 capa/capa51/pProj/capaCommon.c:1.27
--- capa/capa51/pProj/capaCommon.c:1.26	Thu Dec  1 17:32:10 2005
+++ capa/capa51/pProj/capaCommon.c	Tue Dec 20 14:59:57 2005
@@ -2934,7 +2934,7 @@
   char    *us;    /* ans_unit_str */
   Unit_t  *u_p;   /* ans_unit     */
   int      input_len, all_alphabet = 1, idx, ii, type;
-  int      outcome, result = INCORRECT;
+  int      outcome=-1, result = INCORRECT;
   int      sig, corr_len;
   int      choice[ANSWER_STRING_LENG];
   char     num_str[ANSWER_STRING_LENG], unit_str[ANSWER_STRING_LENG];
@@ -3103,7 +3103,7 @@
   char   *fmt;
   int     choice[ANSWER_STRING_LENG], correctans[ANSWER_STRING_LENG];
   int     ii, idx, corr_len, input_len;
-  int     result = INCORRECT, sig, outcome, all_alphabet;
+  int     result = INCORRECT, sig, outcome=-1, all_alphabet;
   char    fmted[FORMAT_STRING_LENG];
   double  given, target, ratio, fmted_target, target_u, target_l, scale=1.0;
   double  delta;