From: Ben Pfaff Date: Sun, 7 Feb 2010 04:35:46 +0000 (-0800) Subject: Greatly simplify PSPP configuration. X-Git-Tag: v0.7.4~17 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f51ecb4802;p=pspp-builds.git Greatly simplify PSPP configuration. This gets rid of the "devices" configuration file entirely. Now you can make pspp output to, for example, an HTML file, by invoking it as "pspp -o out.html". Please read the documentation for full information. It would be good to have a way to read options from a file to support, for example, the IBM-PC or Unicode line drawing characters as implemented in "devices" in previous versions. I hope that we can introduce that soon. --- diff --git a/Makefile.am b/Makefile.am index 0022e1d7..b24afdaf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,7 +61,6 @@ DIST_HOOKS += generate-changelog include $(top_srcdir)/po/automake.mk include $(top_srcdir)/lib/automake.mk include $(top_srcdir)/doc/automake.mk -include $(top_srcdir)/config/automake.mk include $(top_srcdir)/examples/automake.mk include $(top_srcdir)/src/automake.mk diff --git a/Smake b/Smake index e8ffdd57..ad228eba 100644 --- a/Smake +++ b/Smake @@ -5,7 +5,6 @@ GNULIB = ../gnulib GNULIB_TOOL = $(GNULIB)/gnulib-tool GNULIB_MODULES = \ - argp \ assert \ byteswap \ c-ctype \ @@ -81,6 +80,8 @@ GNULIB_MODULES = \ unistr/u8-strncat \ unlocked-io \ vasprintf-posix \ + version-etc \ + version-etc-fsf \ vfprintf-posix \ vprintf-posix \ vsnprintf \ diff --git a/config/OChangeLog b/config/OChangeLog deleted file mode 100644 index dbf6c3ad..00000000 --- a/config/OChangeLog +++ /dev/null @@ -1,217 +0,0 @@ -2007-09-25 Ben Pfaff - - * devices (tty-ascii): Set length and width to "auto", so that - they reflect the current size of the terminal window as it - changes. - -2007-09-22 Ben Pfaff - - Bug #21128. Reviewed by John Darrington. - - * papersize: Removed. - - * automake.mk (dist_pkgsysconf_DATA): Remove papersize. - -2007-08-26 Ben Pfaff - - * devices: Change raw-ascii from screen to listing device (because - that's how it's used). - -2007-07-25 Ben Pfaff - - * devices: Add tty and listing devices that use VT100 (and xterm) - line-drawing characters. - -2007-07-25 Ben Pfaff - - * devices: Add an "interactive" category that defaults to - tty-ascii. Make the tty-ascii device more user-friendly. - -Tue Apr 4 20:20:49 2006 Ben Pfaff - - * automake.mk: Fix bugs in installation targets. - -Mon Apr 3 11:01:16 2006 Ben Pfaff - - * automake.mk: (pkgsysconf_DATA) Add AFM files in config/psfonts. - Remove config/html-prologue, config/ps-prologue. - - * html-prologue: Removed. - - * ps-prologue: Removed. - - * psfonts/Courier-Bold.afm, psfonts/Courier-BoldOblique.afm, - psfonts/Courier-Oblique.afm, psfonts/Courier.afm, - psfonts/Helvetica-Bold.afm, psfonts/Helvetica-BoldOblique.afm, - psfonts/Helvetica-Oblique.afm, psfonts/Helvetica.afm, - psfonts/Times-Bold.afm, psfonts/Times-BoldItalic.afm, - psfonts/Times-Italic.afm, psfonts/Times-Roman.afm: New files. - -Sat Feb 11 21:58:29 2006 Ben Pfaff - - * html-prologue: Don't use ${source-file}, which is no longer - supported. - -Tue Dec 30 22:37:04 2003 Ben Pfaff - - * devices: Add "squeeze=on top-margin=0 bottom-margin=0" to - raw-ascii to make test output more readable. - -Sun May 24 22:40:13 1998 Ben Pfaff - - * ps-prologue: Add %%DocumentMedia: comment. - -Wed May 20 00:02:51 1998 Ben Pfaff - - * ps-prologue: Comment out misleading Bounding-Box comment for - now. SF arguments rearranged. BP removed. - -Wed Apr 15 13:00:46 1998 Ben Pfaff - - * Makefile.am: (private-install) Make it work for separate source - and build directories. - - * ps-prologue: New TL macro for a thick line. New thick-width arg - to BP. - -Sun Jan 4 18:11:11 1998 Ben Pfaff - - * ps-prologue: Minor reorganization. New GB macro to draw a gray - box. - -Wed Dec 24 22:35:13 1997 Ben Pfaff - - * devices: Added devicetype options and documentation for them. - -Fri Dec 5 21:51:08 1997 Ben Pfaff - - * Makefile.am: (pkgsysconf_DATA) Add html-prologue. - (EXTRA_DIST) Add html-prologue. - - * devices: Add `html' device. Add `listing', `screen', and - `printer' flags to devices as appropriate. - - * html-prologue: New file. - - * ps-prologue: Comment fixes. - -Thu Sep 18 21:31:02 1997 Ben Pfaff - - * Makefile.am: (pkgsysconfdir) Changed from $(pkgdatadir) to - $(sysconfdir)/$(PACKAGE). - -Thu Aug 14 22:05:54 1997 Ben Pfaff - - * devices: (tty) Define as null instead of not defining. - -Sun Aug 3 11:33:28 1997 Ben Pfaff - - * devices: tty-ascii has no bold or italic by default. - -Wed Jun 25 22:50:19 1997 Ben Pfaff - - * Makefile.am: (EXTRA_DIST) New target. - -Mon May 5 21:56:54 1997 Ben Pfaff - - * devices, papersize, ps-prologue: Comment fixes. - -Fri May 2 22:05:44 1997 Ben Pfaff - - * Makefile.am: Removed ps-fontmap. - - * ps-fontmap: Removed. - - * ps-prologue: Added comments. Fixed DSC comments. - (BP) Two new arguments; fixed problem with SF argument conflict - with SF function. - -Thu May 1 14:57:52 1997 Ben Pfaff - - * ps-prologue: (BP) New argument, SF or scale factor. - -Fri Apr 18 16:48:41 1997 Ben Pfaff - - * Makefile.am: New file. - - * environment: Comment fix. - -Sat Feb 15 21:26:53 1997 Ben Pfaff - - * devices: Added ml520 and ml520-ul printer devices. - -Sat Jan 11 15:44:15 1997 Ben Pfaff - - * devices: Default listing device is list-ascii, not list-ibmpc. - -Sun Dec 29 21:36:48 1996 Ben Pfaff - - * devices: Changed default devices. - -Sat Sep 7 22:35:12 1996 Ben Pfaff - - * ps-prologue: Added `!encodings' line to cause encodings to be - output. - (T) Fixed. Yes, really this time. - -Thu Sep 5 22:05:56 1996 Ben Pfaff - - * ps-prologue: (T) Now works correctly. - (SF) Parameters changed to: size in psus, target font name, - encoding, PostScript font name. - -Wed Sep 4 21:45:35 1996 Ben Pfaff - - * prologue.ps: Renamed ps-prologue, all references changed. - (T) New definition. - - * ps-encodings: New PostScript configuration file (not present in - distribution). - -Sat Aug 31 23:52:38 1996 Ben Pfaff - - * prologue.ps: One minor comment change. - -Thu Aug 29 21:36:41 1996 Ben Pfaff - - * prologue.ps: Portions other than DSC comments are essentially - completely new. - -Sat Aug 24 23:26:00 1996 Ben Pfaff - - * devices: Added PostScript driver. - -Sun Aug 11 21:31:22 1996 Ben Pfaff - - * prologue.ps: Calls `setlinecap' in setup code. - -Sat Aug 10 23:28:17 1996 Ben Pfaff - - * prologue.ps: DSC comment changes. New call to `setlinewidth' in - setup code. - -Thu Aug 8 22:31:11 1996 Ben Pfaff - - * prologue.ps: Changes to scaling & translating code. - -Sat Aug 3 20:50:35 1996 Ben Pfaff - - * environment: New file. Yet another new time- and memory-hogging - redundant config file; why not? - - * papersize: Comment changes. - - * prologue.ps: Changed vars from $varname$ to ${varname} format. - Miscellaneous changes. - - * ps-fontmap: Comment changes. Fixed ZC family. - -Sat Jul 27 22:32:38 1996 Ben Pfaff - - * ps-fontmap: New configuration file. Added to Makefile.am. - ----------------------------------------------------------------------- -Local Variables: -mode: change-log -version-control: never -End: diff --git a/config/automake.mk b/config/automake.mk deleted file mode 100644 index 509706e5..00000000 --- a/config/automake.mk +++ /dev/null @@ -1,7 +0,0 @@ -## Process this file with automake to produce Makefile.in -*- makefile -*- - - -dist_pkgsysconf_DATA = \ - config/devices - -EXTRA_DIST += config/OChangeLog diff --git a/config/devices b/config/devices deleted file mode 100644 index 3bc685a0..00000000 --- a/config/devices +++ /dev/null @@ -1,210 +0,0 @@ -# PSPP's standard output drivers. -# -# An introduction to the use of PSPP output drivers and this file -# follows. However, refer to PSPP's Texinfo documentation for full -# information. -# -# Each output driver specification must be on a single line; however, -# lines may be spliced with a \ at the end of a line. Line splicing -# is performed *before* comments (introduced by `#') are removed. -# -# Format is `DRIVERNAME:CLASSNAME:DEVICETYPE:OPTIONS'. -# -# DRIVERNAME is the name that identifies the driver to the user. It -# is the name used on the -o command-line option. -# -# CLASSNAME is the internal name of the type of driver. Device -# classes can be listed with `pspp -l'. -# -# DEVICETYPE identifies what type or types the devices is. Zero or -# more of the following keywords may be given here: screen, printer, -# or listing. -# -# OPTIONS is a list of key/value pairs to pass to the driver. Use -# spaces to separate pairs, and '=' to separate keys and values. -# Quotes " or ' can be used to delimit values that contain spaces. -# Example: paper-size="Envelope #10" charset=latin1 -# -# Driver categories may be defined with lines of the form: -# -# category=driver1 driver2 driver3 ... driverN -# -# To disable a driver, define a category with nothing on the right -# side. -# -# Macros may be defined with lines of the form: -# -# define macro-name definition -# -# Macros may not be recursive; they may not take arguments. (However, -# `definition' is macro-expanded *at time of definition*.) Macros are -# referenced with $var or ${var} syntax; the latter is preferred. - -# Preferred devices. -default=list-ascii -interactive=tty-ascii - -# Output files. -define tty-output-file "|more" -define list-output-file "pspp.list" - -# Generic ASCII devices -tty-ascii:ascii:screen:squeeze=on headers=off top-margin=0 bottom-margin=0 \ - paginate=off length=auto width=auto output-file=${tty-output-file} -list-ascii:ascii:listing:length=66 width=79 output-file=${list-output-file} -raw-ascii:ascii:listing:width=9999 length=9999 output-file=${list-output-file} \ - emphasis=none headers=off paginate=off squeeze=on \ - top-margin=0 bottom-margin=0 - -# ASCII devices that support bold & underline via backspacing. -tty-ascii-bi:ascii:screen:output-file=${tty-output-file} -list-ascii-bi:ascii:listing:length=66 width=79 output-file=${list-output-file} - -# VT100 graphics devices. -define vt100-graphics \ - init='\033(B\033)0' \ - box[1000]='\16q\17' box[1010]='\16q\17' box[0010]='\16q\17' \ - box[0100]='\16x\17' box[0101]='\16x\17' box[0001]='\16x\17' \ - box[0011]='\16j\17' box[1100]='\16l\17' box[0110]='\16k\17' \ - box[1001]='\16m\17' box[1110]='\16w\17' box[1101]='\16t\17' \ - box[0111]='\16u\17' box[1011]='\16v\17' box[1111]='\16n\17' - -tty-vt100:ascii:screen:squeeze=on headers=off top-margin=0 bottom-margin=0 \ - paginate=off output-file=${tty-output-file} ${vt100-graphics} -list-vt100:ascii:listing:length=66 width=79 output-file=${list-output-file} \ - ${vt100-graphics} - -# HTML device. -html:html:: - -# PostScript device. -list-ps:postscript:: - -# Cairo devices. -pdf:cairo:listing: -svg:cairo:listing:output-type=svg output-file="pspp.svg" -ps-cairo:cairo:listing:output-type=ps output-file="pspp-cairo.ps" - -odt:odf:listing:debug=off output-file="pspp.odt" - -# Devices that support the IBM PC line-drawing characters. -define ibmpc-graphics \ - box[0000]='\x20' box[0001]='\xb3' box[0002]='\xba' \ - box[0010]='\xc4' box[0011]='\xd9' box[0012]='\xbd' \ - box[0020]='\xcd' box[0021]='\xbe' box[0022]='\xbc' \ - box[0100]='\xb3' box[0101]='\xb3' box[0102]='\xc4' \ - box[0110]='\xbf' box[0111]='\xb4' box[0112]='\xb6' \ - box[0120]='\xb8' box[0121]='\xb5' box[0122]='\xb9' \ - box[0200]='\xba' box[0201]='\xba' box[0202]='\xba' \ - box[0210]='\xb7' box[0211]='\xb6' box[0212]='\xb6' \ - box[0220]='\xbb' box[0221]='\xb9' box[0222]='\xb9' \ - box[1000]='\xc4' box[1001]='\xc0' box[1002]='\xd3' \ - box[1010]='\xc4' box[1011]='\xc1' box[1012]='\xd0' \ - box[1020]='\xcd' box[1021]='\xcf' box[1022]='\xca' \ - box[1100]='\xda' box[1101]='\xc3' box[1102]='\xc7' \ - box[1110]='\xc2' box[1111]='\xc5' box[1112]='\xd7' \ - box[1120]='\xd1' box[1121]='\xd8' box[1122]='\xce' \ - box[1200]='\xd6' box[1201]='\xc7' box[1202]='\xc7' \ - box[1210]='\xd2' box[1211]='\xd7' box[1212]='\xd7' \ - box[1220]='\xca' box[1221]='\xce' box[1222]='\xce' \ - box[2000]='\xcd' box[2001]='\xd4' box[2002]='\xc8' \ - box[2010]='\xcd' box[2011]='\xcf' box[2012]='\xca' \ - box[2020]='\xcd' box[2021]='\xcf' box[2022]='\xca' \ - box[2100]='\xd5' box[2101]='\xc6' box[2102]='\xcc' \ - box[2110]='\xd1' box[2111]='\xd8' box[2112]='\xce' \ - box[2120]='\xd1' box[2121]='\xd8' box[2122]='\xce' \ - box[2200]='\xc9' box[2201]='\xcc' box[2202]='\xcc' \ - box[2210]='\xcb' box[2211]='\xce' box[2212]='\xce' \ - box[2220]='\xcb' box[2221]='\xce' box[2222]='\xce' - -tty-ibmpc:ascii:screen:length=$viewlength width=$viewwidth ${ibmpc-graphics} \ - output-file=${tty-output-file} -list-ibmpc:ascii:listing:length=66 width=79 output-file=${list-output-file} \ - ${ibmpc-graphics} - -# Devices that support Unicode line-drawing characters in UTF-8 encoding. -# PSPP doesn't support a \u escape but if it did then this is how these -# would appear: -# -# define utf8-graphics \ -# box[0000]='\u0020' box[1000]='\u2576' box[2000]='\u2550' \ -# box[0100]='\u2577' box[1100]='\u256D' box[2100]='\u2552' \ -# box[0200]='\u2551' box[1200]='\u2553' box[2200]='\u2554' \ -# box[0010]='\u2574' box[1010]='\u2500' box[2010]='\u2550' \ -# box[0110]='\u256E' box[1110]='\u252C' box[2110]='\u2564' \ -# box[0210]='\u2556' box[1210]='\u2565' box[2210]='\u2566' \ -# box[0020]='\u2550' box[1020]='\u2550' box[2020]='\u2550' \ -# box[0120]='\u2555' box[1120]='\u2564' box[2120]='\u2564' \ -# box[0220]='\u2557' box[1220]='\u2566' box[2220]='\u2566' \ -# box[0001]='\u2575' box[1001]='\u2570' box[2001]='\u2558' \ -# box[0101]='\u2502' box[1101]='\u251C' box[2101]='\u255E' \ -# box[0201]='\u2551' box[1201]='\u255F' box[2201]='\u2560' \ -# box[0011]='\u256F' box[1011]='\u2534' box[2011]='\u2567' \ -# box[0111]='\u2524' box[1111]='\u253C' box[2111]='\u256A' \ -# box[0211]='\u2562' box[1211]='\u256B' box[2211]='\u256C' \ -# box[0021]='\u255B' box[1021]='\u2567' box[2021]='\u2567' \ -# box[0121]='\u2561' box[1121]='\u256A' box[2121]='\u256A' \ -# box[0221]='\u2563' box[1221]='\u256C' box[2221]='\u256C' \ -# box[0002]='\u2551' box[1002]='\u2559' box[2002]='\u255A' \ -# box[0102]='\u2551' box[1102]='\u255F' box[2102]='\u2560' \ -# box[0202]='\u2551' box[1202]='\u255F' box[2202]='\u2560' \ -# box[0012]='\u255C' box[1012]='\u2568' box[2012]='\u2569' \ -# box[0112]='\u2562' box[1112]='\u256A' box[2112]='\u256C' \ -# box[0212]='\u2562' box[1212]='\u256B' box[2212]='\u256C' \ -# box[0022]='\u255D' box[1022]='\u2569' box[2022]='\u2569' \ -# box[0122]='\u2563' box[1122]='\u256C' box[2122]='\u256C' \ -# box[0222]='\u2563' box[1222]='\u256C' box[2222]='\u256C' -# -# Instead, we encode them in UTF-8 by hand below. -# -# Here is a little Perl program that I used to do this translation: -# -# sub utf8_encode { -# my $val = hex($_[0]); -# my $d0 = 0xe0 | ($val >> 12); -# my $d1 = 0x80 | (($val >> 6) & 0x3f); -# my $d2 = 0x80 | ($val & 0x3f); -# return sprintf('\x%02x\x%02x\x%02x', $d0, $d1, $d2); -# } -# while (<>) { -# s/\\u(....)/utf8_encode($1)/ge; -# print $_; -# } -# -define utf8-graphics \ - box[0000]='\xe0\x80\xa0' box[1000]='\xe2\x95\xb6' box[2000]='\xe2\x95\x90' \ - box[0100]='\xe2\x95\xb7' box[1100]='\xe2\x95\xad' box[2100]='\xe2\x95\x92' \ - box[0200]='\xe2\x95\x91' box[1200]='\xe2\x95\x93' box[2200]='\xe2\x95\x94' \ - box[0010]='\xe2\x95\xb4' box[1010]='\xe2\x94\x80' box[2010]='\xe2\x95\x90' \ - box[0110]='\xe2\x95\xae' box[1110]='\xe2\x94\xac' box[2110]='\xe2\x95\xa4' \ - box[0210]='\xe2\x95\x96' box[1210]='\xe2\x95\xa5' box[2210]='\xe2\x95\xa6' \ - box[0020]='\xe2\x95\x90' box[1020]='\xe2\x95\x90' box[2020]='\xe2\x95\x90' \ - box[0120]='\xe2\x95\x95' box[1120]='\xe2\x95\xa4' box[2120]='\xe2\x95\xa4' \ - box[0220]='\xe2\x95\x97' box[1220]='\xe2\x95\xa6' box[2220]='\xe2\x95\xa6' \ - box[0001]='\xe2\x95\xb5' box[1001]='\xe2\x95\xb0' box[2001]='\xe2\x95\x98' \ - box[0101]='\xe2\x94\x82' box[1101]='\xe2\x94\x9c' box[2101]='\xe2\x95\x9e' \ - box[0201]='\xe2\x95\x91' box[1201]='\xe2\x95\x9f' box[2201]='\xe2\x95\xa0' \ - box[0011]='\xe2\x95\xaf' box[1011]='\xe2\x94\xb4' box[2011]='\xe2\x95\xa7' \ - box[0111]='\xe2\x94\xa4' box[1111]='\xe2\x94\xbc' box[2111]='\xe2\x95\xaa' \ - box[0211]='\xe2\x95\xa2' box[1211]='\xe2\x95\xab' box[2211]='\xe2\x95\xac' \ - box[0021]='\xe2\x95\x9b' box[1021]='\xe2\x95\xa7' box[2021]='\xe2\x95\xa7' \ - box[0121]='\xe2\x95\xa1' box[1121]='\xe2\x95\xaa' box[2121]='\xe2\x95\xaa' \ - box[0221]='\xe2\x95\xa3' box[1221]='\xe2\x95\xac' box[2221]='\xe2\x95\xac' \ - box[0002]='\xe2\x95\x91' box[1002]='\xe2\x95\x99' box[2002]='\xe2\x95\x9a' \ - box[0102]='\xe2\x95\x91' box[1102]='\xe2\x95\x9f' box[2102]='\xe2\x95\xa0' \ - box[0202]='\xe2\x95\x91' box[1202]='\xe2\x95\x9f' box[2202]='\xe2\x95\xa0' \ - box[0012]='\xe2\x95\x9c' box[1012]='\xe2\x95\xa8' box[2012]='\xe2\x95\xa9' \ - box[0112]='\xe2\x95\xa2' box[1112]='\xe2\x95\xaa' box[2112]='\xe2\x95\xac' \ - box[0212]='\xe2\x95\xa2' box[1212]='\xe2\x95\xab' box[2212]='\xe2\x95\xac' \ - box[0022]='\xe2\x95\x9d' box[1022]='\xe2\x95\xa9' box[2022]='\xe2\x95\xa9' \ - box[0122]='\xe2\x95\xa3' box[1122]='\xe2\x95\xac' box[2122]='\xe2\x95\xac' \ - box[0222]='\xe2\x95\xa3' box[1222]='\xe2\x95\xac' box[2222]='\xe2\x95\xac' - -tty-utf8:ascii:screen:length=$viewlength width=$viewwidth ${utf8-graphics} \ - output-file=${tty-output-file} emphasis=none -list-utf8:ascii:listing:length=66 width=79 output-file=${list-output-file} \ - ${utf8-graphics} emphasis=none - -# Local Variables: -# fill-prefix: "# " -# End: diff --git a/doc/automake.mk b/doc/automake.mk index 0963e1fd..b1065a8d 100644 --- a/doc/automake.mk +++ b/doc/automake.mk @@ -6,7 +6,6 @@ doc_pspp_TEXINFOS = doc/version.texi \ doc/bugs.texi \ doc/command-index.texi \ doc/concept-index.texi \ - doc/configuring.texi \ doc/data-io.texi \ doc/data-selection.texi \ doc/expressions.texi \ diff --git a/doc/configuring.texi b/doc/configuring.texi deleted file mode 100644 index fc3d160b..00000000 --- a/doc/configuring.texi +++ /dev/null @@ -1,884 +0,0 @@ -@node Configuration -@appendix Configuring PSPP -@cindex configuration -@cindex PSPP, configuring - -This chapter describe how to configure PSPP for your system. - -@menu -* File locations:: How PSPP finds config files. -* Configuration techniques:: Many different methods of configuration... -* Configuration files:: How configuration files are read. -* Environment variables:: All about environment variables. -* Output devices:: Describing your terminal(s) and printer(s). -* Cairo driver class:: Configuration of Cairo devices. -* ASCII driver class:: Configuration of character-code devices. -* HTML driver class:: Configuration for HTML output. -* Miscellaneous configuring:: Even more configuration variables. -@end menu - -@node File locations -@section Locating configuration files - -PSPP searches each directory in the configuration file path for most -configuration files. The default configuration file path searches first -@file{$HOME/.pspp}, then the package system configuration directory (usually -@file{/usr/local/etc/pspp} or @file{/etc/pspp}). The value of -environment variable @env{PSPP_CONFIG_PATH}, if defined, overrides this -default path. Finally, @samp{-B @var{path}} or -@samp{--config-dir=@var{path}} specified on the command line has highest -priority. - -@node Configuration techniques -@section Configuration techniques - -There are many ways that PSPP can be configured. These are -described in the list below. Values given by earlier items take -precedence over those given by later items. - -@enumerate -@item -Syntax commands that modify settings, such as @cmd{SET}. @xref{SET}. - -@item -Command-line options. @xref{Invocation}. - -@item -PSPP-specific environment variable contents. @xref{Environment -variables}. - -@item -General environment variable contents. @xref{Environment variables}. - -@item -Configuration file contents. @xref{Configuration files}. - -@item -Fallback defaults. -@end enumerate - -Some of the above may not apply to a particular setting. - -@node Configuration files -@section Configuration files - -Most configuration files have a common form: - -@itemize @bullet -@item -Each line forms a separate command or directive. This means that lines -cannot be broken up, unless they are spliced together with a trailing -backslash, as described below. - -@item -Before anything else is done, trailing white space is removed. - -@item -When a line ends in a backslash (@samp{\}), the backslash is removed, -and the next line is read and appended to the current line. - -@itemize @minus -@item -White space preceding the backslash is retained. - -@item -This rule continues to be applied until the line read does not end in a -backslash. - -@item -It is an error if the last line in the file ends in a backslash. -@end itemize - -@item -Comments are introduced by an octothorpe (@samp{#}), and continue until the -end of the line. - -@itemize @minus -@item -An octothorpe inside balanced pairs of double quotation marks (@samp{"}) -or single quotation marks (@samp{'}) does not introduce a comment. - -@item -The backslash character can be used inside balanced quotes of either -type to escape the following character as a literal character. - -(This is distinct from the use of a backslash as a line-splicing -character.) - -@item -Line splicing takes place before comment removal. -@end itemize - -@item -Blank lines, and lines that contain only white space, are ignored. -@end itemize - -@node Environment variables -@section Environment variables - -You may think the concept of environment variables is a fairly simple -one. However, the author of PSPP has found a way to complicate -even something so simple. Environment variables are further described -in the sections below: - -@menu -* Environment substitutions:: How environment substitutions are made. -* Predefined variables:: A few variables are automatically defined. -@end menu - -@node Environment substitutions -@subsection Environment substitutions - -Much of the power of environment variables lies in the way that they may -be substituted into configuration files. Variable substitutions are -described below. - -The line is scanned from left to right. In this scan, all characters -other than dollar signs (@samp{$}) are retained without change. Dollar -signs introduce environment variable references. References -take three forms: - -@table @code -@item $@var{var} -Replaced by the value of environment variable @var{var}. @var{var} must -consist of either one or more letters, or exactly one non-alphabetic -character other than a left brace (@samp{@{}). - -@item $@{@var{var}@} -Same as above, but @var{var} may contain any character (except -@samp{@}}). - -@item $$ -Replaced by a single dollar sign. -@end table - -Undefined variables expand to a empty value. - -@node Predefined variables -@subsection Predefined environment variables - -There are two environment variables predefined for use in environment -substitutions: - -@table @samp -@item VER -Defined as the version number of PSPP, as a string, in a format -something like @samp{0.9.4}. - -@item ARCH -Defined as the host architecture of PSPP, as a string, in standard -cpu-manufacturer-OS format. For instance, Debian GNU/Linux 1.1 on an -Intel machine defines this as @samp{i586-unknown-linux}. This is -somewhat dependent on the system used to compile PSPP. -@end table - -Nothing prevents these values from being overridden, although it's a -good idea not to do so. - -@node Output devices -@section Output devices - -Configuring output devices is the most complicated aspect of configuring -PSPP. The output device configuration file is named -@file{devices}. It is searched for using the usual algorithm for -finding configuration files (@pxref{File locations}). Each line in the -file is read in the usual manner for configuration files -(@pxref{Configuration files}). - -Lines in @file{devices} are divided into three categories, described -briefly in the table below: - -@table @i -@item driver category definitions -Define a driver in terms of other drivers. - -@item macro definitions -Define environment variables local to the output driver -configuration file. - -@item device definitions -Describe the configuration of an output device. -@end table - -The following sections further elaborate the contents of the -@file{devices} file. - -@menu -* Driver categories:: How to organize the driver namespace. -* Macro definitions:: Environment variables local to @file{devices}. -* Device definitions:: Output device descriptions. -* Dimensions:: Lengths, widths, sizes, @enddots{} -* Distinguishing line types:: Details on @file{devices} parsing. -* Tokenizing lines:: Dividing @file{devices} lines into tokens. -@end menu - -@node Driver categories -@subsection Driver categories - -Drivers can be divided into categories. Drivers are specified by their -names, or by the names of the categories that they are contained in. -Only certain drivers are enabled each time PSPP is run; by -default, these are the drivers in the category `default'. To enable a -different set of drivers, use the @samp{-o @var{device}} command-line -option (@pxref{Invocation}). - -Categories are specified with a line of the form -@samp{@var{category}=@var{driver1} @var{driver2} @var{driver3} @var{@dots{}} -@var{driver@var{n}}}. This line specifies that the category -@var{category} is composed of drivers named @var{driver1}, -@var{driver2}, and so on. There may be any number of drivers in the -category, from zero on up. - -Categories may also be specified on the command line -(@pxref{Invocation}). - -This is all you need to know about categories. If you're still curious, -read on. - -First of all, the term `categories' is a bit of a misnomer. In fact, -the internal representation is nothing like the hierarchy that the term -seems to imply: a linear list is used to keep track of the enabled -drivers. - -When PSPP first begins reading @file{devices}, this list contains -the name of any drivers or categories specified on the command line, or -the single item `default' if none were specified. - -Each time a category definition is specified, the list is searched for -an item with the value of @var{category}. If a matching item is found, -it is deleted. If there was a match, the list of drivers (@var{driver1} -through @var{driver@var{n}}) is then appended to the list. - -Each time a driver definition line is encountered, the list is searched. -If the list contains an item with that driver's name, the driver is -enabled and the item is deleted from the list. Otherwise, the driver -is not enabled. - -It is an error if the list is not empty when the end of @file{devices} -is reached. - -@node Macro definitions -@subsection Macro definitions - -Macro definitions take the form @samp{define @var{macroname} -@var{definition}}. In such a macro definition, the environment variable -@var{macroname} is defined to expand to the value @var{definition}. -Before the definition is made, however, any macros used in -@var{definition} are expanded. - -Please note the following nuances of macro usage: - -@itemize @bullet -@item -For the purposes of this section, @dfn{macro} and @dfn{environment -variable} are synonyms. - -@item -Macros may not take arguments. - -@item -Macros may not recurse. - -@item -Macros are just environment variable definitions like other environment -variable definitions, with the exception that they are limited in scope -to the @file{devices} configuration file. - -@item -Macros override other all environment variables of the same name (within -the scope of @file{devices}). - -@item -Earlier macro definitions for a particular @var{key} override later -ones. In particular, macro definitions on the command line override -those in the device definition file. @xref{Non-option Arguments}. - -@item -There are two predefined macros, whose values are determined at runtime: - -@table @samp -@item viewwidth -Defined as the width of the console screen, in columns of text. - -@item viewlength -Defined as the length of the console screen, in lines of text. -@end table -@end itemize - -@node Device definitions -@subsection Driver definitions - -Driver definitions are the ultimate purpose of the @file{devices} -configuration file. These are where the real action is. Driver -definitions tell PSPP where it should send its output. - -Each driver definition line is divided into four fields. These fields -are delimited by colons (@samp{:}). Each line is subjected to -environment variable interpolation before it is processed further -(@pxref{Environment substitutions}). From left to right, the four -fields are, in brief: - -@table @i -@item driver name -A unique identifier, used to determine whether to enable the driver. - -@item class name -One of the predefined driver classes supported by PSPP. The -currently supported driver classes include `cairo' and `ascii'. - -@item device type(s) -Zero or more of the following keywords, delimited by spaces: - -@table @code -@item screen - -Indicates that the device is a screen display. This may reduce the -amount of buffering done by the driver, to make interactive use more -convenient. - -@item printer - -Indicates that the device is a printer. - -@item listing - -Indicates that the device is a listing file. -@end table - -These options are just hints to PSPP and do not cause the output to be -directed to the screen, or to the printer, or to a listing file---those -must be set elsewhere in the options. They are used primarily to decide -which devices should be enabled at any given time. @xref{SET}, for more -information. - -@item options -An optional set of options to pass to the driver itself. The exact -format for the options varies among drivers. -@end table - -The driver is enabled if: - -@enumerate -@item -Its driver name is specified on the command line, or - -@item -It's in a category specified on the command line, or - -@item -If no categories or driver names are specified on the command line, it -is in category @code{default}. -@end enumerate - -For more information on driver names, see @ref{Driver categories}. - -The class name must be one of those supported by PSPP. The -classes supported depend on the options with which PSPP was -compiled. See later sections in this chapter for descriptions of the -available driver classes. - -Options are dependent on the driver. See the driver descriptions for -details. - -@node Dimensions -@subsection Dimensions - -Quite often in configuration it is necessary to specify a length or a -size. PSPP uses a common syntax for all such, calling them -collectively by the name @dfn{dimensions}. - -@itemize @bullet -@item -You can specify dimensions in decimal form (@samp{12.5}) or as -fractions, either as mixed numbers (@samp{12-1/2}) or raw fractions -(@samp{25/2}). - -@item -A number of different units are available. These are suffixed to the -numeric part of the dimension. There must be no spaces between the -number and the unit. The available units are identical to those offered -by the popular typesetting system @TeX{}: - -@table @code -@item in -inch (1 @code{in} = 2.54 @code{cm}) - -@item " -inch (1 @code{in} = 2.54 @code{cm}) - -@item pt -printer's point (1 @code{in} = 72.27 @code{pt}) - -@item pc -pica (12 @code{pt} = 1 @code{pc}) - -@item bp -PostScript point (1 @code{in} = 72 @code{bp}) - -@item cm -centimeter - -@item mm -millimeter (10 @code{mm} = 1 @code{cm}) - -@item dd -didot point (1157 @code{dd} = 1238 @code{pt}) - -@item cc -cicero (1 @code{cc} = 12 @code{dd}) - -@item sp -scaled point (65536 @code{sp} = 1 @code{pt}) -@end table - -@item -If no explicit unit is given, PSPP attempts to guess the best unit: - -@itemize @minus -@item -Numbers less than 50 are assumed to be in inches. - -@item -Numbers 50 or greater are assumed to be in millimeters. -@end itemize -@end itemize - -@node Distinguishing line types -@subsection How lines are divided into types - -The lines in @file{devices} are distinguished in the following manner: - -@enumerate -@item -Leading white space is removed. - -@item -If the resulting line begins with the exact string @code{define}, -followed by one or more white space characters, the line is processed as -a macro definition. - -@item -Otherwise, the line is scanned for the first instance of a colon -(@samp{:}) or an equals sign (@samp{=}). - -@item -If a colon is encountered first, the line is processed as a driver -definition. - -@item -Otherwise, if an equals sign is encountered, the line is processed as a -macro definition. - -@item -Otherwise, the line is ill-formed. -@end enumerate - -@node Tokenizing lines -@subsection How lines are divided into tokens - -Each driver definition line is run through a simple tokenizer. This -tokenizer recognizes two basic types of tokens. - -The first type is an equals sign (@samp{=}). Equals signs are both -delimiters between tokens and tokens in themselves. - -The second type is an identifier or string token. Identifiers and -strings are equivalent after tokenization, though they are written -differently. An identifier is any string of characters other than -white space or equals sign. - -A string is introduced by a single- or double-quote character (@samp{'} -or @samp{"}) and, in general, continues until the next occurrence of -that same character. The following standard C escapes can also be -embedded within strings: - -@table @code -@item \' -A single-quote (@samp{'}). - -@item \" -A double-quote (@samp{"}). - -@item \? -A question mark (@samp{?}). Included for hysterical raisins. - -@item \\ -A backslash (@samp{\}). - -@item \a -Audio bell (ASCII 7). - -@item \b -Backspace (ASCII 8). - -@item \f -Formfeed (ASCII 12). - -@item \n -New-line (ASCII 10) - -@item \r -Carriage return (ASCII 13). - -@item \t -Tab (ASCII 9). - -@item \v -Vertical tab (ASCII 11). - -@item \@var{o}@var{o}@var{o} -Each @samp{o} must be an octal digit. The character is the one having -the octal value specified. Any number of octal digits is read and -interpreted; only the lower 8 bits are used. - -@item \x@var{h}@var{h} -Each @samp{h} must be a hex digit. The character is the one having the -hexadecimal value specified. Any number of hex digits is read and -interpreted; only the lower 8 bits are used. -@end table - -Tokens, outside of quoted strings, are delimited by white space or equals -signs. - -@node Cairo driver class -@section The Cairo driver class - -The @code{cairo} driver class can produce output in PDF, PostScript, -and SVG formats. It has full support for international character -sets. - -The Cairo driver is only available if your copy of PSPP was built with -the Cairo library. - -The available options are listed below. - -@table @code -@item output-file=@var{file-name} - -File to which output should be sent. Default: @code{"pspp.pdf"}. - -@item output-type=@var{output-type} - -Type of output to write to the output file, one of @code{pdf}, -@code{ps}, or @code{svg}. Default: @code{pdf}. - -@item paper-size=@var{paper-size} - -Paper size. You may specify a name (e.g.@: @code{a4}, @code{letter}) -or measurements (e.g.@: @code{210x297}, @code{8.5x11in}). - -The default paper size is taken from the @env{PAPERSIZE} environment -variable or the file indicated by the @env{PAPERCONF} environment -variable, if either variable is set. If not, and your system supports -the @code{LC_PAPER} locale category, then the default paper size is -taken from the locale. Otherwise, if @file{/etc/papersize} exists, -the default paper size is read from it. As a last resort, A4 paper is -assumed. - -@item orientation=@var{orientation} - -Either @code{portrait} or @code{landscape}. Default: @code{portrait}. - -@item headers=@var{boolean} - -Controls whether the standard headers showing the time and date and -title and subtitle are printed at the top of each page. Default: -@code{on}. - -@item left-margin=@var{dimension} -@itemx right-margin=@var{dimension} -@itemx top-margin=@var{dimension} -@itemx bottom-margin=@var{dimension} - -Sets the margins around the page. The headers, if enabled, are not -included in the margins; they are in addition to the margins. For a -description of dimensions, see @ref{Dimensions}. Default: @code{0.5in}. - -@item prop-font=@var{font-name} -@itemx emph-font=@var{font-name} -@itemx fixed-font=@var{font-name} - -Sets the font used for proportional, emphasized, or fixed-pitch text. -Most systems support CSS-like font names such as ``serif'' and -``monospace'', but a wide range of system-specific font are likely to -be supported as well. - -Default: proportional font @code{serif}, emphasis font @code{serif -italic}, fixed-pitch font @code{monospace}. - -@item font-size=@var{font-size} - -Sets the size of the default fonts, in thousandths of a point. Default: -10000 (10 point). - -@item line-gutter=@var{dimension} - -Sets the width of white space on either side of lines that border text -or graphics objects. @xref{Dimensions}. Default: @code{1pt}. - -@item line-spacing=@var{dimension} - -Sets the spacing between the lines in a double line in a table. -Default: @code{1pt}. - -@item line-width=@var{dimension} - -Sets the width of the lines used in tables. Default: @code{0.5pt}. -@end table - -@node ASCII driver class -@section The ASCII driver class - -The ASCII driver class produces output that can be displayed on a -terminal or output to printers. The ASCII driver has class name -@samp{ascii}. - -The available options are listed below. - -@table @code -@item output-file=@var{file-name} - -File to which output should be sent. This can be an ordinary file name -(e.g., @code{"pspp.txt"}), a pipe (e.g., @code{"|more"}), or -stdout (@code{"-"}). Default: @code{"pspp.list"}. - -@item chart-files=@var{file-name-template} -Template for the file names used for charts. The name should contain -a single @samp{#}, which is replaced by the chart number. Default: -@file{"pspp-#.png"}. - -@item chart-type=@var{type}. -Type of charts to output, either @samp{png} or @samp{none}. -Default: @samp{png}. - -Charts are always disabled if your installation of PSPP was compiled -without the @code{cairo} library. - -@item paginate=@var{boolean} - -If set, a formfeed will be written at the end of every page. Default: -@code{on}. - -@item headers=@var{boolean} - -If enabled, two lines of header information giving title and subtitle, -page number, date and time, and PSPP version are printed at the top of -every page. These two lines are in addition to any top margin -requested. Default: @code{on}. - -@item length=@var{line-count} - -Physical length of a page. Headers and margins are subtracted from -this value. You may specify the number of lines as a number, or for -screen output you may specify @code{auto} to track the height of the -terminal as it changes. Default: @code{66}. - -@item width=@var{character-count} - -Physical width of a page. Margins are subtracted from this value. -You may specify the width as a number of characters, or for screen -output you may specify @code{auto} to track the width of the terminal -as it changes. Default: @code{79}. - -@item top-margin=@var{top-margin-lines} - -Length of the top margin, in lines. PSPP subtracts this value from -the page length. Default: @code{2}. - -@item bottom-margin=@var{bottom-margin-lines} - -Length of the bottom margin, in lines. PSPP subtracts this value from -the page length. Default: @code{2}. - -@item box[@var{line-type}]=@var{box-chars} - -The characters used for lines in tables produced by the ASCII driver can -be changed using this option. @var{line-type} is used to indicate which -type of line to change; @var{box-chars} is the character or string of -characters to use for this type of line. - -@var{line-type} must be a 4-digit number. The digits are in the order -`right', `bottom', `left', `top'. The possibilities for each digit are: - -@table @asis -@item 0 -No line. - -@item 1 -Single line. - -@item 2 -Double line. -@end table - -Examples: - -@table @code -@item box[0101]="|" - -Sets @samp{|} as the character to use for a single-width line with -bottom and top components. - -@item box[2222]="#" - -Sets @samp{#} as the character to use for the intersection of four -double-width lines, one each from the top, bottom, left and right. - -@item box[1100]="\xda" - -Sets @samp{"\xda"}, which under MS-DOS is a box character suitable for -the top-left corner of a box, as the character for the intersection of -two single-width lines, one each from the right and bottom. - -@end table - -Defaults: - -@itemize @bullet -@item -@code{box[0000]=" "} - -@item -@code{box[1000]="-"} -@*@code{box[0010]="-"} -@*@code{box[1010]="-"} - -@item -@code{box[0100]="|"} -@*@code{box[0001]="|"} -@*@code{box[0101]="|"} - -@item -@code{box[2000]="="} -@*@code{box[0020]="="} -@*@code{box[2020]="="} - -@item -@code{box[3000]="="} -@*@code{box[0030]="="} -@*@code{box[3030]="="} - -@item -For all others, @samp{+} is used unless there are double lines or -special lines, in which case @samp{#} is used. -@end itemize - -@item init=@var{init-string} -If set, this string is written at the beginning of each output file. -It can be used to initialize device features, e.g.@: to enable VT100 -line-drawing characters. - -@item emphasis=@var{emphasis-style} - -How to emphasize text. Your choices are @code{bold}, @code{underline}, -or @code{none}. Bold and underline emphasis are achieved with -overstriking, which may not be supported by all the software to which -you might pass the output. -@end table - -@node HTML driver class -@section The HTML driver class - -The @code{html} driver class is used to produce output for viewing in -tables-capable web browsers such as Emacs' w3-mode. Its configuration -is very simple. Currently, the output has a very plain format. In the -future, further work may be done on improving the output appearance. - -There are only a few options: - -@table @code -@item output-file=@var{file-name} - -File to which output should be sent. This can be an ordinary file name -(i.e., @code{"pspp.ps"}), a pipe (i.e., @code{"|lpr"}), or -stdout (@code{"-"}). Default: @file{"pspp.html"}. - -@item chart-files=@var{file-name-template} -Template for the file names used for charts, which are output in PNG -format. The name should contain a single @samp{#}, which is replaced by -the chart number. Default: @file{"pspp-#.png"}. -@end table - -@node Miscellaneous configuring -@section Miscellaneous configuration - -The following environment variables can be used to further configure -PSPP: - -@table @code -@item HOME - -Used to determine the user's home directory. No default value. - -@item STAT_INCLUDE_PATH - -Path used to find include files in PSPP syntax files. Defaults vary -across operating systems: - -@table @asis -@item UNIX - -@itemize @bullet -@item -@file{.} - -@item -@file{$HOME/.pspp/include} - -@item -@file{/usr/local/lib/pspp/include} - -@item -@file{/usr/lib/pspp/include} - -@item -@file{/usr/local/share/pspp/include} - -@item -@file{/usr/share/pspp/include} -@end itemize - -@item MS-DOS - -@itemize @bullet -@item -@file{.} - -@item -@file{C:\PSPP\INCLUDE} - -@item -@file{$PATH} -@end itemize - -@item Other OSes -No default path. -@end table - -@item TERM - -The terminal type @code{termcap} or @code{ncurses} will use, if such -support was compiled into PSPP. - -@item STAT_OUTPUT_INIT_FILE - -The basename used to search for the driver definition file. -@xref{Output devices}. @xref{File locations}. Default: @code{devices}. - -@item STAT_OUTPUT_INIT_PATH - -The path used to search for the driver definition file. -@xref{File locations}. Default: the standard configuration path. - -@item TMPDIR - -The directory in which PSPP stores its temporary files (used when sorting -cases or concatenating large numbers of cases). -Default: (UNIX) @file{/tmp}, (MS-DOS) @file{\}, (other OSes) empty string. - -@item TEMP -@item TMP - -Under MS-DOS only, these variables are consulted after TMPDIR, in this -order. -@end table diff --git a/doc/invoking.texi b/doc/invoking.texi index 2b8a521d..86ddc31f 100644 --- a/doc/invoking.texi +++ b/doc/invoking.texi @@ -1,227 +1,419 @@ -@node Invocation - -@chapter Starting PSPP +@node Invoking PSPP +@chapter Invoking @command{pspp} @cindex invocation @cindex PSPP, invoking -There are two separate user interfaces for PSPP. -There is the command line interface, which responds to commands -typed by the user. -The command line interface is generally available on more platforms -than the graphic user interface and since it doesn't require a -graphics device it can be used from a remote terminal. -Platforms which have a windowing system may also be able to support -the graphic user interface. -The graphic user interface can perform all functionality of the -command line interface. -In addition it gives an instantaneous view of the data, variables and -statistical output. - -Whichever interface you choose, a basic understanding of the concepts -used by PSPP is necessary before effective use of the system can be achieved. +PSPP has two separate user interfaces. This chapter describes +@command{pspp}, PSPP's command-line driven text-based user interface. +The following chapter briefly describes PSPPIRE, the graphical user +interface to PSPP. +The sections below describe the @command{pspp} program's command-line +interface. @menu -* The command line user interface:: -* The graphic user interface:: +* Main Options:: +* PDF PostScript and SVG Output Options:: +* Plain Text Output Options:: +* HTML Output Options:: +* OpenDocument Output Options:: +* Comma-Separated Value Output Options:: @end menu +@node Main Options +@section Main Options -@node The command line user interface -@section The command line user interface +Here is a summary of all the options, grouped by type, followed by +explanations in the same order. -@cindex command line, options -@cindex options, command-line +In the table, arguments to long options also apply to any +corresponding short options. +@table @emph +@item Non-option arguments @example -pspp [ -B @var{dir} | --config-dir=@var{dir} ] [ -o @var{device} | --device=@var{device} ] - [ -a @{compatible|enhanced@} | --algorithm=@{compatible|enhanced@}] - [ -x @{compatible|enhanced@} | --syntax=@{compatible|enhanced@}] - [ -I- | --no-include ] - [ -I @var{dir} | --include=@var{dir} ] [ -i | --interactive ] - [ -r | --no-statrc ] [ -h | --help ] [ -l | --list ] - [ -s | --safer ] - [ --testing-mode ] [ -V | --version ] - [ @var{key}=@var{value} ] @var{file}@enddots{} +@var{syntax-file} @end example -@menu -* Non-option Arguments:: Specifying syntax files and output devices. -* Configuration Options:: Change the configuration for the current run. -* Input and output options:: Controlling input and output files. -* Language control options:: Language variants. -* Informational options:: Helpful information about PSPP. -@end menu - -@node Non-option Arguments -@subsection Non-option Arguments - -Syntax files and output device substitutions can be specified on -PSPP's command line: - -@table @code -@item @var{file} - -A file by itself on the command line will be executed as a syntax file. -If multiple files are specified, they are executed in order, as if -their contents had been given in a single file. -PSPP terminates after the syntax files run, unless the @code{-i} or -@code{--interactive} option is given (@pxref{Language control options}). - -@item @var{key}=@var{value} - -Defines an output device macro @var{key} to expand to @var{value}, -overriding any macro having the same @var{key} defined in the device -configuration file. @xref{Macro definitions}. - -@end table - -There is one other way to specify a syntax file, if your operating -system supports it. If you have a syntax file @file{foobar.stat}, put -the notation - +@item Output options @example -#! /usr/local/bin/pspp +-o, --output=@var{output-file} +-O @var{option}=@var{value} +-O format=@var{format} +-O device=@{terminal|listing@} +-e, --error-file=@var{error-file} @end example -at the top, and mark the file as executable with @code{chmod +x -foobar.stat}. (If PSPP is not installed in @file{/usr/local/bin}, -then insert its actual installation directory into the syntax file -instead.) Now you should be able to invoke the syntax file just by -typing its name. You can include any options on the command line as -usual. PSPP entirely ignores any lines beginning with @samp{#!}. - -@node Configuration Options -@subsection Configuration Options - -Configuration options are used to change PSPP's configuration for the -current run. The configuration options are: - -@table @code -@item -a @{compatible|enhanced@} -@itemx --algorithm=@{compatible|enhanced@} - -If you chose @code{compatible}, then PSPP will use the same algorithms -as used by some proprietary statistical analysis packages. -This is not recommended, as these algorithms are inferior and in some cases -compeletely broken. -The default setting is @code{enhanced}. -Certain commands have subcommands which allow you to override this setting on -a per command basis. - -@item -B @var{dir} -@itemx --config-dir=@var{dir} - -Sets the configuration directory to @var{dir}. @xref{File locations}. +@item Language options +@example +-I, --include=@var{dir} +-I-, --no-include +-i, --interactive +-r, --no-statrc +-a, --algorithm=@{compatible|enhanced@} +-x, --syntax=@{compatible|enhanced@} +@end example -@item -o @var{device} -@itemx --device=@var{device} +@item Informational options +@example +-h, --help +-V, --version +@end example -Selects the output device with name @var{device}. If this option is -given more than once, then all devices mentioned are selected. This -option disables all devices besides those mentioned on the command line. +@item Other options +@example +-s, --safer +--testing-mode +@end example @end table -@node Input and output options -@subsection Input and output options +@table @code +@item @var{syntax-file} +Read and execute the named syntax file. If no syntax files are +specified, PSPP prompts for commands. If any syntax files are +specified, PSPP by default exits after it runs them, but you may make +it prompt for commands by specifying @samp{-} as an additional syntax +file. + +@item -o @var{output-file} +Write output to @var{output-file}. PSPP has several different output +drivers that support output in various formats (use @option{--help} to +list the available formats). Specify this option more than once to +produce multiple output files, presumably in different formats. + +Use @samp{-} as @var{output-file} to write output to standard output. + +If no @option{-o} option is used, then PSPP writes output to standard +output in plain text format. + +@item -O @var{option}=@var{value} +Sets an option for the output file configured by a preceding +@option{-o}. Most options are specific to particular output formats. +A few options that apply generically are listed below. + +@item -O format=@var{format} +PSPP uses the extension of the file name given on @option{-o} to +select an output format. Use this option to override this choice by +specifying an alternate format, e.g.@: @option{-o pspp.out -O html} to +write HTML to a file named @file{pspp.out}. Use @option{--help} to +list the available formats. + +@item -O device=@{terminal|listing@} +Sets whether PSPP considers the output device configured by the +preceding @option{-o} to be a terminal or a listing device. This +affects what output will be sent to the device, as configured by the +SET command's output routing subcommands (@pxref{SET}). By default, +output written to standard output is considered a terminal device and +other output is considered a listing device. + +@item -e @var{error-file} +@itemx --error-file=@var{error-file} +Configures a file to receive PSPP error, warning, and note messages in +plain text format. Use @samp{-} as @var{error-file} to write messages +to standard output. The default error file is standard output in the +absence of these options, but this is suppressed if an output device +writes to standard output (or another terminal), to avoid printing +every message twice. Use @samp{none} as @var{error-file} to +explicitly suppress the default. -Input and output options affect how PSPP reads input and writes -output. These are the input and output options: +@item -I @var{dir} +@itemx --include=@var{dir} +Appends @var{dir} to the set of directories searched by INCLUDE +(@pxref{INCLUDE}) and INSERT (@pxref{INSERT}). -@table @code @item -I- @itemx --no-include +Clears all directories from the include path, including directories +inserted in the include path by default. The default include path is +@file{.} (the current directory), followed by @file{.pspp} in the +user's home directory, followed by PSPP's system configuration +directory (usually @file{/etc/pspp} or @file{/usr/local/etc/pspp}). -Clears all directories from the include path. This includes all -directories put in the include path by default. @xref{Miscellaneous -configuring}. +@item -i +@itemx --interactive +This option forces syntax files to be interpreted in interactive +mode, rather than the default batch mode. @xref{Syntax Variants}, for +a description of the differences. -@item -I @var{dir} -@itemx --include=@var{dir} +@item -r +@itemx --no-statrc +Disables running @file{rc} at PSPP startup time. + +@item -a @{enhanced|compatible@} +@itemx --algorithm=@{enhanced|compatible@} +With @code{enhanced}, the default, PSPP uses the best implemented +algorithms for statistical procedures. With @code{compatible}, +however, PSPP will in some cases use inferior algorithms to produce +the same results as the proprietary program SPSS. + +Some commands have subcommands that override this setting on a per +command basis. + +@item -x @{enhanced|compatible@} +@itemx --syntax=@{enhanced|compatible@} +With @code{enhanced}, the default, PSPP accepts its own extensions +beyond those compatible with the proprietary program SPSS. With +@code{compatible}, PSPP rejects syntax that uses these extensions. + +@item -? +@itemx --help +Prints a message describing PSPP command-line syntax and the available +device formats, then exits. -Appends directory @var{dir} to the path that is searched for include -files in PSPP syntax files. +@item -V +@itemx --version +Prints a brief message listing PSPP's version, warranties you don't +have, copying conditions and copyright, and e-mail address for bug +reports, then exits. -@item --testing-mode +@item -s +@itemx --safer +Disables certain unsafe operations. This includes the ERASE and +HOST commands, as well as use of pipes as input and output files. +@item --testing-mode Invoke heuristics to assist with testing PSPP. For use by @code{make check} and similar scripts. @end table -@node Language control options -@subsection Language control options +@node PDF PostScript and SVG Output Options +@section PDF, PostScript, and SVG Output Options -Language control options control how PSPP syntax files are parsed and -interpreted. The available language control options are: +To produce output in PDF, PostScript, and SVG formats, specify +@option{-o @var{file}} on the PSPP command line, optionally followed +by any of the options shown in the table below to customize the output +format. + +PDF, PostScript, and SVG output is only available if your installation +of PSPP was compiled with the Cairo library. @table @code -@item -i -@itemx --interactive +@item -O format=@{pdf|ps|svg@} +Specify the output format. This is only necessary if the file name +given on @option{-o} does not end in @file{.pdf}, @file{.ps}, or +@file{.svg}. + +@item -O paper-size=@var{paper-size} +Paper size, as a name (e.g.@: @code{a4}, @code{letter}) or +measurements (e.g.@: @code{210x297}, @code{8.5x11in}). + +The default paper size is taken from the @env{PAPERSIZE} environment +variable or the file indicated by the @env{PAPERCONF} environment +variable, if either variable is set. If not, and your system supports +the @code{LC_PAPER} locale category, then the default paper size is +taken from the locale. Otherwise, if @file{/etc/papersize} exists, +the default paper size is read from it. As a last resort, A4 paper is +assumed. + +@item -O orientation=@var{orientation} +Either @code{portrait} or @code{landscape}. Default: @code{portrait}. + +@item -O headers=@var{boolean} +When enabled, headers showing the time and date, title and subtitle, +and page number are printed at the top of each page. Default: +@code{on}. + +@item -O left-margin=@var{dimension} +@itemx -O right-margin=@var{dimension} +@itemx -O top-margin=@var{dimension} +@itemx -O bottom-margin=@var{dimension} +Sets the margins around the page. The headers, if enabled, are not +included in the margins; they are in addition to the margins. See +below for the allowed forms of @var{dimension} Default: @code{0.5in}. + +@item -O prop-font=@var{font-name} +@itemx -O emph-font=@var{font-name} +@itemx -O fixed-font=@var{font-name} +Sets the font used for proportional, emphasized, or fixed-pitch text. +Most systems support CSS-like font names such as ``serif'' and +``monospace'', but a wide range of system-specific font are likely to +be supported as well. + +Default: proportional font @code{serif}, emphasis font @code{serif +italic}, fixed-pitch font @code{monospace}. + +@item -O font-size=@var{font-size} +Sets the size of the default fonts, in thousandths of a point. Default: +10000 (10 point). + +@item -O line-gutter=@var{dimension} +Sets the width of white space on either side of lines that border text +or graphics objects. Default: @code{1pt}. + +@item -O line-spacing=@var{dimension} +Sets the spacing between the lines in a double line in a table. +Default: @code{1pt}. + +@item -O line-width=@var{dimension} +Sets the width of the lines used in tables. Default: @code{0.5pt}. +@end table -When a syntax file is specified on the command line, PSPP normally -terminates after processing it. Giving this option will cause PSPP to -bring up a command prompt after processing the syntax file. +Each @var{dimension} value above may be specified in various units +based on its suffix: @samp{mm} for millimeters, @samp{in} for inches, +or @samp{pt} for points. Lacking a suffix, numbers below 50 are +assumed to be in inches and those about 50 are assumed to be in +millimeters. -In addition, this forces syntax files to be interpreted in interactive -mode, rather than the default batch mode. @xref{Tokenizing lines}, for -information on the differences between batch mode and interactive mode -command interpretation. +@node Plain Text Output Options +@section Plain Text Output Options -@item -r -@itemx --no-statrc +PSPP can produce plain text output, drawing boxes using ASCII or +Unicode line drawing characters. To produce plain text output, +specify @option{-o @var{file}} on the PSPP command line, optionally +followed by options from the table below to customize the output +format. -Prevents the execution of the PSPP startup syntax file. +@table @code +@item -O format=txt +Specify the output format. This is only necessary if the file name +given on @option{-o} does not end in @file{.txt} or @file{.list}. + +@item -O charts=@{@var{template}.png|none@} +Name for chart files included in output. The value should be a file +name that includes a single @samp{#} and ends in @file{png}. When a +chart is output, the @samp{#} is replaced by the chart number. The +default is the file name specified on @option{-o} with the extension +stripped off and replaced by @file{-#.png}. + +Specify @code{none} to disable chart output. Charts are always +disabled if your installation of PSPP was compiled without the +Cairo library. + +@item -O paginate=@var{boolean} +If set, PSPP writes an ASCII formfeed the end of every page. Default: +@code{off}. + +@item -O headers=@var{boolean} +If enabled, PSPP prints two lines of header information giving title +and subtitle, page number, date and time, and PSPP version are printed +at the top of every page. These two lines are in addition to any top +margin requested. Default: @code{off}. + +@item -O length=@var{line-count} +Physical length of a page. Headers and margins are subtracted from +this value. You may specify the number of lines as a number, or for +screen output you may specify @code{auto} to track the height of the +terminal as it changes. Default: @code{66}. + +@item -O width=@var{character-count} +Width of a page, in characters. Margins are subtracted from this +value. For screen output you may specify @code{auto} in place of a +number to track the width of the terminal as it changes. Default: +@code{79}. + +@item -O top-margin=@var{top-margin-lines} +Length of the top margin, in lines. PSPP subtracts this value from +the page length. Default: @code{0}. + +@item -O bottom-margin=@var{bottom-margin-lines} +Length of the bottom margin, in lines. PSPP subtracts this value from +the page length. Default: @code{0}. + +@item -O box[@var{line-type}]=@var{box-chars} +Sets the characters used for lines in tables. @var{line-type} is a +4-digit number that indicates the type of line to change, in the order +`right', `bottom', `left', `top'. Each digit is 0 for ``no line'', 1 +for a single line, and 2 for a double line. @var{box-chars} is the +character or string of characters to use for this type of line. + +For example, @code{box[0101]="|"} sets @samp{|} as the character to +use for a single-width vertical line, and @code{box[1100]="\xda"} sets +@samp{"\xda"}, which on MS-DOS is suitable for the top-left corner of +a box, as the character for the intersection of two single-width +lines, one each from the right and bottom. + +The defaults use @samp{-}, @samp{|}, and @samp{+} for single-width +lines and @samp{=} and @samp{#} for double-width lines. + +@item -O init=@var{init-string} +If set, this string is written at the beginning of each output file. +It can be used to initialize device features, e.g.@: to enable VT100 +line-drawing characters. + +@item -O emphasis=@{none|bold|underline@} +How to emphasize text. Bold and underline emphasis are achieved with +overstriking, which may not be supported by all the software to which +you might pass the output. Default: @code{none}. +@end table -@item -s -@itemx --safer +@node HTML Output Options +@section HTML Output Options -Disables certain unsafe operations. This includes the ERASE and -HOST commands, as well as use of pipes as input and output files. +To produce output in HTML format, specify @option{-o @var{file}} on +the PSPP command line, optionally followed by any of the options shown +in the table below to customize the output format. + +@table @code +@item -O format=html +Specify the output format. This is only necessary if the file name +given on @option{-o} does not end in @file{.html}. + +@item -O charts=@{@var{template}.png|none@} +Sets the name used for chart files. @xref{Plain Text Output Options}, +for details. @end table -@node Informational options -@subsection Informational options +@node OpenDocument Output Options +@section OpenDocument Output Options -Informational options cause information about PSPP to be written to -the terminal. Here are the available options: +To produce output as an OpenDocument text (ODT) document, specify +@option{-o @var{file}} on the PSPP command line. If @var{file} does +not end in @file{.odt}, you must also specify @option{-O format=odt}. -@table @code -@item -h -@item --help +The OpenDocument output format does not have any configurable options. -Prints a message describing PSPP command-line syntax and the available -device driver classes, then terminates. +@node Comma-Separated Value Output Options +@section Comma-Separated Value Output Options -@item -l -@item --list +To produce output in comma-separated value (CSV) format, specify +@option{-o @var{file}} on the PSPP command line, optionally followed +by any of the options shown in the table below to customize the output +format. -Lists the available device driver classes, then terminates. +@table @code +@item -O format=csv +Specify the output format. This is only necessary if the file name +given on @option{-o} does not end in @file{.csv}. -@item -x @{compatible|enhanced@} -@itemx --syntax=@{compatible|enhanced@} +@item -O separator=@var{field-separator} +Sets the character used to separate fields. The default is a comma +(@samp{,}). +@end table -If you chose @code{compatible}, then PSPP will only accept command syntax that -is compatible with the proprietary program SPSS. -If you choose @code{enhanced} then additional syntax will be available. -The default is @code{enhanced}. +The CSV format used is an extension to that specified in RFC 4180: +@table @asis +@item Tables +Each table row is output on a separate line, and each column is output +as a field. The contents of a cell that spans multiple rows or +columns is output only for the top-left row and column; the rest are +output as empty fields. When a table has a caption, it is output just +above the table as a single field prefixed by @samp{Table:}. -@item -V -@item --version +@item Text +Text in output is printed as a field on a line by itself. The TITLE +and SUBTITLE produce similar output, prefixed by @samp{Title:} or +@samp{Subtitle:}, respectively. -Prints a brief message listing PSPP's version, warranties you don't -have, copying conditions and copyright, and e-mail address for bug -reports, then terminates. +@item Messages +Errors, warnings, and notes are printed the same way as text. +@item Charts +Charts are not included in CSV output. @end table +Successive output items are separated by a blank line. -@node The graphic user interface +@node Invoking PSPPIRE +@chapter Invoking @command{psppire} @section The graphic user interface - @cindex Graphic user interface @cindex PSPPIRE +The PSPPIRE graphic user interface for PSPP can perform all +functionality of the command line interface. In addition it gives an +instantaneous view of the data, variables and statistical output. + The graphic user interface can be started by typing @command{psppire} at a command prompt. Alternatively many systems have a system of interactive menus or buttons diff --git a/doc/language.texi b/doc/language.texi index a57d4dda..19c9a6b9 100644 --- a/doc/language.texi +++ b/doc/language.texi @@ -208,9 +208,9 @@ new command, which allows for visual indentation of a command without that command being considered part of the previous command. The period terminating the end of a command is optional but recommended. -In interactive mode, each command must either be terminated with a period, -or an empty line must follow the command. -The use of (@samp{+} and @samp{@minus{}} as continuation characters is not +In interactive mode, each command must be terminated with a period +or by a blank line. +The use of @samp{+} and @samp{@minus{}} as continuation characters is not permitted. @node Types of Commands diff --git a/doc/pspp.texinfo b/doc/pspp.texinfo index 830e82e4..ae3db342 100644 --- a/doc/pspp.texinfo +++ b/doc/pspp.texinfo @@ -33,6 +33,7 @@ @dircategory Math @direntry * PSPP: (pspp). Statistical analysis package. +* PSPPIRE: (pspp). Graphical user interface to PSPP. @end direntry @copying @@ -86,7 +87,8 @@ in the production of this manual. * Introduction:: Description of the package. * License:: Your rights and obligations. -* Invocation:: Starting and running PSPP. +* Invoking PSPP:: Starting the PSPP text-based interface. +* Invoking PSPPIRE:: Starting the PSPP graphical user interface. * Using PSPP:: How to use PSPP --- A brief tutorial. * Language:: Basics of the PSPP command language. * Expressions:: Numeric and string expression syntax. @@ -108,8 +110,6 @@ in the production of this manual. * Command Index:: Index of PSPP procedures. * Concept Index:: Index of concepts. -* Configuration:: Configuring PSPP. - * GNU Free Documentation License:: License for copying this manual. @end menu @@ -136,8 +136,6 @@ in the production of this manual. @include command-index.texi @include concept-index.texi -@include configuring.texi - @include fdl.texi @bye diff --git a/doc/utilities.texi b/doc/utilities.texi index 6882aa21..fabec248 100644 --- a/doc/utilities.texi +++ b/doc/utilities.texi @@ -330,7 +330,6 @@ SET (interaction) /CPROMPT='cprompt_string' /DPROMPT='dprompt_string' - /ERRORBREAK=@{OFF,ON@} /MXERRS=max_errs /MXWARNS=max_warnings /PROMPT='prompt' @@ -353,17 +352,14 @@ SET /WRB=@{NATIVE,ISL,ISB,IDL,IDB,VF,VD,VG,ZS,ZL@} (output routing) - /ECHO=@{ON,OFF@} /ERRORS=@{ON,OFF,TERMINAL,LISTING,BOTH,NONE@} - /INCLUDE=@{ON,OFF@} /MESSAGES=@{ON,OFF,TERMINAL,LISTING,BOTH,NONE@} - /PRINTBACK=@{ON,OFF@} + /PRINTBACK=@{ON,OFF,TERMINAL,LISTING,BOTH,NONE@} /RESULTS=@{ON,OFF,TERMINAL,LISTING,BOTH,NONE@} (output driver options) /HEADERS=@{NO,YES,BLANK@} /LENGTH=@{NONE,length_in_lines@} - /LISTING=@{ON,OFF,'file-name'@} /MORE=@{ON,OFF@} /WIDTH=@{NARROW,WIDTH,n_characters@} @@ -383,7 +379,6 @@ SET /BOXSTRING=@{'xxx','xxxxxxxxxxx'@} /CASE=@{UPPER,UPLOW@} /CPI=cpi_value - /DISK=@{ON,OFF@} /HIGHRES=@{ON,OFF@} /HISTOGRAM='c' /LOWRES=@{AUTO,ON,OFF@} @@ -524,10 +519,6 @@ The command continuation prompt. The default is @samp{ > }. Prompt used when expecting data input within @cmd{BEGIN DATA} (@pxref{BEGIN DATA}). The default is @samp{data> }. -@item ERRORBREAK -Whether an error causes PSPP to stop processing the current command -file after finishing the current command. The default is OFF. - @item MXERRS The maximum number of errors before PSPP halts processing of the current command file. The default is 50. @@ -615,30 +606,55 @@ RB format (@pxref{Binary and Hexadecimal Numeric Formats}). The choices are the same as SET RIB. The default is NATIVE. @end table -Output routing subcommands affect where the output of transformations -and procedures is sent. These subcommands are +In the PSPP text-based interface, the output routing subcommands +affect where output is sent. The following values are allowed for +each of these subcommands: @table @asis -@item ECHO +@item OFF +@item NONE +Discard this kind of output. + +@item TERMINAL +Write this output to the terminal, but not to listing files and other +output devices. + +@item LISTING +Write this output to listing files and other output devices, but not +to the terminal. -If turned on, commands are written to the listing file as they are read -from command files. The default is OFF. +@item ON +@itemx BOTH +Write this type of output to all output devices. +@end table + +These output routing subcommands are: + +@table @asis +@item ERRORS +Applies to error and warning messages. The default is BOTH. -@itemx ERRORS -@itemx INCLUDE @itemx MESSAGES -@item PRINTBACK -@item RESULTS -Currently not used. +Applies to notes. The default is BOTH. + +@itemx PRINTBACK +Determines whether the syntax used for input is printed back as part +of the output. The default is NONE. + +@itemx RESULTS +Applies to everything not in one of the above categories, such as the +results of statistical procedures. The default is BOTH. @end table +These subcommands have no effect on output in the PSPP GUI +environment. + Output driver option subcommands affect output drivers' settings. These subcommands are @table @asis @item HEADERS @itemx LENGTH -@itemx LISTING @itemx MORE @itemx PAGER @itemx WIDTH @@ -646,7 +662,6 @@ subcommands are @cindex headers @cindex length -@cindex listing @cindex more @cindex pager @cindex width diff --git a/perl-module/Makefile.PL b/perl-module/Makefile.PL index 045b4e76..56b8a930 100644 --- a/perl-module/Makefile.PL +++ b/perl-module/Makefile.PL @@ -12,7 +12,7 @@ do 'pspp-module-config' || do { }; WriteMakefile( - FULLPERL => "PSPP_TEST_CMD=\"$Locations{BuildDir}/src/ui/terminal/pspp -B $Locations{SourceDir}/config\" \$(PERL)", + FULLPERL => "PSPP_TEST_CMD=\"$Locations{BuildDir}/src/ui/terminal/pspp\" \$(PERL)", NAME => 'PSPP', DISTNAME => 'PSPP-Perl', VERSION_FROM => "$Locations{BuildDir}/src/libpspp/version.c", diff --git a/perl-module/t/Pspp.t b/perl-module/t/Pspp.t index 4f65a4b5..50be5df2 100644 --- a/perl-module/t/Pspp.t +++ b/perl-module/t/Pspp.t @@ -40,7 +40,7 @@ sub run_pspp_syntax print FH "$syntax"; close (FH); - system ("cd $tempdir; $pspp_cmd --testing-mode $syntaxfile"); + system ("cd $tempdir; $pspp_cmd -o pspp.csv $syntaxfile"); } sub run_pspp_syntax_cmp diff --git a/src/data/file-name.c b/src/data/file-name.c index d8defd1d..e3047a33 100644 --- a/src/data/file-name.c +++ b/src/data/file-name.c @@ -16,142 +16,68 @@ #include -#include +#include "data/file-name.h" #include #include #include #include #include +#include #include -#include "intprops.h" -#include "minmax.h" -#include "dirname.h" -#include "xmalloca.h" - -#include -#include -#include -#include -#include +#include "data/settings.h" +#include "libpspp/hash.h" +#include "libpspp/message.h" +#include "libpspp/str.h" +#include "libpspp/version.h" -#include "xalloc.h" +#include "gl/dirname.h" +#include "gl/intprops.h" +#include "gl/minmax.h" +#include "gl/relocatable.h" +#include "gl/xalloc.h" +#include "gl/xmalloca.h" #include "gettext.h" #define _(msgid) gettext (msgid) -#include -#include - #if defined _WIN32 || defined __WIN32__ #define WIN32_LEAN_AND_MEAN /* avoid including junk */ #include #endif -/* Initialization. */ - -const char *config_path; - -void -fn_init (void) -{ - config_path = fn_getenv_default ("STAT_CONFIG_PATH", default_config_path); -} - /* Functions for performing operations on file names. */ - -/* Copies from SRC to DST, calling INSERT_VARIABLE to handle each - instance of $var or ${var} in SRC. $$ is replaced by $. */ -void -fn_interp_vars (struct substring src, - void (*insert_variable) (const char *var, - struct string *dst, void *aux), - void *aux, struct string *dst_) -{ - struct string dst = DS_EMPTY_INITIALIZER; - int c; - - while ((c = ss_get_char (&src)) != EOF) - if (c != '$') - ds_put_char (&dst, c); - else - { - if (ss_match_char (&src, '$') || ss_is_empty (src)) - ds_put_char (&dst, '$'); - else - { - struct substring var_name; - char *var; - - if (ss_match_char (&src, '(')) - ss_get_until (&src, ')', &var_name); - else if (ss_match_char (&src, '{')) - ss_get_until (&src, '}', &var_name); - else - ss_get_chars (&src, MAX (1, ss_span (src, ss_cstr (CC_ALNUM))), - &var_name); - - var = ss_xstrdup (var_name); - insert_variable (var, &dst, aux); - free (var); - } - } - - ds_swap (&dst, dst_); - ds_destroy (&dst); -} - -static void -insert_env_var (const char *var, struct string *dst, void *aux UNUSED) -{ - const char *value = fn_getenv (var); - if (value != NULL) - ds_put_cstr (dst, value); -} - -/* Searches for a configuration file with name NAME in the path - given by PATH, which is environment-interpolated. - Directories in PATH are delimited by ':'. Returns the - malloc'd full name of the first file found, or NULL if none is - found. */ +/* Searches for a configuration file with name NAME in the directories given in + PATH, which is terminated by a null pointer. Returns the full name of the + first file found, which the caller is responsible for freeing with free(), + or NULL if none is found. */ char * -fn_search_path (const char *base_name, const char *path_) +fn_search_path (const char *base_name, char **path) { - struct string path; - struct substring dir; - struct string file = DS_EMPTY_INITIALIZER; - size_t save_idx = 0; + size_t i; if (fn_is_absolute (base_name)) return xstrdup (base_name); - /* Interpolate environment variables. */ - ds_init_cstr (&path, path_); - fn_interp_vars (ds_ss (&path), insert_env_var, NULL, &path); - - while (ds_separate (&path, ss_cstr (":"), &save_idx, &dir)) + for (i = 0; path[i] != NULL; i++) { - /* Construct file name. */ - ds_clear (&file); - ds_put_substring (&file, dir); - if (!ds_is_empty (&file) && !ISSLASH (ds_last (&file))) - ds_put_char (&file, '/'); - ds_put_cstr (&file, base_name); - ds_relocate (&file); - - /* Check whether file exists. */ - if (fn_exists (ds_cstr (&file))) - { - ds_destroy (&path); - return ds_cstr (&file); - } + const char *dir = path[i]; + char *file; + + if (!strcmp (dir, "") || !strcmp (dir, ".")) + file = xstrdup (base_name); + else if (ISSLASH (dir[strlen (dir) - 1])) + file = xasprintf ("%s%s", dir, base_name); + else + file = xasprintf ("%s/%s", dir, base_name); + + if (fn_exists (file)) + return file; + free (file); } - /* Failure. */ - ds_destroy (&path); - ds_destroy (&file); return NULL; } @@ -245,11 +171,6 @@ safety_violation (const char *fn) } #endif -/* As a general comment on the following routines, a `sensible value' - for errno includes 0 if there is no associated system error. The - routines will only set errno to 0 if there is an error in a - callback that sets errno to 0; they themselves won't. */ - /* File open routine that understands `-' as stdin/stdout and `|cmd' as a pipe to command `cmd'. Returns resultant FILE on success, NULL on failure. If NULL is returned then errno is set to a @@ -259,12 +180,18 @@ fn_open (const char *fn, const char *mode) { assert (mode[0] == 'r' || mode[0] == 'w' || mode[0] == 'a'); - if (mode[0] == 'r' && (!strcmp (fn, "stdin") || !strcmp (fn, "-"))) - return stdin; - else if (mode[0] == 'w' && (!strcmp (fn, "stdout") || !strcmp (fn, "-"))) - return stdout; - else if (mode[0] == 'w' && !strcmp (fn, "stderr")) - return stderr; + if (mode[0] == 'r') + { + if (!strcmp (fn, "stdin") || !strcmp (fn, "-")) + return stdin; + } + else + { + if (!strcmp (fn, "stdout") || !strcmp (fn, "-")) + return stdout; + if (!strcmp (fn, "stderr")) + return stderr; + } #if HAVE_POPEN if (fn[0] == '|') @@ -297,7 +224,7 @@ fn_open (const char *fn, const char *mode) { FILE *f = fopen (fn, mode); - if (f && mode[0] == 'w') + if (f && mode[0] != 'r') setvbuf (f, NULL, _IOLBF, 0); return f; diff --git a/src/data/file-name.h b/src/data/file-name.h index 327d716e..8e04d36a 100644 --- a/src/data/file-name.h +++ b/src/data/file-name.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,19 +19,11 @@ #include #include -#include #include -/* Search path for configuration files. */ -extern const char *config_path; +struct string_set; -void fn_init (void); - -void fn_interp_vars (struct substring src, - void (*insert_variable) (const char *var, - struct string *dst, void *aux), - void *aux, struct string *dst); -char *fn_search_path (const char *base_name, const char *path); +char *fn_search_path (const char *base_name, char **path); char *fn_dir_name (const char *fn); char *fn_extension (const char *fn); diff --git a/src/data/settings.c b/src/data/settings.c index c86ac9cc..d95e3a14 100644 --- a/src/data/settings.c +++ b/src/data/settings.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,17 +52,14 @@ struct settings int *viewlength; int *viewwidth; bool safer_mode; - bool do_echo; bool include; int epoch; - bool errorbreak; bool route_errors_to_terminal; bool route_errors_to_listing; bool scompress; bool undefined; double blanks; - int mxwarns; - int mxerrs; + int max_messages[MSG_N_SEVERITIES]; bool printback; bool mprint; int mxloops; @@ -77,6 +74,8 @@ struct settings int syntax; struct fmt_number_style *styles; + + enum settings_output_devices output_routing[SETTINGS_N_OUTPUT_TYPES]; }; static struct settings the_settings = { @@ -93,15 +92,11 @@ static struct settings the_settings = { /* viewwidth */ NULL, /* safer_mode */ - false, - /* do_echo */ false, /* include */ true, /* epoch */ -1, - /* errorbreak */ - false, /* route_errors_to_terminal */ true, /* route_errors_to_listing */ @@ -112,10 +107,12 @@ static struct settings the_settings = { true, /* blanks */ SYSMIS, - /* mxwarns */ - 100, - /* mxerrs */ - 100, + /* max_messages */ + { + 100, /* MSG_S_ERROR */ + 100, /* MSG_S_WARNING */ + 100 /* MSG_S_NOTE */ + }, /* printback */ true, /* mprint */ @@ -139,7 +136,12 @@ static struct settings the_settings = { /* syntax */ ENHANCED, /* styles */ - NULL + NULL, + /* output devices */ + {SETTINGS_DEVICE_LISTING | SETTINGS_DEVICE_TERMINAL, + SETTINGS_DEVICE_LISTING | SETTINGS_DEVICE_TERMINAL, + 0, + SETTINGS_DEVICE_LISTING | SETTINGS_DEVICE_TERMINAL} }; static void init_viewport ( int *, int *); @@ -269,20 +271,6 @@ settings_set_safer_mode (void) the_settings.safer_mode = true; } -/* Echo commands to the listing file/printer? */ -bool -settings_get_echo (void) -{ - return the_settings.do_echo; -} - -/* Set echo. */ -void -settings_set_echo ( bool echo) -{ - the_settings.do_echo = echo; -} - /* If echo is on, whether commands from include files are echoed. */ bool settings_get_include (void) @@ -321,50 +309,6 @@ settings_set_epoch ( int epoch) assert (the_settings.epoch >= 0); } -/* Does an error stop execution? */ -bool -settings_get_errorbreak (void) -{ - return the_settings.errorbreak; -} - -/* Sets whether an error stops execution. */ -void -settings_set_errorbreak ( bool errorbreak) -{ - the_settings.errorbreak = errorbreak; -} - -/* Route error messages to terminal? */ -bool -settings_get_error_routing_to_terminal (void) -{ - return the_settings.route_errors_to_terminal; -} - -/* Sets whether error messages should be routed to the - terminal. */ -void -settings_set_error_routing_to_terminal ( bool route_to_terminal) -{ - the_settings.route_errors_to_terminal = route_to_terminal; -} - -/* Route error messages to listing file? */ -bool -settings_get_error_routing_to_listing (void) -{ - return the_settings.route_errors_to_listing; -} - -/* Sets whether error messages should be routed to the - listing file. */ -void -settings_set_error_routing_to_listing ( bool route_to_listing) -{ - the_settings.route_errors_to_listing = route_to_listing; -} - /* Compress system files by default? */ bool settings_get_scompression (void) @@ -408,46 +352,24 @@ settings_set_blanks ( double blanks) the_settings.blanks = blanks; } -/* Maximum number of warnings + errors. */ +/* Returns the maximum number of messages to show of the given SEVERITY before + aborting. (The value for MSG_S_WARNING is interpreted as maximum number of + warnings and errors combined.) */ int -settings_get_mxwarns (void) +settings_get_max_messages (enum msg_severity severity) { - return the_settings.mxwarns; + assert (severity < MSG_N_SEVERITIES); + return the_settings.max_messages[severity]; } -/* Sets maximum number of warnings + errors. */ +/* Sets the maximum number of messages to show of the given SEVERITY before + aborting to MAX. (The value for MSG_S_WARNING is interpreted as maximum + number of warnings and errors combined.) */ void -settings_set_mxwarns ( int mxwarns) +settings_set_max_messages (enum msg_severity severity, int max) { - the_settings.mxwarns = mxwarns; -} - -/* Maximum number of errors. */ -int -settings_get_mxerrs (void) -{ - return the_settings.mxerrs; -} - -/* Sets maximum number of errors. */ -void -settings_set_mxerrs ( int mxerrs) -{ - the_settings.mxerrs = mxerrs; -} - -/* Whether commands are written to the display. */ -bool -settings_get_printback (void) -{ - return the_settings.printback; -} - -/* Sets whether commands are written to the display. */ -void -settings_set_printback ( bool printback) -{ - the_settings.printback = printback; + assert (severity < MSG_N_SEVERITIES); + the_settings.max_messages[severity] = max; } /* Independent of get_printback, controls whether the commands @@ -757,3 +679,18 @@ settings_dollar_template (const struct fmt_spec *fmt) return ds_cstr (&str); } + +void +settings_set_output_routing (enum settings_output_type type, + enum settings_output_devices devices) +{ + assert (type < SETTINGS_N_OUTPUT_TYPES); + the_settings.output_routing[type] = devices; +} + +enum settings_output_devices +settings_get_output_routing (enum settings_output_type type) +{ + assert (type < SETTINGS_N_OUTPUT_TYPES); + return the_settings.output_routing[type] | SETTINGS_DEVICE_UNFILTERED; +} diff --git a/src/data/settings.h b/src/data/settings.h index 3de1715f..7dcb0e34 100644 --- a/src/data/settings.h +++ b/src/data/settings.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,9 +19,11 @@ #include #include -#include -#include -#include + +#include "data/format.h" +#include "libpspp/float-format.h" +#include "libpspp/integer-format.h" +#include "libpspp/message.h" struct caseproto; struct settings; @@ -63,22 +65,12 @@ void settings_set_viewwidth ( int); bool settings_get_safer_mode (void); void settings_set_safer_mode (void); -bool settings_get_echo (void); -void settings_set_echo ( bool); bool settings_get_include (void); void settings_set_include ( bool); int settings_get_epoch (void); void settings_set_epoch ( int); -bool settings_get_errorbreak (void); -void settings_set_errorbreak ( bool); - -bool settings_get_error_routing_to_terminal (void); -void settings_set_error_routing_to_terminal (bool); -bool settings_get_error_routing_to_listing (void); -void settings_set_error_routing_to_listing (bool); - bool settings_get_scompression (void); void settings_set_scompression (bool); @@ -87,13 +79,9 @@ void settings_set_undefined (bool); double settings_get_blanks (void); void settings_set_blanks (double); -int settings_get_mxwarns (void); -void settings_set_mxwarns ( int); -int settings_get_mxerrs (void); -void settings_set_mxerrs ( int); +int settings_get_max_messages (enum msg_severity); +void settings_set_max_messages (enum msg_severity, int max); -bool settings_get_printback (void); -void settings_set_printback (bool); bool settings_get_mprint (void); void settings_set_mprint (bool); @@ -140,4 +128,26 @@ const struct fmt_number_style * settings_get_style (enum fmt_type type); char * settings_dollar_template (const struct fmt_spec *fmt); +/* Routing of different kinds of output. */ +enum settings_output_devices + { + SETTINGS_DEVICE_LISTING = 1 << 0, /* File or device. */ + SETTINGS_DEVICE_TERMINAL = 1 << 1, /* Screen. */ + SETTINGS_DEVICE_UNFILTERED = 1 << 2 /* Gets all output, no filtering. */ + }; + +enum settings_output_type + { + SETTINGS_OUTPUT_ERROR, /* Errors and warnings. */ + SETTINGS_OUTPUT_NOTE, /* Notes. */ + SETTINGS_OUTPUT_SYNTAX, /* Syntax. */ + SETTINGS_OUTPUT_RESULT, /* Everything else. */ + SETTINGS_N_OUTPUT_TYPES + }; + +void settings_set_output_routing (enum settings_output_type, + enum settings_output_devices); +enum settings_output_devices settings_get_output_routing ( + enum settings_output_type); + #endif /* !settings_h */ diff --git a/src/language/lexer/lexer.c b/src/language/lexer/lexer.c index 5ff0b8bc..1c35642f 100644 --- a/src/language/lexer/lexer.c +++ b/src/language/lexer/lexer.c @@ -882,7 +882,6 @@ lex_get_line_raw (struct lexer *lexer) if (ok) { const char *line = ds_cstr (&lexer->line_buffer); - journal_write (lex_current_syntax_mode (lexer) == GETL_BATCH, line); text_item_submit (text_item_create (TEXT_ITEM_SYNTAX, line)); } return ok; diff --git a/src/language/syntax-file.c b/src/language/syntax-file.c index ad277b58..55219724 100644 --- a/src/language/syntax-file.c +++ b/src/language/syntax-file.c @@ -113,10 +113,6 @@ read_syntax_file (struct getl_interface *s, } while (sfs->ln == 1 && !memcmp (ds_cstr (line), "#!", 2)); - /* Echo to listing file, if configured to do so. */ - if (settings_get_echo ()) - tab_output_text (TAB_LEFT | TAB_FIX, ds_cstr (line)); - return true; } diff --git a/src/language/utilities/set.q b/src/language/utilities/set.q index 46d5cd8d..6a1d184f 100644 --- a/src/language/utilities/set.q +++ b/src/language/utilities/set.q @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -72,13 +72,10 @@ int tgetnum (const char *); cpi=integer "x>0" "%s must be greater than 0"; cprompt=string; decimal=dec:dot/comma; - disk=custom; dprompt=string; - echo=echo:on/off; endcmd=string "x==1" "one character long"; epoch=custom; - errorbreak=errbrk:on/off; - errors=errors:terminal/listing/both/on/none/off; + errors=custom; format=custom; headers=headers:no/yes/blank; highres=hires:on/off; @@ -88,11 +85,10 @@ int tgetnum (const char *); log=custom; length=custom; locale=custom; - listing=custom; 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/on/none/off; + messages=custom; mexpand=mexp:on/off; miterate=integer "x>0" "%s must be greater than 0"; mnest=integer "x>0" "%s must be greater than 0"; @@ -102,9 +98,9 @@ int tgetnum (const char *); mxmemory=integer; mxwarns=integer; nulline=null:on/off; - printback=prtbck:on/off; + printback=custom; prompt=string; - results=res:on/off/terminal/listing/both/on/none/off; + results=custom; rib=rib:msbfirst/lsbfirst/vax/native; rrb=rrb:native/isl/isb/idl/idb/vf/vd/vg/zs/zl; safer=safe:on; @@ -162,24 +158,14 @@ cmd_set (struct lexer *lexer, struct dataset *ds) if (cmd.sbc_decimal) settings_set_decimal_char (cmd.dec == STC_DOT ? '.' : ','); - if (cmd.sbc_echo) - settings_set_echo (cmd.echo == STC_ON); if (cmd.sbc_endcmd) settings_set_endcmd (cmd.s_endcmd[0]); - if (cmd.sbc_errorbreak) - settings_set_errorbreak (cmd.errbrk == STC_ON); - if (cmd.sbc_errors) - { - bool both = cmd.errors == STC_BOTH || cmd.errors == STC_ON; - settings_set_error_routing_to_terminal (cmd.errors == STC_TERMINAL || both); - settings_set_error_routing_to_listing (cmd.errors == STC_LISTING || both); - } if (cmd.sbc_include) settings_set_include (cmd.inc == STC_ON); if (cmd.sbc_mxerrs) - settings_set_mxerrs (cmd.n_mxerrs[0]); + settings_set_max_messages (MSG_S_ERROR, cmd.n_mxerrs[0]); if (cmd.sbc_mxwarns) - settings_set_mxwarns (cmd.n_mxwarns[0]); + settings_set_max_messages (MSG_S_WARNING, cmd.n_mxwarns[0]); if (cmd.sbc_nulline) settings_set_nulline (cmd.null == STC_ON); if (cmd.sbc_rib) @@ -280,7 +266,30 @@ stc_to_float_format (int stc) NOT_REACHED (); } +static int +set_output_routing (struct lexer *lexer, enum settings_output_type type) +{ + enum settings_output_devices devices; + + lex_match (lexer, '='); + if (lex_match_id (lexer, "ON") || lex_match_id (lexer, "BOTH")) + devices = SETTINGS_DEVICE_LISTING | SETTINGS_DEVICE_TERMINAL; + else if (lex_match_id (lexer, "TERMINAL")) + devices = SETTINGS_DEVICE_TERMINAL; + else if (lex_match_id (lexer, "LISTING")) + devices = SETTINGS_DEVICE_LISTING; + else if (lex_match_id (lexer, "OFF") || lex_match_id (lexer, "NONE")) + devices = 0; + else + { + lex_error (lexer, NULL); + return 0; + } + + settings_set_output_routing (type, devices); + return 1; +} /* Parses the BLANKS subcommand, which controls the value that completely blank fields in numeric data imply. X, Wnd: Syntax is @@ -336,6 +345,13 @@ stc_custom_epoch (struct lexer *lexer, return 1; } +static int +stc_custom_errors (struct lexer *lexer, struct dataset *ds UNUSED, + struct cmd_set *cmd UNUSED, void *aux UNUSED) +{ + return set_output_routing (lexer, SETTINGS_OUTPUT_ERROR); +} + static int stc_custom_length (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void *aux UNUSED) { @@ -396,7 +412,26 @@ stc_custom_locale (struct lexer *lexer, struct dataset *ds UNUSED, return 1; } +static int +stc_custom_messages (struct lexer *lexer, struct dataset *ds UNUSED, + struct cmd_set *cmd UNUSED, void *aux UNUSED) +{ + return set_output_routing (lexer, SETTINGS_OUTPUT_NOTE); +} + +static int +stc_custom_printback (struct lexer *lexer, struct dataset *ds UNUSED, + struct cmd_set *cmd UNUSED, void *aux UNUSED) +{ + return set_output_routing (lexer, SETTINGS_OUTPUT_SYNTAX); +} +static int +stc_custom_results (struct lexer *lexer, struct dataset *ds UNUSED, + struct cmd_set *cmd UNUSED, void *aux UNUSED) +{ + return set_output_routing (lexer, SETTINGS_OUTPUT_RESULT); +} static int stc_custom_seed (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void *aux UNUSED) @@ -488,33 +523,24 @@ stc_custom_log (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_set * { return stc_custom_journal (lexer, ds, cmd, aux); } - -static int -stc_custom_listing (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void *aux UNUSED) + +static char * +show_output_routing (enum settings_output_type type) { - bool listing; + enum settings_output_devices devices; + const char *s; - lex_match (lexer, '='); - if (lex_match_id (lexer, "ON") || lex_match_id (lexer, "YES")) - listing = true; - else if (lex_match_id (lexer, "OFF") || lex_match_id (lexer, "NO")) - listing = false; + devices = settings_get_output_routing (type); + if (devices & SETTINGS_DEVICE_LISTING) + s = devices & SETTINGS_DEVICE_TERMINAL ? "BOTH" : "LISTING"; + else if (devices & SETTINGS_DEVICE_TERMINAL) + s = "TERMINAL"; else - { - /* FIXME */ - return 0; - } - output_set_type_enabled (listing, OUTPUT_DEVICE_LISTING); + s = "NONE"; - return 1; + return xstrdup (s); } -static int -stc_custom_disk (struct lexer *lexer, struct dataset *ds, struct cmd_set *cmd UNUSED, void *aux) -{ - return stc_custom_listing (lexer, ds, cmd, aux); -} - static char * show_blanks (const struct dataset *ds UNUSED) { @@ -600,12 +626,7 @@ show_endcmd (const struct dataset *ds UNUSED) static char * show_errors (const struct dataset *ds UNUSED) { - bool terminal = settings_get_error_routing_to_terminal (); - bool listing = settings_get_error_routing_to_listing (); - return xstrdup (terminal && listing ? "BOTH" - : terminal ? "TERMINAL" - : listing ? "LISTING" - : "NONE"); + return show_output_routing (SETTINGS_OUTPUT_ERROR); } static char * @@ -627,10 +648,28 @@ show_locale (const struct dataset *ds UNUSED) return xstrdup (get_default_encoding ()); } +static char * +show_messages (const struct dataset *ds UNUSED) +{ + return show_output_routing (SETTINGS_OUTPUT_NOTE); +} + +static char * +show_printback (const struct dataset *ds UNUSED) +{ + return show_output_routing (SETTINGS_OUTPUT_SYNTAX); +} + +static char * +show_results (const struct dataset *ds UNUSED) +{ + return show_output_routing (SETTINGS_OUTPUT_RESULT); +} + static char * show_mxerrs (const struct dataset *ds UNUSED) { - return xasprintf ("%d", settings_get_mxerrs ()); + return xasprintf ("%d", settings_get_max_messages (MSG_S_ERROR)); } static char * @@ -642,7 +681,7 @@ show_mxloops (const struct dataset *ds UNUSED) static char * show_mxwarns (const struct dataset *ds UNUSED) { - return xasprintf ("%d", settings_get_mxwarns ()); + return xasprintf ("%d", settings_get_max_messages (MSG_S_WARNING)); } /* Returns a name for the given INTEGER_FORMAT value. */ @@ -773,9 +812,12 @@ const struct show_sbc show_table[] = {"FORMAT", show_format}, {"LENGTH", show_length}, {"LOCALE", show_locale}, + {"MESSAGES", show_messages}, {"MXERRS", show_mxerrs}, {"MXLOOPS", show_mxloops}, {"MXWARNS", show_mxwarns}, + {"PRINTBACk", show_printback}, + {"RESULTS", show_results}, {"RIB", show_rib}, {"RRB", show_rrb}, {"SCOMPRESSION", show_scompression}, diff --git a/src/libpspp/automake.mk b/src/libpspp/automake.mk index 04c7e9f6..0172d80f 100644 --- a/src/libpspp/automake.mk +++ b/src/libpspp/automake.mk @@ -105,10 +105,6 @@ src/libpspp/version.c: $(top_srcdir)/AUTHORS Makefile (`date`).\";" >> $@ echo "const char host_system[] = \"$(host_triplet)\";" >> $@ echo "const char build_system[] = \"$(build_triplet)\";" >> $@ - echo "const char default_config_path[] =\ -\"\$$HOME/.pspp:$(pkgsysconfdir)\";" >> $@ - echo "const char include_path[] =\ -\"./:\$$HOME/.pspp/include:$(pkgdatadir)\";" >> $@ echo "const char locale_dir[] = \"$(datadir)/locale\";" >> $@ echo "const char *const authors[] = {" >> $@ sed -e 's/^/ \"/' -e 's/$$/\",/' $(top_srcdir)/AUTHORS >> $@ diff --git a/src/libpspp/getl.c b/src/libpspp/getl.c index 302cd913..dc69f11a 100644 --- a/src/libpspp/getl.c +++ b/src/libpspp/getl.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,15 +16,16 @@ #include -#include +#include "libpspp/getl.h" -#include "getl.h" +#include -#include -#include -#include +#include "libpspp/ll.h" +#include "libpspp/str.h" +#include "libpspp/string-array.h" -#include "xalloc.h" +#include "gl/relocatable.h" +#include "gl/xalloc.h" struct getl_source { @@ -41,14 +42,15 @@ struct getl_source struct source_stream { struct ll_list sources ; /* List of source files. */ - - struct string the_include_path; + struct string_array include_path; }; -const char * -getl_include_path (const struct source_stream *ss) +char ** +getl_include_path (const struct source_stream *ss_) { - return ds_cstr (&ss->the_include_path); + struct source_stream *ss = CONST_CAST (struct source_stream *, ss_); + string_array_terminate_null (&ss->include_path); + return ss->include_path.strings; } static struct getl_source * @@ -80,15 +82,19 @@ source_stream_current_error_mode (const struct source_stream *ss) /* Initialize getl. */ struct source_stream * -create_source_stream (const char *initial_include_path) +create_source_stream (void) { - struct source_stream *ss = xzalloc (sizeof (*ss)); + struct source_stream *ss; + + ss = xzalloc (sizeof (*ss)); ll_init (&ss->sources); -#if 0 - ds_init_cstr (&ss->the_include_path, - fn_getenv_default ("STAT_INCLUDE_PATH", include_path)); -#endif - ds_init_cstr (&ss->the_include_path, initial_include_path); + + string_array_init (&ss->include_path); + string_array_append (&ss->include_path, "."); + if (getenv ("HOME") != NULL) + string_array_append_nocopy (&ss->include_path, + xasprintf ("%s/.pspp", getenv ("HOME"))); + string_array_append (&ss->include_path, relocate (PKGDATADIR)); return ss; } @@ -97,17 +103,14 @@ create_source_stream (const char *initial_include_path) void getl_clear_include_path (struct source_stream *ss) { - ds_clear (&ss->the_include_path); + string_array_clear (&ss->include_path); } /* Add to the include path. */ void getl_add_include_dir (struct source_stream *ss, const char *path) { - if (ds_length (&ss->the_include_path)) - ds_put_char (&ss->the_include_path, ':'); - - ds_put_cstr (&ss->the_include_path, path); + string_array_append (&ss->include_path, path); } /* Appends source S to the list of source files. */ @@ -231,7 +234,7 @@ destroy_source_stream (struct source_stream *ss) { while ( !ll_is_empty (&ss->sources)) close_source (ss); - ds_destroy (&ss->the_include_path); + string_array_destroy (&ss->include_path); free (ss); } diff --git a/src/libpspp/getl.h b/src/libpspp/getl.h index c0399377..47dea27e 100644 --- a/src/libpspp/getl.h +++ b/src/libpspp/getl.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -80,7 +80,7 @@ struct getl_interface struct source_stream; -struct source_stream * create_source_stream (const char *); +struct source_stream *create_source_stream (void); enum syntax_mode source_stream_current_syntax_mode (const struct source_stream *); @@ -94,7 +94,7 @@ void destroy_source_stream (struct source_stream *); void getl_clear_include_path (struct source_stream *); void getl_add_include_dir (struct source_stream *, const char *); -const char * getl_include_path (const struct source_stream *); +char **getl_include_path (const struct source_stream *); void getl_abort_noninteractive (struct source_stream *); bool getl_is_interactive (const struct source_stream *); diff --git a/src/libpspp/message.c b/src/libpspp/message.c index 6b4848a3..b3025156 100644 --- a/src/libpspp/message.c +++ b/src/libpspp/message.c @@ -170,8 +170,6 @@ request_bug_report_and_abort (const char *msg) fprintf (stderr, "version: %s\n", stat_version); fprintf (stderr, "host_system: %s\n", host_system); fprintf (stderr, "build_system: %s\n", build_system); - fprintf (stderr, "default_config_path: %s\n", default_config_path); - fprintf (stderr, "include_path: %s\n", include_path); fprintf (stderr, "locale_dir: %s\n", locale_dir); fprintf (stderr, "compiler version: %s\n", #ifdef __VERSION__ diff --git a/src/libpspp/version.h b/src/libpspp/version.h index 88cd3ebe..e2125154 100644 --- a/src/libpspp/version.h +++ b/src/libpspp/version.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,12 +33,6 @@ extern const char host_system[]; /* Canonical name of build system type. */ extern const char build_system[]; -/* Configuration path at build time. */ -extern const char default_config_path[]; - -/* Include path. */ -extern const char include_path[]; - /* Locale directory. */ extern const char locale_dir[]; diff --git a/src/output/ascii.c b/src/output/ascii.c index ffe8515f..b427df53 100644 --- a/src/output/ascii.c +++ b/src/output/ascii.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -93,7 +93,7 @@ struct ascii_driver struct output_driver driver; /* User parameters. */ - bool append; /* Append if output-file already exists? */ + bool append; /* Append if output file already exists? */ bool headers; /* Print headers at top of page? */ bool paginate; /* Insert formfeeds? */ bool squeeze_blank_lines; /* Squeeze multiple blank lines into one? */ @@ -124,6 +124,10 @@ struct ascii_driver int y; }; +static const struct output_driver_class ascii_driver_class; + +static void ascii_submit (struct output_driver *, const struct output_item *); + static int vertical_margins (const struct ascii_driver *); static const char *get_default_box (int right, int bottom, int left, int top); @@ -146,7 +150,7 @@ static void ascii_draw_cell (void *, const struct table_cell *, static struct ascii_driver * ascii_driver_cast (struct output_driver *driver) { - assert (driver->class == &ascii_class); + assert (driver->class == &ascii_driver_class); return UP_CAST (driver, struct ascii_driver, driver); } @@ -158,7 +162,7 @@ opt (struct output_driver *d, struct string_map *options, const char *key, } static struct output_driver * -ascii_create (const char *name, enum output_device_type device_type, +ascii_create (const char *file_name, enum settings_output_devices device_type, struct string_map *o) { struct output_driver *d; @@ -168,28 +172,21 @@ ascii_create (const char *name, enum output_device_type device_type, a = xzalloc (sizeof *a); d = &a->driver; - output_driver_init (&a->driver, &ascii_class, name, device_type); + output_driver_init (&a->driver, &ascii_driver_class, file_name, device_type); a->append = parse_boolean (opt (d, o, "append", "false")); - a->headers = parse_boolean (opt (d, o, "headers", "true")); - a->paginate = parse_boolean (opt (d, o, "paginate", "true")); - a->squeeze_blank_lines = parse_boolean (opt (d, o, "squeeze", "false")); - a->emphasis = parse_enum (opt (d, o, "emphasis", "bold"), + a->headers = parse_boolean (opt (d, o, "headers", "false")); + a->paginate = parse_boolean (opt (d, o, "paginate", "false")); + a->squeeze_blank_lines = parse_boolean (opt (d, o, "squeeze", "true")); + a->emphasis = parse_enum (opt (d, o, "emphasis", "none"), "bold", EMPH_BOLD, "underline", EMPH_UNDERLINE, "none", EMPH_NONE, (char *) NULL); - if (parse_enum (opt (d, o, "chart-type", "png"), - "png", true, - "none", false, - (char *) NULL)) - a->chart_file_name = parse_chart_file_name (opt (d, o, "chart-files", - "pspp-#.png")); - else - a->chart_file_name = NULL; + a->chart_file_name = parse_chart_file_name (opt (d, o, "charts", file_name)); - a->top_margin = parse_int (opt (d, o, "top-margin", "2"), 0, INT_MAX); - a->bottom_margin = parse_int (opt (d, o, "bottom-margin", "2"), 0, INT_MAX); + a->top_margin = parse_int (opt (d, o, "top-margin", "0"), 0, INT_MAX); + a->bottom_margin = parse_int (opt (d, o, "bottom-margin", "0"), 0, INT_MAX); a->width = parse_page_size (opt (d, o, "width", "79")); paper_length = parse_page_size (opt (d, o, "length", "66")); @@ -214,7 +211,7 @@ ascii_create (const char *name, enum output_device_type device_type, a->title = xstrdup (""); a->subtitle = xstrdup (""); - a->file_name = parse_string (opt (d, o, "output-file", "pspp.list")); + a->file_name = xstrdup (file_name); a->file = NULL; a->error = false; a->page_number = 0; @@ -531,10 +528,14 @@ ascii_submit (struct output_driver *driver, } } -const struct output_driver_class ascii_class = +const struct output_driver_factory txt_driver_factory = + { "txt", ascii_create }; +const struct output_driver_factory list_driver_factory = + { "list", ascii_create }; + +static const struct output_driver_class ascii_driver_class = { - "ascii", - ascii_create, + "text", ascii_destroy, ascii_submit, ascii_flush, diff --git a/src/output/cairo.c b/src/output/cairo.c index 3584f30f..c6892793 100644 --- a/src/output/cairo.c +++ b/src/output/cairo.c @@ -133,6 +133,8 @@ struct xr_driver int y; }; +static const struct output_driver_class cairo_driver_class; + static void xr_show_page (struct xr_driver *); static void draw_headers (struct xr_driver *); @@ -154,7 +156,7 @@ static void xr_draw_cell (void *, const struct table_cell *, static struct xr_driver * xr_driver_cast (struct output_driver *driver) { - assert (driver->class == &cairo_class); + assert (driver->class == &cairo_driver_class); return UP_CAST (driver, struct xr_driver, driver); } @@ -173,7 +175,7 @@ xr_allocate (const char *name, int device_type, struct string_map *o) xr = xzalloc (sizeof *xr); d = &xr->driver; - output_driver_init (d, &cairo_class, name, device_type); + output_driver_init (d, &cairo_driver_class, name, device_type); xr->headers = true; xr->font_height = XR_POINT * 10; xr->fonts[XR_FONT_FIXED].string @@ -232,8 +234,8 @@ xr_set_cairo (struct xr_driver *xr, cairo_t *cairo) } static struct output_driver * -xr_create (const char *name, enum output_device_type device_type, - struct string_map *o) +xr_create (const char *file_name, enum settings_output_devices device_type, + struct string_map *o, enum xr_output_type file_type) { enum { MIN_WIDTH = 3, MIN_LENGTH = 3 }; struct output_driver *d; @@ -242,22 +244,13 @@ xr_create (const char *name, enum output_device_type device_type, cairo_status_t status; double width_pt, length_pt; int paper_width, paper_length; - char *file_name; - xr = xr_allocate (name, device_type, o); + xr = xr_allocate (file_name, device_type, o); d = &xr->driver; xr->headers = parse_boolean (opt (d, o, "headers", "true")); - xr->file_type = parse_enum (opt (d, o, "output-type", "pdf"), - "pdf", XR_PDF, - "ps", XR_PS, - "svg", XR_SVG, - (char *) NULL); - file_name = parse_string (opt (d, o, "output-file", - (xr->file_type == XR_PDF ? "pspp.pdf" - : xr->file_type == XR_PS ? "pspp.ps" - : "pspp.svg"))); + xr->file_type = file_type; parse_paper_size (opt (d, o, "paper-size", ""), &paper_width, &paper_length); xr->left_margin = parse_dimension (opt (d, o, "left-margin", ".5in")); @@ -321,7 +314,6 @@ xr_create (const char *name, enum output_device_type device_type, goto error; } - free (file_name); return &xr->driver; error: @@ -329,6 +321,27 @@ xr_create (const char *name, enum output_device_type device_type, return NULL; } +static struct output_driver * +xr_pdf_create (const char *file_name, enum settings_output_devices device_type, + struct string_map *o) +{ + return xr_create (file_name, device_type, o, XR_PDF); +} + +static struct output_driver * +xr_ps_create (const char *file_name, enum settings_output_devices device_type, + struct string_map *o) +{ + return xr_create (file_name, device_type, o, XR_PS); +} + +static struct output_driver * +xr_svg_create (const char *file_name, enum settings_output_devices device_type, + struct string_map *o) +{ + return xr_create (file_name, device_type, o, XR_SVG); +} + static void xr_destroy (struct output_driver *driver) { @@ -899,11 +912,13 @@ free_font (struct xr_font *font) g_object_unref (font->layout); } -/* Cairo driver class. */ -const struct output_driver_class cairo_class = +struct output_driver_factory pdf_driver_factory = { "pdf", xr_pdf_create }; +struct output_driver_factory ps_driver_factory = { "ps", xr_ps_create }; +struct output_driver_factory svg_driver_factory = { "svg", xr_svg_create }; + +static const struct output_driver_class cairo_driver_class = { "cairo", - xr_create, xr_destroy, xr_submit, xr_flush, diff --git a/src/output/csv.c b/src/output/csv.c index 625ce82a..6be9c43a 100644 --- a/src/output/csv.c +++ b/src/output/csv.c @@ -47,10 +47,12 @@ struct csv_driver int n_items; /* Number of items output so far. */ }; +static const struct output_driver_class csv_driver_class; + static struct csv_driver * csv_driver_cast (struct output_driver *driver) { - assert (driver->class == &csv_class); + assert (driver->class == &csv_driver_class); return UP_CAST (driver, struct csv_driver, driver); } @@ -62,7 +64,7 @@ opt (struct output_driver *d, struct string_map *options, const char *key, } static struct output_driver * -csv_create (const char *name, enum output_device_type device_type, +csv_create (const char *file_name, enum settings_output_devices device_type, struct string_map *o) { struct output_driver *d; @@ -70,7 +72,7 @@ csv_create (const char *name, enum output_device_type device_type, csv = xzalloc (sizeof *csv); d = &csv->driver; - output_driver_init (&csv->driver, &csv_class, name, device_type); + output_driver_init (&csv->driver, &csv_driver_class, file_name, device_type); csv->separator = parse_string (opt (d, o, "separator", ",")); csv->file_name = parse_string (opt (d, o, "output-file", "pspp.csv")); @@ -227,10 +229,11 @@ csv_submit (struct output_driver *driver, } } -const struct output_driver_class csv_class = +struct output_driver_factory csv_driver_factory = { "csv", csv_create }; + +static const struct output_driver_class csv_driver_class = { "csv", - csv_create, csv_destroy, csv_submit, csv_flush, diff --git a/src/output/driver-provider.h b/src/output/driver-provider.h index 92929b54..df316373 100644 --- a/src/output/driver-provider.h +++ b/src/output/driver-provider.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,9 +17,11 @@ #ifndef OUTPUT_DRIVER_PROVIDER_H #define OUTPUT_DRIVER_PROVIDER_H 1 -#include #include -#include + +#include "data/settings.h" +#include "libpspp/compiler.h" +#include "output/driver.h" struct output_item; struct string_map; @@ -29,12 +31,12 @@ struct output_driver { const struct output_driver_class *class; /* Driver class. */ char *name; /* Name of this driver. */ - enum output_device_type device_type; /* One of OUTPUT_DEVICE_*. */ + enum settings_output_devices device_type; /* One of SETTINGS_DEVICE_*. */ }; void output_driver_init (struct output_driver *, const struct output_driver_class *, - const char *name, enum output_device_type); + const char *name, enum settings_output_devices); void output_driver_destroy (struct output_driver *); const char *output_driver_get_name (const struct output_driver *); @@ -47,22 +49,8 @@ const char *output_driver_get_name (const struct output_driver *); with error(), which will never call into the output drivers. */ struct output_driver_class { - const char *name; /* Name of this driver class. */ - - /* Creates a new output driver of this class. NAME and TYPE should be - passed directly to output_driver_init. Returns the new output driver if - successful, otherwise a null pointer. - - It is up to the driver class to decide how to interpret OPTIONS. The - functions in output/options.h can be useful. OPTIONS may be modified - but the caller is responsible for destroying it. - - The returned driver should not have been registered (with - output_driver_register). The caller will register the driver (if this - is desirable). */ - struct output_driver *(*create) (const char *name, - enum output_device_type type, - struct string_map *options); + /* Name of this driver class. */ + const char *name; /* Closes and frees DRIVER. */ void (*destroy) (struct output_driver *driver); @@ -83,17 +71,31 @@ struct output_driver_class void (*flush) (struct output_driver *driver); }; -void output_driver_register (struct output_driver *); -void output_driver_unregister (struct output_driver *); -bool output_driver_is_registered (const struct output_driver *); - -/* Common drivers. */ -extern const struct output_driver_class ascii_class; -extern const struct output_driver_class html_class; -extern const struct output_driver_class odt_class; -extern const struct output_driver_class csv_class; -#ifdef HAVE_CAIRO -extern const struct output_driver_class cairo_class; -#endif +/* Useful for output driver implementation. */ +void output_driver_track_current_command (const struct output_item *, char **); + +/* An abstract way for the output subsystem to create an output driver. */ +struct output_driver_factory + { + /* The file extension, without the leading dot, e.g. "pdf". */ + const char *extension; + + /* Creates a new output driver of this class. NAME and TYPE should be + passed directly to output_driver_init. Returns the new output driver if + successful, otherwise a null pointer. + + It is up to the driver class to decide how to interpret OPTIONS. The + create function should delete pairs that it understands from OPTIONS, + because the caller may issue errors about unknown options for any pairs + that remain. The functions in output/options.h can be useful. + + The returned driver should not have been registered (with + output_driver_register). The caller will register the driver (if this + is desirable). */ + struct output_driver *(*create) (const char *name, + enum settings_output_devices type, + struct string_map *options); + }; + #endif /* output/driver-provider.h */ diff --git a/src/output/driver.c b/src/output/driver.c index 6dd25174..61852c4a 100644 --- a/src/output/driver.c +++ b/src/output/driver.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,8 @@ #include -#include -#include +#include "output/driver.h" +#include "output/driver-provider.h" #include #include @@ -25,32 +25,29 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "error.h" -#include "xalloc.h" -#include "xmemdup0.h" +#include "data/file-name.h" +#include "data/settings.h" +#include "libpspp/array.h" +#include "libpspp/assertion.h" +#include "libpspp/message.h" +#include "libpspp/llx.h" +#include "libpspp/string-map.h" +#include "libpspp/string-set.h" +#include "libpspp/str.h" +#include "output/output-item.h" +#include "output/text-item.h" + +#include "gl/error.h" +#include "gl/xalloc.h" +#include "gl/xmemdup0.h" #include "gettext.h" #define _(msgid) gettext (msgid) -static const struct output_driver_class *driver_classes[]; - -static struct output_driver **drivers; -static size_t n_drivers, allocated_drivers; +static const struct output_driver_factory *factories[]; -static unsigned int enabled_device_types = ((1u << OUTPUT_DEVICE_UNKNOWN) - | (1u << OUTPUT_DEVICE_LISTING) - | (1u << OUTPUT_DEVICE_SCREEN) - | (1u << OUTPUT_DEVICE_PRINTER)); +/* Drivers currently registered with output_driver_register(). */ +static struct llx_list drivers = LLX_INITIALIZER (drivers); static struct output_item *deferred_syntax; static bool in_command; @@ -58,509 +55,55 @@ static bool in_command; void output_close (void) { - while (n_drivers > 0) + while (!llx_is_empty (&drivers)) { - struct output_driver *d = drivers[--n_drivers]; + struct output_driver *d = llx_pop_head (&drivers, &llx_malloc_mgr); output_driver_destroy (d); } } -static void -expand_macro (const char *name, struct string *dst, void *macros_) -{ - const struct string_map *macros = macros_; - - if (!strcmp (name, "viewwidth")) - ds_put_format (dst, "%d", settings_get_viewwidth ()); - else if (!strcmp (name, "viewlength")) - ds_put_format (dst, "%d", settings_get_viewlength ()); - else - { - const char *value = string_map_find (macros, name); - if (value != NULL) - ds_put_cstr (dst, value); - } -} - -/* Defines one configuration macro based on the text in BP, which - should be of the form `KEY=VALUE'. Returns true if - successful, false if S is not in the proper form. */ -bool -output_define_macro (const char *s, struct string_map *macros) -{ - const char *key_start, *value; - size_t key_len; - char *key; - - s += strspn (s, CC_SPACES); - - key_start = s; - key_len = strcspn (s, "=" CC_SPACES); - if (key_len == 0) - return false; - s += key_len; - - s += strspn (s, CC_SPACES); - if (*s == '=') - s++; - - s += strspn (s, CC_SPACES); - value = s; - - key = xmemdup0 (key_start, key_len); - if (!string_map_contains (macros, key)) - { - struct string expanded_value = DS_EMPTY_INITIALIZER; - - fn_interp_vars (ss_cstr (value), expand_macro, ¯os, &expanded_value); - string_map_insert_nocopy (macros, key, ds_steal_cstr (&expanded_value)); - } - else - free (key); - - return true; -} - -static void -add_driver_names (char *to, struct string_set *names) -{ - char *save_ptr = NULL; - char *name; - - for (name = strtok_r (to, CC_SPACES, &save_ptr); name != NULL; - name = strtok_r (NULL, CC_SPACES, &save_ptr)) - string_set_insert (names, name); -} - -static void -init_default_drivers (void) -{ - error (0, 0, _("using default output driver configuration")); - output_configure_driver ("list:ascii:listing:" - "length=66 width=79 output-file=\"pspp.list\""); -} - -static void -warn_unused_drivers (const struct string_set *unused_drivers, - const struct string_set *requested_drivers) -{ - const struct string_set_node *node; - const char *name; - - STRING_SET_FOR_EACH (name, node, unused_drivers) - if (string_set_contains (requested_drivers, name)) - error (0, 0, _("unknown output driver `%s'"), name); - else - error (0, 0, _("output driver `%s' referenced but never defined"), name); -} - void -output_read_configuration (const struct string_map *macros_, - const struct string_set *driver_names_) -{ - struct string_map macros = STRING_MAP_INITIALIZER (macros); - struct string_set driver_names = STRING_SET_INITIALIZER (driver_names); - char *devices_file_name = NULL; - FILE *devices_file = NULL; - struct string line = DS_EMPTY_INITIALIZER; - int line_number; - - ds_init_empty (&line); - - devices_file_name = fn_search_path ("devices", config_path); - if (devices_file_name == NULL) - { - error (0, 0, _("cannot find output initialization file " - "(use `-vv' to view search path)")); - goto exit; - } - devices_file = fopen (devices_file_name, "r"); - if (devices_file == NULL) - { - error (0, errno, _("cannot open \"%s\""), devices_file_name); - goto exit; - } - - string_map_replace_map (¯os, macros_); - string_set_union (&driver_names, driver_names_); - if (string_set_is_empty (&driver_names)) - string_set_insert (&driver_names, "default"); - - line_number = 0; - for (;;) - { - char *cp, *delimiter, *name; - - if (!ds_read_config_line (&line, &line_number, devices_file)) - { - if (ferror (devices_file)) - error (0, errno, _("reading \"%s\""), devices_file_name); - break; - } - - cp = ds_cstr (&line); - cp += strspn (cp, CC_SPACES); - - if (*cp == '\0') - continue; - else if (!strncmp ("define", cp, 6) && isspace ((unsigned char) cp[6])) - { - if (!output_define_macro (&cp[7], ¯os)) - error_at_line (0, 0, devices_file_name, line_number, - _("\"%s\" is not a valid macro definition"), - &cp[7]); - continue; - } - - delimiter = cp + strcspn (cp, ":="); - name = xmemdup0 (cp, delimiter - cp); - if (*delimiter == '=') - { - if (string_set_delete (&driver_names, name)) - add_driver_names (delimiter + 1, &driver_names); - } - else if (*delimiter == ':') - { - if (string_set_delete (&driver_names, name)) - { - fn_interp_vars (ds_ss (&line), expand_macro, ¯os, &line); - output_configure_driver (ds_cstr (&line)); - } - } - else - error_at_line (0, 0, devices_file_name, line_number, - _("syntax error")); - free (name); - } - - warn_unused_drivers (&driver_names, driver_names_); - -exit: - if (devices_file != NULL) - fclose (devices_file); - free (devices_file_name); - ds_destroy (&line); - string_set_destroy (&driver_names); - string_map_destroy (¯os); - - if (n_drivers == 0) - { - error (0, 0, _("no active output drivers")); - init_default_drivers (); - } -} - -/* Obtains a token from S and advances its position. Errors are - reported against the given DRIVER_NAME. - The token is stored in TOKEN. Returns true if successful, - false on syntax error. - - Caller is responsible for skipping leading spaces. */ -static bool -get_option_token (char **s_, const char *driver_name, - struct string *token) +output_get_supported_formats (struct string_set *formats) { - struct substring s = ss_cstr (*s_); - int c; - - ds_clear (token); - c = ss_get_char (&s); - if (c == EOF) - { - error (0, 0, _("syntax error parsing options for \"%s\" driver"), - driver_name); - return false; - } - else if (c == '\'' || c == '"') - { - int quote = c; - - for (;;) - { - c = ss_get_char (&s); - if (c == quote) - break; - else if (c == EOF) - { - error (0, 0, - _("reached end of options inside quoted string " - "parsing options for \"%s\" driver"), - driver_name); - return false; - } - else if (c != '\\') - ds_put_char (token, c); - else - { - int out; - - c = ss_get_char (&s); - switch (c) - { - case '\'': - out = '\''; - break; - case '"': - out = '"'; - break; - case '\\': - out = '\\'; - break; - case 'a': - out = '\a'; - break; - case 'b': - out = '\b'; - break; - case 'f': - out = '\f'; - break; - case 'n': - out = '\n'; - break; - case 'r': - out = '\r'; - break; - case 't': - out = '\t'; - break; - case 'v': - out = '\v'; - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - out = c - '0'; - while (ss_first (s) >= '0' && ss_first (s) <= '7') - out = out * 8 + (ss_get_char (&s) - '0'); - break; - case 'x': - case 'X': - out = 0; - while (isxdigit (ss_first (s))) - { - c = ss_get_char (&s); - out *= 16; - if (isdigit (c)) - out += c - '0'; - else - out += tolower (c) - 'a' + 10; - } - break; - default: - error (0, 0, _("syntax error in string constant " - "parsing options for \"%s\" driver"), - driver_name); - return false; - } - ds_put_char (token, out); - } - } - } - else - { - for (;;) - { - ds_put_char (token, c); - - c = ss_first (s); - if (c == EOF || c == '=' || isspace (c)) - break; - ss_advance (&s, 1); - } - } + const struct output_driver_factory **fp; - *s_ = s.string; - return 1; + for (fp = factories; *fp != NULL; fp++) + string_set_insert (formats, (*fp)->extension); } static void -parse_options (const char *driver_name, char *options, - struct string_map *option_map) +output_submit__ (struct output_item *item) { - struct string key = DS_EMPTY_INITIALIZER; - struct string value = DS_EMPTY_INITIALIZER; - - for (;;) - { - options += strspn (options, CC_SPACES); - if (*options == '\0') - break; - - if (!get_option_token (&options, driver_name, &key)) - break; - - options += strspn (options, CC_SPACES); - if (*options != '=') - { - error (0, 0, _("syntax error expecting `=' " - "parsing options for driver \"%s\""), - driver_name); - break; - } - options++; - - options += strspn (options, CC_SPACES); - if (!get_option_token (&options, driver_name, &value)) - break; - - if (string_map_contains (option_map, ds_cstr (&key))) - error (0, 0, _("driver \"%s\" defines option \"%s\" multiple times"), - driver_name, ds_cstr (&key)); - else - string_map_insert (option_map, ds_cstr (&key), ds_cstr (&value)); - } - - ds_destroy (&key); - ds_destroy (&value); -} + struct llx *llx, *next; -static char * -trim_token (char *token) -{ - if (token != NULL) + for (llx = llx_head (&drivers); llx != llx_null (&drivers); llx = next) { - char *end; - - /* Trim leading spaces. */ - while (isspace ((unsigned char) *token)) - token++; - - /* Trim trailing spaces. */ - end = strchr (token, '\0'); - while (end > token && isspace ((unsigned char) end[-1])) - *--end = '\0'; - - /* An empty token is a null token. */ - if (*token == '\0') - return NULL; - } - return token; -} - -static const struct output_driver_class * -find_output_class (const char *name) -{ - const struct output_driver_class **classp; + struct output_driver *d = llx_data (llx); + enum settings_output_type type; - for (classp = driver_classes; *classp != NULL; classp++) - if (!strcmp ((*classp)->name, name)) - break; + next = llx_next (llx); - return *classp; -} - -static struct output_driver * -create_driver (const char *driver_name, const char *class_name, - const char *device_type, struct string_map *options) -{ - const struct output_driver_class *class; - enum output_device_type type; - struct output_driver *driver; - - type = OUTPUT_DEVICE_UNKNOWN; - if (device_type != NULL && device_type[0] != '\0') - { - if (!strcmp (device_type, "listing")) - type = OUTPUT_DEVICE_LISTING; - else if (!strcmp (device_type, "screen")) - type = OUTPUT_DEVICE_SCREEN; - else if (!strcmp (device_type, "printer")) - type = OUTPUT_DEVICE_PRINTER; + if (is_text_item (item) + && text_item_get_type (to_text_item (item)) == TEXT_ITEM_SYNTAX) + type = SETTINGS_OUTPUT_SYNTAX; else - error (0, 0, _("unknown device type `%s'"), device_type); - } - - class = find_output_class (class_name); - if (class != NULL) - driver = class->create (driver_name, type, options); - else - { - error (0, 0, _("unknown output driver class `%s'"), class_name); - driver = NULL; - } - - string_map_destroy (options); - - return driver; -} - -struct output_driver * -output_driver_create (const char *class_name, struct string_map *options) -{ - return create_driver (class_name, class_name, NULL, options); -} - -/* String LINE is in format: - DRIVERNAME:CLASSNAME:DEVICETYPE:OPTIONS -*/ -void -output_configure_driver (const char *line_) -{ - char *save_ptr = NULL; - char *line = xstrdup (line_); - char *driver_name = trim_token (strtok_r (line, ":", &save_ptr)); - char *class_name = trim_token (strtok_r (NULL, ":", &save_ptr)); - char *device_type = trim_token (strtok_r (NULL, ":", &save_ptr)); - char *options = trim_token (strtok_r (NULL, "", &save_ptr)); - - if (driver_name && class_name) - { - struct string_map option_map; - struct output_driver *driver; - - string_map_init (&option_map); - if (options != NULL) - parse_options (driver_name, options, &option_map); + type = SETTINGS_OUTPUT_RESULT; - driver = create_driver (driver_name, class_name, - device_type, &option_map); - if (driver != NULL) - output_driver_register (driver); + if (settings_get_output_routing (type) & d->device_type) + d->class->submit (d, item); } - else - error (0, 0, - _("driver definition line missing driver name or class name")); - free (line); -} - -/* Display on stdout a list of all registered driver classes. */ -void -output_list_classes (void) -{ - const struct output_driver_class **classp; - - printf (_("Driver classes:")); - for (classp = driver_classes; *classp != NULL; classp++) - printf (" %s", (*classp)->name); - putc ('\n', stdout); -} - -static bool -driver_is_enabled (const struct output_driver *d) -{ - return (1u << d->device_type) & enabled_device_types; + output_item_unref (item); } static void -output_submit__ (struct output_item *item) +flush_deferred_syntax (void) { - size_t i; - - for (i = 0; i < n_drivers; i++) + if (deferred_syntax != NULL) { - struct output_driver *d = drivers[i]; - if (driver_is_enabled (d)) - d->class->submit (d, item); + output_submit__ (deferred_syntax); + deferred_syntax = NULL; } - - output_item_unref (item); } /* Submits ITEM to the configured output drivers, and transfers ownership to @@ -576,8 +119,7 @@ output_submit (struct output_item *item) case TEXT_ITEM_SYNTAX: if (!in_command) { - if (deferred_syntax != NULL) - output_submit__ (deferred_syntax); + flush_deferred_syntax (); deferred_syntax = item; return; } @@ -585,11 +127,7 @@ output_submit (struct output_item *item) case TEXT_ITEM_COMMAND_OPEN: output_submit__ (item); - if (deferred_syntax != NULL) - { - output_submit__ (deferred_syntax); - deferred_syntax = NULL; - } + flush_deferred_syntax (); in_command = true; return; @@ -610,42 +148,21 @@ output_submit (struct output_item *item) void output_flush (void) { - size_t i; + struct llx *llx; - for (i = 0; i < n_drivers; i++) + for (llx = llx_head (&drivers); llx != llx_null (&drivers); + llx = llx_next (llx)) { - struct output_driver *d = drivers[i]; - if (driver_is_enabled (d) && d->class->flush != NULL) + struct output_driver *d = llx_data (llx); + if (d->device_type & SETTINGS_DEVICE_TERMINAL && d->class->flush != NULL) d->class->flush (d); } } - -unsigned int -output_get_enabled_types (void) -{ - return enabled_device_types; -} - -void -output_set_enabled_types (unsigned int types) -{ - enabled_device_types = types; -} - -void -output_set_type_enabled (bool enable, enum output_device_type type) -{ - unsigned int bit = 1u << type; - if (enable) - enabled_device_types |= bit; - else - enabled_device_types |= ~bit; -} void output_driver_init (struct output_driver *driver, const struct output_driver_class *class, - const char *name, enum output_device_type type) + const char *name, enum settings_output_devices type) { driver->class = class; driver->name = xstrdup (name); @@ -676,47 +193,147 @@ void output_driver_register (struct output_driver *driver) { assert (!output_driver_is_registered (driver)); - if (n_drivers >= allocated_drivers) - drivers = x2nrealloc (drivers, &allocated_drivers, sizeof *drivers); - drivers[n_drivers++] = driver; + llx_push_tail (&drivers, driver, &llx_malloc_mgr); } void output_driver_unregister (struct output_driver *driver) { - size_t i; - - for (i = 0; i < n_drivers; i++) - if (drivers[i] == driver) - { - remove_element (drivers, n_drivers, sizeof *drivers, i); - return; - } - NOT_REACHED (); + llx_remove (llx_find (llx_head (&drivers), llx_null (&drivers), driver), + &llx_malloc_mgr); } bool output_driver_is_registered (const struct output_driver *driver) { - size_t i; + return llx_find (llx_head (&drivers), llx_null (&drivers), driver) != NULL; +} + +/* Useful functions for output driver implementation. */ + +void +output_driver_track_current_command (const struct output_item *output_item, + char **command_namep) +{ + if (is_text_item (output_item)) + { + const struct text_item *item = to_text_item (output_item); + const char *text = text_item_get_text (item); + enum text_item_type type = text_item_get_type (item); - for (i = 0; i < n_drivers; i++) - if (drivers[i] == driver) - return true; - return false; + if (type == TEXT_ITEM_COMMAND_OPEN) + { + free (*command_namep); + *command_namep = xstrdup (text); + } + else if (type == TEXT_ITEM_COMMAND_CLOSE) + { + free (*command_namep); + *command_namep = NULL; + } + } } -/* Known driver classes. */ +extern const struct output_driver_factory txt_driver_factory; +extern const struct output_driver_factory list_driver_factory; +extern const struct output_driver_factory html_driver_factory; +extern const struct output_driver_factory odt_driver_factory; +extern const struct output_driver_factory csv_driver_factory; +#ifdef HAVE_CAIRO +extern const struct output_driver_factory pdf_driver_factory; +extern const struct output_driver_factory ps_driver_factory; +extern const struct output_driver_factory svg_driver_factory; +#endif -static const struct output_driver_class *driver_classes[] = +static const struct output_driver_factory *factories[] = { - &ascii_class, + &txt_driver_factory, + &list_driver_factory, + &html_driver_factory, + &odt_driver_factory, + &csv_driver_factory, #ifdef HAVE_CAIRO - &cairo_class, + &pdf_driver_factory, + &ps_driver_factory, + &svg_driver_factory, #endif - &html_class, - &odt_class, - &csv_class, - NULL, + NULL }; +static const struct output_driver_factory * +find_factory (const char *format) +{ + const struct output_driver_factory **fp; + + for (fp = factories; *fp != NULL; fp++) + { + const struct output_driver_factory *f = *fp; + + if (!strcmp (f->extension, format)) + return f; + } + return &txt_driver_factory; +} + +static enum settings_output_devices +default_device_type (const char *file_name) +{ + return (!strcmp (file_name, "-") + ? SETTINGS_DEVICE_TERMINAL + : SETTINGS_DEVICE_LISTING); +} + +struct output_driver * +output_driver_create (struct string_map *options) +{ + enum settings_output_devices device_type; + const struct output_driver_factory *f; + struct output_driver *driver; + char *device_string; + char *file_name; + char *format; + + file_name = string_map_find_and_delete (options, "output-file"); + if (file_name == NULL) + file_name = xstrdup ("-"); + + format = string_map_find_and_delete (options, "format"); + if (format == NULL) + { + const char *extension = strrchr (file_name, '.'); + format = xstrdup (extension != NULL ? extension + 1 : ""); + } + + /* XXX should use parse_enum(). */ + device_string = string_map_find_and_delete (options, "device"); + if (device_string == NULL || device_string[0] == '\0') + device_type = default_device_type (file_name); + else if (!strcmp (device_string, "terminal")) + device_type = SETTINGS_DEVICE_TERMINAL; + else if (!strcmp (device_string, "listing")) + device_type = SETTINGS_DEVICE_LISTING; + else + { + error (0, 0, _("%s is not a valid device type (the choices are " + "\"terminal\" and \"listing\")"), device_string); + device_type = default_device_type (file_name); + } + + f = find_factory (format); + driver = f->create (file_name, device_type, options); + if (driver != NULL) + { + const struct string_map_node *node; + const char *key; + + STRING_MAP_FOR_EACH_KEY (key, node, options) + error (0, 0, _("%s: unknown option \"%s\""), file_name, key); + } + string_map_clear (options); + + free (file_name); + free (format); + free (device_string); + + return driver; +} diff --git a/src/output/driver.h b/src/output/driver.h index 3fb4cabf..93802078 100644 --- a/src/output/driver.h +++ b/src/output/driver.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,34 +20,19 @@ #include struct output_item; -struct string_map; struct string_set; - -void output_close (void); - -struct output_driver *output_driver_create (const char *class_name, - struct string_map *options); - -bool output_define_macro (const char *, struct string_map *macros); -void output_read_configuration (const struct string_map *macros, - const struct string_set *drivers); -void output_configure_driver (const char *); - -void output_list_classes (void); +struct string_map; void output_submit (struct output_item *); + void output_flush (void); -/* Device types. */ -enum output_device_type - { - OUTPUT_DEVICE_UNKNOWN, /* Unknown type of device. */ - OUTPUT_DEVICE_LISTING, /* Listing device. */ - OUTPUT_DEVICE_SCREEN, /* Screen device. */ - OUTPUT_DEVICE_PRINTER /* Printer device. */ - }; -unsigned int output_get_enabled_types (void); -void output_set_enabled_types (unsigned int); -void output_set_type_enabled (bool enable, enum output_device_type); +void output_close (void); +void output_get_supported_formats (struct string_set *); + +struct output_driver *output_driver_create (struct string_map *options); +void output_driver_register (struct output_driver *); +void output_driver_unregister (struct output_driver *); +bool output_driver_is_registered (const struct output_driver *); #endif /* output/driver.h */ diff --git a/src/output/html.c b/src/output/html.c index 3f9c177b..a3e14ba1 100644 --- a/src/output/html.c +++ b/src/output/html.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -56,7 +56,7 @@ struct html_driver bool in_syntax; }; -const struct output_driver_class html_class; +static const struct output_driver_class html_driver_class; static void html_output_table (struct html_driver *, struct table_item *); static void escape_string (FILE *file, @@ -68,7 +68,7 @@ static void print_title_tag (FILE *file, const char *name, static struct html_driver * html_driver_cast (struct output_driver *driver) { - assert (driver->class == &html_class); + assert (driver->class == &html_driver_class); return UP_CAST (driver, struct html_driver, driver); } @@ -80,7 +80,7 @@ opt (struct output_driver *d, struct string_map *options, const char *key, } static struct output_driver * -html_create (const char *name, enum output_device_type device_type, +html_create (const char *file_name, enum settings_output_devices device_type, struct string_map *o) { struct output_driver *d; @@ -88,10 +88,12 @@ html_create (const char *name, enum output_device_type device_type, html = xzalloc (sizeof *html); d = &html->driver; - output_driver_init (&html->driver, &html_class, name, device_type); - html->file_name = parse_string (opt (d, o, "output-file", "pspp.html")); - html->chart_file_name = parse_chart_file_name (opt (d, o, "chart-files", - "pspp-#.png")); + output_driver_init (&html->driver, &html_driver_class, file_name, + device_type); + + html->file_name = xstrdup (file_name); + html->chart_file_name = parse_chart_file_name (opt (d, o, "charts", + file_name)); html->file = NULL; html->chart_cnt = 1; @@ -470,10 +472,11 @@ html_output_table (struct html_driver *html, struct table_item *item) fputs ("\n\n", html->file); } -const struct output_driver_class html_class = +struct output_driver_factory html_driver_factory = { "html", html_create }; + +static const struct output_driver_class html_driver_class = { "html", - html_create, html_destroy, html_submit, NULL, diff --git a/src/output/odt.c b/src/output/odt.c index f02ae3de..ab38cd04 100644 --- a/src/output/odt.c +++ b/src/output/odt.c @@ -66,10 +66,12 @@ struct odt_driver int table_num; }; +static const struct output_driver_class odt_driver_class; + static struct odt_driver * odt_driver_cast (struct output_driver *driver) { - assert (driver->class == &odt_class); + assert (driver->class == &odt_driver_class); return UP_CAST (driver, struct odt_driver, driver); } @@ -293,7 +295,7 @@ opt (struct output_driver *d, struct string_map *options, const char *key, } static struct output_driver * -odt_create (const char *name, enum output_device_type device_type, +odt_create (const char *file_name, enum settings_output_devices device_type, struct string_map *o) { struct output_driver *d; @@ -301,9 +303,9 @@ odt_create (const char *name, enum output_device_type device_type, odt = xzalloc (sizeof *odt); d = &odt->driver; - output_driver_init (d, &odt_class, name, device_type); + output_driver_init (d, &odt_driver_class, file_name, device_type); - odt->file_name = parse_string (opt (d, o, "output-file", "pspp.odt")); + odt->file_name = xstrdup (file_name); odt->debug = parse_boolean (opt (d, o, "debug", "false")); odt->dirname = xstrdup ("odt-XXXXXX"); @@ -521,11 +523,11 @@ odt_submit (struct output_driver *driver, } } -/* ODT driver class. */ -const struct output_driver_class odt_class = +struct output_driver_factory odt_driver_factory = { "odt", odt_create }; + +static const struct output_driver_class odt_driver_class = { "odf", - odt_create, odt_destroy, odt_submit, NULL, diff --git a/src/output/options.c b/src/output/options.c index 918f718c..593adf5a 100644 --- a/src/output/options.c +++ b/src/output/options.c @@ -282,30 +282,57 @@ parse_string (struct driver_option *o) return retval; } -/* Parses O's value as a string and returns it as a malloc'd string that the - caller is responsible for freeing. +static char * +default_chart_file_name (const char *file_name) +{ + if (strcmp (file_name, "-")) + { + const char *extension = strrchr (file_name, '.'); + int stem_length = extension ? extension - file_name : strlen (file_name); + return xasprintf ("%.*s-#.png", stem_length, file_name); + } + else + return NULL; +} + +/* Parses and returns a chart file name, or NULL if no charts should be output. + If a nonnull string is returned, it will contain at least one '#' character, + which the client will presumably replace by a number as part of writing + charts to separate files. + + If O->value is "none", then this function returns NULL. - The string must contain at least one '#' character, which the client will - presumably replace by a number as part of writing charts to separate files. + If O->value is non-NULL but not "none", returns a copy of that string (if it + contains '#'). + + If O->value is NULL, then O's default_value should be the name of the main + output file. Returns NULL if default_value is "-", and otherwise returns a + copy of string string with its extension stripped off and "-#.png" appended. Destroys O. */ char * parse_chart_file_name (struct driver_option *o) { - char *value; + char *chart_file_name; - if (o->value != NULL && strchr (o->value, '#') != NULL) - value = xstrdup (o->value); - else + if (o->value != NULL) { - value = xstrdup (o->default_value); - if (o->value != NULL) - error (0, 0, _("%s: \"%s\" is \"%s\" but a file name that contains " - "\"#\" is required."), - o->name, o->value, o->driver_name); + if (!strcmp (o->value, "none")) + chart_file_name = NULL; + else if (strchr (o->value, '#') != NULL) + chart_file_name = xstrdup (o->value); + else + { + error (0, 0, _("%s: \"%s\" is \"%s\" but a file name that contains " + "\"#\" is required."), + o->name, o->value, o->driver_name); + chart_file_name = default_chart_file_name (o->default_value); + } } + else + chart_file_name = default_chart_file_name (o->default_value); driver_option_destroy (o); - return value; + return chart_file_name; } diff --git a/src/ui/automake.mk b/src/ui/automake.mk index 743d0b6d..124380cf 100644 --- a/src/ui/automake.mk +++ b/src/ui/automake.mk @@ -9,7 +9,6 @@ endif noinst_LTLIBRARIES += src/ui/libuicommon.la src_ui_libuicommon_la_SOURCES = \ - src/ui/command-line.c src/ui/command-line.h \ src/ui/debugger.c src/ui/debugger.h \ src/ui/source-init-opts.c src/ui/source-init-opts.h \ src/ui/syntax-gen.c src/ui/syntax-gen.h diff --git a/src/ui/command-line.c b/src/ui/command-line.c deleted file mode 100644 index 46dddd49..00000000 --- a/src/ui/command-line.c +++ /dev/null @@ -1,166 +0,0 @@ -/* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008 Free Software Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - - -#include -#include "command-line.h" -#include -#include -#include -#include -#include -#include - - -struct clp_child -{ - void *aux; -}; - -struct command_line_processor -{ - struct argp master_parser; - - struct clp_child *child_lookup_table; - struct argp_child *children; - int n_children; - - const char *doc; - const char *args_doc; - - void *aux; -}; - - -/* Convenience function for use in parsing functions. - Returns the object for this parser */ -struct command_line_processor * -get_subject (struct argp_state *state) -{ - const struct argp *root = state->root_argp; - - const struct argp_child *children = root->children; - - return (struct command_line_processor *) children[0].argp; -} - - -/* Create a command line processor. - DOC is typically the name of the program and short description. - ARGS_DOC is a short description of the non option arguments. - AUX is an arbitrary pointer. - */ -struct command_line_processor * -command_line_processor_create (const char *doc, const char *args_doc, void *aux) -{ - struct command_line_processor *clp = xzalloc (sizeof (*clp)); - - clp->children = NULL; - clp->child_lookup_table = NULL; - - clp->doc = doc; - clp->args_doc = args_doc; - clp->aux = aux; - - return clp; -} - -/* Destroy a command line processor */ -void -command_line_processor_destroy (struct command_line_processor *clp) -{ - free (clp->children); - free (clp->child_lookup_table); - free (clp); -} - - -/* Add a CHILD to the processor CLP, with the doc string DOC. - AUX is an auxilliary pointer, specific to CHILD. - If AUX is not known or not needed then it may be set to NULL -*/ -void -command_line_processor_add_options (struct command_line_processor *clp, const struct argp *child, - const char *doc, void *aux) -{ - clp->n_children++; - - clp->children = xrealloc (clp->children, (clp->n_children + 1) * sizeof (*clp->children)); - memset (&clp->children[clp->n_children - 1], 0, sizeof (*clp->children)); - - clp->child_lookup_table = xrealloc (clp->child_lookup_table, - clp->n_children * sizeof (*clp->child_lookup_table)); - - clp->child_lookup_table [clp->n_children - 1].aux = aux; - - clp->children [clp->n_children - 1].argp = child; - clp->children [clp->n_children - 1].header = doc; - clp->children [clp->n_children].argp = NULL; -} - - -/* Set the aux paramter for CHILD in CLP to AUX. - Any previous value will be overwritten. - */ -void -command_line_processor_replace_aux (struct command_line_processor *clp, const struct argp *child, void *aux) -{ - int i; - for (i = 0 ; i < clp->n_children; ++i ) - { - if (child->options == clp->children[i].argp->options) - { - clp->child_lookup_table[i].aux = aux; - break; - } - } - assert (i < clp->n_children); -} - - -static error_t -top_level_parser (int key UNUSED, char *arg UNUSED, struct argp_state *state) -{ - int i; - struct command_line_processor *clp = state->input; - - if ( key == ARGP_KEY_INIT) - { - - for (i = 0; i < clp->n_children ; ++i) - { - state->child_inputs[i] = clp->child_lookup_table[i].aux; - } - } - - return ARGP_ERR_UNKNOWN; -} - - -/* Parse the command line specified by (ARGC, ARGV) using CLP */ -void -command_line_processor_parse (struct command_line_processor *clp, int argc, char **argv) -{ - clp->master_parser.parser = top_level_parser; - clp->master_parser.args_doc = clp->args_doc; - - clp->master_parser.doc = clp->doc; - - clp->master_parser.children = clp->children; - - argp_parse (&clp->master_parser, argc, argv, 0, 0, clp); -} - diff --git a/src/ui/command-line.h b/src/ui/command-line.h deleted file mode 100644 index 98edbea1..00000000 --- a/src/ui/command-line.h +++ /dev/null @@ -1,36 +0,0 @@ -/* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008 Free Software Foundation - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef SRC_UI_COMMAND_LINE_H -#define SRC_UI_COMMAND_LINE_H - -#include - -struct command_line_processor; - -struct command_line_processor * get_subject (struct argp_state *state); - -struct command_line_processor *command_line_processor_create (const char *, const char *, void *); - -void command_line_processor_add_options (struct command_line_processor *cla, const struct argp *child, const char *doc, void *aux); - -void command_line_processor_replace_aux (struct command_line_processor *cla, const struct argp *child, void *aux); - -void command_line_processor_destroy (struct command_line_processor *); - -void command_line_processor_parse (struct command_line_processor *, int argc, char **argv); - -#endif diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c index b09a2f58..38110f5c 100644 --- a/src/ui/gui/helper.c +++ b/src/ui/gui/helper.c @@ -24,7 +24,6 @@ #include #include "helper.h" -#include "message-dialog.h" #include #include #include diff --git a/src/ui/gui/main.c b/src/ui/gui/main.c index 05cc421b..517d74af 100644 --- a/src/ui/gui/main.c +++ b/src/ui/gui/main.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2004, 2005, 2006 Free Software Foundation + Copyright (C) 2004, 2005, 2006, 2010 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,55 +15,57 @@ along with this program. If not, see . */ #include -#include + +#include "ui/gui/psppire.h" + #include -#include "psppire.h" -#include "progname.h" #include -#include -#include -#include -#include -#include -#include +#include "libpspp/argv-parser.h" +#include "libpspp/assertion.h" +#include "libpspp/getl.h" +#include "libpspp/version.h" +#include "libpspp/copyleft.h" +#include "ui/source-init-opts.h" + +#include "gl/progname.h" +#include "gl/relocatable.h" +#include "gl/xalloc.h" #include "gettext.h" #define _(msgid) gettext (msgid) #define N_(msgid) msgid -const char *argp_program_version = version; -const char *argp_program_bug_address = PACKAGE_BUGREPORT; - /* Arguments to be interpreted before the X server gets initialised */ -static const struct argp_option startup_options [] = +enum { - {"no-splash", 'q', 0, 0, N_("Don't show the splash screen"), 0 }, - { 0, 0, 0, 0, 0, 0 } + OPT_NO_SPLASH, + N_STARTUP_OPTIONS }; -static error_t -parse_startup_opts (int key, char *arg, struct argp_state *state) +static const struct argv_option startup_options[N_STARTUP_OPTIONS] = + { + {"no-splash", 'q', no_argument, OPT_NO_SPLASH} + }; + +static void +startup_option_callback (int id, void *show_splash_) { - gboolean *showsplash = state->input; + gboolean *show_splash = show_splash_; - switch (key) + switch (id) { - case 'q': - *showsplash = FALSE; + case OPT_NO_SPLASH: + *show_splash = FALSE; break; + default: - return ARGP_ERR_UNKNOWN; + NOT_REACHED (); } - return 0; } - -static const struct argp startup_argp = {startup_options, parse_startup_opts, 0, 0, 0, 0, 0}; - - static GtkWidget * create_splash_window (void) { @@ -108,10 +110,9 @@ quit_one_loop (gpointer data) struct initialisation_parameters { - int argc; - char **argv; + struct source_stream *ss; + const char *data_file; GtkWidget *splash_window; - struct command_line_processor *clp; }; @@ -119,7 +120,7 @@ static gboolean run_inner_loop (gpointer data) { struct initialisation_parameters *ip = data; - initialize (ip->clp, ip->argc, ip->argv); + initialize (ip->ss, ip->data_file); g_timeout_add (500, hide_splash_window, ip->splash_window); @@ -144,10 +145,10 @@ static GMemVTable vtable = int main (int argc, char *argv[]) { - struct command_line_processor *clp ; struct initialisation_parameters init_p; gboolean show_splash = TRUE; - + struct argv_parser *parser; + struct source_stream *ss; const gchar *vers; set_program_name (argv[0]); @@ -170,21 +171,22 @@ main (int argc, char *argv[]) g_warning (vers); } - clp = command_line_processor_create (_("PSPPIRE --- A user interface for PSPP"), "[ DATA-FILE ]", 0); - - command_line_processor_add_options (clp, &startup_argp, _("Miscellaneous options:"), &show_splash); - command_line_processor_add_options (clp, &post_init_argp, - _("Options affecting syntax and behavior:"), NULL); - command_line_processor_add_options (clp, &non_option_argp, NULL, NULL); - - command_line_processor_parse (clp, argc, argv); - + /* Let GDK remove any options that it owns. */ gdk_init (&argc, &argv); + /* Parse our own options. */ + ss = create_source_stream (); + parser = argv_parser_create (); + argv_parser_add_options (parser, startup_options, N_STARTUP_OPTIONS, + startup_option_callback, &show_splash); + source_init_register_argv_parser (parser, ss); + if (!argv_parser_run (parser, argc, argv)) + exit (EXIT_FAILURE); + argv_parser_destroy (parser); + init_p.splash_window = create_splash_window (); - init_p.argc = argc; - init_p.argv = argv; - init_p.clp = clp; + init_p.ss = ss; + init_p.data_file = optind < argc ? argv[optind] : NULL; if ( show_splash ) gtk_widget_show (init_p.splash_window); diff --git a/src/ui/gui/psppire-output-window.c b/src/ui/gui/psppire-output-window.c index ebca5533..ebf29c01 100644 --- a/src/ui/gui/psppire-output-window.c +++ b/src/ui/gui/psppire-output-window.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008, 2009 Free Software Foundation + Copyright (C) 2008, 2009, 2010 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -301,7 +301,6 @@ done: static struct output_driver_class psppire_output_class = { "PSPPIRE", /* name */ - NULL, /* create */ NULL, /* destroy */ psppire_output_submit, /* submit */ NULL, /* flush */ @@ -315,7 +314,8 @@ psppire_output_window_setup (void) pod = xzalloc (sizeof *pod); d = &pod->driver; - output_driver_init (d, &psppire_output_class, "PSPPIRE", 0); + output_driver_init (d, &psppire_output_class, "PSPPIRE", + SETTINGS_DEVICE_UNFILTERED); output_driver_register (d); } @@ -387,12 +387,13 @@ add_filter (GtkFileChooser *chooser, const char *name, const char *pattern) static void export_output (PsppireOutputWindow *window, struct string_map *options, - const char *class_name) + const char *format) { struct output_driver *driver; size_t i; - driver = output_driver_create (class_name, options); + string_map_insert (options, "format", format); + driver = output_driver_create (options); if (driver == NULL) return; diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index ddf915f2..1c04e93b 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation + Copyright (C) 2004, 2005, 2006, 2009, 2010 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,53 +16,48 @@ #include -#include +#include "ui/gui/psppire.h" + #include -#include #include - -#include -#include -#include -#include "relocatable.h" - -#include "psppire-data-window.h" -#include "psppire.h" -#include "widgets.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include -#include "psppire-dict.h" -#include "dict-display.h" -#include "psppire-selector.h" -#include "psppire-var-view.h" -#include "psppire-var-store.h" -#include "psppire-data-store.h" -#include "executor.h" -#include "message-dialog.h" -#include - -#include "psppire-window-register.h" -#include "psppire-output-window.h" - -#include -#include +#include +#include -#include +#include "data/casereader.h" +#include "data/datasheet.h" +#include "data/file-handle-def.h" +#include "data/file-name.h" +#include "data/por-file-reader.h" +#include "data/procedure.h" +#include "data/settings.h" +#include "data/sys-file-reader.h" +#include "language/lexer/lexer.h" +#include "language/syntax-string-source.h" +#include "libpspp/getl.h" +#include "libpspp/i18n.h" +#include "libpspp/message.h" +#include "libpspp/version.h" +#include "output/driver.h" +#include "output/journal.h" +#include "ui/gui/dict-display.h" +#include "ui/gui/executor.h" +#include "ui/gui/message-dialog.h" +#include "ui/gui/psppire-data-store.h" +#include "ui/gui/psppire-data-window.h" +#include "ui/gui/psppire-dict.h" +#include "ui/gui/psppire-output-window.h" +#include "ui/gui/psppire-selector.h" +#include "ui/gui/psppire-var-store.h" +#include "ui/gui/psppire-var-view.h" +#include "ui/gui/psppire-window-register.h" +#include "ui/gui/psppire.h" +#include "ui/gui/widgets.h" +#include "ui/source-init-opts.h" +#include "ui/syntax-gen.h" + +#include "gl/xalloc.h" +#include "gl/relocatable.h" GtkRecentManager *the_recent_mgr = 0; PsppireDataStore *the_data_store = 0; @@ -75,6 +70,8 @@ struct dataset * the_dataset = NULL; static GtkWidget *the_data_window; +static void load_data_file (const char *); + static void replace_casereader (struct casereader *s) { @@ -88,7 +85,7 @@ replace_casereader (struct casereader *s) void -initialize (struct command_line_processor *clp, int argc, char **argv) +initialize (struct source_stream *ss, const char *data_file) { PsppireDict *dictionary = 0; @@ -97,18 +94,13 @@ initialize (struct command_line_processor *clp, int argc, char **argv) preregister_widgets (); gsl_set_error_handler_off (); - fn_init (); settings_init (&viewer_width, &viewer_length); fh_init (); - the_source_stream = - create_source_stream ( - fn_getenv_default ("STAT_INCLUDE_PATH", include_path) - ); the_dataset = create_dataset (); - message_dialog_init (the_source_stream); + the_source_stream = ss; dictionary = psppire_dict_new_from_dict (dataset_dict (the_dataset)); @@ -135,11 +127,8 @@ initialize (struct command_line_processor *clp, int argc, char **argv) psppire_selector_set_default_selection_func (GTK_TYPE_TREE_VIEW, insert_source_row_into_tree_view); the_data_window = psppire_data_window_new (); - - command_line_processor_replace_aux (clp, &post_init_argp, the_source_stream); - command_line_processor_replace_aux (clp, &non_option_argp, the_source_stream); - - command_line_processor_parse (clp, argc, argv); + if (data_file != NULL) + load_data_file (data_file); execute_syntax (create_syntax_string_source ("")); @@ -248,81 +237,61 @@ create_icon_factory (void) gtk_icon_factory_add_default (factory); } - - -static error_t -parse_non_options (int key, char *arg, struct argp_state *state) +static void +load_data_file (const char *arg) { - struct source_stream *ss = state->input; - - if ( NULL == ss ) - return 0; + gchar *filename = NULL; + gchar *utf8 = NULL; + const gchar *local_encoding = NULL; + gsize written = -1; + const gboolean local_is_utf8 = g_get_charset (&local_encoding); + + /* There seems to be no Glib function to convert from local encoding + to filename encoding. Therefore it has to be done in two steps: + the intermediate encoding is UTF8. + + Either step could fail. However, in many cases the file can still + be loaded even if the conversion fails. So in those cases, after showing + a warning, we simply copy the locally encoded filename to the destination + and hope for the best. + */ + + if ( local_is_utf8) + { + utf8 = xstrdup (arg); + } + else + { + GError *err = NULL; + utf8 = g_locale_to_utf8 (arg, -1, NULL, &written, &err); + if ( NULL == utf8) + { + g_warning ("Cannot convert filename from local encoding \"%s\" to UTF-8: %s", + local_encoding, + err->message); + g_clear_error (&err); + } + } - switch (key) + if ( NULL != utf8) { - case ARGP_KEY_ARG: - { - gchar *filename = NULL; - gchar *utf8 = NULL; - const gchar *local_encoding = NULL; - gsize written = -1; - const gboolean local_is_utf8 = g_get_charset (&local_encoding); - - /* There seems to be no Glib function to convert from local encoding - to filename encoding. Therefore it has to be done in two steps: - the intermediate encoding is UTF8. - - Either step could fail. However, in many cases the file can still - be loaded even if the conversion fails. So in those cases, after showing - a warning, we simply copy the locally encoded filename to the destination - and hope for the best. - */ - - if ( local_is_utf8) - { - utf8 = xstrdup (arg); - } - else - { - GError *err = NULL; - utf8 = g_locale_to_utf8 (arg, -1, NULL, &written, &err); - if ( NULL == utf8) - { - g_warning ("Cannot convert filename from local encoding \"%s\" to UTF-8: %s", - local_encoding, - err->message); - g_clear_error (&err); - } - } - - if ( NULL != utf8) - { - GError *err = NULL; - filename = g_filename_from_utf8 (utf8, written, NULL, NULL, &err); - if ( NULL == filename) - { - g_warning ("Cannot convert filename from UTF8 to filename encoding: %s", - err->message); - g_clear_error (&err); - } - } - - g_free (utf8); - - if ( filename == NULL) - filename = xstrdup (arg); - - psppire_window_load (PSPPIRE_WINDOW (the_data_window), filename); - - g_free (filename); - break; - } - default: - return ARGP_ERR_UNKNOWN; + GError *err = NULL; + filename = g_filename_from_utf8 (utf8, written, NULL, NULL, &err); + if ( NULL == filename) + { + g_warning ("Cannot convert filename from UTF8 to filename encoding: %s", + err->message); + g_clear_error (&err); + } } - return 0; -} + g_free (utf8); -const struct argp non_option_argp = {NULL, parse_non_options, 0, 0, 0, 0, 0}; + if ( filename == NULL) + filename = xstrdup (arg); + + psppire_window_load (PSPPIRE_WINDOW (the_data_window), filename); + + g_free (filename); +} diff --git a/src/ui/gui/psppire.h b/src/ui/gui/psppire.h index 27a633f2..ee747ef9 100644 --- a/src/ui/gui/psppire.h +++ b/src/ui/gui/psppire.h @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation + Copyright (C) 2004, 2005, 2006, 2009, 2010 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,12 +17,9 @@ #ifndef PSPPIRE_H #define PSPPIRE_H -#include +struct source_stream; -struct command_line_processor ; -extern const struct argp non_option_argp ; - -void initialize (struct command_line_processor *, int argc, char **argv); +void initialize (struct source_stream *, const char *data_file); void de_initialize (void); void psppire_quit (void); diff --git a/src/ui/source-init-opts.c b/src/ui/source-init-opts.c index 61a108e0..c91a9fef 100644 --- a/src/ui/source-init-opts.c +++ b/src/ui/source-init-opts.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008 Free Software Foundation + Copyright (C) 2008, 2010 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,121 +15,103 @@ along with this program. If not, see . */ #include -#include + #include "source-init-opts.h" + #include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include + +#include "data/file-name.h" +#include "data/por-file-reader.h" +#include "data/settings.h" +#include "data/sys-file-reader.h" +#include "language/syntax-file.h" +#include "language/syntax-string-source.h" +#include "libpspp/assertion.h" +#include "libpspp/argv-parser.h" +#include "libpspp/getl.h" +#include "libpspp/llx.h" +#include "libpspp/message.h" +#include "ui/syntax-gen.h" + +#include "gl/error.h" +#include "gl/xalloc.h" #include "gettext.h" #define _(msgid) gettext (msgid) #define N_(msgid) msgid -static const struct argp_option post_init_options [] = { - {"algorithm", 'a', "{compatible|enhanced}", 0, N_("set to `compatible' if you want output calculated from broken algorithms"), 0}, - {"include", 'I', "DIR", 0, N_("Append DIR to include path"), 0}, - {"no-include", 'I', 0, 0, N_("Clear include path"), 0}, - {"no-statrc", 'r', 0, 0, N_("Disable execution of .pspp/rc at startup"), 0}, - {"config-dir", 'B', "DIR", 0, N_("Set configuration directory to DIR"), 0}, - {"safer", 's', 0, 0, N_("Don't allow some unsafe operations"), 0}, - {"syntax", 'x', "{compatible|enhanced}", 0, N_("Set to `compatible' if you want only to accept SPSS compatible syntax"), 0}, - { 0, 0, 0, 0, 0, 0 } -}; - -static error_t -parse_post_init_opts (int key, char *arg, struct argp_state *state) -{ - struct source_init +enum { - bool process_statrc; + OPT_ALGORITHM, + OPT_INCLUDE, + OPT_NO_INCLUDE, + OPT_SAFER, + OPT_SYNTAX, + N_SOURCE_INIT_OPTIONS }; - struct source_init *sip = state->hook; - - struct source_stream *ss = state->input; +static const struct argv_option source_init_options[N_SOURCE_INIT_OPTIONS] = + { + {"algorithm", 'a', required_argument, OPT_ALGORITHM}, + {"include", 'I', required_argument, OPT_INCLUDE}, + {"no-include", 0, no_argument, OPT_NO_INCLUDE}, + {"safer", 's', no_argument, OPT_SAFER}, + {"syntax", 'x', required_argument, OPT_SYNTAX}, + }; - if ( state->input == NULL) - return 0; +static void +source_init_option_callback (int id, void *ss_) +{ + struct source_stream *ss = ss_; - switch (key) + switch (id) { - case ARGP_KEY_INIT: - state->hook = sip = xzalloc (sizeof (struct source_init)); - sip->process_statrc = true; - break; - case ARGP_KEY_FINI: - free (sip); - break; - case 'a': - if ( 0 == strcmp (arg, "compatible") ) + case OPT_ALGORITHM: + if (!strcmp (optarg, "compatible")) settings_set_algorithm (COMPATIBLE); - else if ( 0 == strcmp (arg, "enhanced")) + else if (!strcmp (optarg, "enhanced")) settings_set_algorithm (ENHANCED); else - { - argp_failure (state, 1, 0, _("Algorithm must be either \"compatible\" or \"enhanced\".")); - } - break; - case 'B': - config_path = arg; + error (1, 0, + _("Algorithm must be either \"compatible\" or \"enhanced\".")); break; - case 'I': - if (arg == NULL || !strcmp (arg, "-")) + + case OPT_INCLUDE: + if (!strcmp (optarg, "-")) getl_clear_include_path (ss); else - getl_add_include_dir (ss, arg); + getl_add_include_dir (ss, optarg); break; - case 'r': - sip->process_statrc = false; - break; - case ARGP_KEY_SUCCESS: - if (sip->process_statrc) - { - char *pspprc_fn = fn_search_path ("rc", config_path); - if (pspprc_fn != NULL) - { - getl_append_source (ss, - create_syntax_file_source (pspprc_fn), - GETL_BATCH, - ERRMODE_CONTINUE - ); - - free (pspprc_fn); - } - } + + case OPT_NO_INCLUDE: + getl_clear_include_path (ss); break; - case 's': + + case OPT_SAFER: settings_set_safer_mode (); break; - case 'x': - if ( 0 == strcmp (arg, "compatible") ) + + case OPT_SYNTAX: + if (!strcmp (optarg, "compatible") ) settings_set_syntax (COMPATIBLE); - else if ( 0 == strcmp (arg, "enhanced")) + else if (!strcmp (optarg, "enhanced")) settings_set_syntax (ENHANCED); else - { - argp_failure (state, 1, 0, _("Syntax must be either \"compatible\" or \"enhanced\".")); - } + error (1, 0, + _("Syntax must be either \"compatible\" or \"enhanced\".")); break; + default: - return ARGP_ERR_UNKNOWN; + NOT_REACHED (); } - - return 0; } -const struct argp post_init_argp = - {post_init_options, parse_post_init_opts, 0, 0, 0, 0, 0}; - +void +source_init_register_argv_parser (struct argv_parser *ap, + struct source_stream *ss) +{ + argv_parser_add_options (ap, source_init_options, N_SOURCE_INIT_OPTIONS, + source_init_option_callback, ss); +} diff --git a/src/ui/source-init-opts.h b/src/ui/source-init-opts.h index 87493531..cfd87f3f 100644 --- a/src/ui/source-init-opts.h +++ b/src/ui/source-init-opts.h @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008 Free Software Foundation + Copyright (C) 2008, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,10 +15,13 @@ along with this program. If not, see . */ -#ifndef SOURCE_INIT_OPTS -#define SOURCE_INIT_OPTS +#ifndef UI_SOURCE_INIT_OPTS +#define UI_SOURCE_INIT_OPTS -extern const struct argp post_init_argp; +struct argv_parser; +struct source_stream; -#endif +void source_init_register_argv_parser (struct argv_parser *, + struct source_stream *); +#endif /* ui/source/source-init-opts.h */ diff --git a/src/ui/terminal/main.c b/src/ui/terminal/main.c index 1366bd7a..10b3b7e9 100644 --- a/src/ui/terminal/main.c +++ b/src/ui/terminal/main.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,35 +29,34 @@ #include #endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "fatal-signal.h" -#include "progname.h" -#include "relocatable.h" +#include "data/dictionary.h" +#include "data/file-handle-def.h" +#include "data/file-name.h" +#include "data/procedure.h" +#include "data/settings.h" +#include "data/variable.h" +#include "gsl/gsl_errno.h" +#include "language/command.h" +#include "language/lexer/lexer.h" +#include "language/prompt.h" +#include "libpspp/argv-parser.h" +#include "libpspp/compiler.h" +#include "libpspp/getl.h" +#include "libpspp/i18n.h" +#include "libpspp/message.h" +#include "libpspp/version.h" +#include "math/random.h" +#include "output/driver.h" +#include "ui/debugger.h" +#include "ui/source-init-opts.h" +#include "ui/terminal/msg-ui.h" +#include "ui/terminal/read-line.h" +#include "ui/terminal/terminal-opts.h" +#include "ui/terminal/terminal.h" + +#include "gl/fatal-signal.h" +#include "gl/progname.h" +#include "gl/relocatable.h" #include "gettext.h" #define _(msgid) gettext (msgid) @@ -76,15 +75,14 @@ static struct dataset * the_dataset = NULL; static struct lexer *the_lexer; static struct source_stream *the_source_stream ; -const char *argp_program_version = version; -const char *argp_program_bug_address = PACKAGE_BUGREPORT; - /* Program entry point. */ int main (int argc, char **argv) { int *view_width_p, *view_length_p; - struct command_line_processor *clp; + struct terminal_opts *terminal_opts; + struct argv_parser *parser; + set_program_name (argv[0]); signal (SIGABRT, bug_handler); @@ -96,12 +94,8 @@ main (int argc, char **argv) fpu_init (); gsl_set_error_handler_off (); - fn_init (); fh_init (); - the_source_stream = - create_source_stream ( - fn_getenv_default ("STAT_INCLUDE_PATH", include_path) - ); + the_source_stream = create_source_stream (); prompt_init (); readln_initialize (); terminal_init (&view_width_p, &view_length_p); @@ -110,21 +104,13 @@ main (int argc, char **argv) the_dataset = create_dataset (); - - - clp = command_line_processor_create (_("PSPP --- A program for statistical analysis"), - _("FILE1, FILE2 ... FILEn"), NULL); - - command_line_processor_add_options (clp, &io_argp, - _("Options affecting input and output locations:"), the_source_stream); - - command_line_processor_add_options (clp, &test_argp, - _("Diagnostic options:"), the_source_stream); - - command_line_processor_add_options (clp, &post_init_argp, - _("Options affecting syntax and behavior:"), the_source_stream); - - command_line_processor_parse (clp, argc, argv); + parser = argv_parser_create (); + terminal_opts = terminal_opts_init (parser, the_source_stream); + source_init_register_argv_parser (parser, the_source_stream); + if (!argv_parser_run (parser, argc, argv)) + exit (EXIT_FAILURE); + terminal_opts_done (terminal_opts, argc, argv); + argv_parser_destroy (parser); msg_ui_init (the_source_stream); diff --git a/src/ui/terminal/msg-ui.c b/src/ui/terminal/msg-ui.c index 383ccb8c..b5280fe6 100644 --- a/src/ui/terminal/msg-ui.c +++ b/src/ui/terminal/msg-ui.c @@ -92,14 +92,15 @@ check_msg_count (struct source_stream *ss) { if (!getl_is_interactive (ss)) { - if (settings_get_errorbreak () && error_count) - msg (MN, _("Terminating execution of syntax file due to error.")); - else if (error_count > settings_get_mxerrs () ) + int max_errors = settings_get_max_messages (MSG_S_ERROR); + int max_warnings = settings_get_max_messages (MSG_S_WARNING); + + if (error_count > max_errors) msg (MN, _("Errors (%d) exceed limit (%d)."), - error_count, settings_get_mxerrs ()); - else if (error_count + warning_count > settings_get_mxwarns () ) + error_count, max_errors); + else if (error_count + warning_count > max_warnings) msg (MN, _("Warnings (%d) exceed limit (%d)."), - error_count + warning_count, settings_get_mxwarns () ); + error_count + warning_count, max_warnings); else return; @@ -143,20 +144,22 @@ handle_msg (const struct msg *m) struct severity { + enum settings_output_type type; const char *name; /* How to identify this severity. */ int *count; /* Number of msgs with this severity so far. */ }; static struct severity severities[] = { - {N_("error"), &error_count}, /* MSG_ERROR. */ - {N_("warning"), &warning_count}, /* MSG_WARNING. */ - {NULL, NULL}, /* MSG_NOTE. */ + { SETTINGS_OUTPUT_ERROR, N_("error"), &error_count }, + { SETTINGS_OUTPUT_ERROR, N_("warning"), &warning_count }, + { SETTINGS_OUTPUT_NOTE, NULL, NULL}, }; const struct category *category = &categories[m->category]; const struct severity *severity = &severities[m->severity]; struct string string = DS_EMPTY_INITIALIZER; + enum settings_output_devices routing; if (category->show_file_location && m->where.file_name) { @@ -177,21 +180,22 @@ handle_msg (const struct msg *m) ds_put_cstr (&string, m->text); - if (msg_file != stdout || settings_get_error_routing_to_terminal ()) + routing = settings_get_output_routing (severity->type); + if (msg_file != stdout || routing & SETTINGS_DEVICE_TERMINAL) dump_message (ds_cstr (&string), isatty (fileno (msg_file)) ? settings_get_viewwidth () : INT_MAX, 8, write_stream, msg_file); dump_message (ds_cstr (&string), 78, 0, write_journal, NULL); - if (settings_get_error_routing_to_listing ()) + if (routing & SETTINGS_DEVICE_LISTING) { - /* Disable screen output devices, because the error should - already have been reported to the screen with the - dump_message call above. */ - output_set_type_enabled (false, OUTPUT_DEVICE_SCREEN); + /* Disable terminal output devices, because the error should already have + been reported to the terminal with the dump_message call above. */ + settings_set_output_routing (severity->type, + routing & ~SETTINGS_DEVICE_TERMINAL); tab_output_text (TAB_LEFT, ds_cstr (&string)); - output_set_type_enabled (true, OUTPUT_DEVICE_SCREEN); + settings_set_output_routing (severity->type, routing); } ds_destroy (&string); diff --git a/src/ui/terminal/terminal-opts.c b/src/ui/terminal/terminal-opts.c index c55dc57f..886bcdc2 100644 --- a/src/ui/terminal/terminal-opts.c +++ b/src/ui/terminal/terminal-opts.c @@ -18,192 +18,319 @@ #include "terminal-opts.h" -#include #include #include #include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include + +#include "data/settings.h" +#include "data/file-name.h" +#include "language/syntax-file.h" +#include "libpspp/argv-parser.h" +#include "libpspp/assertion.h" +#include "libpspp/compiler.h" +#include "libpspp/getl.h" +#include "libpspp/llx.h" +#include "libpspp/str.h" +#include "libpspp/string-array.h" +#include "libpspp/string-map.h" +#include "libpspp/string-set.h" +#include "libpspp/version.h" +#include "output/driver.h" +#include "output/driver-provider.h" +#include "ui/terminal/msg-ui.h" +#include "ui/terminal/read-line.h" #include "gl/error.h" +#include "gl/progname.h" +#include "gl/version-etc.h" +#include "gl/xmemdup0.h" #include "gettext.h" #define _(msgid) gettext (msgid) #define N_(msgid) msgid -static const struct argp_option test_options [] = +struct terminal_opts { - {"testing-mode", 'T', 0, OPTION_HIDDEN, 0, 0}, + struct source_stream *source_stream; + enum syntax_mode syntax_mode; + struct string_map options; /* Output driver options. */ + bool has_output_driver; + bool has_terminal_driver; + bool process_statrc; + }; - { 0, 0, 0, 0, 0, 0 } +enum + { + OPT_TESTING_MODE, + OPT_ERROR_FILE, + OPT_OUTPUT, + OPT_OUTPUT_OPTION, + OPT_INTERACTIVE, + OPT_NO_STATRC, + OPT_HELP, + OPT_VERSION, + N_TERMINAL_OPTIONS }; -static error_t -parse_test_opts (int key, char *arg, struct argp_state *state) +static struct argv_option terminal_argv_options[N_TERMINAL_OPTIONS] = + { + {"testing-mode", 0, no_argument, OPT_TESTING_MODE}, + {"error-file", 'e', required_argument, OPT_ERROR_FILE}, + {"output", 'o', required_argument, OPT_OUTPUT}, + {NULL, 'O', required_argument, OPT_OUTPUT_OPTION}, + {"interactive", 'i', no_argument, OPT_INTERACTIVE}, + {"no-statrc", 'r', no_argument, OPT_NO_STATRC}, + {"help", 'h', no_argument, OPT_HELP}, + {"version", 'V', no_argument, OPT_VERSION}, + }; + +static void +register_output_driver (struct terminal_opts *to) { - switch (key) + if (!string_map_is_empty (&to->options)) { - case 'T': - settings_set_testing_mode (true); - break; - default: - return ARGP_ERR_UNKNOWN; - } - - return 0; -} + struct output_driver *driver; -static const struct argp_option io_options [] = - { - {"error-file", 'e', "FILE", 0, - N_("Send error messages to FILE (appended)"), 0}, + driver = output_driver_create (&to->options); + if (driver != NULL) + { + output_driver_register (driver); - {"device", 'o', "DEVICE", 0, - N_("Select output driver DEVICE and disable defaults"), 0}, + to->has_output_driver = true; + if (driver->device_type == SETTINGS_DEVICE_TERMINAL) + to->has_terminal_driver = true; + } + string_map_clear (&to->options); + } +} - {"list", 'l', 0, 0, - N_("Print a list of known driver classes, then exit"), 0}, +static void +parse_output_option (struct terminal_opts *to, const char *option) +{ + const char *equals; + char *key, *value; - {"interactive", 'i', 0, 0, N_("Start an interactive session"), 0}, + equals = strchr (option, '='); + if (equals == NULL) + { + error (0, 0, _("%s: output option missing `='"), option); + return; + } - { 0, 0, 0, 0, 0, 0 } - }; + key = xmemdup0 (option, equals - option); + if (string_map_contains (&to->options, key)) + { + error (0, 0, _("%s: output option %s specified more than twice"), key); + free (key); + return; + } + value = xmemdup0 (equals + 1, strlen (equals + 1)); + string_map_insert_nocopy (&to->options, key, value); +} -static error_t -parse_io_opts (int key, char *arg, struct argp_state *state) +static char * +get_supported_formats (void) { - struct source_init - { - struct llx_list file_list; - bool interactive; - - /* Output devices. */ - struct string_map macros; - struct string_set drivers; - }; - - struct fn_element { - struct ll ll; - const char *fn; - }; + const struct string_set_node *node; + struct string_array format_array; + struct string_set format_set; + char *format_string; + const char *format; + size_t i; + + /* Get supported formats as unordered set. */ + string_set_init (&format_set); + output_get_supported_formats (&format_set); + + /* Converted supported formats to sorted array. */ + string_array_init (&format_array); + STRING_SET_FOR_EACH (format, node, &format_set) + string_array_append (&format_array, format); + string_array_sort (&format_array); + string_set_destroy (&format_set); + + /* Converted supported formats to string. */ + format_string = string_array_join (&format_array, " "); + string_array_destroy (&format_array); + return format_string; +} - struct source_init *sip = state->hook; +static char * +get_default_include_path (void) +{ + struct source_stream *ss; + struct string dst; + char **path; + size_t i; + + ss = create_source_stream (); + path = getl_include_path (ss); + ds_init_empty (&dst); + for (i = 0; path[i] != NULL; i++) + ds_put_format (&dst, " %s", path[i]); + destroy_source_stream (ss); + + return ds_steal_cstr (&dst); +} - struct source_stream *ss = state->input; +static void +usage (void) +{ + char *supported_formats = get_supported_formats (); + char *default_include_path = get_default_include_path (); + + printf ("\ +PSPP, a program for statistical analysis of sample data.\n\ +Usage: %s [OPTION]... FILE...\n\ +\n\ +Arguments to long options also apply to equivalent short options.\n\ +\n\ +Output options:\n\ + -o, --output=FILE output to FILE, default format from FILE's name\n\ + -O format=FORMAT override format for previous -o\n\ + -O OPTION=VALUE set output option to customize previous -o\n\ + -O device={terminal|listing} override device type for previous -o\n\ + -e, --error-file=FILE append errors, warnings, and notes to FILE\n\ +Supported output formats: %s\n\ +\n\ +Language options:\n\ + -I, --include=DIR append DIR to search path\n\ + -I-, --no-include clear search path\n\ + -r, --no-statrc disable running rc file at startup\n\ + -a, --algorithm={compatible|enhanced}\n\ + set to `compatible' if you want output\n\ + calculated from broken algorithms\n\ + -x, --syntax={compatible|enhanced}\n\ + set to `compatible' to disable PSPP extensions\n\ + -i, --interactive interpret syntax in interactive mode\n\ + -s, --safer don't allow some unsafe operations\n\ +Default search path:%s\n\ +\n\ +Informative output:\n\ + -h, --help display this help and exit\n\ + -V, --version output version information and exit\n\ +\n\ +Non-option arguments are interpreted as syntax files to execute.\n", + program_name, supported_formats, default_include_path); + + free (supported_formats); + free (default_include_path); + + emit_bug_reporting_address (); + exit (EXIT_SUCCESS); +} - struct command_line_processor *clp = get_subject (state); +static void +terminal_option_callback (int id, void *to_) +{ + struct terminal_opts *to = to_; - switch (key) + switch (id) { - case ARGP_KEY_INIT: - state->hook = sip = xzalloc (sizeof (struct source_init)); - llx_init (&sip->file_list); - string_map_init (&sip->macros); - string_set_init (&sip->drivers); - break; - case ARGP_KEY_ARG: - if (strchr (arg, '=')) - { - if (!output_define_macro (arg, &sip->macros)) - error (0, 0, _("\"%s\" is not a valid macro definition"), arg); - } - else - { - llx_push_tail (&sip->file_list, arg, &llx_malloc_mgr); - } - break; - case ARGP_KEY_SUCCESS: - { - struct llx *llx = llx_null (&sip->file_list); - while ((llx = llx_next (llx)) != llx_null (&sip->file_list)) - { - const char *fn = llx_data (llx); - /* Assume it's a syntax file */ - getl_append_source (ss, - create_syntax_file_source (fn), - GETL_BATCH, - ERRMODE_CONTINUE - ); - - } - - if (sip->interactive || llx_is_empty (&sip->file_list)) - { - getl_append_source (ss, create_readln_source (), - GETL_INTERACTIVE, - ERRMODE_CONTINUE - ); - - string_set_insert (&sip->drivers, "interactive"); - } - - if (!settings_get_testing_mode ()) - output_read_configuration (&sip->macros, &sip->drivers); - else - output_configure_driver ("csv:csv::"); - - string_map_destroy (&sip->macros); - string_set_destroy (&sip->drivers); - } + case OPT_TESTING_MODE: + settings_set_testing_mode (true); break; - case ARGP_KEY_FINI: - free (sip); + + case OPT_ERROR_FILE: + msg_ui_set_error_file (optarg); break; - case 'e': - msg_ui_set_error_file (arg); + + case OPT_OUTPUT: + register_output_driver (to); + string_map_insert (&to->options, "output-file", optarg); break; - case 'i': - sip->interactive = true; + + case OPT_OUTPUT_OPTION: + parse_output_option (to, optarg); break; - case 'l': - output_list_classes (); + + case OPT_INTERACTIVE: + to->syntax_mode = GETL_INTERACTIVE; break; - case 'o': - string_set_insert (&sip->drivers, arg); + + case OPT_NO_STATRC: + to->process_statrc = false; break; + + case OPT_HELP: + usage (); + exit (EXIT_SUCCESS); + + case OPT_VERSION: + version_etc (stdout, "pspp", PACKAGE_NAME, PACKAGE_VERSION, + "Ben Pfaff", "John Darrington", "Jason Stover", + (char *) NULL); + exit (EXIT_SUCCESS); + default: - return ARGP_ERR_UNKNOWN; + NOT_REACHED (); } - - return 0; } -const struct argp io_argp = {io_options, parse_io_opts, 0, 0, 0, 0, 0}; -const struct argp test_argp = {test_options, parse_test_opts, 0, 0, 0, 0, 0}; - -#if 0 -static const struct argp_child children [] = - { - {&io_argp, 0, N_("Options affecting input and output locations:"), 0}, - {&test_argp, 0, N_("Diagnostic options:"), 0}, - {0, 0, 0, 0} - }; +struct terminal_opts * +terminal_opts_init (struct argv_parser *ap, struct source_stream *ss) +{ + struct terminal_opts *to; + + to = xmalloc (sizeof *to); + to->source_stream = ss; + to->syntax_mode = GETL_BATCH; + string_map_init (&to->options); + to->has_output_driver = false; + to->process_statrc = true; + + argv_parser_add_options (ap, terminal_argv_options, N_TERMINAL_OPTIONS, + terminal_option_callback, to); + return to; +} +static void +add_syntax_file (struct terminal_opts *to, const char *file_name) +{ + if (!strcmp (file_name, "-") && isatty (STDIN_FILENO)) + getl_append_source (to->source_stream, create_readln_source (), + GETL_INTERACTIVE, ERRMODE_CONTINUE); + else + getl_append_source (to->source_stream, + create_syntax_file_source (file_name), + to->syntax_mode, ERRMODE_CONTINUE); +} -static error_t -propagate_aux (int key, char *arg, struct argp_state *state) +void +terminal_opts_done (struct terminal_opts *to, int argc, char *argv[]) { - if ( key == ARGP_KEY_INIT) + if (to->process_statrc) { - int i; - for (i = 0 ; i < sizeof (children) / sizeof (children[0]) - 1 ; ++i) - state->child_inputs[i] = state->input; + char *rc = fn_search_path ("rc", getl_include_path (to->source_stream)); + if (rc != NULL) + { + getl_append_source (to->source_stream, + create_syntax_file_source (rc), GETL_BATCH, + ERRMODE_CONTINUE); + free (rc); + } } - return ARGP_ERR_UNKNOWN; -} + if (optind < argc) + { + int i; + + for (i = optind; i < argc; i++) + add_syntax_file (to, argv[i]); + } + else + add_syntax_file (to, "-"); -const struct argp terminal_argp = {NULL, propagate_aux, 0, 0, children, 0, 0}; + register_output_driver (to); + if (!to->has_output_driver) + { + string_map_insert (&to->options, "output-file", "-"); + string_map_insert (&to->options, "format", "txt"); + register_output_driver (to); + } -#endif + string_map_destroy (&to->options); + free (to); +} diff --git a/src/ui/terminal/terminal-opts.h b/src/ui/terminal/terminal-opts.h index e5d032d1..12251123 100644 --- a/src/ui/terminal/terminal-opts.h +++ b/src/ui/terminal/terminal-opts.h @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008 Free Software Foundation + Copyright (C) 2008, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,13 +15,15 @@ along with this program. If not, see . */ -#ifndef TERMINAL_OPTS -#define TERMINAL_OPTS +#ifndef UI_TERMINAL_TERMINAL_OPTS_H +#define UI_TERMINAL_TERMINAL_OPTS_H 1 -extern const struct argp io_argp ; -extern const struct argp test_argp ; +struct argv_parser; +struct source_stream; +struct terminal_opts; -extern const struct argp terminal_argp; - -#endif +struct terminal_opts *terminal_opts_init (struct argv_parser *, + struct source_stream *); +void terminal_opts_done (struct terminal_opts *, int argc, char *argv[]); +#endif /* ui/terminal/terminal-opts.h */ diff --git a/tests/bugs/agg-crash-2.sh b/tests/bugs/agg-crash-2.sh index 0bb8962f..98bd8dcf 100755 --- a/tests/bugs/agg-crash-2.sh +++ b/tests/bugs/agg-crash-2.sh @@ -74,7 +74,7 @@ LIST /x y. EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/bugs/agg_crash.sh b/tests/bugs/agg_crash.sh index 43fd9f8c..449e90e9 100755 --- a/tests/bugs/agg_crash.sh +++ b/tests/bugs/agg_crash.sh @@ -76,7 +76,7 @@ if [ $? -ne 0 ] ; then no_result ; fi # So this will have a non zero error status. # But it shouldn't crash! activity="run_program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 1 ] ; then fail ; fi diff --git a/tests/bugs/alpha-freq.sh b/tests/bugs/alpha-freq.sh index ae60e79c..e3adb6ef 100755 --- a/tests/bugs/alpha-freq.sh +++ b/tests/bugs/alpha-freq.sh @@ -73,7 +73,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/big-input-2.sh b/tests/bugs/big-input-2.sh index b0da13bb..c400e2e9 100755 --- a/tests/bugs/big-input-2.sh +++ b/tests/bugs/big-input-2.sh @@ -84,7 +84,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 0 ] ; then fail ; fi activity="appending to data" @@ -93,7 +93,7 @@ $PERL -e 'for ($i=0; $i<25000; $i++) { print "AB04\nAB12\n" };' >> $TEMPDIR/larg if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 0 ] ; then fail ; fi pass; diff --git a/tests/bugs/big-input.sh b/tests/bugs/big-input.sh index 3c9365df..9cc3ad93 100755 --- a/tests/bugs/big-input.sh +++ b/tests/bugs/big-input.sh @@ -75,7 +75,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 0 ] ; then fail ; fi pass; diff --git a/tests/bugs/case-map.sh b/tests/bugs/case-map.sh index 011c344d..17f4fedf 100755 --- a/tests/bugs/case-map.sh +++ b/tests/bugs/case-map.sh @@ -72,7 +72,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 0 ] ; then fail ; fi pass; diff --git a/tests/bugs/comment-at-eof.sh b/tests/bugs/comment-at-eof.sh index 342f9bc0..f28762d1 100755 --- a/tests/bugs/comment-at-eof.sh +++ b/tests/bugs/comment-at-eof.sh @@ -63,7 +63,7 @@ COMMENT this is a comment at end of file. EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail; fi pass; diff --git a/tests/bugs/compression.sh b/tests/bugs/compression.sh index 71f9eab4..d8c83888 100755 --- a/tests/bugs/compression.sh +++ b/tests/bugs/compression.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi # Make sure the file really was compressed diff --git a/tests/bugs/compute-fmt.sh b/tests/bugs/compute-fmt.sh index 0d4a313e..2417cca9 100755 --- a/tests/bugs/compute-fmt.sh +++ b/tests/bugs/compute-fmt.sh @@ -70,7 +70,7 @@ SAVE outfile='$TEMPDIR/temp.sav'. EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail; fi diff --git a/tests/bugs/compute-lv.sh b/tests/bugs/compute-lv.sh index 88c42c3c..5bb13214 100755 --- a/tests/bugs/compute-lv.sh +++ b/tests/bugs/compute-lv.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run prog" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/compute-sum.sh b/tests/bugs/compute-sum.sh index 83aeae04..455ec39d 100755 --- a/tests/bugs/compute-sum.sh +++ b/tests/bugs/compute-sum.sh @@ -72,7 +72,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/compute-sum.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/compute-sum.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/bugs/computebug.sh b/tests/bugs/computebug.sh index 4f8a5731..4ba6a9d1 100755 --- a/tests/bugs/computebug.sh +++ b/tests/bugs/computebug.sh @@ -73,7 +73,7 @@ LIST. EOF activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/crosstabs-crash.sh b/tests/bugs/crosstabs-crash.sh index f7d19d83..5bebfed5 100755 --- a/tests/bugs/crosstabs-crash.sh +++ b/tests/bugs/crosstabs-crash.sh @@ -70,7 +70,7 @@ CROSSTABS VARIABLES X (1,7) Y (1,7) /TABLES X BY Y. EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/crosstabs-crash2.sh b/tests/bugs/crosstabs-crash2.sh index 910ec0bb..d2835161 100755 --- a/tests/bugs/crosstabs-crash2.sh +++ b/tests/bugs/crosstabs-crash2.sh @@ -75,7 +75,7 @@ CROSSTABS /TABLES = x BY y. EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TESTFILE > /dev/null +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE > /dev/null if [ $? -ne 0 ] ; then no_result ; fi diff -c $TEMPDIR/pspp.csv - << EOF diff --git a/tests/bugs/crosstabs.sh b/tests/bugs/crosstabs.sh index 3ef691f3..6f02a508 100755 --- a/tests/bugs/crosstabs.sh +++ b/tests/bugs/crosstabs.sh @@ -84,7 +84,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/ct.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/ct.stat if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/crosstabs2.sh b/tests/bugs/crosstabs2.sh index 964cf23c..bfb6f685 100755 --- a/tests/bugs/crosstabs2.sh +++ b/tests/bugs/crosstabs2.sh @@ -76,7 +76,7 @@ CROSSTABS EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/curtailed.sh b/tests/bugs/curtailed.sh index 26de22b2..624f5a5b 100755 --- a/tests/bugs/curtailed.sh +++ b/tests/bugs/curtailed.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi #This must fail activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 1 ] ; then fail ; fi diff --git a/tests/bugs/data-crash.sh b/tests/bugs/data-crash.sh index dfdcbfdc..15ba9e2c 100755 --- a/tests/bugs/data-crash.sh +++ b/tests/bugs/data-crash.sh @@ -67,7 +67,7 @@ if [ $? -ne 0 ] ; then no_result ; fi #This must fail activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TEMPDIR/ct.stat +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TEMPDIR/ct.stat if [ $? -ne 1 ] ; then fail ; fi pass; diff --git a/tests/bugs/double-frequency.sh b/tests/bugs/double-frequency.sh index ca958cd1..c579cf36 100755 --- a/tests/bugs/double-frequency.sh +++ b/tests/bugs/double-frequency.sh @@ -77,7 +77,7 @@ if [ $? -ne 0 ] ; then no_result ; fi cd $TEMPDIR activity="run data" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/ff.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/ff.stat if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/empty-do-repeat.sh b/tests/bugs/empty-do-repeat.sh index b96b2fea..ddc2e7a6 100755 --- a/tests/bugs/empty-do-repeat.sh +++ b/tests/bugs/empty-do-repeat.sh @@ -71,7 +71,7 @@ if [ $? -ne 0 ] ; then no_result ; fi # Must not crash. activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/repeat.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/repeat.stat if [ $? -ne 0 ] ; then fail ; fi pass; diff --git a/tests/bugs/examine-1sample.sh b/tests/bugs/examine-1sample.sh index 49ce086c..dd4449d8 100755 --- a/tests/bugs/examine-1sample.sh +++ b/tests/bugs/examine-1sample.sh @@ -73,7 +73,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi pass diff --git a/tests/bugs/examine-crash.sh b/tests/bugs/examine-crash.sh index 6cd172fd..03c51c6f 100755 --- a/tests/bugs/examine-crash.sh +++ b/tests/bugs/examine-crash.sh @@ -73,7 +73,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/examine-crash2.sh b/tests/bugs/examine-crash2.sh index 01fe8f9a..32f0e99f 100755 --- a/tests/bugs/examine-crash2.sh +++ b/tests/bugs/examine-crash2.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/examine-crash3.sh b/tests/bugs/examine-crash3.sh index 6093c343..2afc044f 100755 --- a/tests/bugs/examine-crash3.sh +++ b/tests/bugs/examine-crash3.sh @@ -75,7 +75,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/examine-missing.sh b/tests/bugs/examine-missing.sh index 5e3edec3..86b382e6 100755 --- a/tests/bugs/examine-missing.sh +++ b/tests/bugs/examine-missing.sh @@ -74,7 +74,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE 2> /dev/null +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE 2> /dev/null if [ $? -ne 0 ] ; then fail ; fi pass; diff --git a/tests/bugs/examine-missing2.sh b/tests/bugs/examine-missing2.sh index c95cca1b..2ea650c8 100755 --- a/tests/bugs/examine-missing2.sh +++ b/tests/bugs/examine-missing2.sh @@ -78,7 +78,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare results" @@ -126,7 +126,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/freq-nolabels.sh b/tests/bugs/freq-nolabels.sh index b5c44b54..f6c2f002 100755 --- a/tests/bugs/freq-nolabels.sh +++ b/tests/bugs/freq-nolabels.sh @@ -77,7 +77,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/get-no-file.sh b/tests/bugs/get-no-file.sh index d047b767..88e539c1 100755 --- a/tests/bugs/get-no-file.sh +++ b/tests/bugs/get-no-file.sh @@ -68,7 +68,7 @@ if [ $? -ne 0 ] ; then no_result ; fi # We use the stdinput here, because the bug seems to manifest itself only in # interactive mode. activity="run program" -cat $TESTFILE | $SUPERVISOR $PSPP --testing-mode > /dev/null -if [ $? -ne 0 ] ; then fail ; fi +cat $TESTFILE | $SUPERVISOR $PSPP -o pspp.csv > /dev/null +if [ $? -ne 1 ] ; then fail ; fi pass diff --git a/tests/bugs/get.sh b/tests/bugs/get.sh index 86b39c66..aa76a8c0 100755 --- a/tests/bugs/get.sh +++ b/tests/bugs/get.sh @@ -87,7 +87,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/html-frequency.sh b/tests/bugs/html-frequency.sh index 789fe32c..3417601a 100755 --- a/tests/bugs/html-frequency.sh +++ b/tests/bugs/html-frequency.sh @@ -77,7 +77,7 @@ if [ $? -ne 0 ] ; then no_result ; fi cd $TEMPDIR activity="run data" -$SUPERVISOR $PSPP -o html $TESTFILE +$SUPERVISOR $PSPP -o pspp.html $TESTFILE if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/if_crash.sh b/tests/bugs/if_crash.sh index 4f07d302..9882d0da 100755 --- a/tests/bugs/if_crash.sh +++ b/tests/bugs/if_crash.sh @@ -80,7 +80,7 @@ if [ $? -ne 0 ] ; then no_result ; fi # So this will have a non zero error status. # But it shouldn't crash! activity="run_program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 1 ] ; then fail ; fi diff --git a/tests/bugs/input-crash.sh b/tests/bugs/input-crash.sh index 600ca729..947e782b 100755 --- a/tests/bugs/input-crash.sh +++ b/tests/bugs/input-crash.sh @@ -73,7 +73,7 @@ if [ $? -ne 0 ] ; then no_result ; fi # The above syntax is invalid, so this program should fail to parse activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 1 ] ; then fail ; fi @@ -92,7 +92,7 @@ if [ $? -ne 0 ] ; then no_result ; fi # The above syntax is invalid, so this program should fail to parse activity="run program 2" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 1 ] ; then fail ; fi diff --git a/tests/bugs/keep-all.sh b/tests/bugs/keep-all.sh index 408255d2..dce41774 100755 --- a/tests/bugs/keep-all.sh +++ b/tests/bugs/keep-all.sh @@ -73,7 +73,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run PSPP ($mode)" - $SUPERVISOR $PSPP --testing-mode $TESTFILE + $SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/lag_crash.sh b/tests/bugs/lag_crash.sh index 73bce147..e848639c 100755 --- a/tests/bugs/lag_crash.sh +++ b/tests/bugs/lag_crash.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run_program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/list-overflow.sh b/tests/bugs/list-overflow.sh index e89ecadf..296952ce 100755 --- a/tests/bugs/list-overflow.sh +++ b/tests/bugs/list-overflow.sh @@ -78,7 +78,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi pass; diff --git a/tests/bugs/match-files-scratch.sh b/tests/bugs/match-files-scratch.sh index 6eb5b439..25b0dcfb 100755 --- a/tests/bugs/match-files-scratch.sh +++ b/tests/bugs/match-files-scratch.sh @@ -78,7 +78,7 @@ FINISH. EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/multipass.sh b/tests/bugs/multipass.sh index 11e27406..1ec496eb 100755 --- a/tests/bugs/multipass.sh +++ b/tests/bugs/multipass.sh @@ -78,7 +78,7 @@ DESCRIPTIVES EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/overwrite-input-file.sh b/tests/bugs/overwrite-input-file.sh index a255b2fc..27795114 100755 --- a/tests/bugs/overwrite-input-file.sh +++ b/tests/bugs/overwrite-input-file.sh @@ -77,7 +77,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="check and save copy of output files" @@ -103,7 +103,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -{ $SUPERVISOR $PSPP --testing-mode $TESTFILE -e /dev/null; } >/dev/null 2>&1 +{ $SUPERVISOR $PSPP -o pspp.csv $TESTFILE -e /dev/null; } >/dev/null 2>&1 # PSPP should have terminated with a signal. POSIX requires that the exit # status of a process terminated by a signal be greater than 128. if [ $? -le 128 ] ; then no_result ; fi @@ -142,7 +142,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 3" -$SUPERVISOR $PSPP --testing-mode $TESTFILE -e /dev/null +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE -e /dev/null if [ $? -ne 0 ] ; then no_result ; fi activity="check for remaining temporary files" @@ -162,7 +162,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 4" -$SUPERVISOR $PSPP --testing-mode $TESTFILE -e /dev/null +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE -e /dev/null if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/bugs/overwrite-special-file.sh b/tests/bugs/overwrite-special-file.sh index a40eae66..8089a21a 100755 --- a/tests/bugs/overwrite-special-file.sh +++ b/tests/bugs/overwrite-special-file.sh @@ -84,7 +84,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="check that foo2.out was created" diff --git a/tests/bugs/piechart.sh b/tests/bugs/piechart.sh index 657e5383..0296de0d 100755 --- a/tests/bugs/piechart.sh +++ b/tests/bugs/piechart.sh @@ -85,7 +85,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/print-crash.sh b/tests/bugs/print-crash.sh index 22b21566..0b66ddb1 100755 --- a/tests/bugs/print-crash.sh +++ b/tests/bugs/print-crash.sh @@ -70,7 +70,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 1 ] ; then fail ; fi diff --git a/tests/bugs/random.sh b/tests/bugs/random.sh index d2016edb..7d931d46 100755 --- a/tests/bugs/random.sh +++ b/tests/bugs/random.sh @@ -75,7 +75,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/recode-copy-bug.sh b/tests/bugs/recode-copy-bug.sh index e0a18b8f..6e6ac06e 100755 --- a/tests/bugs/recode-copy-bug.sh +++ b/tests/bugs/recode-copy-bug.sh @@ -97,7 +97,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode recode-copy-bug-1.stat +$SUPERVISOR $PSPP -o pspp.csv recode-copy-bug-1.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare output 1" @@ -119,7 +119,7 @@ if [ $? -ne 0 ] ; then fail ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode recode-copy-bug-2.stat +$SUPERVISOR $PSPP -o pspp.csv recode-copy-bug-2.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare output 2" diff --git a/tests/bugs/shbang.sh b/tests/bugs/shbang.sh index cc3fc5e2..b0961302 100755 --- a/tests/bugs/shbang.sh +++ b/tests/bugs/shbang.sh @@ -69,7 +69,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/bugs/signals.sh b/tests/bugs/signals.sh index dedfc6c8..b6cddb2a 100755 --- a/tests/bugs/signals.sh +++ b/tests/bugs/signals.sh @@ -59,7 +59,7 @@ mkdir -p $TEMPDIR cd $TEMPDIR activity="sending SIGINT to pspp" -echo 'host kill -INT $PPID' | $PSPP --testing-mode > /dev/null 2> $TEMPDIR/stderr1 +echo 'host kill -INT $PPID' | $PSPP -o pspp.csv > /dev/null 2> $TEMPDIR/stderr1 if [ $? -ne 0 ] ; then no_result ; fi # SIGINT should have caused a clean shutdown @@ -68,7 +68,7 @@ activity="checking for absence of error messages 1" if [ $? -ne 0 ] ; then fail ; fi activity="sending SIGSEGV to pspp" -echo 'host kill -SEGV $PPID' | $PSPP --testing-mode > /dev/null 2> $TEMPDIR/stderr2 +echo 'host kill -SEGV $PPID' | $PSPP -o pspp.csv > /dev/null 2> $TEMPDIR/stderr2 if [ $? -eq 0 ] ; then no_result ; fi # SIGSEGV should have caused an error message diff --git a/tests/bugs/t-test-alpha.sh b/tests/bugs/t-test-alpha.sh index 2a1693b5..205a7d4c 100755 --- a/tests/bugs/t-test-alpha.sh +++ b/tests/bugs/t-test-alpha.sh @@ -82,7 +82,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/bugs/t-test-alpha2.sh b/tests/bugs/t-test-alpha2.sh index c49103a8..0fdac2af 100755 --- a/tests/bugs/t-test-alpha2.sh +++ b/tests/bugs/t-test-alpha2.sh @@ -81,7 +81,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE > /dev/null +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE > /dev/null #invert v if [ $? -eq 0 ] ; then fail ; fi diff --git a/tests/bugs/t-test-alpha3.sh b/tests/bugs/t-test-alpha3.sh index b197c574..5504e6cc 100755 --- a/tests/bugs/t-test-alpha3.sh +++ b/tests/bugs/t-test-alpha3.sh @@ -79,7 +79,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/t-test-paired.sh b/tests/bugs/t-test-paired.sh index c5555f6f..47b09642 100755 --- a/tests/bugs/t-test-paired.sh +++ b/tests/bugs/t-test-paired.sh @@ -73,7 +73,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/t-test-with-temp.sh b/tests/bugs/t-test-with-temp.sh index ba355580..3413a51f 100755 --- a/tests/bugs/t-test-with-temp.sh +++ b/tests/bugs/t-test-with-temp.sh @@ -75,7 +75,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="copy output" diff --git a/tests/bugs/t-test.sh b/tests/bugs/t-test.sh index e8c43ebc..e4940c08 100755 --- a/tests/bugs/t-test.sh +++ b/tests/bugs/t-test.sh @@ -77,7 +77,7 @@ if [ $? -ne 0 ] ; then no_result ; fi #The syntax was invalid. Therefore pspp must return non zero. activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 1 ] ; then fail ; fi pass; diff --git a/tests/bugs/temp-freq.sh b/tests/bugs/temp-freq.sh index b0c91fd3..2027c0a3 100755 --- a/tests/bugs/temp-freq.sh +++ b/tests/bugs/temp-freq.sh @@ -83,7 +83,7 @@ FINISH EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff -c $TEMPDIR/pspp.csv - << EOF diff --git a/tests/bugs/temporary.sh b/tests/bugs/temporary.sh index 345ed852..96856d5a 100755 --- a/tests/bugs/temporary.sh +++ b/tests/bugs/temporary.sh @@ -80,7 +80,7 @@ list. EOF if [ $? -ne 0 ] ; then no_result ; fi -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/bugs/unwritable-dir.sh b/tests/bugs/unwritable-dir.sh index 774b6230..3f3a40ad 100755 --- a/tests/bugs/unwritable-dir.sh +++ b/tests/bugs/unwritable-dir.sh @@ -81,12 +81,12 @@ chmod u-w $TEMPDIR # on a single PSPP invocation, except that charts are only supported for # a single driver at a time, and we'd prefer to test chart support for # all of our driver types. -for driver in list-ascii list-ps html; do +for file in pspp.csv pspp.html pspp.odt pspp.pdf pspp.txt; do # PSPP will fail to create the output file. Currently this doesn't cause # PSPP's exit status to be nonzero, although this is arguably incorrect. # At any rate, PSPP should not crash. - activity="run pspp with $driver driver" - $SUPERVISOR $PSPP -o $driver test.pspp >/dev/null 2>&1 + activity="run pspp with $file driver" + $SUPERVISOR $PSPP -o $file test.pspp >/dev/null 2>&1 if [ $? -ne 0 ] ; then fail ; fi done diff --git a/tests/bugs/val-labs-trailing-slash.sh b/tests/bugs/val-labs-trailing-slash.sh index 7388caaa..d552041e 100755 --- a/tests/bugs/val-labs-trailing-slash.sh +++ b/tests/bugs/val-labs-trailing-slash.sh @@ -77,7 +77,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi pass diff --git a/tests/bugs/val-labs.sh b/tests/bugs/val-labs.sh index 4d57f661..1f07ca6d 100755 --- a/tests/bugs/val-labs.sh +++ b/tests/bugs/val-labs.sh @@ -77,7 +77,7 @@ if [ $? -ne 0 ] ; then no_result ; fi #Invalid syntax --- return value is non zero. activity="run program" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 1 ] ; then fail ; fi pass; diff --git a/tests/command/add-files.sh b/tests/command/add-files.sh index f0542c0b..d2b164bf 100755 --- a/tests/command/add-files.sh +++ b/tests/command/add-files.sh @@ -186,7 +186,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run $name.pspp" - $SUPERVISOR $PSPP --testing-mode $name.pspp + $SUPERVISOR $PSPP -o pspp.csv $name.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="check $name output" diff --git a/tests/command/aggregate.sh b/tests/command/aggregate.sh index 48b0ef6e..ba51161c 100755 --- a/tests/command/aggregate.sh +++ b/tests/command/aggregate.sh @@ -228,7 +228,7 @@ for outfile in scratch active external; do if [ $? -ne 0 ] ; then no_result ; fi activity="run $name.pspp" - $SUPERVISOR $PSPP --testing-mode -e /dev/null $name.pspp + $SUPERVISOR $PSPP -o pspp.csv -e /dev/null $name.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="check $name output" diff --git a/tests/command/attributes.sh b/tests/command/attributes.sh index f3a39e29..d4dece6c 100755 --- a/tests/command/attributes.sh +++ b/tests/command/attributes.sh @@ -96,7 +96,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/command/autorecod.sh b/tests/command/autorecod.sh index e4a86dfa..6aaf8722 100755 --- a/tests/command/autorecod.sh +++ b/tests/command/autorecod.sh @@ -87,7 +87,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="test output" diff --git a/tests/command/beg-data.sh b/tests/command/beg-data.sh index e3933d8f..45752fc7 100755 --- a/tests/command/beg-data.sh +++ b/tests/command/beg-data.sh @@ -86,7 +86,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare data" diff --git a/tests/command/bignum.sh b/tests/command/bignum.sh index 41e1963c..8caa95c4 100755 --- a/tests/command/bignum.sh +++ b/tests/command/bignum.sh @@ -138,7 +138,7 @@ foobar if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi # Like the above comments say ... diff --git a/tests/command/correlation.sh b/tests/command/correlation.sh index daec5de2..06c1d245 100755 --- a/tests/command/correlation.sh +++ b/tests/command/correlation.sh @@ -94,7 +94,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare results 1" @@ -162,7 +162,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="copy results" @@ -196,7 +196,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 3" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="Compare weighted and unweighted results" diff --git a/tests/command/count.sh b/tests/command/count.sh index d6fd1db8..bba7d062 100755 --- a/tests/command/count.sh +++ b/tests/command/count.sh @@ -80,7 +80,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="Run pspp 1" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi @@ -127,7 +127,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="Run pspp 2" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/data-list.sh b/tests/command/data-list.sh index 52b3dcb8..13c2a683 100755 --- a/tests/command/data-list.sh +++ b/tests/command/data-list.sh @@ -147,7 +147,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi activity="compare output" diff --git a/tests/command/do-if.sh b/tests/command/do-if.sh index b3bbed7f..8d2dcdae 100755 --- a/tests/command/do-if.sh +++ b/tests/command/do-if.sh @@ -108,7 +108,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run test1" -$SUPERVISOR $PSPP --testing-mode test1.pspp +$SUPERVISOR $PSPP -o pspp.csv test1.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="compare test1 results" diff --git a/tests/command/do-repeat.sh b/tests/command/do-repeat.sh index 07d67ec9..8c68a8b9 100755 --- a/tests/command/do-repeat.sh +++ b/tests/command/do-repeat.sh @@ -84,7 +84,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare results" diff --git a/tests/command/erase.sh b/tests/command/erase.sh index 491f79aa..42766614 100755 --- a/tests/command/erase.sh +++ b/tests/command/erase.sh @@ -81,7 +81,7 @@ if [ ! -f $TEMPDIR/foobar ] ; then fail ; fi # This command must fail activity="run prog 1" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -eq 0 ] ; then fail ; fi @@ -95,7 +95,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run prog 2" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi # foobar should now be gone diff --git a/tests/command/examine-extremes.sh b/tests/command/examine-extremes.sh index f771c66d..71d7d279 100755 --- a/tests/command/examine-extremes.sh +++ b/tests/command/examine-extremes.sh @@ -95,7 +95,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare results" diff --git a/tests/command/examine-percentiles.sh b/tests/command/examine-percentiles.sh index bf2fcbf9..9cb0b959 100755 --- a/tests/command/examine-percentiles.sh +++ b/tests/command/examine-percentiles.sh @@ -88,7 +88,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/examine.sh b/tests/command/examine.sh index 8fc9f7ca..1e5b0db0 100755 --- a/tests/command/examine.sh +++ b/tests/command/examine.sh @@ -98,7 +98,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi # NOTE: In the following data: Only the extreme values have been checked diff --git a/tests/command/file-handle.sh b/tests/command/file-handle.sh index ed44ba6b..937f05f7 100755 --- a/tests/command/file-handle.sh +++ b/tests/command/file-handle.sh @@ -76,7 +76,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/file-label.sh b/tests/command/file-label.sh index 4dc929ea..a275f295 100755 --- a/tests/command/file-label.sh +++ b/tests/command/file-label.sh @@ -119,7 +119,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi # We need to filter out the dates/times diff --git a/tests/command/filter.sh b/tests/command/filter.sh index 4c9c4161..13704791 100755 --- a/tests/command/filter.sh +++ b/tests/command/filter.sh @@ -86,7 +86,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/flip.sh b/tests/command/flip.sh index 7766ad44..141a75cc 100755 --- a/tests/command/flip.sh +++ b/tests/command/flip.sh @@ -92,7 +92,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/flip.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/flip.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/command/get-data-gnm.sh b/tests/command/get-data-gnm.sh index cf4e6ca8..c6cf630c 100755 --- a/tests/command/get-data-gnm.sh +++ b/tests/command/get-data-gnm.sh @@ -87,7 +87,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi @@ -197,7 +197,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE > /dev/null if [ $? -ne 0 ] ; then fail ; fi activity="compare output 2" diff --git a/tests/command/get-data-psql.sh b/tests/command/get-data-psql.sh index 081c7974..e15080ab 100755 --- a/tests/command/get-data-psql.sh +++ b/tests/command/get-data-psql.sh @@ -202,7 +202,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output 1" @@ -320,7 +320,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output 2" @@ -370,7 +370,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 3" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output 3" @@ -431,7 +431,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 4" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/get-data-txt-examples.sh b/tests/command/get-data-txt-examples.sh index 1e1a5164..3cc68499 100755 --- a/tests/command/get-data-txt-examples.sh +++ b/tests/command/get-data-txt-examples.sh @@ -132,7 +132,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run test" -$SUPERVISOR $PSPP --testing-mode test.pspp +$SUPERVISOR $PSPP -o pspp.csv test.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="compare test results" diff --git a/tests/command/get-data-txt-importcases.sh b/tests/command/get-data-txt-importcases.sh index 8293f290..54d6cf86 100755 --- a/tests/command/get-data-txt-importcases.sh +++ b/tests/command/get-data-txt-importcases.sh @@ -86,7 +86,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi activity="compare output" diff --git a/tests/command/get-data-txt.sh b/tests/command/get-data-txt.sh index 01bd196c..f0560495 100755 --- a/tests/command/get-data-txt.sh +++ b/tests/command/get-data-txt.sh @@ -152,7 +152,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi activity="compare output" diff --git a/tests/command/import-export.sh b/tests/command/import-export.sh index 9a581402..b519d469 100755 --- a/tests/command/import-export.sh +++ b/tests/command/import-export.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/command/input-program.sh b/tests/command/input-program.sh index 4aa5ebd2..07401286 100755 --- a/tests/command/input-program.sh +++ b/tests/command/input-program.sh @@ -87,7 +87,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run test1" -$SUPERVISOR $PSPP --testing-mode test1.pspp +$SUPERVISOR $PSPP -o pspp.csv test1.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="compare test1 results" @@ -121,7 +121,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run test2" -$SUPERVISOR $PSPP --testing-mode test2.pspp +$SUPERVISOR $PSPP -o pspp.csv test2.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="compare test2 results" @@ -161,7 +161,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run test3" -$SUPERVISOR $PSPP --testing-mode test3.pspp +$SUPERVISOR $PSPP -o pspp.csv test3.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="compare test3 results" @@ -207,7 +207,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run test4" -$SUPERVISOR $PSPP --testing-mode test4.pspp +$SUPERVISOR $PSPP -o pspp.csv test4.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="compare test4 results" @@ -244,7 +244,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run test5" -$SUPERVISOR $PSPP --testing-mode test5.pspp +$SUPERVISOR $PSPP -o pspp.csv test5.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="compare test5 results" diff --git a/tests/command/insert.sh b/tests/command/insert.sh index c6d1464c..0d8f1697 100755 --- a/tests/command/insert.sh +++ b/tests/command/insert.sh @@ -92,7 +92,7 @@ if [ $? -ne 0 ] ; then no_result ; fi #This command should fail activity="run program 1" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE > /dev/null if [ $? -eq 0 ] ; then fail ; fi @@ -110,7 +110,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi @@ -158,7 +158,7 @@ if [ $? -ne 0 ] ; then no_result ; fi # This command should fail activity="run program 3" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE > /dev/null if [ $? -eq 0 ] ; then fail ; fi activity="create wrapper 6" @@ -174,7 +174,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 4" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi @@ -210,7 +210,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 5" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE > /dev/null if [ $? -ne 1 ] ; then no_result ; fi activity="examine output 1" @@ -237,7 +237,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 6" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE > /dev/null if [ $? -ne 1 ] ; then no_result ; fi activity="examine output 2" @@ -268,7 +268,7 @@ if [ $? -ne 0 ] ; then no_result ; fi #This command should fail activity="run program 7" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE > /dev/null if [ $? -eq 0 ] ; then no_result ; fi pass; diff --git a/tests/command/lag.sh b/tests/command/lag.sh index de197c97..e8c39dd2 100755 --- a/tests/command/lag.sh +++ b/tests/command/lag.sh @@ -77,7 +77,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/lag.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/lag.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare result" diff --git a/tests/command/line-ends.sh b/tests/command/line-ends.sh index e78e4ae4..14612b90 100755 --- a/tests/command/line-ends.sh +++ b/tests/command/line-ends.sh @@ -83,7 +83,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/command/list.sh b/tests/command/list.sh index dfeb29c3..7079fd4d 100755 --- a/tests/command/list.sh +++ b/tests/command/list.sh @@ -78,7 +78,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/longvars.sh b/tests/command/longvars.sh index 8040f44a..a57e5732 100755 --- a/tests/command/longvars.sh +++ b/tests/command/longvars.sh @@ -77,7 +77,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/command/loop.sh b/tests/command/loop.sh index 21d883e8..c49633e6 100755 --- a/tests/command/loop.sh +++ b/tests/command/loop.sh @@ -131,7 +131,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -e $TEMPDIR/stdout $TEMPDIR/loop.stat +$SUPERVISOR $PSPP -o pspp.csv -e $TEMPDIR/stdout $TEMPDIR/loop.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare stdout" diff --git a/tests/command/match-files.sh b/tests/command/match-files.sh index a125cbd6..29d56696 100755 --- a/tests/command/match-files.sh +++ b/tests/command/match-files.sh @@ -174,7 +174,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run $name.pspp" - $SUPERVISOR $PSPP --testing-mode -e /dev/null $name.pspp + $SUPERVISOR $PSPP -o pspp.csv -e /dev/null $name.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="check $name output" @@ -197,7 +197,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run $name.pspp" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $name.pspp +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $name.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="check $name output" @@ -245,7 +245,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run $name.pspp" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $name.pspp +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $name.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="check $name output" diff --git a/tests/command/missing-values.sh b/tests/command/missing-values.sh index c01adf31..a4cde41b 100755 --- a/tests/command/missing-values.sh +++ b/tests/command/missing-values.sh @@ -119,7 +119,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode --error-file=$TEMPDIR/errs $TEMPDIR/missing-values.stat +$SUPERVISOR $PSPP -o pspp.csv --error-file=$TEMPDIR/errs $TEMPDIR/missing-values.stat # Note vv --- there are errors in input. Therefore, the command must FAIL if [ $? -eq 0 ] ; then fail ; fi diff --git a/tests/command/n_of_cases.sh b/tests/command/n_of_cases.sh index 24a3429b..bb685f84 100755 --- a/tests/command/n_of_cases.sh +++ b/tests/command/n_of_cases.sh @@ -76,7 +76,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/no_case_size.sh b/tests/command/no_case_size.sh index 4243f326..9e792122 100755 --- a/tests/command/no_case_size.sh +++ b/tests/command/no_case_size.sh @@ -68,7 +68,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/command/npar-binomial.sh b/tests/command/npar-binomial.sh index 9a776f6b..ea892b15 100755 --- a/tests/command/npar-binomial.sh +++ b/tests/command/npar-binomial.sh @@ -247,7 +247,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output 1" diff --git a/tests/command/npar-chisquare.sh b/tests/command/npar-chisquare.sh index 0f4b3fac..8ee9bb8e 100755 --- a/tests/command/npar-chisquare.sh +++ b/tests/command/npar-chisquare.sh @@ -92,7 +92,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output 1" @@ -176,7 +176,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode $TESTFILE > $TEMPDIR/output +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE > $TEMPDIR/output if [ $? -eq 0 ] ; then no_result ; fi activity="compare errors 2" @@ -215,7 +215,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 3" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi @@ -277,7 +277,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 4" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/npar-sign.sh b/tests/command/npar-sign.sh index 1c7c629a..03c8117c 100755 --- a/tests/command/npar-sign.sh +++ b/tests/command/npar-sign.sh @@ -81,7 +81,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output 1" diff --git a/tests/command/npar-wilcoxon.sh b/tests/command/npar-wilcoxon.sh index f4434a64..f259ea95 100755 --- a/tests/command/npar-wilcoxon.sh +++ b/tests/command/npar-wilcoxon.sh @@ -91,7 +91,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="generate results" @@ -154,7 +154,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output 2" diff --git a/tests/command/oneway-missing.sh b/tests/command/oneway-missing.sh index d4a4c6fd..5fe701b0 100755 --- a/tests/command/oneway-missing.sh +++ b/tests/command/oneway-missing.sh @@ -88,7 +88,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="copy output" @@ -126,7 +126,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare outputs" @@ -166,7 +166,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 3" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare outputs" diff --git a/tests/command/oneway-with-splits.sh b/tests/command/oneway-with-splits.sh index 8466d8f5..35cc76de 100755 --- a/tests/command/oneway-with-splits.sh +++ b/tests/command/oneway-with-splits.sh @@ -96,7 +96,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff -c $TEMPDIR/pspp.csv - << EOF diff --git a/tests/command/oneway.sh b/tests/command/oneway.sh index c55101d5..cb7fb79b 100755 --- a/tests/command/oneway.sh +++ b/tests/command/oneway.sh @@ -93,7 +93,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff -c $TEMPDIR/pspp.csv - << EOF diff --git a/tests/command/permissions.sh b/tests/command/permissions.sh index db54cd5a..0234187e 100755 --- a/tests/command/permissions.sh +++ b/tests/command/permissions.sh @@ -70,7 +70,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/per.sps +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/per.sps if [ $? -ne 0 ] ; then no_result ; fi activity="Check Permissions" @@ -86,7 +86,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/per.sps +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/per.sps if [ $? -ne 0 ] ; then no_result ; fi activity="Check Permissions" diff --git a/tests/command/print-strings.sh b/tests/command/print-strings.sh index 5fb73006..b8ac189e 100755 --- a/tests/command/print-strings.sh +++ b/tests/command/print-strings.sh @@ -79,7 +79,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/print.sh b/tests/command/print.sh index f135b4c1..a0b806e5 100755 --- a/tests/command/print.sh +++ b/tests/command/print.sh @@ -105,7 +105,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode --error-file=$TEMPDIR/errs $TEMPDIR/print.stat +$SUPERVISOR $PSPP -o pspp.csv --error-file=$TEMPDIR/errs $TEMPDIR/print.stat if [ $? -ne 0 ] ; then fail ; fi activity="compare print.out" diff --git a/tests/command/rank.sh b/tests/command/rank.sh index bc208af8..67e19c9f 100755 --- a/tests/command/rank.sh +++ b/tests/command/rank.sh @@ -82,7 +82,7 @@ if [ $? -ne 0 ] ; then no_result ; fi # Check that it properly handles failed transformations. activity="run program 1" -$SUPERVISOR $PSPP --testing-mode -e $TEMPDIR/err $TESTFILE +$SUPERVISOR $PSPP --testing-mode -o pspp.csv -e $TEMPDIR/err $TESTFILE if [ $? -ne 1 ] ; then fail ; fi activity="diff 1" @@ -131,7 +131,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program (syntax errors)" -$SUPERVISOR $PSPP --testing-mode -e $TEMPDIR/errs $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e $TEMPDIR/errs $TESTFILE if [ $? -ne 1 ] ; then fail ; fi activity="compare errors" @@ -359,7 +359,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 3" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi @@ -629,7 +629,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 4" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/command/regression-qr.sh b/tests/command/regression-qr.sh index 1c4211ab..7cbb8156 100755 --- a/tests/command/regression-qr.sh +++ b/tests/command/regression-qr.sh @@ -1566,7 +1566,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff -c $TEMPDIR/pspp.csv - << EOF diff --git a/tests/command/regression.sh b/tests/command/regression.sh index 88b4cd83..4ff48e51 100755 --- a/tests/command/regression.sh +++ b/tests/command/regression.sh @@ -78,7 +78,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff -c $TEMPDIR/pspp.csv - << EOF diff --git a/tests/command/reliability.sh b/tests/command/reliability.sh index c9344042..df86fa82 100755 --- a/tests/command/reliability.sh +++ b/tests/command/reliability.sh @@ -245,7 +245,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/command/rename.sh b/tests/command/rename.sh index a4b9646e..1e08782a 100755 --- a/tests/command/rename.sh +++ b/tests/command/rename.sh @@ -80,7 +80,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="check sysfile" diff --git a/tests/command/roc.sh b/tests/command/roc.sh index 081263ee..c6ab0461 100755 --- a/tests/command/roc.sh +++ b/tests/command/roc.sh @@ -94,7 +94,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/roc2.sh b/tests/command/roc2.sh index ffed0fe6..7976a6e4 100755 --- a/tests/command/roc2.sh +++ b/tests/command/roc2.sh @@ -101,7 +101,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/sample.sh b/tests/command/sample.sh index 4d001bf7..c8d25e75 100755 --- a/tests/command/sample.sh +++ b/tests/command/sample.sh @@ -81,7 +81,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/sample.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/sample.stat if [ $? -ne 0 ] ; then no_result ; fi activity="create head" diff --git a/tests/command/sort.sh b/tests/command/sort.sh index d66681be..409c1196 100755 --- a/tests/command/sort.sh +++ b/tests/command/sort.sh @@ -121,7 +121,7 @@ for count_repeat_buffers in \ } > sort.pspp || no_result activity="run program" - $SUPERVISOR $PSPP --testing-mode sort.pspp + $SUPERVISOR $PSPP --testing-mode -o pspp.csv sort.pspp if [ $? -ne 0 ] ; then no_result ; fi perl -pi -e 's/^\s*$//g' sort.exp sort.out diff --git a/tests/command/split-file.sh b/tests/command/split-file.sh index 1452588d..5bebedc7 100755 --- a/tests/command/split-file.sh +++ b/tests/command/split-file.sh @@ -85,7 +85,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/split.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/split.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare results" diff --git a/tests/command/sysfile-info.sh b/tests/command/sysfile-info.sh index d5768252..35a4e53f 100755 --- a/tests/command/sysfile-info.sh +++ b/tests/command/sysfile-info.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="filter output" diff --git a/tests/command/sysfiles-old.sh b/tests/command/sysfiles-old.sh index e136a0b2..fefe3afc 100755 --- a/tests/command/sysfiles-old.sh +++ b/tests/command/sysfiles-old.sh @@ -84,7 +84,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="check file exists" diff --git a/tests/command/sysfiles.sh b/tests/command/sysfiles.sh index a671dff5..08b28888 100755 --- a/tests/command/sysfiles.sh +++ b/tests/command/sysfiles.sh @@ -83,7 +83,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/command/t-test-1-indep-val.sh b/tests/command/t-test-1-indep-val.sh index 0dcd194b..04f6b05e 100755 --- a/tests/command/t-test-1-indep-val.sh +++ b/tests/command/t-test-1-indep-val.sh @@ -90,7 +90,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/t-test-1-sample-missing-anal.sh b/tests/command/t-test-1-sample-missing-anal.sh index cbac8dba..76943491 100755 --- a/tests/command/t-test-1-sample-missing-anal.sh +++ b/tests/command/t-test-1-sample-missing-anal.sh @@ -75,7 +75,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="copy output" @@ -101,7 +101,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare outputs" diff --git a/tests/command/t-test-1-sample-missing-list.sh b/tests/command/t-test-1-sample-missing-list.sh index 0db7e8e9..476f2fe0 100755 --- a/tests/command/t-test-1-sample-missing-list.sh +++ b/tests/command/t-test-1-sample-missing-list.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="copy output" @@ -101,7 +101,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare outputs" diff --git a/tests/command/t-test-1s.sh b/tests/command/t-test-1s.sh index c20d0f66..b0bb6ab4 100755 --- a/tests/command/t-test-1s.sh +++ b/tests/command/t-test-1s.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/command/t-test-groups.sh b/tests/command/t-test-groups.sh index 57aef96a..c149ea56 100755 --- a/tests/command/t-test-groups.sh +++ b/tests/command/t-test-groups.sh @@ -81,7 +81,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/command/t-test-indep-missing-anal.sh b/tests/command/t-test-indep-missing-anal.sh index aab5ecc4..8f2e8597 100755 --- a/tests/command/t-test-indep-missing-anal.sh +++ b/tests/command/t-test-indep-missing-anal.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="copy output" @@ -102,7 +102,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/t-test-indep-missing-list.sh b/tests/command/t-test-indep-missing-list.sh index 026dba7f..b77c5dc1 100755 --- a/tests/command/t-test-indep-missing-list.sh +++ b/tests/command/t-test-indep-missing-list.sh @@ -75,7 +75,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="copy output" @@ -100,7 +100,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/t-test-paired-missing-anal.sh b/tests/command/t-test-paired-missing-anal.sh index b1e4157b..5c40a65c 100755 --- a/tests/command/t-test-paired-missing-anal.sh +++ b/tests/command/t-test-paired-missing-anal.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="copy output" @@ -100,7 +100,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/t-test-paired-missing-list.sh b/tests/command/t-test-paired-missing-list.sh index f034651a..700c1ca9 100755 --- a/tests/command/t-test-paired-missing-list.sh +++ b/tests/command/t-test-paired-missing-list.sh @@ -74,7 +74,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 1" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="copy output" @@ -100,7 +100,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/t-test-pairs.sh b/tests/command/t-test-pairs.sh index eb23b6a1..4dc40cd8 100755 --- a/tests/command/t-test-pairs.sh +++ b/tests/command/t-test-pairs.sh @@ -73,7 +73,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/command/tabs.sh b/tests/command/tabs.sh index addb170b..0d05c5ab 100755 --- a/tests/command/tabs.sh +++ b/tests/command/tabs.sh @@ -78,7 +78,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/tabs.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/tabs.stat if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/trimmed-mean.sh b/tests/command/trimmed-mean.sh index 28843920..f410a9f5 100755 --- a/tests/command/trimmed-mean.sh +++ b/tests/command/trimmed-mean.sh @@ -81,7 +81,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/update.sh b/tests/command/update.sh index 92615a64..4d4da661 100755 --- a/tests/command/update.sh +++ b/tests/command/update.sh @@ -155,7 +155,7 @@ EOF activity="run $name.pspp" rm -f errors - $SUPERVISOR $PSPP --testing-mode --error-file=errors $name.pspp + $SUPERVISOR $PSPP -o pspp.csv --error-file=errors $name.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="check $name output" diff --git a/tests/command/use.sh b/tests/command/use.sh index b6bc661f..7b26cd7b 100755 --- a/tests/command/use.sh +++ b/tests/command/use.sh @@ -79,7 +79,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP -B $STAT_CONFIG_PATH --testing-mode $TEMPDIR/filter.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/filter.stat if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/variable-display.sh b/tests/command/variable-display.sh index 1cf74f34..5bf71719 100755 --- a/tests/command/variable-display.sh +++ b/tests/command/variable-display.sh @@ -70,7 +70,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then fail ; fi activity="compare output" diff --git a/tests/command/vector.sh b/tests/command/vector.sh index 06a31867..a0da5f12 100755 --- a/tests/command/vector.sh +++ b/tests/command/vector.sh @@ -84,7 +84,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -e $TEMPDIR/stdout $TEMPDIR/vector.stat +$SUPERVISOR $PSPP -o pspp.csv -e $TEMPDIR/stdout $TEMPDIR/vector.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare stdout" diff --git a/tests/command/very-long-strings.sh b/tests/command/very-long-strings.sh index e9d20e91..e7130c14 100755 --- a/tests/command/very-long-strings.sh +++ b/tests/command/very-long-strings.sh @@ -73,7 +73,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 0" -$SUPERVISOR $PSPP --testing-mode -e /dev/null $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE if [ $? -ne 0 ] ; then fail ; fi activity="compare variable display 0" @@ -152,7 +152,7 @@ EOF activity="run program 1 ($options)" - $SUPERVISOR $PSPP --testing-mode $TESTFILE + $SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="Create file2 ($options)" @@ -173,7 +173,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program 2 ($options)" - $SUPERVISOR $PSPP --testing-mode $TESTFILE + $SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/weight.sh b/tests/command/weight.sh index 40a3ca9c..5c6ce31b 100755 --- a/tests/command/weight.sh +++ b/tests/command/weight.sh @@ -73,7 +73,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="compare results" diff --git a/tests/coverage.sh b/tests/coverage.sh index de91adc6..3a210783 100755 --- a/tests/coverage.sh +++ b/tests/coverage.sh @@ -47,6 +47,6 @@ FREQUENCIES /COVERAGE EOF -src/pspp -o html $TEMPDIR/cov.sps +src/pspp -o pspp.html $TEMPDIR/cov.sps rm -rf $TEMPDIR diff --git a/tests/expressions/epoch.sh b/tests/expressions/epoch.sh index 1ceab308..dcbfc0ac 100755 --- a/tests/expressions/epoch.sh +++ b/tests/expressions/epoch.sh @@ -142,7 +142,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/epoch.stat > $TEMPDIR/epoch.err 2> $TEMPDIR/epoch.out +$SUPERVISOR $PSPP --testing-mode -o pspp.csv $TEMPDIR/epoch.stat > $TEMPDIR/epoch.err 2> $TEMPDIR/epoch.out activity="compare results" perl -pi -e 's/^\s*$//g' $TEMPDIR/epoch.out diff --git a/tests/expressions/expressions.sh b/tests/expressions/expressions.sh index 339abed4..49ad4f7d 100755 --- a/tests/expressions/expressions.sh +++ b/tests/expressions/expressions.sh @@ -1565,7 +1565,7 @@ sed < $TEMPDIR/expr-list >> $TEMPDIR/expr-opt.stat \ if [ $? -ne 0 ] ; then no_result ; fi activity="run optimizing program" -$SUPERVISOR $PSPP --testing-mode \ +$SUPERVISOR $PSPP --testing-mode -o pspp.csv \ $TEMPDIR/expr-opt.stat >$TEMPDIR/expr-opt.err 2> $TEMPDIR/expr-opt.out activity="compare optimizing output" @@ -1581,7 +1581,7 @@ sed < $TEMPDIR/expr-list >> $TEMPDIR/expr-noopt.stat \ if [ $? -ne 0 ] ; then no_result ; fi activity="run non-optimizing program" -$SUPERVISOR $PSPP --testing-mode \ +$SUPERVISOR $PSPP --testing-mode -o pspp.csv \ $TEMPDIR/expr-noopt.stat >$TEMPDIR/expr-noopt.err 2> $TEMPDIR/expr-noopt.out activity="compare non-optimizing output" @@ -1597,7 +1597,7 @@ sed < $TEMPDIR/expr-list >> $TEMPDIR/expr-opt-pos.stat \ if [ $? -ne 0 ] ; then no_result ; fi activity="run optimizing postfix program" -$SUPERVISOR $PSPP --testing-mode \ +$SUPERVISOR $PSPP --testing-mode -o pspp.csv \ $TEMPDIR/expr-opt-pos.stat >$TEMPDIR/expr-opt-pos.err 2> $TEMPDIR/expr-opt-pos.out if [ $? -eq 0 ] ; then no_result ; fi @@ -1609,7 +1609,7 @@ sed < $TEMPDIR/expr-list >> $TEMPDIR/expr-noopt-pos.stat \ if [ $? -ne 0 ] ; then no_result ; fi activity="run non-optimizing postfix program" -$SUPERVISOR $PSPP --testing-mode \ +$SUPERVISOR $PSPP --testing-mode -o pspp.csv \ $TEMPDIR/expr-noopt-pos.stat >$TEMPDIR/expr-noopt-pos.err 2> $TEMPDIR/expr-noopt-pos.out if [ $? -eq 0 ] ; then no_result ; fi diff --git a/tests/expressions/randist.sh b/tests/expressions/randist.sh index 58fe386d..88a57e5f 100755 --- a/tests/expressions/randist.sh +++ b/tests/expressions/randist.sh @@ -60,7 +60,7 @@ perl $top_srcdir/tests/expressions/randist/randist.pl \ if [ $? -ne 0 ] ; then no_result ; fi activity="run command file" -$SUPERVISOR $PSPP --testing-mode \ +$SUPERVISOR $PSPP -o pspp.csv \ $TEMPDIR/randist.pspp >$TEMPDIR/randist.err 2> $TEMPDIR/randist.out if [ $? -ne 0 ] ; then fail ; fi diff --git a/tests/expressions/valuelabel.sh b/tests/expressions/valuelabel.sh index 1b5b92e2..c751689e 100755 --- a/tests/expressions/valuelabel.sh +++ b/tests/expressions/valuelabel.sh @@ -88,7 +88,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/valuelabel.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/valuelabel.stat if [ $? -ne 0 ] ; then fail ; fi activity="compare results" diff --git a/tests/expressions/variables.sh b/tests/expressions/variables.sh index b4f3ffca..64ea80d1 100755 --- a/tests/expressions/variables.sh +++ b/tests/expressions/variables.sh @@ -101,7 +101,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/variables.stat > $TEMPDIR/variables.err 2> $TEMPDIR/variables.out +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/variables.stat > $TEMPDIR/variables.err 2> $TEMPDIR/variables.out if [ $? -ne 0 ] ; then fail ; fi activity="compare results" diff --git a/tests/expressions/vectors.sh b/tests/expressions/vectors.sh index 9205f7fc..3eb41404 100755 --- a/tests/expressions/vectors.sh +++ b/tests/expressions/vectors.sh @@ -78,7 +78,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/vectors.stat > $TEMPDIR/vectors.err 2> $TEMPDIR/vectors.out +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/vectors.stat > $TEMPDIR/vectors.err 2> $TEMPDIR/vectors.out if [ $? -ne 0 ] ; then fail ; fi activity="compare results" diff --git a/tests/formats/360.sh b/tests/formats/360.sh index 9c156efd..57f928cf 100755 --- a/tests/formats/360.sh +++ b/tests/formats/360.sh @@ -235,7 +235,7 @@ EOF rm -f pspp.csv activity="run $type.pspp" - $SUPERVISOR $PSPP --testing-mode $type.pspp + $SUPERVISOR $PSPP -o pspp.csv $type.pspp if [ $? -ne 0 ] ; then fail ; fi activity="compare $type.pspp output" diff --git a/tests/formats/bcd-in.sh b/tests/formats/bcd-in.sh index 934f4302..46c972fe 100755 --- a/tests/formats/bcd-in.sh +++ b/tests/formats/bcd-in.sh @@ -71,7 +71,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode bcd-in.pspp +$SUPERVISOR $PSPP -o pspp.csv bcd-in.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="gunzip expected results" diff --git a/tests/formats/binhex-out.sh b/tests/formats/binhex-out.sh index caffb03b..6fb4a972 100755 --- a/tests/formats/binhex-out.sh +++ b/tests/formats/binhex-out.sh @@ -154,7 +154,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode binhex-out.pspp +$SUPERVISOR $PSPP -o pspp.csv binhex-out.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="gunzip expected results" diff --git a/tests/formats/date-in.sh b/tests/formats/date-in.sh index edadc3f5..9488fb9b 100755 --- a/tests/formats/date-in.sh +++ b/tests/formats/date-in.sh @@ -254,7 +254,7 @@ $PERL date-in.pl if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode date-in.pspp +$SUPERVISOR $PSPP -o pspp.csv date-in.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="compare adate.out output" diff --git a/tests/formats/date-out.sh b/tests/formats/date-out.sh index 6e28083c..5f360c73 100755 --- a/tests/formats/date-out.sh +++ b/tests/formats/date-out.sh @@ -88,7 +88,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode date-out.pspp +$SUPERVISOR $PSPP -o pspp.csv date-out.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" @@ -510,7 +510,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode bad-date-out.pspp +$SUPERVISOR $PSPP -o pspp.csv bad-date-out.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/formats/float-format.sh b/tests/formats/float-format.sh index 2a6b6087..dee97909 100755 --- a/tests/formats/float-format.sh +++ b/tests/formats/float-format.sh @@ -149,7 +149,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/float-format.pspp +$SUPERVISOR $PSPP --testing-mode -o pspp.csv $TEMPDIR/float-format.pspp if [ $? -ne 0 ] ; then fail ; fi pass diff --git a/tests/formats/format-guesser.sh b/tests/formats/format-guesser.sh index 75885a78..c84860a7 100755 --- a/tests/formats/format-guesser.sh +++ b/tests/formats/format-guesser.sh @@ -186,7 +186,7 @@ activity="create syntax file" if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode \ +$SUPERVISOR $PSPP --testing-mode -o pspp.csv \ $TEMPDIR/test.stat >$TEMPDIR/test.err 2> $TEMPDIR/test.out activity="compare output" diff --git a/tests/formats/ib-in.sh b/tests/formats/ib-in.sh index 3a54c2f0..50c8c93b 100755 --- a/tests/formats/ib-in.sh +++ b/tests/formats/ib-in.sh @@ -72,7 +72,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode ib-in.pspp +$SUPERVISOR $PSPP -o pspp.csv ib-in.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="gunzip expected results" diff --git a/tests/formats/legacy-in.sh b/tests/formats/legacy-in.sh index 1087a06f..eaab8e14 100755 --- a/tests/formats/legacy-in.sh +++ b/tests/formats/legacy-in.sh @@ -71,7 +71,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode legacy-in.pspp +$SUPERVISOR $PSPP -o pspp.csv legacy-in.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="gunzip expected results" diff --git a/tests/formats/month-in.sh b/tests/formats/month-in.sh index 2d32a594..dd5f0272 100755 --- a/tests/formats/month-in.sh +++ b/tests/formats/month-in.sh @@ -105,7 +105,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode month-in.pspp +$SUPERVISOR $PSPP -o pspp.csv month-in.pspp if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/formats/month-out.sh b/tests/formats/month-out.sh index 65d0a42e..fba0ae89 100755 --- a/tests/formats/month-out.sh +++ b/tests/formats/month-out.sh @@ -41,6 +41,7 @@ cd $TEMPDIR activity="write pspp syntax" cat > month-out.pspp < paper-size.out +PAPERSIZE=letter $SUPERVISOR $PSPP --testing-mode -o pspp.csv paper-size.pspp > paper-size.out if [ $? -ne 0 ] ; then no_result ; fi activity="compare results" @@ -88,7 +88,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="Run pspp 2" -PAPERSIZE=a4 $SUPERVISOR $PSPP --testing-mode paper-size-2.pspp > paper-size-2.out +PAPERSIZE=a4 $SUPERVISOR $PSPP --testing-mode -o pspp.csv paper-size-2.pspp > paper-size-2.out if [ $? -ne 0 ] ; then no_result ; fi activity="compare results 2" diff --git a/tests/output/render-test.c b/tests/output/render-test.c index 5d8a2918..729db850 100644 --- a/tests/output/render-test.c +++ b/tests/output/render-test.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,14 +22,16 @@ #include #include -#include -#include -#include -#include -#include +#include "libpspp/assertion.h" +#include "libpspp/compiler.h" +#include "libpspp/string-map.h" +#include "output/driver.h" +#include "output/tab.h" +#include "output/table-item.h" #include "gl/error.h" #include "gl/progname.h" +#include "gl/xalloc.h" #include "gl/xvasprintf.h" /* --transpose: Transpose the table before outputting? */ @@ -70,24 +72,67 @@ main (int argc, char **argv) return 0; } +static void +configure_drivers (int width, int length) +{ + struct string_map options, tmp; + struct output_driver *driver; + + string_map_init (&options); + string_map_insert (&options, "format", "txt"); + string_map_insert (&options, "output-file", "-"); + string_map_insert_nocopy (&options, xstrdup ("width"), + xasprintf ("%d", width)); + string_map_insert_nocopy (&options, xstrdup ("length"), + xasprintf ("%d", length)); + + /* Render to stdout. */ + string_map_clone (&tmp, &options); + driver = output_driver_create (&tmp); + if (driver == NULL) + exit (EXIT_FAILURE); + output_driver_register (driver); + string_map_destroy (&tmp); + + /* Render to render.txt. */ + string_map_replace (&options, "output-file", "render.txt"); + driver = output_driver_create (&options); + if (driver == NULL) + exit (EXIT_FAILURE); + output_driver_register (driver); + + /* Render to render.pdf. */ + string_map_insert (&options, "output-file", "render.pdf"); + string_map_insert (&options, "headers", "off"); + string_map_insert (&options, "top-margin", "0"); + string_map_insert (&options, "bottom-margin", "0"); + string_map_insert (&options, "left-margin", "0"); + string_map_insert (&options, "right-margin", "0"); + string_map_insert_nocopy (&options, xstrdup ("paper-size"), + xasprintf ("%dx%dpt", width * 5, length * 6)); + driver = output_driver_create (&options); + if (driver == NULL) + exit (EXIT_FAILURE); + output_driver_register (driver); + + string_map_destroy (&options); +} + static const char * parse_options (int argc, char **argv) { - bool configured_driver = false; int width = 79; int length = 66; for (;;) { enum { - OPT_DRIVER = UCHAR_MAX + 1, - OPT_WIDTH, + OPT_WIDTH = UCHAR_MAX + 1, OPT_LENGTH, OPT_HELP }; static const struct option options[] = { - {"driver", required_argument, NULL, OPT_DRIVER}, {"width", required_argument, NULL, OPT_WIDTH}, {"length", required_argument, NULL, OPT_LENGTH}, {"transpose", no_argument, &transpose, 1}, @@ -101,11 +146,6 @@ parse_options (int argc, char **argv) switch (c) { - case OPT_DRIVER: - output_configure_driver (optarg); - configured_driver = true; - break; - case OPT_WIDTH: width = atoi (optarg); break; @@ -130,32 +170,7 @@ parse_options (int argc, char **argv) } - if (!configured_driver) - { - char *config; - -#if 1 - config = xasprintf ("ascii:ascii:listing:headers=off top-margin=0 " - "bottom-margin=0 output-file=- emphasis=none " - "paginate=off squeeze=on width=%d length=%d", - width, length); - output_configure_driver (config); - free (config); - - config = xasprintf ("ascii:ascii:listing:headers=off top-margin=0 " - "bottom-margin=0 output-file=render.txt " - "emphasis=none paginate=off squeeze=on"); - output_configure_driver (config); - free (config); -#endif - - config = xasprintf ("pdf:cairo:listing:headers=off top-margin=0 " - "bottom-margin=0 left-margin=0 right-margin=0 " - "output-file=render.pdf paper-size=%dx%dpt", - width * 5, length * 6); - output_configure_driver (config); - free (config); - } + configure_drivers (width, length); if (optind + 1 != argc) error (1, 0, "exactly one non-option argument required; " diff --git a/tests/stats/descript-basic.sh b/tests/stats/descript-basic.sh index fedb73f6..3577a03b 100755 --- a/tests/stats/descript-basic.sh +++ b/tests/stats/descript-basic.sh @@ -82,7 +82,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/descript.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/descript.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/stats/descript-mean-bug.sh b/tests/stats/descript-mean-bug.sh index 532abed0..4a8853b4 100755 --- a/tests/stats/descript-mean-bug.sh +++ b/tests/stats/descript-mean-bug.sh @@ -77,7 +77,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/descript.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/descript.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/stats/descript-missing.sh b/tests/stats/descript-missing.sh index fce8a17e..2370a1d5 100755 --- a/tests/stats/descript-missing.sh +++ b/tests/stats/descript-missing.sh @@ -83,7 +83,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/descript.stat +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/descript.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/stats/moments.sh b/tests/stats/moments.sh index 89854285..5fc7c690 100755 --- a/tests/stats/moments.sh +++ b/tests/stats/moments.sh @@ -84,7 +84,7 @@ sed < $TEMPDIR/moments-list-2p >> $TEMPDIR/moments-2p.stat \ if [ $? -ne 0 ] ; then no_result ; fi activity="run two-pass program" -$SUPERVISOR $PSPP --testing-mode \ +$SUPERVISOR $PSPP --testing-mode -o pspp.csv \ $TEMPDIR/moments-2p.stat >$TEMPDIR/moments-2p.err 2> $TEMPDIR/moments-2p.out activity="compare two-pass output" @@ -98,7 +98,7 @@ sed < $TEMPDIR/moments-list-1p >> $TEMPDIR/moments-1p.stat \ if [ $? -ne 0 ] ; then no_result ; fi activity="run one-pass program" -$SUPERVISOR $PSPP --testing-mode \ +$SUPERVISOR $PSPP --testing-mode -o pspp.csv \ $TEMPDIR/moments-1p.stat >$TEMPDIR/moments-1p.err 2> $TEMPDIR/moments-1p.out activity="compare one-pass output" diff --git a/tests/stats/ntiles.sh b/tests/stats/ntiles.sh index 4f4eedb1..697cc426 100755 --- a/tests/stats/ntiles.sh +++ b/tests/stats/ntiles.sh @@ -77,7 +77,7 @@ EOF if [ $? -ne 0 ] ; then no_result; fi activity="run program $i" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps if [ $? -ne 0 ] ; then no_result ; fi activity="move output" @@ -106,7 +106,7 @@ EOF if [ $? -ne 0 ] ; then no_result; fi activity="run program $i" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps if [ $? -ne 0 ] ; then no_result ; fi activity="compare output" diff --git a/tests/stats/percentiles-compatible.sh b/tests/stats/percentiles-compatible.sh index 2d539a1d..e546a45b 100755 --- a/tests/stats/percentiles-compatible.sh +++ b/tests/stats/percentiles-compatible.sh @@ -82,7 +82,7 @@ EOF if [ $? -ne 0 ] ; then no_result; fi activity="run program $i" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps if [ $? -ne 0 ] ; then no_result ; fi activity="compare output $i" diff --git a/tests/stats/percentiles-enhanced.sh b/tests/stats/percentiles-enhanced.sh index 5c5accbb..03643f5b 100755 --- a/tests/stats/percentiles-enhanced.sh +++ b/tests/stats/percentiles-enhanced.sh @@ -81,7 +81,7 @@ EOF if [ $? -ne 0 ] ; then no_result; fi activity="run program $i" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps if [ $? -ne 0 ] ; then no_result ; fi activity="compare output $i" @@ -137,7 +137,7 @@ if [ $? -ne 0 ] ; then no_result; fi activity="run program $i" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps if [ $? -ne 0 ] ; then no_result ; fi activity="compare output $i" @@ -191,7 +191,7 @@ if [ $? -ne 0 ] ; then no_result; fi activity="run program $i" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps if [ $? -ne 0 ] ; then no_result ; fi activity="compare output $i" @@ -244,7 +244,7 @@ if [ $? -ne 0 ] ; then no_result; fi activity="run program $i" -$SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps +$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps if [ $? -ne 0 ] ; then no_result ; fi activity="compare output $i" diff --git a/tests/test_template b/tests/test_template index 5c996621..41f00bce 100755 --- a/tests/test_template +++ b/tests/test_template @@ -62,7 +62,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/xforms/recode.sh b/tests/xforms/recode.sh index f36e5f2a..a0119cb4 100755 --- a/tests/xforms/recode.sh +++ b/tests/xforms/recode.sh @@ -162,7 +162,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $PSPP --testing-mode $TESTFILE +$SUPERVISOR $PSPP -o pspp.csv $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi activity="test output"