Changed all the licence notices in all the files.
[pspp-builds.git] / src / data-list.c
index eb491d1d9dd72e0f50c19300b50a142e4550bc74..24fa0dbcee0b51594bf9c05140c88e4d075c84b4 100644 (file)
@@ -14,8 +14,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA. */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
 
 #include <config.h>
 #include "data-list.h"
@@ -65,7 +65,7 @@ struct dls_var_spec
     int fc, lc;                        /* Column numbers in record. */
 
     /* Free format only. */
-    char name[9];              /* Name of variable. */
+    char name[SHORT_NAME_LEN + 1];             /* Name of variable. */
   };
 
 /* Constants for DATA LIST type. */
@@ -278,8 +278,7 @@ cmd_data_list (void)
       add_transformation (&new_pgm->h);
     }
   else 
-    vfm_source = create_case_source (&data_list_source_class,
-                                     default_dict, dls);
+    vfm_source = create_case_source (&data_list_source_class, dls);
 
   return CMD_SUCCESS;
 
@@ -350,7 +349,7 @@ parse_fixed (struct data_list_pgm *dls)
       while (lex_match ('/'))
        {
          fx.recno++;
-         if (lex_integer_p ())
+         if (lex_is_integer ())
            {
              if (lex_integer () < fx.recno)
                {
@@ -371,7 +370,7 @@ parse_fixed (struct data_list_pgm *dls)
       if (!parse_DATA_LIST_vars (&fx.name, &fx.name_cnt, PV_NONE))
        return 0;
 
-      if (token == T_NUM)
+      if (lex_is_number ())
        {
          if (!fixed_parse_compatible (&fx, &dls->first, &dls->last))
            goto fail;
@@ -501,7 +500,7 @@ fixed_parse_compatible (struct fixed_parsing_state *fx,
       else
        input.type = FMT_F;
 
-      if (lex_integer_p ())
+      if (lex_is_integer ())
        {
          if (lex_integer () < 1)
            {
@@ -713,7 +712,7 @@ fixed_parse_fortran_internal (struct fixed_parsing_state *fx,
       tail = new;
 
       /* Parse count. */
-      if (lex_integer_p ())
+      if (lex_is_integer ())
        {
          new->count = lex_integer ();
          lex_get ();
@@ -842,6 +841,7 @@ parse_free (struct dls_var_spec **first, struct dls_var_spec **last)
 
       if (!parse_DATA_LIST_vars (&name, &name_cnt, PV_NONE))
        return 0;
+
       if (lex_match ('('))
        {
          if (!parse_format_specifier (&input, 0)
@@ -874,6 +874,7 @@ parse_free (struct dls_var_spec **first, struct dls_var_spec **last)
          struct variable *v;
 
          v = dict_create_var (default_dict, name[i], width);
+         
          if (!v)
            {
              msg (SE, _("%s is a duplicate variable name."), name[i]);
@@ -888,7 +889,7 @@ parse_free (struct dls_var_spec **first, struct dls_var_spec **last)
           spec->input = input;
           spec->v = v;
          spec->fv = v->fv;
-         strcpy (spec->name, name[i]);
+         strcpy (spec->name, v->name);
          append_var_spec (first, last, spec);
        }
       for (i = 0; i < name_cnt; i++)
@@ -1113,7 +1114,7 @@ read_from_data_list_fixed (const struct data_list_pgm *dls,
          data_in_finite_line (&di, ls_c_str (&line), ls_length (&line),
                                var_spec->fc, var_spec->lc);
          di.v = case_data_rw (c, var_spec->fv);
-         di.flags = 0;
+         di.flags = DI_IMPLIED_DECIMALS;
          di.f1 = var_spec->fc;
          di.format = var_spec->input;
 
@@ -1690,7 +1691,7 @@ parse_num_or_var (struct rpd_num_or_var *value, const char *message)
          return 0;
        }
     }
-  else if (lex_integer_p ())
+  else if (lex_is_integer ())
     {
       value->num = lex_integer ();
       
@@ -1725,7 +1726,7 @@ parse_repeating_data (struct dls_var_spec **first, struct dls_var_spec **last)
       if (!parse_DATA_LIST_vars (&fx.name, &fx.name_cnt, PV_NONE))
        return 0;
 
-      if (token == T_NUM)
+      if (lex_is_number ())
        {
          if (!fixed_parse_compatible (&fx, first, last))
            goto fail;