From: Ben Pfaff Date: Sat, 4 Nov 2006 19:49:45 +0000 (+0000) Subject: Implement SET ERRORS, SHOW ERRORS. X-Git-Tag: v0.6.0~704 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77fe52abf7926d6ce8f24130ad07a24a809c6eb0;p=pspp-builds.git Implement SET ERRORS, SHOW ERRORS. --- diff --git a/src/data/ChangeLog b/src/data/ChangeLog index aa03bb95..54368b4a 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,16 @@ +Sat Nov 4 11:47:09 2006 Ben Pfaff + + Implement SET ERRORS, SHOW ERRORS. Fixes bug #17609. + + * settings.c: (route_errors_to_terminal) New variable. + (route_errors_to_listing) New variable. + (get_error_routing_to_terminal) New function. + (set_error_routing_to_terminal) New function. + (get_error_routing_to_listing) New function. + (set_error_routing_to_listing) New function. + + * settings.h: (SET_ROUTE_* enums) Removed, because unused. + Tue Oct 31 19:58:27 2006 Ben Pfaff * format.c: Completely rewrite, to achieve better abstraction. diff --git a/src/data/settings.c b/src/data/settings.c index 844fdde3..1885f6ca 100644 --- a/src/data/settings.c +++ b/src/data/settings.c @@ -40,6 +40,9 @@ static int epoch = -1; static bool errorbreak = false; +static bool route_errors_to_terminal = true; +static bool route_errors_to_listing = true; + static bool scompress = true; static bool undefined = true; @@ -242,6 +245,36 @@ set_errorbreak (bool errorbreak_) errorbreak = errorbreak_; } +/* Route error messages to terminal? */ +bool +get_error_routing_to_terminal (void) +{ + return route_errors_to_terminal; +} + +/* Sets whether error messages should be routed to the + terminal. */ +void +set_error_routing_to_terminal (bool route_to_terminal) +{ + route_errors_to_terminal = route_to_terminal; +} + +/* Route error messages to listing file? */ +bool +get_error_routing_to_listing (void) +{ + return route_errors_to_listing; +} + +/* Sets whether error messages should be routed to the + listing file. */ +void +set_error_routing_to_listing (bool route_to_listing) +{ + route_errors_to_listing = route_to_listing; +} + /* Compress system files by default? */ bool get_scompression (void) diff --git a/src/data/settings.h b/src/data/settings.h index b9fc73ae..da009abd 100644 --- a/src/data/settings.h +++ b/src/data/settings.h @@ -23,15 +23,6 @@ #include #include -/* Types of routing. */ -enum - { - SET_ROUTE_SCREEN = 001, /* Output to screen devices? */ - SET_ROUTE_LISTING = 002, /* Output to listing devices? */ - SET_ROUTE_OTHER = 004, /* Output to other devices? */ - SET_ROUTE_DISABLE = 010 /* Disable output--overrides all other bits. */ - }; - void settings_init (void); void settings_done (void); @@ -56,6 +47,11 @@ void set_epoch (int); bool get_errorbreak (void); void set_errorbreak (bool); +bool get_error_routing_to_terminal (void); +void set_error_routing_to_terminal (bool); +bool get_error_routing_to_listing (void); +void set_error_routing_to_listing (bool); + bool get_scompression (void); void set_scompression (bool); diff --git a/src/language/utilities/ChangeLog b/src/language/utilities/ChangeLog index 23b9b19d..bcae1ebd 100644 --- a/src/language/utilities/ChangeLog +++ b/src/language/utilities/ChangeLog @@ -1,3 +1,10 @@ +Sat Nov 4 11:48:23 2006 Ben Pfaff + + * set.q: Update ERRORS, MESSAGES, RESULTS command syntax. + (cmd_set) Handle ERRORS command. + (show_errors) New function. + (var show_table[]) Add ERRORS to the table. + Tue Oct 31 20:10:24 2006 Ben Pfaff * set.q (cmd_set): Drop the `ok' variable, which didn't do diff --git a/src/language/utilities/set.q b/src/language/utilities/set.q index 25f09eb7..d55511e0 100644 --- a/src/language/utilities/set.q +++ b/src/language/utilities/set.q @@ -74,7 +74,7 @@ int tgetnum (const char *); endcmd=string "x==1" "one character long"; epoch=custom; errorbreak=errbrk:on/off; - errors=errors:on/off/terminal/listing/both/none; + errors=errors:terminal/listing/both/on/none/off; format=custom; headers=headers:no/yes/blank; highres=hires:on/off; @@ -86,7 +86,7 @@ int tgetnum (const char *); lowres=lores:auto/on/off; lpi=integer "x>0" "%s must be greater than 0"; menus=menus:standard/extended; - messages=messages:on/off/terminal/listing/both/none; + messages=messages:on/off/terminal/listing/both/on/none/off; mexpand=mexp:on/off; miterate=integer "x>0" "%s must be greater than 0"; mnest=integer "x>0" "%s must be greater than 0"; @@ -98,7 +98,7 @@ int tgetnum (const char *); nulline=null:on/off; printback=prtbck:on/off; prompt=string; - results=res:on/off/terminal/listing/both/none; + results=res:on/off/terminal/listing/both/on/none/off; safer=safe:on; scompression=scompress:on/off; scripttab=string "x==1" "one character long"; @@ -153,6 +153,12 @@ cmd_set (struct dataset *ds) set_endcmd (cmd.s_endcmd[0]); if (cmd.sbc_errorbreak) set_errorbreak (cmd.errbrk == STC_ON); + if (cmd.sbc_errors) + { + bool both = cmd.errors == STC_BOTH || cmd.errors == STC_ON; + set_error_routing_to_terminal (cmd.errors == STC_TERMINAL || both); + set_error_routing_to_listing (cmd.errors == STC_LISTING || both); + } if (cmd.sbc_include) set_include (cmd.inc == STC_ON); if (cmd.sbc_mxerrs) @@ -555,6 +561,18 @@ show_endcmd (const struct dataset *ds UNUSED) msg (SN, _("ENDCMD is \"%c\"."), get_endcmd ()); } +static void +show_errors (const struct dataset *ds UNUSED) +{ + bool terminal = get_error_routing_to_terminal (); + bool listing = get_error_routing_to_listing (); + msg (SN, _("ERRORS is \"%s\"."), + terminal && listing ? "BOTH" + : terminal ? "TERMINAL" + : listing ? "LISTING" + : "NONE"); +} + static void show_format (const struct dataset *ds UNUSED) { @@ -636,6 +654,7 @@ const struct show_sbc show_table[] = {"CCE", show_cce}, {"DECIMALS", show_decimals}, {"ENDCMD", show_endcmd}, + {"ERRORS", show_errors}, {"FORMAT", show_format}, {"LENGTH", show_length}, {"MXERRS", show_mxerrs},