struct casewriter *writer; /* Writer. */
};
-static trns_proc_func output_trns_proc;
-static trns_free_func output_trns_free;
+static const struct trns_class output_trns_class;
static struct casewriter *parse_write_command (struct lexer *,
struct dataset *,
enum writer_type,
return CMD_CASCADING_FAILURE;
}
- add_transformation (ds, output_trns_proc, output_trns_free, t);
+ add_transformation (ds, &output_trns_class, t);
return CMD_SUCCESS;
}
{
if (handle != NULL)
{
- lex_sbc_only_once ("OUTFILE");
+ lex_sbc_only_once (lexer, "OUTFILE");
goto error;
}
{
if (metadata != NULL)
{
- lex_sbc_only_once ("METADATA");
+ lex_sbc_only_once (lexer, "METADATA");
goto error;
}
&& lex_match_id (lexer, "VERSION"))
{
lex_match (lexer, T_EQUALS);
- if (!lex_force_int (lexer))
+ if (!lex_force_int_range (lexer, "VERSION", 2, 3))
goto error;
sysfile_opts.version = lex_integer (lexer);
lex_get (lexer);
else if (writer_type == PORFILE_WRITER && lex_match_id (lexer, "DIGITS"))
{
lex_match (lexer, T_EQUALS);
- if (!lex_force_int (lexer))
+ if (!lex_force_int_range (lexer, "DIGITS", 1, INT_MAX))
goto error;
porfile_opts.digits = lex_integer (lexer);
lex_get (lexer);
}
- else if (!parse_dict_trim (lexer, dict))
+ else if (!parse_dict_trim (lexer, dict, false))
goto error;
if (!lex_match (lexer, T_SLASH))
}
/* Writes case *C to the system file specified on XSAVE or XEXPORT. */
-static int
+static enum trns_result
output_trns_proc (void *trns_, struct ccase **c, casenumber case_num UNUSED)
{
struct output_trns *t = trns_;
free (t);
return ok;
}
+
+static const struct trns_class output_trns_class = {
+ .name = "XSAVE/XEXPORT",
+ .execute = output_trns_proc,
+ .destroy = output_trns_free,
+};