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; |
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); |
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 |
|
|
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 |
{ |
{ |
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 |
|
|
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) |