02110-1301, USA. */
#include <config.h>
-#include <data/settings.h>
-#include <libpspp/message.h>
+
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <time.h>
-#include <libpspp/alloc.h>
-#include <language/command.h>
-#include <libpspp/compiler.h>
+
#include <data/dictionary.h>
-#include <language/line-buffer.h>
+#include <data/format.h>
+#include <data/procedure.h>
+#include <data/settings.h>
+#include <data/variable.h>
+#include <language/command.h>
+#include <language/lexer/format-parser.h>
#include <language/lexer/lexer.h>
-#include <libpspp/message.h>
+#include <language/line-buffer.h>
+#include <libpspp/alloc.h>
+#include <libpspp/compiler.h>
+#include <libpspp/copyleft.h>
#include <libpspp/magic.h>
-#include <output/output.h>
+#include <libpspp/message.h>
#include <math/random.h>
-#include <data/variable.h>
-#include <data/format.h>
-#include <libpspp/copyleft.h>
-#include <data/variable.h>
-
+#include <output/output.h>
#if HAVE_LIBTERMCAP
#if HAVE_TERMCAP_H
xsort=xsort:yes/no.
*/
+/* (headers) */
+
/* (declarations) */
/* (_functions) */
static bool do_cc (const char *cc_string, int idx);
int
-cmd_set (void)
+cmd_set (struct dataset *ds)
{
struct cmd_set cmd;
bool ok = true;
- if (!parse_set (&cmd))
+ if (!parse_set (ds, &cmd, NULL))
return CMD_FAILURE;
if (cmd.sbc_cca)
set_workspace (cmd.n_workspace[0] * 1024L);
if (cmd.sbc_block)
- msg (SW, _("%s is obsolete."),"BLOCK");
+ msg (SW, _("%s is obsolete."), "BLOCK");
if (cmd.sbc_boxstring)
- msg (SW, _("%s is obsolete."),"BOXSTRING");
+ msg (SW, _("%s is obsolete."), "BOXSTRING");
if (cmd.sbc_histogram)
- msg (MW, _("%s is obsolete."),"HISTOGRAM");
- if (cmd.sbc_menus )
- msg (MW, _("%s is obsolete."),"MENUS");
- if (cmd.sbc_xsort )
- msg (SW, _("%s is obsolete."),"XSORT");
- if (cmd.sbc_mxmemory )
- msg (SE, _("%s is obsolete."),"MXMEMORY");
+ msg (SW, _("%s is obsolete."), "HISTOGRAM");
+ if (cmd.sbc_menus)
+ msg (SW, _("%s is obsolete."), "MENUS");
+ if (cmd.sbc_xsort)
+ msg (SW, _("%s is obsolete."), "XSORT");
+ if (cmd.sbc_mxmemory)
+ msg (SE, _("%s is obsolete."), "MXMEMORY");
if (cmd.sbc_scripttab)
- msg (SE, _("%s is obsolete."),"SCRIPTTAB");
+ msg (SE, _("%s is obsolete."), "SCRIPTTAB");
if (cmd.sbc_tbfonts)
- msg (SW, _("%s is obsolete."),"TBFONTS");
+ msg (SW, _("%s is obsolete."), "TBFONTS");
if (cmd.sbc_tb1 && cmd.s_tb1)
- msg (SW, _("%s is obsolete."),"TB1");
+ msg (SW, _("%s is obsolete."), "TB1");
if (cmd.sbc_case)
msg (SW, _("%s is not implemented."), "CASE");
if (cmd.sbc_compression)
- msg (MW, _("Active file compression is not implemented."));
+ msg (SW, _("Active file compression is not implemented."));
return CMD_SUCCESS;
}
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 dataset *ds UNUSED, 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 dataset *ds UNUSED, 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 dataset *ds UNUSED, 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 dataset *ds UNUSED, 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 dataset *ds UNUSED, 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 dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void *aux UNUSED)
{
struct fmt_spec fmt;
lex_match ('=');
- if (!parse_format_specifier (&fmt, 0))
+ if (!parse_format_specifier (&fmt))
return 0;
if ((formats[fmt.type].cat & FCAT_STRING) != 0)
{
}
static int
-stc_custom_journal (struct cmd_set *cmd UNUSED)
+stc_custom_journal (struct dataset *ds UNUSED, 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 dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void *aux UNUSED)
{
bool listing;
}
static int
-stc_custom_disk (struct cmd_set *cmd UNUSED)
+stc_custom_disk (struct dataset *ds, struct cmd_set *cmd UNUSED, void *aux)
{
- return stc_custom_listing (cmd);
+ return stc_custom_listing (ds, cmd, aux);
}
\f
static void
-show_blanks (void)
+show_blanks (const struct dataset *ds UNUSED)
{
if (get_blanks () == SYSMIS)
- msg (MN, _("BLANKS is SYSMIS."));
+ msg (SN, _("BLANKS is SYSMIS."));
else
- msg (MN, _("BLANKS is %g."), get_blanks ());
+ msg (SN, _("BLANKS is %g."), get_blanks ());
}
out = format_cc (cc->neg_suffix, cc->grouping, out);
*out = '\0';
- msg (MN, _("CC%c is \"%s\"."), "ABCDE"[idx], cc_string);
+ msg (SN, _("CC%c is \"%s\"."), "ABCDE"[idx], cc_string);
}
static void
-show_cca (void)
+show_cca (const struct dataset *ds UNUSED)
{
show_cc (0);
}
static void
-show_ccb (void)
+show_ccb (const struct dataset *ds UNUSED)
{
show_cc (1);
}
static void
-show_ccc (void)
+show_ccc (const struct dataset *ds UNUSED)
{
show_cc (2);
}
static void
-show_ccd (void)
+show_ccd (const struct dataset *ds UNUSED)
{
show_cc (3);
}
static void
-show_cce (void)
+show_cce (const struct dataset *ds UNUSED)
{
show_cc (4);
}
static void
-show_decimals (void)
+show_decimals (const struct dataset *ds UNUSED)
{
- msg (MN, _("DECIMAL is \"%c\"."), get_decimal ());
+ msg (SN, _("DECIMAL is \"%c\"."), get_decimal ());
}
static void
-show_endcmd (void)
+show_endcmd (const struct dataset *ds UNUSED)
{
- msg (MN, _("ENDCMD is \"%c\"."), get_endcmd ());
+ msg (SN, _("ENDCMD is \"%c\"."), get_endcmd ());
}
static void
-show_format (void)
+show_format (const struct dataset *ds UNUSED)
{
- msg (MN, _("FORMAT is %s."), fmt_to_string (get_format ()));
+ msg (SN, _("FORMAT is %s."), fmt_to_string (get_format ()));
}
static void
-show_length (void)
+show_length (const struct dataset *ds UNUSED)
{
- msg (MN, _("LENGTH is %d."), get_viewlength ());
+ msg (SN, _("LENGTH is %d."), get_viewlength ());
}
static void
-show_mxerrs (void)
+show_mxerrs (const struct dataset *ds UNUSED)
{
- msg (MN, _("MXERRS is %d."), get_mxerrs ());
+ msg (SN, _("MXERRS is %d."), get_mxerrs ());
}
static void
-show_mxloops (void)
+show_mxloops (const struct dataset *ds UNUSED)
{
- msg (MN, _("MXLOOPS is %d."), get_mxloops ());
+ msg (SN, _("MXLOOPS is %d."), get_mxloops ());
}
static void
-show_mxwarns (void)
+show_mxwarns (const struct dataset *ds UNUSED)
{
- msg (MN, _("MXWARNS is %d."), get_mxwarns ());
+ msg (SN, _("MXWARNS is %d."), get_mxwarns ());
}
static void
-show_scompression (void)
+show_scompression (const struct dataset *ds UNUSED)
{
if (get_scompression ())
- msg (MN, _("SCOMPRESSION is ON."));
+ msg (SN, _("SCOMPRESSION is ON."));
else
- msg (MN, _("SCOMPRESSION is OFF."));
+ msg (SN, _("SCOMPRESSION is OFF."));
}
static void
-show_undefined (void)
+show_undefined (const struct dataset *ds UNUSED)
{
if (get_undefined ())
- msg (MN, _("UNDEFINED is WARN."));
+ msg (SN, _("UNDEFINED is WARN."));
else
- msg (MN, _("UNDEFINED is NOWARN."));
+ msg (SN, _("UNDEFINED is NOWARN."));
}
static void
-show_weight (void)
+show_weight (const struct dataset *ds)
{
- struct variable *var = dict_get_weight (default_dict);
+ struct variable *var = dict_get_weight (dataset_dict (ds));
if (var == NULL)
- msg (MN, _("WEIGHT is off."));
+ msg (SN, _("WEIGHT is off."));
else
- msg (MN, _("WEIGHT is variable %s."), var->name);
+ msg (SN, _("WEIGHT is variable %s."), var->name);
}
static void
-show_width (void)
+show_width (const struct dataset *ds UNUSED)
{
- msg (MN, _("WIDTH is %d."), get_viewwidth ());
+ msg (SN, _("WIDTH is %d."), get_viewwidth ());
}
struct show_sbc
{
const char *name;
- void (*function) (void);
+ void (*function) (const struct dataset *);
};
-struct show_sbc show_table[] =
+const struct show_sbc show_table[] =
{
{"BLANKS", show_blanks},
{"CCA", show_cca},
};
static void
-show_all (void)
+show_all (const struct dataset *ds)
{
size_t i;
for (i = 0; i < sizeof show_table / sizeof *show_table; i++)
- show_table[i].function ();
+ show_table[i].function (ds);
}
static void
}
static void
-show_warranty (void)
+show_warranty (const struct dataset *ds UNUSED)
{
msg (MN, lack_of_warranty);
}
static void
-show_copying (void)
+show_copying (const struct dataset *ds UNUSED)
{
msg (MN, copyleft);
}
int
-cmd_show (void)
+cmd_show (struct dataset *ds)
{
if (token == '.')
{
- show_all ();
+ show_all (ds);
return CMD_SUCCESS;
}
do
{
if (lex_match (T_ALL))
- show_all ();
+ show_all (ds);
else if (lex_match_id ("CC"))
show_all_cc ();
else if (lex_match_id ("WARRANTY"))
- show_warranty ();
+ show_warranty (ds);
else if (lex_match_id ("COPYING"))
- show_copying ();
+ show_copying (ds);
else if (token == T_ID)
{
int i;
for (i = 0; i < sizeof show_table / sizeof *show_table; i++)
if (lex_match_id (show_table[i].name))
{
- show_table[i].function ();
+ show_table[i].function (ds);
goto found;
}
lex_error (NULL);