functions.
if (!lex_force_match ('/'))
return CMD_CASCADING_FAILURE;
- if (!parse_file_handle (&cmd))
+ if (!parse_file_handle (&cmd, NULL))
return CMD_CASCADING_FAILURE;
if (lex_end_of_command () != CMD_SUCCESS)
struct variable casenum_var;
bool ok;
- if (!parse_list (&cmd))
+ if (!parse_list (&cmd, NULL))
return CMD_FAILURE;
/* Fill in defaults. */
+Tue Jun 27 19:15:33 2006 Ben Pfaff <blp@gnu.org>
+
+ Add auxiliary data pointer to q2c parse_<command> function, and
+ pass it along to the custom parser functions.
+
+ Updated all uses of custom functions in all the existing .q files.
+
+ * q2c.c (dump_declarations): Include auxiliary parameter in
+ function prototypes.
+ (dump_subcommand) Include aux arg in calls to custom functions.
+ (dump_parser) Include aux param in parse_<command> function
+ definition. Include aux arg in calls to custom functions.
+
Tue Jun 27 12:07:34 2006 Ben Pfaff <blp@gnu.org>
* variable-parser.h: New header. Moved the var_set and variable
dump (0, "/* Prototype for custom subcommands of %s. */",
cmdname);
}
- dump (0, "static int %scustom_%s (struct cmd_%s *);",
+ dump (0, "static int %scustom_%s (struct cmd_%s *, void *);",
st_lower (prefix), st_lower (sbc->name),
make_identifier (cmdname));
}
/* Prototypes for parsing and freeing functions. */
{
dump (0, "/* Command parsing functions. */");
- dump (0, "static int parse_%s (struct cmd_%s *);",
+ dump (0, "static int parse_%s (struct cmd_%s *, void *);",
make_identifier (cmdname), make_identifier (cmdname));
dump (0, "static void free_%s (struct cmd_%s *);",
make_identifier (cmdname), make_identifier (cmdname));
}
else if (sbc->type == SBC_CUSTOM)
{
- dump (1, "switch (%scustom_%s (p))",
+ dump (1, "switch (%scustom_%s (p, aux))",
st_lower (prefix), st_lower (sbc->name));
dump (0, "{");
dump (1, "case 0:");
indent = 0;
dump (0, "static int");
- dump (0, "parse_%s (struct cmd_%s *p)", make_identifier (cmdname),
+ dump (0, "parse_%s (struct cmd_%s *p, void *aux UNUSED)",
+ make_identifier (cmdname),
make_identifier (cmdname));
dump (1, "{");
}
else if (def && def->type == SBC_CUSTOM)
{
- dump (1, "switch (%scustom_%s (p))",
+ dump (1, "switch (%scustom_%s (p, aux))",
st_lower (prefix), st_lower (def->name));
dump (0, "{");
dump (1, "case 0:");
cor_list = cor_last = NULL;
matrix_file = NULL;
- if (!parse_correlations (&cmd))
+ if (!parse_correlations (&cmd, NULL))
return CMD_FAILURE;
free_correlations (&cmd);
}
static int
-cor_custom_variables (struct cmd_correlations *cmd UNUSED)
+cor_custom_variables (struct cmd_correlations *cmd UNUSED, void *aux UNUSED)
{
struct variable **v1, **v2;
size_t nv1, nv2;
}
static int
-cor_custom_matrix (struct cmd_correlations *cmd UNUSED)
+cor_custom_matrix (struct cmd_correlations *cmd UNUSED, void *aux UNUSED)
{
if (!lex_force_match ('('))
return 0;
pl_tc = pool_create ();
pl_col = pool_create ();
- if (!parse_crosstabs (&cmd))
+ if (!parse_crosstabs (&cmd, NULL))
return CMD_FAILURE;
mode = variables ? INTEGER : GENERAL;
/* Parses the TABLES subcommand. */
static int
-crs_custom_tables (struct cmd_crosstabs *cmd UNUSED)
+crs_custom_tables (struct cmd_crosstabs *cmd UNUSED, void *aux UNUSED)
{
struct var_set *var_set;
int n_by;
/* Parses the VARIABLES subcommand. */
static int
-crs_custom_variables (struct cmd_crosstabs *cmd UNUSED)
+crs_custom_variables (struct cmd_crosstabs *cmd UNUSED, void *aux UNUSED)
{
if (nxtab)
{
subc_list_double_create(&percentile_list);
percentile_algorithm = PC_HAVERAGE;
- if ( !parse_examine(&cmd) )
+ if ( !parse_examine(&cmd, NULL) )
return CMD_FAILURE;
/* If /MISSING=INCLUDE is set, then user missing values are ignored */
/* Parse the PERCENTILES subcommand */
static int
-xmn_custom_percentiles(struct cmd_examine *p UNUSED)
+xmn_custom_percentiles(struct cmd_examine *p UNUSED, void *aux UNUSED)
{
sbc_percentile = 1;
/* TOTAL and NOTOTAL are simple, mutually exclusive flags */
static int
-xmn_custom_total(struct cmd_examine *p)
+xmn_custom_total(struct cmd_examine *p, void *aux UNUSED)
{
if ( p->sbc_nototal )
{
}
static int
-xmn_custom_nototal(struct cmd_examine *p)
+xmn_custom_nototal(struct cmd_examine *p, void *aux UNUSED)
{
if ( p->sbc_total )
{
/* Parser for the variables sub command
Returns 1 on success */
static int
-xmn_custom_variables(struct cmd_examine *cmd )
+xmn_custom_variables(struct cmd_examine *cmd, void *aux UNUSED)
{
lex_match('=');
n_variables = 0;
v_variables = NULL;
- if (!parse_frequencies (&cmd))
+ if (!parse_frequencies (&cmd, NULL))
return CMD_FAILURE;
if (cmd.onepage_limit == NOT_LONG)
/* Parses the VARIABLES subcommand, adding to
{n_variables,v_variables}. */
static int
-frq_custom_variables (struct cmd_frequencies *cmd UNUSED)
+frq_custom_variables (struct cmd_frequencies *cmd UNUSED, void *aux UNUSED)
{
int mode;
int min = 0, max = 0;
/* Parses the GROUPED subcommand, setting the n_grouped, grouped
fields of specified variables. */
static int
-frq_custom_grouped (struct cmd_frequencies *cmd UNUSED)
+frq_custom_grouped (struct cmd_frequencies *cmd UNUSED, void *aux UNUSED)
{
lex_match ('=');
if ((token == T_ID && dict_lookup_var (default_dict, tokid) != NULL)
v_dim = NULL;
v_var = NULL;
- if (!parse_means (&cmd))
+ if (!parse_means (&cmd, NULL))
goto free;
if (cmd.sbc_cells)
/* Parses the TABLES subcommand. */
static int
-mns_custom_tables (struct cmd_means *cmd)
+mns_custom_tables (struct cmd_means *cmd, void *aux UNUSED)
{
struct var_set *var_set;
int i;
bool ok;
- if ( !parse_oneway(&cmd) )
+ if ( !parse_oneway(&cmd, NULL) )
return CMD_FAILURE;
/* If /MISSING=INCLUDE is set, then user missing values are ignored */
/* Parser for the variables sub command */
static int
-oneway_custom_variables(struct cmd_oneway *cmd UNUSED)
+oneway_custom_variables(struct cmd_oneway *cmd UNUSED, void *aux UNUSED)
{
lex_match('=');
size_t i;
n_rank_specs = 0;
- if ( !parse_rank(&cmd) )
+ if ( !parse_rank(&cmd, NULL) )
return CMD_FAILURE;
#if 1
/* Parser for the variables sub command
Returns 1 on success */
static int
-rank_custom_variables(struct cmd_rank *cmd UNUSED)
+rank_custom_variables(struct cmd_rank *cmd UNUSED, void *aux UNUSED)
{
static const int terminators[2] = {T_BY, 0};
static int
-rank_custom_rank(struct cmd_rank *cmd )
+rank_custom_rank(struct cmd_rank *cmd, void *aux UNUSED )
{
return parse_rank_function(cmd, RANK);
}
static int
-rank_custom_normal(struct cmd_rank *cmd )
+rank_custom_normal(struct cmd_rank *cmd, void *aux UNUSED )
{
return parse_rank_function(cmd, NORMAL);
}
static int
-rank_custom_percent(struct cmd_rank *cmd )
+rank_custom_percent(struct cmd_rank *cmd, void *aux UNUSED )
{
return parse_rank_function(cmd, NORMAL);
}
static int
-rank_custom_rfraction(struct cmd_rank *cmd )
+rank_custom_rfraction(struct cmd_rank *cmd, void *aux UNUSED )
{
return parse_rank_function(cmd, RFRACTION);
}
static int
-rank_custom_proportion(struct cmd_rank *cmd )
+rank_custom_proportion(struct cmd_rank *cmd, void *aux UNUSED )
{
return parse_rank_function(cmd, PROPORTION);
}
static int
-rank_custom_n(struct cmd_rank *cmd )
+rank_custom_n(struct cmd_rank *cmd, void *aux UNUSED )
{
return parse_rank_function(cmd, N);
}
static int
-rank_custom_savage(struct cmd_rank *cmd )
+rank_custom_savage(struct cmd_rank *cmd, void *aux UNUSED )
{
return parse_rank_function(cmd, SAVAGE);
}
static int
-rank_custom_ntiles(struct cmd_rank *cmd )
+rank_custom_ntiles(struct cmd_rank *cmd, void *aux UNUSED )
{
if ( lex_force_match('(') )
{
}
}
static int
-regression_custom_export (struct cmd_regression *cmd UNUSED)
+regression_custom_export (struct cmd_regression *cmd UNUSED, void *aux UNUSED)
{
/* 0 on failure, 1 on success, 2 on failure that should result in syntax error */
if (!lex_force_match ('('))
int
cmd_regression (void)
{
- if (!parse_regression (&cmd))
+ if (!parse_regression (&cmd, NULL))
return CMD_FAILURE;
models = xnmalloc (cmd.n_dependent, sizeof *models);
/* Parser for the variables sub command */
static int
-regression_custom_variables (struct cmd_regression *cmd UNUSED)
+regression_custom_variables (struct cmd_regression *cmd UNUSED,
+ void *aux UNUSED)
{
lex_match ('=');
{
bool ok;
- if ( !parse_t_test(&cmd) )
+ if ( !parse_t_test(&cmd, NULL) )
return CMD_FAILURE;
if (! cmd.sbc_criteria)
}
static int
-tts_custom_groups (struct cmd_t_test *cmd UNUSED)
+tts_custom_groups (struct cmd_t_test *cmd UNUSED, void *aux UNUSED)
{
int n_group_values=0;
static int
-tts_custom_pairs (struct cmd_t_test *cmd UNUSED)
+tts_custom_pairs (struct cmd_t_test *cmd UNUSED, void *aux UNUSED)
{
struct variable **vars;
size_t n_vars;
struct cmd_set cmd;
bool ok = true;
- if (!parse_set (&cmd))
+ if (!parse_set (&cmd, NULL))
return CMD_FAILURE;
if (cmd.sbc_cca)
completely blank fields in numeric data imply. X, Wnd: Syntax is
SYSMIS or a numeric value. */
static int
-stc_custom_blanks (struct cmd_set *cmd UNUSED)
+stc_custom_blanks (struct cmd_set *cmd UNUSED, void *aux UNUSED)
{
lex_match ('=');
if ((token == T_ID && lex_id_match ("SYSMIS", tokid)))
/* Parses the EPOCH subcommand, which controls the epoch used for
parsing 2-digit years. */
static int
-stc_custom_epoch (struct cmd_set *cmd UNUSED)
+stc_custom_epoch (struct cmd_set *cmd UNUSED, void *aux UNUSED)
{
lex_match ('=');
if (lex_match_id ("AUTOMATIC"))
}
static int
-stc_custom_length (struct cmd_set *cmd UNUSED)
+stc_custom_length (struct cmd_set *cmd UNUSED, void *aux UNUSED)
{
int page_length;
}
static int
-stc_custom_seed (struct cmd_set *cmd UNUSED)
+stc_custom_seed (struct cmd_set *cmd UNUSED, void *aux UNUSED)
{
lex_match ('=');
if (lex_match_id ("RANDOM"))
}
static int
-stc_custom_width (struct cmd_set *cmd UNUSED)
+stc_custom_width (struct cmd_set *cmd UNUSED, void *aux UNUSED)
{
lex_match ('=');
if (lex_match_id ("NARROW"))
/* Parses FORMAT subcommand, which consists of a numeric format
specifier. */
static int
-stc_custom_format (struct cmd_set *cmd UNUSED)
+stc_custom_format (struct cmd_set *cmd UNUSED, void *aux UNUSED)
{
struct fmt_spec fmt;
}
static int
-stc_custom_journal (struct cmd_set *cmd UNUSED)
+stc_custom_journal (struct cmd_set *cmd UNUSED, void *aux UNUSED)
{
lex_match ('=');
if (!lex_match_id ("ON") && !lex_match_id ("OFF"))
}
static int
-stc_custom_listing (struct cmd_set *cmd UNUSED)
+stc_custom_listing (struct cmd_set *cmd UNUSED, void *aux UNUSED)
{
bool listing;
}
static int
-stc_custom_disk (struct cmd_set *cmd UNUSED)
+stc_custom_disk (struct cmd_set *cmd UNUSED, void *aux)
{
- return stc_custom_listing (cmd);
+ return stc_custom_listing (cmd, aux);
}
\f
static void