/[pspp]/pspp/src/get.c
ViewVC logotype

Diff of /pspp/src/get.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.22 by blp, Mon Mar 14 06:54:40 2005 UTC revision 1.23 by jmd, Wed Apr 13 10:09:59 2005 UTC
# Line 191  static trns_free_func save_trns_free; Line 191  static trns_free_func save_trns_free;
191  static struct save_trns *  static struct save_trns *
192  cmd_save_internal (void)  cmd_save_internal (void)
193  {  {
194    struct file_handle *fh;    struct file_handle *fh = NULL;
195    struct dictionary *dict = NULL;    struct dictionary *dict = NULL;
196    struct save_trns *t = NULL;    struct save_trns *t = NULL;
197    int compress = get_scompression ();    int compress = get_scompression ();
198      const int default_version = 3;
199      int version = default_version;
200      short no_name_table = 0;
201    
202    t = xmalloc (sizeof *t);    t = xmalloc (sizeof *t);
203    t->h.proc = save_trns_proc;    t->h.proc = save_trns_proc;
# Line 203  cmd_save_internal (void) Line 206  cmd_save_internal (void)
206    t->map = NULL;    t->map = NULL;
207    case_nullify (&t->bounce);    case_nullify (&t->bounce);
208        
209    lex_match ('/');  
210    if (lex_match_id ("OUTFILE"))    /* Read most of the subcommands. */
211      lex_match ('=');    for (;;)
212    fh = fh_parse ();      {
213    if (fh == NULL)        if (lex_match_id ("VERSION"))
214      goto error;          {
215              lex_match ('=');
216              if ( lex_force_num() )
217                {
218                  lex_get();
219                  version = tokval;
220                  
221                  if ( 0 == strncasecmp (tokid,"x", 1) )
222                    {
223                      lex_get();
224                      no_name_table = 1;
225                    }
226    
227                }
228            }
229          else if (lex_match_id ("OUTFILE"))
230            {
231              lex_match ('=');
232          
233              fh = fh_parse ();
234              if (fh == NULL)
235                goto error;
236    
237            }
238          if ( ! lex_match('/')  )
239            break;
240    
241        }
242    
243      if (token != '.')
244        {
245          lex_error (_("expecting end of command"));
246          goto error;
247        }
248    
249      if ( fh == NULL )
250        {
251          msg ( ME, _("The required %s subcommand was not present"), "OUTFILE");
252          goto error;
253        }
254    
255      if ( version != default_version )
256        {
257          msg (MW, _("Unsupported sysfile version: %d. Using version %d instead."),
258               version, default_version);
259    
260          version = default_version;
261        }
262    
263    dict = dict_clone (default_dict);    dict = dict_clone (default_dict);
264    start_case_map (dict);    start_case_map (dict);
# Line 218  cmd_save_internal (void) Line 268  cmd_save_internal (void)
268    if (t->map != NULL)    if (t->map != NULL)
269      case_create (&t->bounce, dict_get_next_value_idx (dict));      case_create (&t->bounce, dict_get_next_value_idx (dict));
270    
271    t->writer = sfm_open_writer (fh, dict, compress);    t->writer = sfm_open_writer (fh, dict, compress, no_name_table);
272    if (t->writer == NULL)    if (t->writer == NULL)
273      goto error;      goto error;
274    
# Line 439  rename_variables (struct dictionary *dic Line 489  rename_variables (struct dictionary *dic
489        if (!lex_force_match ('=')        if (!lex_force_match ('=')
490            || !lex_force_id ())            || !lex_force_id ())
491          return 0;          return 0;
492        if (!strncmp (tokid, v->name, 8))        if (!strncmp (tokid, v->name, SHORT_NAME_LEN))
493          return 1;          return 1;
494        if (dict_lookup_var (dict, tokid) != NULL)        if (dict_lookup_var (dict, tokid) != NULL)
495          {          {
# Line 610  struct mtf_file Line 660  struct mtf_file
660      struct file_handle *handle; /* File handle. */      struct file_handle *handle; /* File handle. */
661      struct sfm_reader *reader;  /* System file reader. */      struct sfm_reader *reader;  /* System file reader. */
662      struct dictionary *dict;    /* Dictionary from system file. */      struct dictionary *dict;    /* Dictionary from system file. */
663      char in[9];                 /* Name of the variable from IN=. */      char in[SHORT_NAME_LEN + 1];    /* Name of the variable from IN=. */
664      char first[9], last[9];     /* Name of the variables from FIRST=, LAST=. */      char first[SHORT_NAME_LEN + 1];
665        char last[SHORT_NAME_LEN + 1];      /* Name of the variables from FIRST=, LAST=. */
666      struct ccase input;         /* Input record. */      struct ccase input;         /* Input record. */
667    };    };
668    
# Line 1385  mtf_merge_dictionary (struct dictionary Line 1436  mtf_merge_dictionary (struct dictionary
1436            mv->label = xstrdup (dv->label);            mv->label = xstrdup (dv->label);
1437          if (!mv)          if (!mv)
1438            {            {
1439              mv = dict_clone_var (m, dv, dv->name);              mv = dict_clone_var (m, dv, dv->name, dv->longname);
1440              assert (mv != NULL);              assert (mv != NULL);
1441            }            }
1442          else if (mv->width != dv->width)          else if (mv->width != dv->width)

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26