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
GNULIB_TOOL = $(GNULIB)/gnulib-tool
GNULIB_MODULES = \
- argp \
assert \
byteswap \
c-ctype \
unistr/u8-strncat \
unlocked-io \
vasprintf-posix \
+ version-etc \
+ version-etc-fsf \
vfprintf-posix \
vprintf-posix \
vsnprintf \
+++ /dev/null
-2007-09-25 Ben Pfaff <blp@gnu.org>
-
- * 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 <blp@gnu.org>
-
- Bug #21128. Reviewed by John Darrington.
-
- * papersize: Removed.
-
- * automake.mk (dist_pkgsysconf_DATA): Remove papersize.
-
-2007-08-26 Ben Pfaff <blp@gnu.org>
-
- * devices: Change raw-ascii from screen to listing device (because
- that's how it's used).
-
-2007-07-25 Ben Pfaff <blp@gnu.org>
-
- * devices: Add tty and listing devices that use VT100 (and xterm)
- line-drawing characters.
-
-2007-07-25 Ben Pfaff <blp@gnu.org>
-
- * 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 <blp@gnu.org>
-
- * automake.mk: Fix bugs in installation targets.
-
-Mon Apr 3 11:01:16 2006 Ben Pfaff <blp@gnu.org>
-
- * 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 <blp@gnu.org>
-
- * html-prologue: Don't use ${source-file}, which is no longer
- supported.
-
-Tue Dec 30 22:37:04 2003 Ben Pfaff <blp@gnu.org>
-
- * 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 <blp@gnu.org>
-
- * ps-prologue: Add %%DocumentMedia: comment.
-
-Wed May 20 00:02:51 1998 Ben Pfaff <blp@gnu.org>
-
- * ps-prologue: Comment out misleading Bounding-Box comment for
- now. SF arguments rearranged. BP removed.
-
-Wed Apr 15 13:00:46 1998 Ben Pfaff <blp@gnu.org>
-
- * 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 <blp@gnu.org>
-
- * ps-prologue: Minor reorganization. New GB macro to draw a gray
- box.
-
-Wed Dec 24 22:35:13 1997 Ben Pfaff <blp@gnu.org>
-
- * devices: Added devicetype options and documentation for them.
-
-Fri Dec 5 21:51:08 1997 Ben Pfaff <blp@gnu.org>
-
- * 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 <blp@gnu.org>
-
- * Makefile.am: (pkgsysconfdir) Changed from $(pkgdatadir) to
- $(sysconfdir)/$(PACKAGE).
-
-Thu Aug 14 22:05:54 1997 Ben Pfaff <blp@gnu.org>
-
- * devices: (tty) Define as null instead of not defining.
-
-Sun Aug 3 11:33:28 1997 Ben Pfaff <blp@gnu.org>
-
- * devices: tty-ascii has no bold or italic by default.
-
-Wed Jun 25 22:50:19 1997 Ben Pfaff <blp@gnu.org>
-
- * Makefile.am: (EXTRA_DIST) New target.
-
-Mon May 5 21:56:54 1997 Ben Pfaff <blp@gnu.org>
-
- * devices, papersize, ps-prologue: Comment fixes.
-
-Fri May 2 22:05:44 1997 Ben Pfaff <blp@gnu.org>
-
- * 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 <blp@gnu.org>
-
- * ps-prologue: (BP) New argument, SF or scale factor.
-
-Fri Apr 18 16:48:41 1997 Ben Pfaff <blp@gnu.org>
-
- * Makefile.am: New file.
-
- * environment: Comment fix.
-
-Sat Feb 15 21:26:53 1997 Ben Pfaff <blp@gnu.org>
-
- * devices: Added ml520 and ml520-ul printer devices.
-
-Sat Jan 11 15:44:15 1997 Ben Pfaff <blp@gnu.org>
-
- * devices: Default listing device is list-ascii, not list-ibmpc.
-
-Sun Dec 29 21:36:48 1996 Ben Pfaff <blp@gnu.org>
-
- * devices: Changed default devices.
-
-Sat Sep 7 22:35:12 1996 Ben Pfaff <blp@gnu.org>
-
- * 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 <blp@gnu.org>
-
- * 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 <blp@gnu.org>
-
- * 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 <blp@gnu.org>
-
- * prologue.ps: One minor comment change.
-
-Thu Aug 29 21:36:41 1996 Ben Pfaff <blp@gnu.org>
-
- * prologue.ps: Portions other than DSC comments are essentially
- completely new.
-
-Sat Aug 24 23:26:00 1996 Ben Pfaff <blp@gnu.org>
-
- * devices: Added PostScript driver.
-
-Sun Aug 11 21:31:22 1996 Ben Pfaff <blp@gnu.org>
-
- * prologue.ps: Calls `setlinecap' in setup code.
-
-Sat Aug 10 23:28:17 1996 Ben Pfaff <blp@gnu.org>
-
- * prologue.ps: DSC comment changes. New call to `setlinewidth' in
- setup code.
-
-Thu Aug 8 22:31:11 1996 Ben Pfaff <blp@gnu.org>
-
- * prologue.ps: Changes to scaling & translating code.
-
-Sat Aug 3 20:50:35 1996 Ben Pfaff <blp@gnu.org>
-
- * 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 <blp@gnu.org>
-
- * ps-fontmap: New configuration file. Added to Makefile.am.
-
-----------------------------------------------------------------------
-Local Variables:
-mode: change-log
-version-control: never
-End:
+++ /dev/null
-## Process this file with automake to produce Makefile.in -*- makefile -*-
-
-
-dist_pkgsysconf_DATA = \
- config/devices
-
-EXTRA_DIST += config/OChangeLog
+++ /dev/null
-# 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:
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 \
+++ /dev/null
-@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
-@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
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
@dircategory Math
@direntry
* PSPP: (pspp). Statistical analysis package.
+* PSPPIRE: (pspp). Graphical user interface to PSPP.
@end direntry
@copying
* 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.
* 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
@include command-index.texi
@include concept-index.texi
-@include configuring.texi
-
@include fdl.texi
@bye
(interaction)
/CPROMPT='cprompt_string'
/DPROMPT='dprompt_string'
- /ERRORBREAK=@{OFF,ON@}
/MXERRS=max_errs
/MXWARNS=max_warnings
/PROMPT='prompt'
/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@}
/BOXSTRING=@{'xxx','xxxxxxxxxxx'@}
/CASE=@{UPPER,UPLOW@}
/CPI=cpi_value
- /DISK=@{ON,OFF@}
/HIGHRES=@{ON,OFF@}
/HISTOGRAM='c'
/LOWRES=@{AUTO,ON,OFF@}
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.
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
@cindex headers
@cindex length
-@cindex listing
@cindex more
@cindex pager
@cindex width
};
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",
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
#include <config.h>
-#include <data/file-name.h>
+#include "data/file-name.h"
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/stat.h>
#include <unistd.h>
-#include "intprops.h"
-#include "minmax.h"
-#include "dirname.h"
-#include "xmalloca.h"
-
-#include <data/settings.h>
-#include <libpspp/hash.h>
-#include <libpspp/message.h>
-#include <libpspp/str.h>
-#include <libpspp/version.h>
+#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 <unistd.h>
-#include <sys/stat.h>
-
#if defined _WIN32 || defined __WIN32__
#define WIN32_LEAN_AND_MEAN /* avoid including junk */
#include <windows.h>
#endif
\f
-/* Initialization. */
-
-const char *config_path;
-
-void
-fn_init (void)
-{
- config_path = fn_getenv_default ("STAT_CONFIG_PATH", default_config_path);
-}
-\f
/* 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;
}
}
#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
{
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] == '|')
{
FILE *f = fopen (fn, mode);
- if (f && mode[0] == 'w')
+ if (f && mode[0] != 'r')
setvbuf (f, NULL, _IOLBF, 0);
return f;
/* 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
#include <stdio.h>
#include <stdbool.h>
-#include <libpspp/str.h>
#include <sys/types.h>
-/* 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);
/* 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
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;
int syntax;
struct fmt_number_style *styles;
+
+ enum settings_output_devices output_routing[SETTINGS_N_OUTPUT_TYPES];
};
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 */
true,
/* blanks */
SYSMIS,
- /* mxwarns */
- 100,
- /* mxerrs */
- 100,
+ /* max_messages */
+ {
+ 100, /* MSG_S_ERROR */
+ 100, /* MSG_S_WARNING */
+ 100 /* MSG_S_NOTE */
+ },
/* printback */
true,
/* mprint */
/* 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 *);
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)
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)
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
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;
+}
/* 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
#include <stdbool.h>
#include <stddef.h>
-#include <data/format.h>
-#include <libpspp/float-format.h>
-#include <libpspp/integer-format.h>
+
+#include "data/format.h"
+#include "libpspp/float-format.h"
+#include "libpspp/integer-format.h"
+#include "libpspp/message.h"
struct caseproto;
struct settings;
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);
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);
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 */
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;
}
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;
}
/* 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
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;
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";
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;
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)
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
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)
{
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)
{
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)
+\f
+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);
-}
-\f
static char *
show_blanks (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 *
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 *
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. */
{"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},
(`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 >> $@
/* 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
#include <config.h>
-#include <stdlib.h>
+#include "libpspp/getl.h"
-#include "getl.h"
+#include <stdlib.h>
-#include <libpspp/str.h>
-#include <libpspp/ll.h>
-#include <libpspp/version.h>
+#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
{
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 *
/* 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;
}
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. */
{
while ( !ll_is_empty (&ss->sources))
close_source (ss);
- ds_destroy (&ss->the_include_path);
+ string_array_destroy (&ss->include_path);
free (ss);
}
/* 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
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 *);
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 *);
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__
/* 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
/* 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[];
/* 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
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? */
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);
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);
}
}
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;
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"));
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;
}
}
-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,
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 *);
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);
}
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
}
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;
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"));
goto error;
}
- free (file_name);
return &xr->driver;
error:
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)
{
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,
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);
}
}
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;
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"));
}
}
-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,
/* 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
#ifndef OUTPUT_DRIVER_PROVIDER_H
#define OUTPUT_DRIVER_PROVIDER_H 1
-#include <libpspp/compiler.h>
#include <stdbool.h>
-#include <output/driver.h>
+
+#include "data/settings.h"
+#include "libpspp/compiler.h"
+#include "output/driver.h"
struct output_item;
struct string_map;
{
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 *);
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);
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 **);
+\f
+/* 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 */
/* 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
#include <config.h>
-#include <output/driver.h>
-#include <output/driver-provider.h>
+#include "output/driver.h"
+#include "output/driver-provider.h"
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include <data/file-name.h>
-#include <data/settings.h>
-#include <libpspp/array.h>
-#include <libpspp/assertion.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 "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;
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
case TEXT_ITEM_SYNTAX:
if (!in_command)
{
- if (deferred_syntax != NULL)
- output_submit__ (deferred_syntax);
+ flush_deferred_syntax ();
deferred_syntax = item;
return;
}
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;
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;
-}
\f
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);
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;
+}
+\f
+/* 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;
+ }
+ }
}
\f
-/* 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;
+}
/* 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
#include <stdbool.h>
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 */
/* 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
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,
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);
}
}
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;
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;
fputs ("</TABLE>\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,
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);
}
}
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;
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");
}
}
-/* 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,
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;
}
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
+++ /dev/null
-/* 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 <http://www.gnu.org/licenses/>. */
-
-
-#include <config.h>
-#include "command-line.h"
-#include <argp.h>
-#include <gl/xalloc.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libpspp/compiler.h>
-#include <assert.h>
-
-
-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);
-}
-
+++ /dev/null
-/* 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 <http://www.gnu.org/licenses/>. */
-
-#ifndef SRC_UI_COMMAND_LINE_H
-#define SRC_UI_COMMAND_LINE_H
-
-#include <argp.h>
-
-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
#include <glib.h>
#include "helper.h"
-#include "message-dialog.h"
#include <data/format.h>
#include <data/data-in.h>
#include <data/data-out.h>
/* 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
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <gl/xalloc.h>
+
+#include "ui/gui/psppire.h"
+
#include <gtk/gtk.h>
-#include "psppire.h"
-#include "progname.h"
#include <stdlib.h>
-#include <argp.h>
-#include <gl/relocatable.h>
-#include <ui/command-line.h>
-#include <ui/source-init-opts.h>
-#include <libpspp/version.h>
-#include <libpspp/copyleft.h>
+#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;
-
\f
/* 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};
-
\f
-
static GtkWidget *
create_splash_window (void)
{
struct initialisation_parameters
{
- int argc;
- char **argv;
+ struct source_stream *ss;
+ const char *data_file;
GtkWidget *splash_window;
- struct command_line_processor *clp;
};
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);
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]);
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);
/* 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
static struct output_driver_class psppire_output_class =
{
"PSPPIRE", /* name */
- NULL, /* create */
NULL, /* destroy */
psppire_output_submit, /* submit */
NULL, /* flush */
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);
}
\f
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;
/* 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
#include <config.h>
-#include <libpspp/i18n.h>
+#include "ui/gui/psppire.h"
+
#include <assert.h>
-#include <libintl.h>
#include <gsl/gsl_errno.h>
-
-#include <xalloc.h>
-#include <argp.h>
-#include <ui/command-line.h>
-#include "relocatable.h"
-
-#include "psppire-data-window.h"
-#include "psppire.h"
-#include "widgets.h"
-
-#include <libpspp/getl.h>
-#include <unistd.h>
-#include <data/casereader.h>
-#include <data/datasheet.h>
-#include <data/file-handle-def.h>
-#include <data/settings.h>
-#include <data/file-name.h>
-#include <data/procedure.h>
-#include <libpspp/getl.h>
-#include <language/lexer/lexer.h>
-#include <libpspp/version.h>
-#include <output/driver.h>
-#include <output/journal.h>
-#include <language/syntax-string-source.h>
-
#include <gtk/gtk.h>
-#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 <ui/syntax-gen.h>
-
-#include "psppire-window-register.h"
-#include "psppire-output-window.h"
-
-#include <data/sys-file-reader.h>
-#include <data/por-file-reader.h>
+#include <libintl.h>
+#include <unistd.h>
-#include <ui/source-init-opts.h>
+#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;
static GtkWidget *the_data_window;
+static void load_data_file (const char *);
+
static void
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;
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));
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 (""));
gtk_icon_factory_add_default (factory);
}
-
\f
-
-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);
+}
/* 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
#ifndef PSPPIRE_H
#define PSPPIRE_H
-#include <argp.h>
+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);
/* 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
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include <argp.h>
+
#include "source-init-opts.h"
+
#include <stdbool.h>
-#include <xalloc.h>
-#include <string.h>
-#include <data/file-name.h>
-#include <libpspp/getl.h>
-#include <language/syntax-file.h>
#include <stdlib.h>
-#include <libpspp/llx.h>
-#include <data/por-file-reader.h>
-#include <data/sys-file-reader.h>
-#include <libpspp/message.h>
-#include <ui/syntax-gen.h>
-#include <language/syntax-string-source.h>
-#include <data/file-name.h>
-#include <data/settings.h>
+#include <string.h>
+
+#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);
+}
/* 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
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#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 */
/* 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
#include <ieeefp.h>
#endif
-
-#include <libpspp/i18n.h>
-#include <data/dictionary.h>
-#include <data/file-handle-def.h>
-#include <libpspp/getl.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/compiler.h>
-#include <libpspp/message.h>
-#include <libpspp/version.h>
-#include <math/random.h>
-#include <output/driver.h>
-#include <ui/debugger.h>
-#include <ui/terminal/msg-ui.h>
-#include <ui/terminal/read-line.h>
-#include <ui/terminal/terminal.h>
-#include <ui/terminal/terminal-opts.h>
-#include <ui/command-line.h>
-#include <ui/source-init-opts.h>
-
-#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)
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);
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);
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);
{
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;
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)
{
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);
#include "terminal-opts.h"
-#include <argp.h>
#include <stdbool.h>
#include <xalloc.h>
#include <stdlib.h>
-
-#include <data/settings.h>
-#include <data/file-name.h>
-#include <language/syntax-file.h>
-#include <libpspp/getl.h>
-#include <libpspp/llx.h>
-#include <libpspp/string-map.h>
-#include <libpspp/string-set.h>
-#include <output/driver.h>
-#include <ui/command-line.h>
-#include <ui/terminal/msg-ui.h>
-#include <ui/terminal/read-line.h>
+#include <unistd.h>
+
+#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);
+}
/* 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
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#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 */
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"
# 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
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
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"
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;
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;
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;
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;
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
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
activity="run prog"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
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"
EOF
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
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
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
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
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
#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
#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;
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
# 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;
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
activity="run program"
-$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
activity="run program"
-$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
activity="run program"
-$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
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;
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"
activity="run program 2"
-$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
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
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
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
# 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
# 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
# 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
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
activity="run_program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
pass;
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
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
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"
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
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"
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"
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"
activity="run program 1"
-$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; 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
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
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"
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"
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
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
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
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare output"
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
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="run program"
-$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
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"
#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;
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
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
# 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
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
pass
#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;
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"
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"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare output"
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"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare data"
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 ...
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"
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"
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"
activity="Run pspp 1"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
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
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
activity="compare output"
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"
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"
# 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
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
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare results"
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="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
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
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
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
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"
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
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"
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"
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"
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"
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
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"
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"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
activity="compare output"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare output"
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"
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"
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"
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"
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"
#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
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
# 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"
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
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"
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"
#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;
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"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
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="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare output"
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"
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"
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"
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"
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
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
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"
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"
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"
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"
activity="run program 3"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
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
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"
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"
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"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="copy output"
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"
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"
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
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
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"
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"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
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"
# 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"
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"
activity="run program 3"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
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
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
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
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"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="check sysfile"
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
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="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"
} > 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
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"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="filter output"
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"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare output"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
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"
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"
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"
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"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare output"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare output"
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"
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="run program 1"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="copy output"
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="run program 1"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="copy output"
activity="run program 2"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
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"
activity="run program 2"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
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"
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
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
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"
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
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then fail ; fi
activity="compare output"
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"
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"
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)"
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
activity="run program"
-$SUPERVISOR $PSPP --testing-mode $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare results"
EOF
-src/pspp -o html $TEMPDIR/cov.sps
+src/pspp -o pspp.html $TEMPDIR/cov.sps
rm -rf $TEMPDIR
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
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"
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"
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
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
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
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"
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"
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"
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"
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"
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"
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"
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"
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"
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
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"
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"
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"
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"
activity="write pspp syntax"
cat > month-out.pspp <<EOF
set errors=none.
+set mxerr=1000000.
set mxwarns=10000000.
data list /x 1-10.
begin data.
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program"
-$SUPERVISOR $PSPP --testing-mode month-out.pspp
+$SUPERVISOR $PSPP -o pspp.csv month-out.pspp
if [ $? -eq 0 ] ; then no_result ; fi
activity="compare output"
echo -n .
activity="run program"
-$SUPERVISOR $PSPP --testing-mode num-in.pspp
+$SUPERVISOR $PSPP -o pspp.csv num-in.pspp
if [ $? -ne 0 ] ; then no_result ; fi
echo -n .
echo -n .
activity="run program"
-$SUPERVISOR $PSPP --testing-mode num-out.pspp
+$SUPERVISOR $PSPP -o pspp.csv num-out.pspp
if [ $? -ne 0 ] ; then no_result ; fi
echo -n .
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program"
-$SUPERVISOR $PSPP --testing-mode time-in.pspp
+$SUPERVISOR $PSPP -o pspp.csv time-in.pspp
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare time.out output"
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program"
-$SUPERVISOR $PSPP --testing-mode time-out.pspp
+$SUPERVISOR $PSPP -o pspp.csv time-out.pspp
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare output"
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program"
-$SUPERVISOR $PSPP --testing-mode wkday-in.pspp
+$SUPERVISOR $PSPP -o pspp.csv wkday-in.pspp
if [ $? -ne 0 ] ; then no_result ; fi
activity="compare output"
if [ $? -ne 0 ] ; then no_result ; fi
activity="run program"
-$SUPERVISOR $PSPP --testing-mode wkday-out.pspp
+$SUPERVISOR $PSPP -o pspp.csv wkday-out.pspp
if [ $? -eq 0 ] ; then no_result ; fi
activity="compare output"
if [ $? -ne 0 ] ; then no_result ; fi
activity="Run pspp 1"
-PAPERSIZE=letter $SUPERVISOR $PSPP --testing-mode paper-size.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"
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"
/* 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
#include <stdio.h>
#include <string.h>
-#include <libpspp/assertion.h>
-#include <libpspp/compiler.h>
-#include <output/driver.h>
-#include <output/tab.h>
-#include <output/table-item.h>
+#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? */
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},
switch (c)
{
- case OPT_DRIVER:
- output_configure_driver (optarg);
- configured_driver = true;
- break;
-
case OPT_WIDTH:
width = atoi (optarg);
break;
}
- 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; "
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
activity="run program"
-$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
if [ $? -ne 0 ] ; then no_result ; fi
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"