pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp src/data/ChangeLog src/data/sys-file-reade...


From: John Darrington
Subject: [Pspp-cvs] pspp src/data/ChangeLog src/data/sys-file-reade...
Date: Fri, 20 Apr 2007 11:04:55 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   07/04/20 11:04:55

Modified files:
        src/data       : ChangeLog sys-file-reader.c 
        tests          : ChangeLog 
        tests/command  : no_case_size.sh sysfiles-old.sh 

Log message:
        If sys files have no long_name table, implicitly add one, use the lower 
case
        version of the variable names.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/ChangeLog?cvsroot=pspp&r1=1.110&r2=1.111
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/sys-file-reader.c?cvsroot=pspp&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/pspp/tests/ChangeLog?cvsroot=pspp&r1=1.85&r2=1.86
http://cvs.savannah.gnu.org/viewcvs/pspp/tests/command/no_case_size.sh?cvsroot=pspp&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pspp/tests/command/sysfiles-old.sh?cvsroot=pspp&r1=1.9&r2=1.10

Patches:
Index: src/data/ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/data/ChangeLog,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -b -r1.110 -r1.111
--- src/data/ChangeLog  16 Apr 2007 10:49:32 -0000      1.110
+++ src/data/ChangeLog  20 Apr 2007 11:04:55 -0000      1.111
@@ -1,3 +1,9 @@
+2007-04-19 John Darrington <address@hidden>
+
+       * sys-file-reader.c: When reading a system file which has no 
+       long name table, automatically create one where the long names 
+       are the lower case versions of the short names.
+       
 2007-04-16 John Darrington <address@hidden>
 
        * sys-file-reader.c: Some versions of Other Software seem to 

Index: src/data/sys-file-reader.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/sys-file-reader.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- src/data/sys-file-reader.c  16 Apr 2007 10:49:32 -0000      1.33
+++ src/data/sys-file-reader.c  20 Apr 2007 11:04:55 -0000      1.34
@@ -76,6 +76,7 @@
     int value_cnt;             /* Number of 8-byte units per case. */
     struct sfm_var *vars;       /* Variables. */
     size_t var_cnt;             /* Number of variables. */
+    bool has_long_var_names;    /* File has a long variable name map */
     bool has_vls;               /* File has one or more very long strings? */
 
     /* Decompression. */
@@ -192,6 +193,7 @@
   r->error = false;
   r->value_cnt = 0;
   r->has_vls = false;
+  r->has_long_var_names = false;
   r->opcode_idx = sizeof r->opcodes;
 
   if (setjmp (r->bail_out)) 
@@ -250,6 +252,33 @@
       rec_type = read_int32 (r);
     }
 
+
+  if ( ! r->has_long_var_names )
+    {
+      int i;
+      for (i = 0; i < dict_get_var_cnt (*dict); i++)
+       {
+         struct variable *var = dict_get_var (*dict, i);
+         char short_name [SHORT_NAME_LEN + 1];
+         char long_name [SHORT_NAME_LEN + 1];
+         char *s = short_name;
+         char *d = long_name;
+
+         strcpy (short_name, var_get_name (var));
+
+         strcpy (long_name, short_name);
+         str_lowercase (long_name);
+
+         /* Set long name.  Renaming a variable may clear the short
+            name, but we want to retain it, so re-set it
+            explicitly. */
+         dict_rename_var (*dict, var, long_name);
+         var_set_short_name (var, short_name);
+       }
+
+      r->has_long_var_names = true;
+    }
+
   /* Read record 999 data, which is just filler. */
   read_int32 (r);
 
@@ -880,6 +909,7 @@
       var_set_short_name (var, short_name);
     }
   close_variable_to_value_map (r, map);
+  r->has_long_var_names = true;
 }
 
 /* Reads record type 7, subtype 14, which gives the real length

Index: tests/ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/tests/ChangeLog,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- tests/ChangeLog     16 Apr 2007 00:14:08 -0000      1.85
+++ tests/ChangeLog     20 Apr 2007 11:04:55 -0000      1.86
@@ -1,3 +1,9 @@
+2007-04-19 John Darrington <address@hidden>
+       
+        * tests/command/no_case_size.sh tests/command/sysfiles-old.sh :
+       Changed tests to reflect new behaviour (case changing) when
+       reading system files with no long name table.
+
 2007-04-15  Ben Pfaff  <address@hidden>
 
        * automake.mk: Add recode.sh to tests.

Index: tests/command/no_case_size.sh
===================================================================
RCS file: /sources/pspp/pspp/tests/command/no_case_size.sh,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- tests/command/no_case_size.sh       22 Nov 2006 04:24:03 -0000      1.10
+++ tests/command/no_case_size.sh       20 Apr 2007 11:04:55 -0000      1.11
@@ -78,19 +78,19 @@
 +--------+-------------------------------------------+--------+
 |Variable|Description                                |Position|
 #========#===========================================#========#
-|CONT    |continents of the world                    |       1|
+|cont    |continents of the world                    |       1|
 |        |Format: A32                                |        |
 +--------+-------------------------------------------+--------+
-|SIZE    |sq km                                      |       2|
+|size    |sq km                                      |       2|
 |        |Format: F8.2                               |        |
 +--------+-------------------------------------------+--------+
-|POP     |population                                 |       3|
+|pop     |population                                 |       3|
 |        |Format: F8.2                               |        |
 +--------+-------------------------------------------+--------+
-|COUNT   |number of countries                        |       4|
+|count   |number of countries                        |       4|
 |        |Format: F8.2                               |        |
 +--------+-------------------------------------------+--------+
-                            CONT     SIZE      POP    COUNT
+                            cont     size      pop    count
 -------------------------------- -------- -------- --------
 Asia                             44579000 3.7E+009    44.00 
 Africa                           30065000 7.8E+008    53.00 

Index: tests/command/sysfiles-old.sh
===================================================================
RCS file: /sources/pspp/pspp/tests/command/sysfiles-old.sh,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- tests/command/sysfiles-old.sh       11 Mar 2006 07:16:40 -0000      1.9
+++ tests/command/sysfiles-old.sh       20 Apr 2007 11:04:55 -0000      1.10
@@ -95,7 +95,7 @@
 activity="compare output"
 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
 diff -b  -w $TEMPDIR/pspp.list - << EOF
-       X VARIABLE VARIAB_A VARIAB_B
+       x variable variab_a variab_b
 -------- -------- -------- --------
     1.00     1.00     1.00     2.00 
     1.00     1.00     2.00    30.00 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]