From 05e356b2a3087e819ef3b5388e29c822f41502e1 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 13 Apr 2005 10:09:59 +0000 Subject: [PATCH] Implemented long variable names a la spss V12. We can now read and write SPSS v12 system files. --- AUTHORS | 5 +- ChangeLog | 4 + NEWS | 14 +- README | 2 +- configure.ac | 2 +- doc/ChangeLog | 5 + doc/configuring.texi | 3 +- doc/data-file-format.texi | 135 ++++++++- doc/files.texi | 7 + doc/language.texi | 4 +- doc/pspp.texinfo | 3 +- doc/statistics.texi | 2 +- doc/variables.texi | 87 +++++- po/en_GB.po | 436 +++++++++++++++------------- po/pspp.pot | 436 +++++++++++++++------------- pref.h.orig | 3 + src/ChangeLog | 18 ++ src/Makefile.am | 1 + src/aggregate.c | 10 +- src/command.def | 18 +- src/compute.c | 6 +- src/count.c | 2 +- src/data-list.c | 6 +- src/descript.c | 4 +- src/dictionary.c | 381 ++++++++++++++++++++++-- src/dictionary.h | 15 +- src/expressions/evaluate.c | 2 +- src/file-handle.q | 9 +- src/file-type.c | 2 +- src/flip.c | 20 +- src/format.h | 18 ++ src/get.c | 75 ++++- src/lexer.c | 28 +- src/lexer.h | 4 +- src/loop.c | 2 +- src/modify-vars.c | 2 +- src/pfm-read.c | 24 +- src/plot-chart.c | 7 +- src/plot-hist.c | 5 + src/recode.c | 2 +- src/repeat.c | 8 +- src/sfm-read.c | 91 +++++- src/sfm-write.c | 116 +++++++- src/sfm-write.h | 4 +- src/sfmP.h | 2 +- src/val-labs.c | 2 +- src/val.h | 4 +- src/var-display.c | 154 ++++++++++ src/var.h | 30 +- src/vars-atr.c | 4 +- src/vars-prs.c | 73 +++-- src/vector.c | 6 +- tests/Makefile.am | 5 + tests/bugs/compute-lv.sh | 89 ++++++ tests/bugs/get.sh | 9 +- tests/command/file-label.sh | 13 +- tests/command/filter.sh | 4 +- tests/command/list.sh | 8 +- tests/command/loop.sh | 8 +- tests/command/oneway-with-splits.sh | 4 +- tests/command/oneway.sh | 4 +- tests/command/weight.sh | 3 +- tests/coverage.sh | 49 ++++ tests/expressions/randist.sh | 5 +- 64 files changed, 1922 insertions(+), 582 deletions(-) create mode 100644 src/var-display.c create mode 100755 tests/bugs/compute-lv.sh create mode 100755 tests/coverage.sh diff --git a/AUTHORS b/AUTHORS index 18583506..be9daa83 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,5 +5,6 @@ * John Williams originally wrote the T-TEST procedure, which was subsequently re-written by John Darrington - * John Darrington wrote the T-TEST and ONEWAY procedures, and made - numerous revisions to other modules. + * John Darrington wrote the T-TEST ONEWAY and EXAMINE procedures, + implemented support for long variable names and made numerous + revisions to other modules. diff --git a/ChangeLog b/ChangeLog index 3b228ddf..6e8daa20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ + * AUTHORS: Added note about the long variable names extension. + + * pref.h.orig: Added definitions for variable names lengths. + Thu Mar 3 22:06:19 WST 2005 John Darrington * configure.ac: Added AC_PROG_RANLIB --- needed by autoconf 1.9 diff --git a/NEWS b/NEWS index 51c7a109..b899f56d 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,13 @@ See the end for copying conditions. Please send PSPP bug reports to bug-gnu-pspp@gnu.org. +Preliminary list of changes from 0.3.1 to 0.3.2: + + PSPP now reads and writes system files compatible with spssV12. + + New commands: VARIABLE WIDTH, VARIABLE ALIGNMENT, VARIABLE LEVEL. + + Preliminary list of changes from 0.3.0 to 0.3.1: New build dependencies: @@ -16,6 +23,7 @@ Preliminary list of changes from 0.3.0 to 0.3.1: * libplot from GNU plotutils is optional; without it, the new graphing features will not work. + Newly implemented commands and statistical features: * DATE (as a stub, to enhance compatibility). @@ -28,7 +36,9 @@ Preliminary list of changes from 0.3.0 to 0.3.1: * PERMISSIONS. - * T-TEST. + * SHOW. + + * T-TEST (re-written). * USE (as a stub, to enhance compatibility). @@ -51,6 +61,8 @@ Preliminary list of changes from 0.3.0 to 0.3.1: Much of the code has been rewritten and refactored. It is now much cleaner. + lib/julcal has been removed. + For developers, the build system now requires Autoconf 2.58 and Automake 1.7. The included gettext has been updated to version 0.12.1. diff --git a/README b/README index 51fb8eae..da675978 100644 --- a/README +++ b/README @@ -7,7 +7,7 @@ SPSS's transformation language. Its statistical procedure support is currently limited, but growing. Source code for the latest development release of PSPP is available at -ftp://alpha.gnu.org/gnu/pspp and ftp://pspp.stat.wisc.edu/pub/PSPP. +ftp://alpha.gnu.org/gnu/pspp For information on differences from previous versions, please see file NEWS. Full documentation on PSPP's language and information on known diff --git a/configure.ac b/configure.ac index 542b453a..37edbdb7 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. dnl Initialize. AX_PREREQ(2.57) -AC_INIT(pspp, 0.3.1,bug-gnu-pspp@gnu.org) +AC_INIT(pspp, 0.3.2,bug-gnu-pspp@gnu.org) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE diff --git a/doc/ChangeLog b/doc/ChangeLog index 09f0f6fe..bebb4742 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ + * variables.texi: Corrected the entry for VARIABLE LABELS + + * data-file-format.texi: Added documentation about the Long Variable + Names record. + Thu Mar 3 22:06:54 WST 2005 John Darrington * expressions.texi: corrected some mismatched parentheses. diff --git a/doc/configuring.texi b/doc/configuring.texi index 91d585cb..818742dd 100644 --- a/doc/configuring.texi +++ b/doc/configuring.texi @@ -1671,7 +1671,8 @@ file. @xref{File locations}. Default: the standard configuration path. @item TMPDIR -The @code{sort} procedure stores its temporary files in this directory. +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 diff --git a/doc/data-file-format.texi b/doc/data-file-format.texi index 230a72f9..b2fc27e5 100644 --- a/doc/data-file-format.texi +++ b/doc/data-file-format.texi @@ -43,6 +43,8 @@ described below: * Document Record:: * Machine int32 Info Record:: * Machine flt64 Info Record:: +* Auxilliary Variable Parameter Record:: +* Long Variable Names Record:: * Miscellaneous Informational Records:: * Dictionary Termination Record:: * Data Record:: @@ -467,7 +469,7 @@ Character code. 1 indicates EBCDIC, 2 indicates 7-bit ASCII, 3 indicates 8-bit ASCII, 4 indicates DEC Kanji. @end table -@node Machine flt64 Info Record, Miscellaneous Informational Records, Machine int32 Info Record, Data File Format +@node Machine flt64 Info Record, Auxilliary Variable Parameter Record, Machine int32 Info Record, Data File Format @section Machine @code{flt64} Info Record There must be no more than one machine @code{flt64} info record per @@ -513,7 +515,136 @@ The value used for HIGHEST in missing values. The value used for LOWEST in missing values. @end table -@node Miscellaneous Informational Records, Dictionary Termination Record, Machine flt64 Info Record, Data File Format +@node Auxilliary Variable Parameter Record, Long Variable Names Record, Machine flt64 Info Record, Data File Format +@section Auxilliary Variable Parameter Record + +There must be no more than one auxilliary variable parameter record per +system file. This record must follow the variable +records and precede the dictionary termination record. + +@example +struct sysfile_aux_var_parameter + @{ + /* Header. */ + int32 rec_type; + int32 subtype; + int32 size; + int32 count; + + /* Data. */ + struct aux_params aux_params[/* variable length */]; + @}; +@end example + +@table @code +@item int32 rec_type; +Record type. Always set to 7. + +@item int32 subtype; +Record subtype. Always set to 11. + +@item int32 size; +The size @code{int32}. Always set to 4. + +@item int32 count; +The total number of bytes in @code{aux_params} divided by 3. + +@item struct aux_params aux_params[]; +An array of @code{struct aux_params}. The order of the elements corresponds +to the order of the variables in the Variable Records. The @code{struct aux_params} type is defined as follows: + +@example +struct aux_params + @{ + int32 measure; + int32 width; + int32 alignment; + @}; +@end example + +@table @code +@item int32 measure +The measurement type of the variable: +@table @asis +@item 0 +Nominal Scale +@item 1 +Ordinal Scale +@item 2 +Continuous Scale +@end table + +@item int32 width +The width of the display column for the variable in characters. + +@item int32 alignment +The alignment of the variable for display purposes: + +@table @asis +@item 0 +Left aligned +@item 1 +Right aligned +@item 2 +Centre aligned +@end table + +@end table + + + +@end table + + + +@node Long Variable Names Record, Miscellaneous Informational Records, Auxilliary Variable Parameter Record, Data File Format +@section Long Variable Names Record + +There must be no more than one long variable names record per +system file. This record must follow the variable +records and precede the dictionary termination record. + +@example +struct sysfile_long_variable_names + @{ + /* Header. */ + int32 rec_type; + int32 subtype; + int32 size; + int32 count; + + /* Data. */ + char var_name_pairs[/* variable length */]; + @}; +@end example + +@table @code +@item int32 rec_type; +Record type. Always set to 7. + +@item int32 subtype; +Record subtype. Always set to 13. + +@item int32 size; +The size of each element in the @code{var_name_pairs} member. Always set to 1. + +@item int32 count; +The total number of bytes in @code{var_name_pairs}. + +@item char var_name_pairs[/* variable length]; +A list of @var{key}--@var{value} tuples, where @var{key} is the name +of a variable, and @var{value} is its long variable name. +The @var{key} field is at most 8 bytes long and must match the +name of a variable which appears in the variable record @xref{Variable Record}. +The @var{value} field is at most 64 bytes long. +The @var{key} and @var{value} fields are separated by a @samp{=} byte. +Each tuple is separated by a byte whose value is 09. There is no +trailing separator following the last tuple. +The total length is @code{count} bytes. +@end table + + +@node Miscellaneous Informational Records, Dictionary Termination Record, Long Variable Names Record, Data File Format @section Miscellaneous Informational Records Miscellaneous informational records must follow the variable records and diff --git a/doc/files.texi b/doc/files.texi index 3321390e..2701d4da 100644 --- a/doc/files.texi +++ b/doc/files.texi @@ -226,6 +226,7 @@ SAVE /@{COMPRESSED,UNCOMPRESSED@} /DROP=var_list /KEEP=var_list + /VERSION=version /RENAME=(src_names=target_names)@dots{} @end display @@ -264,6 +265,12 @@ each may be present any number of times. @cmd{SAVE} never modifies the active file. DROP, KEEP, and RENAME only affect the system file written to disk. +The VERSION subcommand specifies the version of the file format. Valid +versions are '3' and '3x'. Version 3x system files are identical to +version 3 files, except that variable names greater than 8 bytes will +be truncated. The default version is 3. The VERSION subcommand is +optional. There is no need ever to use it. + @cmd{SAVE} causes the data to be read. It is a procedure. @node SYSFILE INFO, XSAVE, SAVE, System and Portable Files diff --git a/doc/language.texi b/doc/language.texi index 6a5a19e6..81003710 100644 --- a/doc/language.texi +++ b/doc/language.texi @@ -70,8 +70,8 @@ one of the following special characters: @item @cindex variable names @cindex names, variable -Variable names may be any length, but only the first 8 characters are -significant. +Variable names may be up any length up to 64 bytes long. + @item @cindex case-sensitivity diff --git a/doc/pspp.texinfo b/doc/pspp.texinfo index 6e6c9af4..01dcd26e 100644 --- a/doc/pspp.texinfo +++ b/doc/pspp.texinfo @@ -2,7 +2,6 @@ @c %**start of header @setfilename pspp.info @settitle PSPP -@set TIMESTAMP Time-stamp: Sat Oct 30 17:30:39 WST 2004 @c For double-sided printing, uncomment: @c @setchapternewpage odd @c %**end of header @@ -91,7 +90,7 @@ approved by the Foundation. This file documents the PSPP package for statistical analysis of sampled data. This is edition @value{EDITION}, for PSPP version -@value{VERSION}, last modified at @value{TIMESTAMP}. +@value{VERSION}, last modified on @value{UPDATED}. @end ifinfo diff --git a/doc/statistics.texi b/doc/statistics.texi index 98be7cc7..26266e4e 100644 --- a/doc/statistics.texi +++ b/doc/statistics.texi @@ -601,7 +601,7 @@ of variable preceding @code{WITH} against variable following @node ONEWAY, , T-TEST, Statistics @comment node-name, next, previous, up -@section Oneway +@section ONEWAY @vindex ONEWAY @cindex analysis of variance diff --git a/doc/variables.texi b/doc/variables.texi index 9b087882..525c7094 100644 --- a/doc/variables.texi +++ b/doc/variables.texi @@ -18,6 +18,9 @@ several utility functions for examining and adjusting them. * VALUE LABELS:: Set value labels for variables. * STRING:: Create new string variables. * VARIABLE LABELS:: Set variable labels for variables. +* VARIABLE ALIGNMENT:: Set the alignment for display. +* VARIABLE WIDTH:: Set the display width. +* VARIABLE LEVEL:: Set the measurement level. * VECTOR:: Declare an array of variables. * WRITE FORMATS:: Set variable write formats. @end menu @@ -335,24 +338,91 @@ implicitly derived from the specified output formats. Created variables are initialized to spaces. -@node VARIABLE LABELS, VECTOR, STRING, Variable Attributes + +@node VARIABLE LABELS, VARIABLE ALIGNMENT, STRING, Variable Attributes @section VARIABLE LABELS @vindex VARIABLE LABELS @display VARIABLE LABELS - /var_list 'var_label'. + var_list 'var_label' + [ /var_list 'var_label'] + . + . + . + [ /var_list 'var_label'] @end display @cmd{VARIABLE LABELS} associates explanatory names with variables. This name, called a @dfn{variable label}, is displayed by statistical procedures. -To assign a variable label to a group of variables, specify a slash -(@samp{/}), followed by the list of variable names and the variable -label as a string. +To assign a variable label to a group of variables, specify a +list of variable names and the variable label as a string. +To assign different labels to different variables in the same command, +preceed the subsequent variable list with a slash (@samp{/}). + + +@node VARIABLE ALIGNMENT, VARIABLE WIDTH, VARIABLE LABELS, Variable Attributes +@comment node-name, next, previous, u +@section VARIABLE ALIGNMENT +@vindex VARIABLE ALIGNMENT + +@display +VARIABLE ALIGNMENT + var_list ( LEFT | RIGHT | CENTER ) + [ /var_list ( LEFT | RIGHT | CENTER ) ] + . + . + . + [ /var_list ( LEFT | RIGHT | CENTER ) ] +@end display + +@cmd{VARIABLE ALIGNMENT} sets the alignment of variables for display editing +purposes. This only has effect for third party software. It does not affect +the display of variables in the PSPP output. + + -@node VECTOR, WRITE FORMATS, VARIABLE LABELS, Variable Attributes + +@node VARIABLE WIDTH, VARIABLE LEVEL, VARIABLE ALIGNMENT, Variable Attributes +@comment node-name, next, previous, up +@section VARIABLE WIDTH +@vindex VARIABLE WIDTH +@display +VARIABLE WIDTH + var_list (width) + [ /var_list (width) ] + . + . + . + [ /var_list (width) ] +@end display + +@cmd{VARIABLE WIDTH} sets the column width of variables for display editing +purposes. This only affects third party software. It does not affect +the display of variables in the PSPP output. + + +@node VARIABLE LEVEL, VECTOR, VARIABLE WIDTH, Variable Attributes +@comment node-name, next, previous, up +@section VARIABLE LEVEL +@vindex VARIABLE LEVEL +@display +VARIABLE LEVEL + var_list ( SCALE | NOMINAL | ORDINAL ) + [ /var_list ( SCALE | NOMINAL | ORDINAL ) ] + . + . + . + [ /var_list ( SCALE | NOMINAL | ORDINAL ) ] +@end display + +@cmd{VARIABLE LEVEL} sets the measurement level of variables. +Currently, this has no effect except for certain third party software. + + +@node VECTOR, WRITE FORMATS, VARIABLE LEVEL, Variable Attributes @section VECTOR @vindex VECTOR @@ -373,7 +443,7 @@ To make a vector and create variables at the same time, specify one or more vector names followed by a count in parentheses. This will cause variables named @code{@var{vec}1} through @code{@var{vec}@var{count}} to be created as numeric variables with print and write format F8.2. -Variable names including numeric suffixes may not exceed 8 characters +Variable names including numeric suffixes may not exceed 64 characters in length, and none of the variables may exist prior to @cmd{VECTOR}. All the variables in a vector must be the same type. @@ -386,6 +456,9 @@ Variables}). Variables within a vector may be referenced in expressions using @code{vector(index)} syntax. + + + @node WRITE FORMATS, , VECTOR, Variable Attributes @section WRITE FORMATS @vindex WRITE FORMATS diff --git a/po/en_GB.po b/po/en_GB.po index ec8fd66d..6b5025f4 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PSPP 0.3.1\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2005-03-13 22:49-0800\n" +"POT-Creation-Date: 2005-04-13 06:39+0800\n" "PO-Revision-Date: 2004-01-23 13:04+0800\n" "Last-Translator: John Darrington \n" "Language-Team: John Darrington \n" @@ -20,58 +20,58 @@ msgstr "" msgid "while expecting COLUMNWISE" msgstr "" -#: src/aggregate.c:225 +#: src/aggregate.c:227 msgid "expecting BREAK" msgstr "" -#: src/aggregate.c:230 +#: src/aggregate.c:232 msgid "" "When PRESORTED is specified, specifying sorting directions with (A) or (D) " "has no effect. Output data will be sorted the same way as the input data." msgstr "" -#: src/aggregate.c:387 +#: src/aggregate.c:389 msgid "expecting aggregation function" msgstr "" -#: src/aggregate.c:403 +#: src/aggregate.c:405 #, c-format msgid "Unknown aggregation function %s." msgstr "" -#: src/aggregate.c:418 +#: src/aggregate.c:420 msgid "expecting `('" msgstr "" -#: src/aggregate.c:455 +#: src/aggregate.c:457 #, c-format msgid "Missing argument %d to %s." msgstr "" -#: src/aggregate.c:463 +#: src/aggregate.c:465 #, c-format msgid "Arguments to %s must be of same type as source variables." msgstr "" -#: src/aggregate.c:473 +#: src/aggregate.c:475 msgid "expecting `)'" msgstr "" -#: src/aggregate.c:485 +#: src/aggregate.c:487 #, c-format msgid "" "Number of source variables (%d) does not match number of target variables (%" "d)." msgstr "" -#: src/aggregate.c:502 +#: src/aggregate.c:504 #, c-format msgid "" "The value arguments passed to the %s function are out-of-order. They will " "be treated as if they had been specified in the correct order." msgstr "" -#: src/aggregate.c:570 +#: src/aggregate.c:571 #, c-format msgid "" "Variable name %s is not unique within the aggregate file dictionary, which " @@ -83,13 +83,13 @@ msgstr "" msgid "Variable %s is %s in target file, but %s in source file." msgstr "" -#: src/apply-dict.c:71 src/apply-dict.c:72 src/format.c:224 src/sfm-read.c:882 -#: src/sfm-read.c:1011 src/sfm-read.c:1012 +#: src/apply-dict.c:71 src/apply-dict.c:72 src/format.c:224 src/sfm-read.c:946 +#: src/sfm-read.c:1075 src/sfm-read.c:1076 msgid "string" msgstr "" -#: src/apply-dict.c:71 src/apply-dict.c:72 src/format.c:224 src/sfm-read.c:882 -#: src/sfm-read.c:1011 src/sfm-read.c:1012 +#: src/apply-dict.c:71 src/apply-dict.c:72 src/format.c:224 src/sfm-read.c:946 +#: src/sfm-read.c:1075 src/sfm-read.c:1076 msgid "numeric" msgstr "" @@ -233,8 +233,8 @@ msgid "Source variable count (%d) does not match target variable count (%d)." msgstr "" #: src/autorecode.c:139 src/command.c:791 src/compute.c:277 -#: src/data-list.c:409 src/data-list.c:899 src/data-list.c:1750 -#: src/do-if.c:253 src/get.c:406 src/lexer.c:420 src/loop.c:241 +#: src/data-list.c:409 src/data-list.c:901 src/data-list.c:1752 +#: src/do-if.c:253 src/get.c:245 src/get.c:456 src/lexer.c:426 src/loop.c:241 #: src/matrix-data.c:527 src/print.c:335 src/print.c:1045 src/recode.c:405 #: src/sel-if.c:54 src/sel-if.c:131 src/vector.c:193 src/file-handle.q:140 msgid "expecting end of command" @@ -295,13 +295,13 @@ msgstr "" msgid "%s: Temporary file ended unexpectedly." msgstr "" -#: src/cmdline.c:143 src/cmdline.c:162 src/cmdline.c:174 src/command.c:207 +#: src/cmdline.c:141 src/cmdline.c:160 src/cmdline.c:172 src/command.c:207 #: src/set.q:425 src/set.q:427 src/set.q:994 #, c-format msgid "%s is not yet implemented." msgstr "" -#: src/cmdline.c:245 +#: src/cmdline.c:243 #, c-format msgid "" "PSPP, a program for statistical analysis of sample data.\n" @@ -351,7 +351,7 @@ msgid "" "\n" msgstr "" -#: src/cmdline.c:283 +#: src/cmdline.c:281 #, c-format msgid "" "\n" @@ -664,7 +664,7 @@ msgid "" "fields must be listed in order of increasing record number." msgstr "" -#: src/data-list.c:385 src/data-list.c:1739 +#: src/data-list.c:385 src/data-list.c:1741 msgid "" "SPSS-like or FORTRAN-like format specification expected after variable names." msgstr "" @@ -705,7 +705,7 @@ msgstr "" msgid "Input format %s doesn't accept decimal places." msgstr "" -#: src/data-list.c:568 src/data-list.c:664 src/data-list.c:878 +#: src/data-list.c:568 src/data-list.c:664 src/data-list.c:880 #, c-format msgid "%s is a duplicate variable name." msgstr "" @@ -732,7 +732,7 @@ msgid "" "names given." msgstr "" -#: src/data-list.c:795 src/data-list.c:921 src/descript.c:880 src/print.c:796 +#: src/data-list.c:795 src/data-list.c:923 src/descript.c:880 src/print.c:796 #: src/sysfile-info.c:134 src/sysfile-info.c:367 src/vfm.c:830 msgid "Variable" msgstr "" @@ -745,7 +745,7 @@ msgstr "" msgid "Columns" msgstr "" -#: src/data-list.c:798 src/data-list.c:922 src/print.c:799 +#: src/data-list.c:798 src/data-list.c:924 src/print.c:799 msgid "Format" msgstr "" @@ -763,159 +763,159 @@ msgid_plural "Reading %d records from the command file." msgstr[0] "" msgstr[1] "" -#: src/data-list.c:938 +#: src/data-list.c:940 #, c-format msgid "Reading free-form data from file %s." msgstr "" -#: src/data-list.c:941 +#: src/data-list.c:943 msgid "Reading free-form data from the command file." msgstr "" -#: src/data-list.c:992 +#: src/data-list.c:994 #, c-format msgid "Quoted string missing terminating `%c'." msgstr "" -#: src/data-list.c:1101 +#: src/data-list.c:1103 #, c-format msgid "Partial case of %d of %d records discarded." msgstr "" -#: src/data-list.c:1155 +#: src/data-list.c:1157 #, c-format msgid "Partial case discarded. The first variable missing was %s." msgstr "" -#: src/data-list.c:1199 +#: src/data-list.c:1201 #, c-format msgid "" "Missing value(s) for all variables from %s onward. These will be filled " "with the system-missing value or blanks, as appropriate." msgstr "" -#: src/data-list.c:1277 +#: src/data-list.c:1279 msgid "Attempt to read past end of file." msgstr "" -#: src/data-list.c:1413 +#: src/data-list.c:1415 msgid "" "REPEATING DATA must use the same file as its corresponding DATA LIST or FILE " "TYPE." msgstr "" -#: src/data-list.c:1423 src/data-list.c:1458 src/data-list.c:1471 -#: src/data-list.c:1484 src/data-list.c:1517 +#: src/data-list.c:1425 src/data-list.c:1460 src/data-list.c:1473 +#: src/data-list.c:1486 src/data-list.c:1519 #, c-format msgid "%s subcommand given multiple times." msgstr "" -#: src/data-list.c:1447 +#: src/data-list.c:1449 #, c-format msgid "STARTS beginning column (%d) exceeds STARTS ending column (%d)." msgstr "" -#: src/data-list.c:1503 +#: src/data-list.c:1505 #, c-format msgid "CONTINUED beginning column (%d) exceeds CONTINUED ending column (%d)." msgstr "" -#: src/data-list.c:1526 +#: src/data-list.c:1528 #, c-format msgid "ID beginning column (%ld) must be positive." msgstr "" -#: src/data-list.c:1541 +#: src/data-list.c:1543 #, c-format msgid "ID ending column (%ld) must be positive." msgstr "" -#: src/data-list.c:1547 +#: src/data-list.c:1549 #, c-format msgid "ID ending column (%ld) cannot be less than ID beginning column (%d)." msgstr "" -#: src/data-list.c:1587 +#: src/data-list.c:1589 msgid "Missing required specification STARTS." msgstr "" -#: src/data-list.c:1589 +#: src/data-list.c:1591 msgid "Missing required specification OCCURS." msgstr "" -#: src/data-list.c:1596 +#: src/data-list.c:1598 msgid "ID specified without CONTINUED." msgstr "" -#: src/data-list.c:1688 +#: src/data-list.c:1690 msgid "String variable not allowed here." msgstr "" -#: src/data-list.c:1698 +#: src/data-list.c:1700 #, c-format msgid "%s (%d) must be at least 1." msgstr "" -#: src/data-list.c:1704 +#: src/data-list.c:1706 #, c-format msgid "Variable or integer expected for %s." msgstr "" -#: src/data-list.c:1842 +#: src/data-list.c:1844 #, c-format msgid "Encountered mismatched record ID \"%s\" expecting \"%s\"." msgstr "" -#: src/data-list.c:1874 +#: src/data-list.c:1876 #, c-format msgid "" "Variable %s starting in column %d extends beyond physical record length of %" "d." msgstr "" -#: src/data-list.c:1942 +#: src/data-list.c:1944 #, c-format msgid "Invalid value %d for OCCURS." msgstr "" -#: src/data-list.c:1948 +#: src/data-list.c:1950 #, c-format msgid "Beginning column for STARTS (%d) must be at least 1." msgstr "" -#: src/data-list.c:1956 +#: src/data-list.c:1958 #, c-format msgid "Ending column for STARTS (%d) is less than beginning column (%d)." msgstr "" -#: src/data-list.c:1964 +#: src/data-list.c:1966 #, c-format msgid "Invalid value %d for LENGTH." msgstr "" -#: src/data-list.c:1971 +#: src/data-list.c:1973 #, c-format msgid "Beginning column for CONTINUED (%d) must be at least 1." msgstr "" -#: src/data-list.c:1979 +#: src/data-list.c:1981 #, c-format msgid "Ending column for CONTINUED (%d) is less than beginning column (%d)." msgstr "" -#: src/data-list.c:2011 +#: src/data-list.c:2013 #, c-format msgid "" "Number of repetitions specified on OCCURS (%d) exceed number of repetitions " "available in space on STARTS (%d), and CONTINUED not specified." msgstr "" -#: src/data-list.c:2029 +#: src/data-list.c:2031 #, c-format msgid "Unexpected end of file with %d repetitions remaining out of %d." msgstr "" -#: src/data-out.c:235 src/sfm-read.c:426 src/sysfile-info.c:115 +#: src/data-out.c:235 src/sfm-read.c:485 src/sysfile-info.c:115 msgid "Unknown" msgstr "" @@ -1136,7 +1136,13 @@ msgstr "" msgid "Error writing file %s: %s." msgstr "" -#: src/dictionary.c:597 +#: src/dictionary.c:256 +#, c-format +msgid "" +"The entry \"%s\" in the variable name map, has no corresponding variable" +msgstr "" + +#: src/dictionary.c:836 msgid "" "At least one case in the data file had a weight value that was user-missing, " "system-missing, zero, or negative. These case(s) were ignored." @@ -1221,6 +1227,25 @@ msgstr "" msgid "installation error" msgstr "" +#: src/filename.c:221 +#, c-format +msgid "Searching for `%s'..." +msgstr "" + +#: src/filename.c:229 src/filename.c:261 +msgid "Search unsuccessful!" +msgstr "" + +#: src/filename.c:254 +#, c-format +msgid "Found `%s'." +msgstr "" + +#: src/filename.c:686 +#, c-format +msgid "Not opening pipe file `%s' because SAFER option set." +msgstr "" + #: src/file-type.c:129 msgid "MIXED, GROUPED, or NESTED expected." msgstr "" @@ -1270,7 +1295,7 @@ msgstr "" msgid "YES or NO expected after ORDERED." msgstr "" -#: src/file-type.c:248 src/file-type.c:543 src/get.c:390 +#: src/file-type.c:248 src/file-type.c:543 src/get.c:440 msgid "while expecting a valid subcommand" msgstr "" @@ -1359,25 +1384,6 @@ msgstr "" msgid "Unknown record type %g." msgstr "" -#: src/filename.c:221 -#, c-format -msgid "Searching for `%s'..." -msgstr "" - -#: src/filename.c:229 src/filename.c:261 -msgid "Search unsuccessful!" -msgstr "" - -#: src/filename.c:254 -#, c-format -msgid "Found `%s'." -msgstr "" - -#: src/filename.c:686 -#, c-format -msgid "Not opening pipe file `%s' because SAFER option set." -msgstr "" - #: src/flip.c:82 msgid "" "FLIP ignores TEMPORARY. Temporary transformations will be made permanent." @@ -1492,11 +1498,11 @@ msgstr "" msgid "%s variables are not compatible with %s format %s." msgstr "" -#: src/format.c:223 src/pfm-read.c:473 src/sfm-read.c:880 +#: src/format.c:223 src/pfm-read.c:473 src/sfm-read.c:944 msgid "String" msgstr "" -#: src/format.c:223 src/pfm-read.c:473 src/sfm-read.c:880 +#: src/format.c:223 src/pfm-read.c:473 src/sfm-read.c:944 msgid "Numeric" msgstr "" @@ -1527,11 +1533,21 @@ msgstr "" msgid "`)' expected after output format." msgstr "" -#: src/get.c:396 -msgid "All variables deleted from system file dictionary." +#: src/get.c:251 +#, c-format +msgid "The required %s subcommand was not present" +msgstr "" + +#: src/get.c:257 +#, c-format +msgid "Unsupported sysfile version: %d. Using version %d instead." msgstr "" #: src/get.c:446 +msgid "All variables deleted from system file dictionary." +msgstr "" + +#: src/get.c:496 #, c-format msgid "" "Cannot rename %s as %s because there already exists a variable named %s. To " @@ -1539,78 +1555,78 @@ msgid "" "as \"/RENAME (A=B)(B=C)(C=A)\", or equivalently, \"/RENAME (A B C=B C A)\"." msgstr "" -#: src/get.c:471 +#: src/get.c:521 msgid "`=' expected after variable list." msgstr "" -#: src/get.c:478 +#: src/get.c:528 #, c-format msgid "" "Number of variables on left side of `=' (%d) does not match number of " "variables on right side (%d), in parenthesized group %d of RENAME subcommand." msgstr "" -#: src/get.c:491 +#: src/get.c:541 #, c-format msgid "Requested renaming duplicates variable name %s." msgstr "" -#: src/get.c:677 +#: src/get.c:728 msgid "The BY subcommand may be given once at most." msgstr "" -#: src/get.c:749 +#: src/get.c:800 msgid "The active file may not be specified more than once." msgstr "" -#: src/get.c:758 +#: src/get.c:809 msgid "Cannot specify the active file since no active file has been defined." msgstr "" -#: src/get.c:766 +#: src/get.c:817 msgid "" "MATCH FILES may not be used after TEMPORARY when the active file is an input " "source. Temporary transformations will be made permanent." msgstr "" -#: src/get.c:796 +#: src/get.c:847 msgid "" "IN, FIRST, and LAST subcommands may not occur before the first FILE or TABLE." msgstr "" -#: src/get.c:831 +#: src/get.c:882 #, c-format msgid "Multiple %s subcommands for a single FILE or TABLE." msgstr "" -#: src/get.c:841 +#: src/get.c:892 #, c-format msgid "Duplicate variable name %s while creating %s variable." msgstr "" -#: src/get.c:853 +#: src/get.c:904 msgid "" "RENAME, KEEP, and DROP subcommands may not occur before the first FILE or " "TABLE." msgstr "" -#: src/get.c:880 +#: src/get.c:931 msgid "The BY subcommand is required when a TABLE subcommand is given." msgstr "" -#: src/get.c:899 +#: src/get.c:950 #, c-format msgid "File %s lacks BY variable %s." msgstr "" -#: src/get.c:1393 +#: src/get.c:1444 #, c-format msgid "" "Variable %s in file %s (%s) has different type or width from the same " "variable in earlier file (%s)." msgstr "" -#: src/get.c:1471 +#: src/get.c:1522 msgid "expecting COMM or TAPE" msgstr "" @@ -1865,101 +1881,101 @@ msgid "" "REREAD: Column numbers must be positive finite numbers. Column set to 1." msgstr "" -#: src/lexer.c:253 +#: src/lexer.c:255 #, c-format msgid "%s does not form a valid number." msgstr "" -#: src/lexer.c:370 +#: src/lexer.c:376 #, c-format msgid "Bad character in input: `%c'." msgstr "" -#: src/lexer.c:372 +#: src/lexer.c:378 #, c-format msgid "Bad character in input: `\\%o'." msgstr "" -#: src/lexer.c:393 +#: src/lexer.c:399 msgid "Syntax error at end of file." msgstr "" -#: src/lexer.c:403 +#: src/lexer.c:409 #, c-format msgid "Syntax error %s at `%s'." msgstr "" -#: src/lexer.c:406 +#: src/lexer.c:412 #, c-format msgid "Syntax error at `%s'." msgstr "" -#: src/lexer.c:525 +#: src/lexer.c:531 #, c-format msgid "expecting `%s'" msgstr "" -#: src/lexer.c:542 +#: src/lexer.c:548 #, c-format msgid "expecting %s" msgstr "" -#: src/lexer.c:556 src/val-labs.c:154 +#: src/lexer.c:562 src/val-labs.c:154 msgid "expecting string" msgstr "" -#: src/lexer.c:570 src/val-labs.c:163 +#: src/lexer.c:576 src/val-labs.c:163 msgid "expecting integer" msgstr "" -#: src/lexer.c:584 +#: src/lexer.c:590 msgid "expecting number" msgstr "" -#: src/lexer.c:598 +#: src/lexer.c:604 msgid "expecting identifier" msgstr "" -#: src/lexer.c:884 +#: src/lexer.c:890 msgid "" msgstr "" -#: src/lexer.c:1018 src/repeat.c:214 +#: src/lexer.c:1024 src/repeat.c:214 msgid "Unexpected end of file." msgstr "" -#: src/lexer.c:1027 +#: src/lexer.c:1033 msgid "binary" msgstr "" -#: src/lexer.c:1027 +#: src/lexer.c:1033 msgid "octal" msgstr "" -#: src/lexer.c:1027 +#: src/lexer.c:1033 msgid "hex" msgstr "" -#: src/lexer.c:1041 +#: src/lexer.c:1047 #, c-format msgid "String of %s digits has %d characters, which is not a multiple of %d." msgstr "" -#: src/lexer.c:1070 +#: src/lexer.c:1076 #, c-format msgid "`%c' is not a valid %s digit." msgstr "" -#: src/lexer.c:1101 +#: src/lexer.c:1107 msgid "Unterminated string constant." msgstr "" -#: src/lexer.c:1173 +#: src/lexer.c:1179 #, c-format msgid "String exceeds 255 characters in length (%d characters)." msgstr "" -#: src/lexer.c:1188 +#: src/lexer.c:1194 msgid "" "Sorry, literal strings may not contain null characters. Replacing with " "spaces." @@ -2595,7 +2611,7 @@ msgstr "" msgid "Bad time string length %d." msgstr "" -#: src/pfm-read.c:465 src/sfm-read.c:867 src/sfm-read.c:875 +#: src/pfm-read.c:465 src/sfm-read.c:931 src/sfm-read.c:939 #, c-format msgid "%s: Bad format specifier byte (%d)." msgstr "" @@ -2628,44 +2644,59 @@ msgstr "" msgid "Invalid variable width %d." msgstr "" -#: src/pfm-read.c:525 +#: src/pfm-read.c:527 +#, c-format +msgid "position %d: Variable name has %u characters." +msgstr "" + +#: src/pfm-read.c:531 +#, c-format +msgid "position %d: Variable name begins with invalid character." +msgstr "" + +#: src/pfm-read.c:535 +#, c-format +msgid "position %d: Variable name begins with lowercase letter %c." +msgstr "" + +#: src/pfm-read.c:547 #, c-format msgid "position %d: Invalid variable name `%s'." msgstr "" -#: src/pfm-read.c:533 +#: src/pfm-read.c:555 #, c-format msgid "Duplicate variable name %s." msgstr "" -#: src/pfm-read.c:573 +#: src/pfm-read.c:595 #, c-format msgid "Bad missing values for %s." msgstr "" -#: src/pfm-read.c:591 +#: src/pfm-read.c:613 #, c-format msgid "Weighting variable %s not present in dictionary." msgstr "" -#: src/pfm-read.c:638 +#: src/pfm-read.c:660 #, c-format msgid "Unknown variable %s while parsing value labels." msgstr "" -#: src/pfm-read.c:641 +#: src/pfm-read.c:663 #, c-format msgid "" "Cannot assign value labels to %s and %s, which have different variable types " "or widths." msgstr "" -#: src/pfm-read.c:665 +#: src/pfm-read.c:687 #, c-format msgid "Duplicate label for value %g for variable %s." msgstr "" -#: src/pfm-read.c:668 +#: src/pfm-read.c:690 #, c-format msgid "Duplicate label for value `%.*s' for variable %s." msgstr "" @@ -2686,11 +2717,11 @@ msgstr "" msgid "%s: Closing portable file: %s." msgstr "" -#: src/plot-hist.c:118 +#: src/plot-hist.c:123 msgid "HISTOGRAM" msgstr "" -#: src/plot-hist.c:120 src/frequencies.q:1139 +#: src/plot-hist.c:125 src/frequencies.q:1139 msgid "Frequency" msgstr "" @@ -3024,7 +3055,7 @@ msgstr "" msgid "corrupt system file: " msgstr "" -#: src/sfm-read.c:149 src/sfm-write.c:808 +#: src/sfm-read.c:149 src/sfm-write.c:918 #, c-format msgid "%s: Closing system file: %s." msgstr "" @@ -3053,66 +3084,71 @@ msgid "" "immediately follow type 3 records." msgstr "" -#: src/sfm-read.c:329 +#: src/sfm-read.c:333 +#, c-format +msgid "%s: Invalid subrecord length. Record: 7; Subrecord: 11" +msgstr "" + +#: src/sfm-read.c:388 #, c-format msgid "%s: Unrecognized record type 7, subtype %d encountered in system file." msgstr "" -#: src/sfm-read.c:354 +#: src/sfm-read.c:413 #, c-format msgid "%s: Unrecognized record type %d." msgstr "" -#: src/sfm-read.c:386 +#: src/sfm-read.c:445 #, c-format msgid "" "%s: Bad size (%d) or count (%d) field on record type 7, subtype 3.\tExpected " "size %d, count 8." msgstr "" -#: src/sfm-read.c:397 +#: src/sfm-read.c:456 #, c-format msgid "" "%s: Floating-point representation in system file is not IEEE-754. PSPP " "cannot convert between floating-point formats." msgstr "" -#: src/sfm-read.c:413 +#: src/sfm-read.c:472 #, c-format msgid "" "%s: File-indicated endianness (%s) does not match endianness intuited from " "file header (%s)." msgstr "" -#: src/sfm-read.c:416 src/sfm-read.c:417 +#: src/sfm-read.c:475 src/sfm-read.c:476 msgid "big-endian" msgstr "" -#: src/sfm-read.c:416 src/sfm-read.c:417 +#: src/sfm-read.c:475 src/sfm-read.c:476 msgid "little-endian" msgstr "" -#: src/sfm-read.c:418 +#: src/sfm-read.c:477 msgid "unknown" msgstr "" -#: src/sfm-read.c:422 +#: src/sfm-read.c:481 #, c-format msgid "%s: File-indicated character representation code (%s) is not ASCII." msgstr "" -#: src/sfm-read.c:426 +#: src/sfm-read.c:485 msgid "DEC Kanji" msgstr "" -#: src/sfm-read.c:442 +#: src/sfm-read.c:501 #, c-format msgid "" "%s: Bad size (%d) or count (%d) field on record type 7, subtype 4.\tExpected " "size %d, count 8." msgstr "" -#: src/sfm-read.c:457 +#: src/sfm-read.c:516 #, c-format msgid "" "%s: File-indicated value is different from internal value for at least one " @@ -3120,245 +3156,249 @@ msgid "" "%g; LOWEST: %g, %g." msgstr "" -#: src/sfm-read.c:484 +#: src/sfm-read.c:543 #, c-format msgid "" "%s: Bad magic. Proper system files begin with the four characters `$FL2'. " "This file will not be read." msgstr "" -#: src/sfm-read.c:526 +#: src/sfm-read.c:585 #, c-format msgid "" "%s: File layout code has unexpected value %d. Value should be 2, in big-" "endian or little-endian format." msgstr "" -#: src/sfm-read.c:542 +#: src/sfm-read.c:601 #, c-format msgid "%s: Number of elements per case (%d) is not between 1 and %d." msgstr "" -#: src/sfm-read.c:551 +#: src/sfm-read.c:610 #, c-format msgid "" "%s: Index of weighting variable (%d) is not between 0 and number of elements " "per case (%d)." msgstr "" -#: src/sfm-read.c:558 +#: src/sfm-read.c:617 #, c-format msgid "%s: Number of cases in file (%ld) is not between -1 and %d." msgstr "" -#: src/sfm-read.c:563 +#: src/sfm-read.c:622 #, c-format msgid "%s: Compression bias (%g) is not the usual value of 100." msgstr "" -#: src/sfm-read.c:656 +#: src/sfm-read.c:717 #, c-format msgid "%s: position %d: Bad record type (%d); the expected value was 2." msgstr "" -#: src/sfm-read.c:666 +#: src/sfm-read.c:727 #, c-format msgid "" "%s: position %d: String variable does not have proper number of continuation " "records." msgstr "" -#: src/sfm-read.c:675 +#: src/sfm-read.c:736 #, c-format msgid "%s: position %d: Superfluous long string continuation record." msgstr "" -#: src/sfm-read.c:681 +#: src/sfm-read.c:742 #, c-format msgid "%s: position %d: Bad variable type code %d." msgstr "" -#: src/sfm-read.c:684 +#: src/sfm-read.c:745 #, c-format msgid "%s: position %d: Variable label indicator field is not 0 or 1." msgstr "" -#: src/sfm-read.c:688 +#: src/sfm-read.c:749 #, c-format msgid "" "%s: position %d: Missing value indicator field is not -3, -2, 0, 1, 2, or 3." msgstr "" -#: src/sfm-read.c:694 +#: src/sfm-read.c:755 #, c-format msgid "%s: position %d: Variable name begins with invalid character." msgstr "" -#: src/sfm-read.c:698 +#: src/sfm-read.c:759 #, c-format msgid "%s: position %d: Variable name begins with lowercase letter %c." msgstr "" -#: src/sfm-read.c:702 +#: src/sfm-read.c:763 #, c-format msgid "" "%s: position %d: Variable name begins with octothorpe (`#'). Scratch " "variables should not appear in system files." msgstr "" -#: src/sfm-read.c:717 +#: src/sfm-read.c:778 #, c-format msgid "%s: position %d: Variable name character %d is lowercase letter %c." msgstr "" -#: src/sfm-read.c:726 +#: src/sfm-read.c:787 #, c-format msgid "" "%s: position %d: character `\\%03o' (%c) is not valid in a variable name." msgstr "" -#: src/sfm-read.c:735 +#: src/sfm-read.c:796 #, c-format msgid "%s: Duplicate variable name `%s' within system file." msgstr "" -#: src/sfm-read.c:756 +#: src/sfm-read.c:817 #, c-format msgid "%s: Variable %s indicates variable label of invalid length %d." msgstr "" -#: src/sfm-read.c:773 +#: src/sfm-read.c:837 #, c-format msgid "%s: Long string variable %s may not have missing values." msgstr "" -#: src/sfm-read.c:798 +#: src/sfm-read.c:862 #, c-format msgid "" "%s: String variable %s may not have missing values specified as a range." msgstr "" -#: src/sfm-read.c:846 +#: src/sfm-read.c:910 #, c-format msgid "%s: Long string continuation records omitted at end of dictionary." msgstr "" -#: src/sfm-read.c:850 +#: src/sfm-read.c:914 #, c-format msgid "" "%s: System file header indicates %d variable positions but %d were read from " "file." msgstr "" -#: src/sfm-read.c:878 +#: src/sfm-read.c:942 #, c-format msgid "%s: %s variable %s has %s format specifier %s." msgstr "" -#: src/sfm-read.c:957 +#: src/sfm-read.c:1021 #, c-format msgid "" "%s: Variable index record (type 4) does not immediately follow value label " "record (type 3) as it should." msgstr "" -#: src/sfm-read.c:968 +#: src/sfm-read.c:1032 #, c-format msgid "" "%s: Number of variables associated with a value label (%d) is not between 1 " "and the number of variables (%d)." msgstr "" -#: src/sfm-read.c:984 +#: src/sfm-read.c:1048 #, c-format msgid "" "%s: Variable index associated with value label (%d) is not between 1 and the " "number of values (%d)." msgstr "" -#: src/sfm-read.c:991 +#: src/sfm-read.c:1055 #, c-format msgid "" "%s: Variable index associated with value label (%d) refers to a continuation " "of a string variable, not to an actual variable." msgstr "" -#: src/sfm-read.c:996 +#: src/sfm-read.c:1060 #, c-format msgid "%s: Value labels are not allowed on long string variables (%s)." msgstr "" -#: src/sfm-read.c:1007 +#: src/sfm-read.c:1071 #, c-format msgid "" "%s: Variables associated with value label are not all of identical type. " "Variable %s has %s type, but variable %s has %s type." msgstr "" -#: src/sfm-read.c:1048 +#: src/sfm-read.c:1112 #, c-format msgid "%s: File contains duplicate label for value %g for variable %s." msgstr "" -#: src/sfm-read.c:1052 +#: src/sfm-read.c:1116 #, c-format msgid "%s: File contains duplicate label for value `%.*s' for variable %s." msgstr "" -#: src/sfm-read.c:1087 src/sfm-read.c:1351 +#: src/sfm-read.c:1158 src/sfm-read.c:1422 #, c-format msgid "%s: Reading system file: %s." msgstr "" -#: src/sfm-read.c:1090 src/sfm-read.c:1192 src/sfm-read.c:1234 +#: src/sfm-read.c:1161 src/sfm-read.c:1263 src/sfm-read.c:1305 #, c-format msgid "%s: Unexpected end of file." msgstr "" -#: src/sfm-read.c:1107 +#: src/sfm-read.c:1178 #, c-format msgid "%s: System file contains multiple type 6 (document) records." msgstr "" -#: src/sfm-read.c:1113 +#: src/sfm-read.c:1184 #, c-format msgid "%s: Number of document lines (%ld) must be greater than 0." msgstr "" -#: src/sfm-read.c:1145 +#: src/sfm-read.c:1216 #, c-format msgid "%s: Error reading file: %s." msgstr "" -#: src/sfm-read.c:1182 +#: src/sfm-read.c:1253 #, c-format msgid "%s: Compressed data is corrupted. Data ends in partial case." msgstr "" -#: src/sfm-read.c:1354 +#: src/sfm-read.c:1425 #, c-format msgid "%s: Partial record at end of system file." msgstr "" -#: src/sfm-write.c:143 +#: src/sfm-write.c:153 #, c-format msgid "Error opening \"%s\" for writing as a system file: %s." msgstr "" -#: src/sfm-write.c:628 +#: src/sfm-write.c:738 #, c-format msgid "%s: Writing system file: %s." msgstr "" -#: src/sort.c:203 +#: src/sort.c:103 +msgid "Buffer limit must be at least 2." +msgstr "" + +#: src/sort.c:221 msgid "`A' or `D' expected inside parentheses." msgstr "" -#: src/sort.c:208 +#: src/sort.c:226 msgid "`)' expected." msgstr "" -#: src/sort.c:572 src/sort.c:750 +#: src/sort.c:573 #, c-format msgid "" "Out of memory. Could not allocate room for minimum of %d cases of %d bytes " @@ -3572,28 +3612,28 @@ msgstr "" msgid "Truncating variable label to 255 characters." msgstr "" -#: src/vars-atr.c:248 +#: src/vars-atr.c:249 msgid "Variable names must be at least 1 character long." msgstr "" -#: src/vars-atr.c:254 +#: src/vars-atr.c:255 #, c-format msgid "Variable name %s exceeds %d-character limit." msgstr "" -#: src/vars-atr.c:263 +#: src/vars-atr.c:264 #, c-format msgid "Character `%c' (in %s) may not appear in a variable name." msgstr "" -#: src/vars-atr.c:272 +#: src/vars-atr.c:273 #, c-format msgid "" "Character `%c' (in %s), may not appear as the first character in a variable " "name." msgstr "" -#: src/vars-atr.c:280 +#: src/vars-atr.c:281 #, c-format msgid "%s may not be used as a variable name because it is a reserved word." msgstr "" @@ -3619,36 +3659,36 @@ msgstr "" msgid "scratch" msgstr "" -#: src/vars-prs.c:174 +#: src/vars-prs.c:175 #, c-format msgid "" "%s is not a numeric variable. It will not be included in the variable list." msgstr "" -#: src/vars-prs.c:177 +#: src/vars-prs.c:178 #, c-format msgid "" "%s is not a string variable. It will not be included in the variable list." msgstr "" -#: src/vars-prs.c:181 +#: src/vars-prs.c:182 #, c-format msgid "Scratch variables (such as %s) are not allowed here." msgstr "" -#: src/vars-prs.c:184 +#: src/vars-prs.c:185 #, c-format msgid "" "%s and %s are not the same type. All variables in this variable list must " "be of the same type. %s will be omitted from list." msgstr "" -#: src/vars-prs.c:189 +#: src/vars-prs.c:190 #, c-format msgid "Variable %s appears twice in variable list." msgstr "" -#: src/vars-prs.c:299 +#: src/vars-prs.c:300 #, c-format msgid "%s TO %s is not valid syntax since %s precedes %s in the dictionary." msgstr "" diff --git a/po/pspp.pot b/po/pspp.pot index 8aadfe56..85f2aaf0 100644 --- a/po/pspp.pot +++ b/po/pspp.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2005-03-13 22:49-0800\n" +"POT-Creation-Date: 2005-04-13 06:39+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,58 +21,58 @@ msgstr "" msgid "while expecting COLUMNWISE" msgstr "" -#: src/aggregate.c:225 +#: src/aggregate.c:227 msgid "expecting BREAK" msgstr "" -#: src/aggregate.c:230 +#: src/aggregate.c:232 msgid "" "When PRESORTED is specified, specifying sorting directions with (A) or (D) " "has no effect. Output data will be sorted the same way as the input data." msgstr "" -#: src/aggregate.c:387 +#: src/aggregate.c:389 msgid "expecting aggregation function" msgstr "" -#: src/aggregate.c:403 +#: src/aggregate.c:405 #, c-format msgid "Unknown aggregation function %s." msgstr "" -#: src/aggregate.c:418 +#: src/aggregate.c:420 msgid "expecting `('" msgstr "" -#: src/aggregate.c:455 +#: src/aggregate.c:457 #, c-format msgid "Missing argument %d to %s." msgstr "" -#: src/aggregate.c:463 +#: src/aggregate.c:465 #, c-format msgid "Arguments to %s must be of same type as source variables." msgstr "" -#: src/aggregate.c:473 +#: src/aggregate.c:475 msgid "expecting `)'" msgstr "" -#: src/aggregate.c:485 +#: src/aggregate.c:487 #, c-format msgid "" "Number of source variables (%d) does not match number of target variables (%" "d)." msgstr "" -#: src/aggregate.c:502 +#: src/aggregate.c:504 #, c-format msgid "" "The value arguments passed to the %s function are out-of-order. They will " "be treated as if they had been specified in the correct order." msgstr "" -#: src/aggregate.c:570 +#: src/aggregate.c:571 #, c-format msgid "" "Variable name %s is not unique within the aggregate file dictionary, which " @@ -84,13 +84,13 @@ msgstr "" msgid "Variable %s is %s in target file, but %s in source file." msgstr "" -#: src/apply-dict.c:71 src/apply-dict.c:72 src/format.c:224 src/sfm-read.c:882 -#: src/sfm-read.c:1011 src/sfm-read.c:1012 +#: src/apply-dict.c:71 src/apply-dict.c:72 src/format.c:224 src/sfm-read.c:946 +#: src/sfm-read.c:1075 src/sfm-read.c:1076 msgid "string" msgstr "" -#: src/apply-dict.c:71 src/apply-dict.c:72 src/format.c:224 src/sfm-read.c:882 -#: src/sfm-read.c:1011 src/sfm-read.c:1012 +#: src/apply-dict.c:71 src/apply-dict.c:72 src/format.c:224 src/sfm-read.c:946 +#: src/sfm-read.c:1075 src/sfm-read.c:1076 msgid "numeric" msgstr "" @@ -234,8 +234,8 @@ msgid "Source variable count (%d) does not match target variable count (%d)." msgstr "" #: src/autorecode.c:139 src/command.c:791 src/compute.c:277 -#: src/data-list.c:409 src/data-list.c:899 src/data-list.c:1750 -#: src/do-if.c:253 src/get.c:406 src/lexer.c:420 src/loop.c:241 +#: src/data-list.c:409 src/data-list.c:901 src/data-list.c:1752 +#: src/do-if.c:253 src/get.c:245 src/get.c:456 src/lexer.c:426 src/loop.c:241 #: src/matrix-data.c:527 src/print.c:335 src/print.c:1045 src/recode.c:405 #: src/sel-if.c:54 src/sel-if.c:131 src/vector.c:193 src/file-handle.q:140 msgid "expecting end of command" @@ -296,13 +296,13 @@ msgstr "" msgid "%s: Temporary file ended unexpectedly." msgstr "" -#: src/cmdline.c:143 src/cmdline.c:162 src/cmdline.c:174 src/command.c:207 +#: src/cmdline.c:141 src/cmdline.c:160 src/cmdline.c:172 src/command.c:207 #: src/set.q:425 src/set.q:427 src/set.q:994 #, c-format msgid "%s is not yet implemented." msgstr "" -#: src/cmdline.c:245 +#: src/cmdline.c:243 #, c-format msgid "" "PSPP, a program for statistical analysis of sample data.\n" @@ -352,7 +352,7 @@ msgid "" "\n" msgstr "" -#: src/cmdline.c:283 +#: src/cmdline.c:281 #, c-format msgid "" "\n" @@ -665,7 +665,7 @@ msgid "" "fields must be listed in order of increasing record number." msgstr "" -#: src/data-list.c:385 src/data-list.c:1739 +#: src/data-list.c:385 src/data-list.c:1741 msgid "" "SPSS-like or FORTRAN-like format specification expected after variable names." msgstr "" @@ -706,7 +706,7 @@ msgstr "" msgid "Input format %s doesn't accept decimal places." msgstr "" -#: src/data-list.c:568 src/data-list.c:664 src/data-list.c:878 +#: src/data-list.c:568 src/data-list.c:664 src/data-list.c:880 #, c-format msgid "%s is a duplicate variable name." msgstr "" @@ -733,7 +733,7 @@ msgid "" "names given." msgstr "" -#: src/data-list.c:795 src/data-list.c:921 src/descript.c:880 src/print.c:796 +#: src/data-list.c:795 src/data-list.c:923 src/descript.c:880 src/print.c:796 #: src/sysfile-info.c:134 src/sysfile-info.c:367 src/vfm.c:830 msgid "Variable" msgstr "" @@ -746,7 +746,7 @@ msgstr "" msgid "Columns" msgstr "" -#: src/data-list.c:798 src/data-list.c:922 src/print.c:799 +#: src/data-list.c:798 src/data-list.c:924 src/print.c:799 msgid "Format" msgstr "" @@ -764,159 +764,159 @@ msgid_plural "Reading %d records from the command file." msgstr[0] "" msgstr[1] "" -#: src/data-list.c:938 +#: src/data-list.c:940 #, c-format msgid "Reading free-form data from file %s." msgstr "" -#: src/data-list.c:941 +#: src/data-list.c:943 msgid "Reading free-form data from the command file." msgstr "" -#: src/data-list.c:992 +#: src/data-list.c:994 #, c-format msgid "Quoted string missing terminating `%c'." msgstr "" -#: src/data-list.c:1101 +#: src/data-list.c:1103 #, c-format msgid "Partial case of %d of %d records discarded." msgstr "" -#: src/data-list.c:1155 +#: src/data-list.c:1157 #, c-format msgid "Partial case discarded. The first variable missing was %s." msgstr "" -#: src/data-list.c:1199 +#: src/data-list.c:1201 #, c-format msgid "" "Missing value(s) for all variables from %s onward. These will be filled " "with the system-missing value or blanks, as appropriate." msgstr "" -#: src/data-list.c:1277 +#: src/data-list.c:1279 msgid "Attempt to read past end of file." msgstr "" -#: src/data-list.c:1413 +#: src/data-list.c:1415 msgid "" "REPEATING DATA must use the same file as its corresponding DATA LIST or FILE " "TYPE." msgstr "" -#: src/data-list.c:1423 src/data-list.c:1458 src/data-list.c:1471 -#: src/data-list.c:1484 src/data-list.c:1517 +#: src/data-list.c:1425 src/data-list.c:1460 src/data-list.c:1473 +#: src/data-list.c:1486 src/data-list.c:1519 #, c-format msgid "%s subcommand given multiple times." msgstr "" -#: src/data-list.c:1447 +#: src/data-list.c:1449 #, c-format msgid "STARTS beginning column (%d) exceeds STARTS ending column (%d)." msgstr "" -#: src/data-list.c:1503 +#: src/data-list.c:1505 #, c-format msgid "CONTINUED beginning column (%d) exceeds CONTINUED ending column (%d)." msgstr "" -#: src/data-list.c:1526 +#: src/data-list.c:1528 #, c-format msgid "ID beginning column (%ld) must be positive." msgstr "" -#: src/data-list.c:1541 +#: src/data-list.c:1543 #, c-format msgid "ID ending column (%ld) must be positive." msgstr "" -#: src/data-list.c:1547 +#: src/data-list.c:1549 #, c-format msgid "ID ending column (%ld) cannot be less than ID beginning column (%d)." msgstr "" -#: src/data-list.c:1587 +#: src/data-list.c:1589 msgid "Missing required specification STARTS." msgstr "" -#: src/data-list.c:1589 +#: src/data-list.c:1591 msgid "Missing required specification OCCURS." msgstr "" -#: src/data-list.c:1596 +#: src/data-list.c:1598 msgid "ID specified without CONTINUED." msgstr "" -#: src/data-list.c:1688 +#: src/data-list.c:1690 msgid "String variable not allowed here." msgstr "" -#: src/data-list.c:1698 +#: src/data-list.c:1700 #, c-format msgid "%s (%d) must be at least 1." msgstr "" -#: src/data-list.c:1704 +#: src/data-list.c:1706 #, c-format msgid "Variable or integer expected for %s." msgstr "" -#: src/data-list.c:1842 +#: src/data-list.c:1844 #, c-format msgid "Encountered mismatched record ID \"%s\" expecting \"%s\"." msgstr "" -#: src/data-list.c:1874 +#: src/data-list.c:1876 #, c-format msgid "" "Variable %s starting in column %d extends beyond physical record length of %" "d." msgstr "" -#: src/data-list.c:1942 +#: src/data-list.c:1944 #, c-format msgid "Invalid value %d for OCCURS." msgstr "" -#: src/data-list.c:1948 +#: src/data-list.c:1950 #, c-format msgid "Beginning column for STARTS (%d) must be at least 1." msgstr "" -#: src/data-list.c:1956 +#: src/data-list.c:1958 #, c-format msgid "Ending column for STARTS (%d) is less than beginning column (%d)." msgstr "" -#: src/data-list.c:1964 +#: src/data-list.c:1966 #, c-format msgid "Invalid value %d for LENGTH." msgstr "" -#: src/data-list.c:1971 +#: src/data-list.c:1973 #, c-format msgid "Beginning column for CONTINUED (%d) must be at least 1." msgstr "" -#: src/data-list.c:1979 +#: src/data-list.c:1981 #, c-format msgid "Ending column for CONTINUED (%d) is less than beginning column (%d)." msgstr "" -#: src/data-list.c:2011 +#: src/data-list.c:2013 #, c-format msgid "" "Number of repetitions specified on OCCURS (%d) exceed number of repetitions " "available in space on STARTS (%d), and CONTINUED not specified." msgstr "" -#: src/data-list.c:2029 +#: src/data-list.c:2031 #, c-format msgid "Unexpected end of file with %d repetitions remaining out of %d." msgstr "" -#: src/data-out.c:235 src/sfm-read.c:426 src/sysfile-info.c:115 +#: src/data-out.c:235 src/sfm-read.c:485 src/sysfile-info.c:115 msgid "Unknown" msgstr "" @@ -1137,7 +1137,13 @@ msgstr "" msgid "Error writing file %s: %s." msgstr "" -#: src/dictionary.c:597 +#: src/dictionary.c:256 +#, c-format +msgid "" +"The entry \"%s\" in the variable name map, has no corresponding variable" +msgstr "" + +#: src/dictionary.c:836 msgid "" "At least one case in the data file had a weight value that was user-missing, " "system-missing, zero, or negative. These case(s) were ignored." @@ -1222,6 +1228,25 @@ msgstr "" msgid "installation error" msgstr "" +#: src/filename.c:221 +#, c-format +msgid "Searching for `%s'..." +msgstr "" + +#: src/filename.c:229 src/filename.c:261 +msgid "Search unsuccessful!" +msgstr "" + +#: src/filename.c:254 +#, c-format +msgid "Found `%s'." +msgstr "" + +#: src/filename.c:686 +#, c-format +msgid "Not opening pipe file `%s' because SAFER option set." +msgstr "" + #: src/file-type.c:129 msgid "MIXED, GROUPED, or NESTED expected." msgstr "" @@ -1271,7 +1296,7 @@ msgstr "" msgid "YES or NO expected after ORDERED." msgstr "" -#: src/file-type.c:248 src/file-type.c:543 src/get.c:390 +#: src/file-type.c:248 src/file-type.c:543 src/get.c:440 msgid "while expecting a valid subcommand" msgstr "" @@ -1360,25 +1385,6 @@ msgstr "" msgid "Unknown record type %g." msgstr "" -#: src/filename.c:221 -#, c-format -msgid "Searching for `%s'..." -msgstr "" - -#: src/filename.c:229 src/filename.c:261 -msgid "Search unsuccessful!" -msgstr "" - -#: src/filename.c:254 -#, c-format -msgid "Found `%s'." -msgstr "" - -#: src/filename.c:686 -#, c-format -msgid "Not opening pipe file `%s' because SAFER option set." -msgstr "" - #: src/flip.c:82 msgid "" "FLIP ignores TEMPORARY. Temporary transformations will be made permanent." @@ -1493,11 +1499,11 @@ msgstr "" msgid "%s variables are not compatible with %s format %s." msgstr "" -#: src/format.c:223 src/pfm-read.c:473 src/sfm-read.c:880 +#: src/format.c:223 src/pfm-read.c:473 src/sfm-read.c:944 msgid "String" msgstr "" -#: src/format.c:223 src/pfm-read.c:473 src/sfm-read.c:880 +#: src/format.c:223 src/pfm-read.c:473 src/sfm-read.c:944 msgid "Numeric" msgstr "" @@ -1528,11 +1534,21 @@ msgstr "" msgid "`)' expected after output format." msgstr "" -#: src/get.c:396 -msgid "All variables deleted from system file dictionary." +#: src/get.c:251 +#, c-format +msgid "The required %s subcommand was not present" +msgstr "" + +#: src/get.c:257 +#, c-format +msgid "Unsupported sysfile version: %d. Using version %d instead." msgstr "" #: src/get.c:446 +msgid "All variables deleted from system file dictionary." +msgstr "" + +#: src/get.c:496 #, c-format msgid "" "Cannot rename %s as %s because there already exists a variable named %s. To " @@ -1540,78 +1556,78 @@ msgid "" "as \"/RENAME (A=B)(B=C)(C=A)\", or equivalently, \"/RENAME (A B C=B C A)\"." msgstr "" -#: src/get.c:471 +#: src/get.c:521 msgid "`=' expected after variable list." msgstr "" -#: src/get.c:478 +#: src/get.c:528 #, c-format msgid "" "Number of variables on left side of `=' (%d) does not match number of " "variables on right side (%d), in parenthesized group %d of RENAME subcommand." msgstr "" -#: src/get.c:491 +#: src/get.c:541 #, c-format msgid "Requested renaming duplicates variable name %s." msgstr "" -#: src/get.c:677 +#: src/get.c:728 msgid "The BY subcommand may be given once at most." msgstr "" -#: src/get.c:749 +#: src/get.c:800 msgid "The active file may not be specified more than once." msgstr "" -#: src/get.c:758 +#: src/get.c:809 msgid "Cannot specify the active file since no active file has been defined." msgstr "" -#: src/get.c:766 +#: src/get.c:817 msgid "" "MATCH FILES may not be used after TEMPORARY when the active file is an input " "source. Temporary transformations will be made permanent." msgstr "" -#: src/get.c:796 +#: src/get.c:847 msgid "" "IN, FIRST, and LAST subcommands may not occur before the first FILE or TABLE." msgstr "" -#: src/get.c:831 +#: src/get.c:882 #, c-format msgid "Multiple %s subcommands for a single FILE or TABLE." msgstr "" -#: src/get.c:841 +#: src/get.c:892 #, c-format msgid "Duplicate variable name %s while creating %s variable." msgstr "" -#: src/get.c:853 +#: src/get.c:904 msgid "" "RENAME, KEEP, and DROP subcommands may not occur before the first FILE or " "TABLE." msgstr "" -#: src/get.c:880 +#: src/get.c:931 msgid "The BY subcommand is required when a TABLE subcommand is given." msgstr "" -#: src/get.c:899 +#: src/get.c:950 #, c-format msgid "File %s lacks BY variable %s." msgstr "" -#: src/get.c:1393 +#: src/get.c:1444 #, c-format msgid "" "Variable %s in file %s (%s) has different type or width from the same " "variable in earlier file (%s)." msgstr "" -#: src/get.c:1471 +#: src/get.c:1522 msgid "expecting COMM or TAPE" msgstr "" @@ -1866,101 +1882,101 @@ msgid "" "REREAD: Column numbers must be positive finite numbers. Column set to 1." msgstr "" -#: src/lexer.c:253 +#: src/lexer.c:255 #, c-format msgid "%s does not form a valid number." msgstr "" -#: src/lexer.c:370 +#: src/lexer.c:376 #, c-format msgid "Bad character in input: `%c'." msgstr "" -#: src/lexer.c:372 +#: src/lexer.c:378 #, c-format msgid "Bad character in input: `\\%o'." msgstr "" -#: src/lexer.c:393 +#: src/lexer.c:399 msgid "Syntax error at end of file." msgstr "" -#: src/lexer.c:403 +#: src/lexer.c:409 #, c-format msgid "Syntax error %s at `%s'." msgstr "" -#: src/lexer.c:406 +#: src/lexer.c:412 #, c-format msgid "Syntax error at `%s'." msgstr "" -#: src/lexer.c:525 +#: src/lexer.c:531 #, c-format msgid "expecting `%s'" msgstr "" -#: src/lexer.c:542 +#: src/lexer.c:548 #, c-format msgid "expecting %s" msgstr "" -#: src/lexer.c:556 src/val-labs.c:154 +#: src/lexer.c:562 src/val-labs.c:154 msgid "expecting string" msgstr "" -#: src/lexer.c:570 src/val-labs.c:163 +#: src/lexer.c:576 src/val-labs.c:163 msgid "expecting integer" msgstr "" -#: src/lexer.c:584 +#: src/lexer.c:590 msgid "expecting number" msgstr "" -#: src/lexer.c:598 +#: src/lexer.c:604 msgid "expecting identifier" msgstr "" -#: src/lexer.c:884 +#: src/lexer.c:890 msgid "" msgstr "" -#: src/lexer.c:1018 src/repeat.c:214 +#: src/lexer.c:1024 src/repeat.c:214 msgid "Unexpected end of file." msgstr "" -#: src/lexer.c:1027 +#: src/lexer.c:1033 msgid "binary" msgstr "" -#: src/lexer.c:1027 +#: src/lexer.c:1033 msgid "octal" msgstr "" -#: src/lexer.c:1027 +#: src/lexer.c:1033 msgid "hex" msgstr "" -#: src/lexer.c:1041 +#: src/lexer.c:1047 #, c-format msgid "String of %s digits has %d characters, which is not a multiple of %d." msgstr "" -#: src/lexer.c:1070 +#: src/lexer.c:1076 #, c-format msgid "`%c' is not a valid %s digit." msgstr "" -#: src/lexer.c:1101 +#: src/lexer.c:1107 msgid "Unterminated string constant." msgstr "" -#: src/lexer.c:1173 +#: src/lexer.c:1179 #, c-format msgid "String exceeds 255 characters in length (%d characters)." msgstr "" -#: src/lexer.c:1188 +#: src/lexer.c:1194 msgid "" "Sorry, literal strings may not contain null characters. Replacing with " "spaces." @@ -2596,7 +2612,7 @@ msgstr "" msgid "Bad time string length %d." msgstr "" -#: src/pfm-read.c:465 src/sfm-read.c:867 src/sfm-read.c:875 +#: src/pfm-read.c:465 src/sfm-read.c:931 src/sfm-read.c:939 #, c-format msgid "%s: Bad format specifier byte (%d)." msgstr "" @@ -2629,44 +2645,59 @@ msgstr "" msgid "Invalid variable width %d." msgstr "" -#: src/pfm-read.c:525 +#: src/pfm-read.c:527 +#, c-format +msgid "position %d: Variable name has %u characters." +msgstr "" + +#: src/pfm-read.c:531 +#, c-format +msgid "position %d: Variable name begins with invalid character." +msgstr "" + +#: src/pfm-read.c:535 +#, c-format +msgid "position %d: Variable name begins with lowercase letter %c." +msgstr "" + +#: src/pfm-read.c:547 #, c-format msgid "position %d: Invalid variable name `%s'." msgstr "" -#: src/pfm-read.c:533 +#: src/pfm-read.c:555 #, c-format msgid "Duplicate variable name %s." msgstr "" -#: src/pfm-read.c:573 +#: src/pfm-read.c:595 #, c-format msgid "Bad missing values for %s." msgstr "" -#: src/pfm-read.c:591 +#: src/pfm-read.c:613 #, c-format msgid "Weighting variable %s not present in dictionary." msgstr "" -#: src/pfm-read.c:638 +#: src/pfm-read.c:660 #, c-format msgid "Unknown variable %s while parsing value labels." msgstr "" -#: src/pfm-read.c:641 +#: src/pfm-read.c:663 #, c-format msgid "" "Cannot assign value labels to %s and %s, which have different variable types " "or widths." msgstr "" -#: src/pfm-read.c:665 +#: src/pfm-read.c:687 #, c-format msgid "Duplicate label for value %g for variable %s." msgstr "" -#: src/pfm-read.c:668 +#: src/pfm-read.c:690 #, c-format msgid "Duplicate label for value `%.*s' for variable %s." msgstr "" @@ -2687,11 +2718,11 @@ msgstr "" msgid "%s: Closing portable file: %s." msgstr "" -#: src/plot-hist.c:118 +#: src/plot-hist.c:123 msgid "HISTOGRAM" msgstr "" -#: src/plot-hist.c:120 src/frequencies.q:1139 +#: src/plot-hist.c:125 src/frequencies.q:1139 msgid "Frequency" msgstr "" @@ -3025,7 +3056,7 @@ msgstr "" msgid "corrupt system file: " msgstr "" -#: src/sfm-read.c:149 src/sfm-write.c:808 +#: src/sfm-read.c:149 src/sfm-write.c:918 #, c-format msgid "%s: Closing system file: %s." msgstr "" @@ -3054,66 +3085,71 @@ msgid "" "immediately follow type 3 records." msgstr "" -#: src/sfm-read.c:329 +#: src/sfm-read.c:333 +#, c-format +msgid "%s: Invalid subrecord length. Record: 7; Subrecord: 11" +msgstr "" + +#: src/sfm-read.c:388 #, c-format msgid "%s: Unrecognized record type 7, subtype %d encountered in system file." msgstr "" -#: src/sfm-read.c:354 +#: src/sfm-read.c:413 #, c-format msgid "%s: Unrecognized record type %d." msgstr "" -#: src/sfm-read.c:386 +#: src/sfm-read.c:445 #, c-format msgid "" "%s: Bad size (%d) or count (%d) field on record type 7, subtype 3.\tExpected " "size %d, count 8." msgstr "" -#: src/sfm-read.c:397 +#: src/sfm-read.c:456 #, c-format msgid "" "%s: Floating-point representation in system file is not IEEE-754. PSPP " "cannot convert between floating-point formats." msgstr "" -#: src/sfm-read.c:413 +#: src/sfm-read.c:472 #, c-format msgid "" "%s: File-indicated endianness (%s) does not match endianness intuited from " "file header (%s)." msgstr "" -#: src/sfm-read.c:416 src/sfm-read.c:417 +#: src/sfm-read.c:475 src/sfm-read.c:476 msgid "big-endian" msgstr "" -#: src/sfm-read.c:416 src/sfm-read.c:417 +#: src/sfm-read.c:475 src/sfm-read.c:476 msgid "little-endian" msgstr "" -#: src/sfm-read.c:418 +#: src/sfm-read.c:477 msgid "unknown" msgstr "" -#: src/sfm-read.c:422 +#: src/sfm-read.c:481 #, c-format msgid "%s: File-indicated character representation code (%s) is not ASCII." msgstr "" -#: src/sfm-read.c:426 +#: src/sfm-read.c:485 msgid "DEC Kanji" msgstr "" -#: src/sfm-read.c:442 +#: src/sfm-read.c:501 #, c-format msgid "" "%s: Bad size (%d) or count (%d) field on record type 7, subtype 4.\tExpected " "size %d, count 8." msgstr "" -#: src/sfm-read.c:457 +#: src/sfm-read.c:516 #, c-format msgid "" "%s: File-indicated value is different from internal value for at least one " @@ -3121,245 +3157,249 @@ msgid "" "%g; LOWEST: %g, %g." msgstr "" -#: src/sfm-read.c:484 +#: src/sfm-read.c:543 #, c-format msgid "" "%s: Bad magic. Proper system files begin with the four characters `$FL2'. " "This file will not be read." msgstr "" -#: src/sfm-read.c:526 +#: src/sfm-read.c:585 #, c-format msgid "" "%s: File layout code has unexpected value %d. Value should be 2, in big-" "endian or little-endian format." msgstr "" -#: src/sfm-read.c:542 +#: src/sfm-read.c:601 #, c-format msgid "%s: Number of elements per case (%d) is not between 1 and %d." msgstr "" -#: src/sfm-read.c:551 +#: src/sfm-read.c:610 #, c-format msgid "" "%s: Index of weighting variable (%d) is not between 0 and number of elements " "per case (%d)." msgstr "" -#: src/sfm-read.c:558 +#: src/sfm-read.c:617 #, c-format msgid "%s: Number of cases in file (%ld) is not between -1 and %d." msgstr "" -#: src/sfm-read.c:563 +#: src/sfm-read.c:622 #, c-format msgid "%s: Compression bias (%g) is not the usual value of 100." msgstr "" -#: src/sfm-read.c:656 +#: src/sfm-read.c:717 #, c-format msgid "%s: position %d: Bad record type (%d); the expected value was 2." msgstr "" -#: src/sfm-read.c:666 +#: src/sfm-read.c:727 #, c-format msgid "" "%s: position %d: String variable does not have proper number of continuation " "records." msgstr "" -#: src/sfm-read.c:675 +#: src/sfm-read.c:736 #, c-format msgid "%s: position %d: Superfluous long string continuation record." msgstr "" -#: src/sfm-read.c:681 +#: src/sfm-read.c:742 #, c-format msgid "%s: position %d: Bad variable type code %d." msgstr "" -#: src/sfm-read.c:684 +#: src/sfm-read.c:745 #, c-format msgid "%s: position %d: Variable label indicator field is not 0 or 1." msgstr "" -#: src/sfm-read.c:688 +#: src/sfm-read.c:749 #, c-format msgid "" "%s: position %d: Missing value indicator field is not -3, -2, 0, 1, 2, or 3." msgstr "" -#: src/sfm-read.c:694 +#: src/sfm-read.c:755 #, c-format msgid "%s: position %d: Variable name begins with invalid character." msgstr "" -#: src/sfm-read.c:698 +#: src/sfm-read.c:759 #, c-format msgid "%s: position %d: Variable name begins with lowercase letter %c." msgstr "" -#: src/sfm-read.c:702 +#: src/sfm-read.c:763 #, c-format msgid "" "%s: position %d: Variable name begins with octothorpe (`#'). Scratch " "variables should not appear in system files." msgstr "" -#: src/sfm-read.c:717 +#: src/sfm-read.c:778 #, c-format msgid "%s: position %d: Variable name character %d is lowercase letter %c." msgstr "" -#: src/sfm-read.c:726 +#: src/sfm-read.c:787 #, c-format msgid "" "%s: position %d: character `\\%03o' (%c) is not valid in a variable name." msgstr "" -#: src/sfm-read.c:735 +#: src/sfm-read.c:796 #, c-format msgid "%s: Duplicate variable name `%s' within system file." msgstr "" -#: src/sfm-read.c:756 +#: src/sfm-read.c:817 #, c-format msgid "%s: Variable %s indicates variable label of invalid length %d." msgstr "" -#: src/sfm-read.c:773 +#: src/sfm-read.c:837 #, c-format msgid "%s: Long string variable %s may not have missing values." msgstr "" -#: src/sfm-read.c:798 +#: src/sfm-read.c:862 #, c-format msgid "" "%s: String variable %s may not have missing values specified as a range." msgstr "" -#: src/sfm-read.c:846 +#: src/sfm-read.c:910 #, c-format msgid "%s: Long string continuation records omitted at end of dictionary." msgstr "" -#: src/sfm-read.c:850 +#: src/sfm-read.c:914 #, c-format msgid "" "%s: System file header indicates %d variable positions but %d were read from " "file." msgstr "" -#: src/sfm-read.c:878 +#: src/sfm-read.c:942 #, c-format msgid "%s: %s variable %s has %s format specifier %s." msgstr "" -#: src/sfm-read.c:957 +#: src/sfm-read.c:1021 #, c-format msgid "" "%s: Variable index record (type 4) does not immediately follow value label " "record (type 3) as it should." msgstr "" -#: src/sfm-read.c:968 +#: src/sfm-read.c:1032 #, c-format msgid "" "%s: Number of variables associated with a value label (%d) is not between 1 " "and the number of variables (%d)." msgstr "" -#: src/sfm-read.c:984 +#: src/sfm-read.c:1048 #, c-format msgid "" "%s: Variable index associated with value label (%d) is not between 1 and the " "number of values (%d)." msgstr "" -#: src/sfm-read.c:991 +#: src/sfm-read.c:1055 #, c-format msgid "" "%s: Variable index associated with value label (%d) refers to a continuation " "of a string variable, not to an actual variable." msgstr "" -#: src/sfm-read.c:996 +#: src/sfm-read.c:1060 #, c-format msgid "%s: Value labels are not allowed on long string variables (%s)." msgstr "" -#: src/sfm-read.c:1007 +#: src/sfm-read.c:1071 #, c-format msgid "" "%s: Variables associated with value label are not all of identical type. " "Variable %s has %s type, but variable %s has %s type." msgstr "" -#: src/sfm-read.c:1048 +#: src/sfm-read.c:1112 #, c-format msgid "%s: File contains duplicate label for value %g for variable %s." msgstr "" -#: src/sfm-read.c:1052 +#: src/sfm-read.c:1116 #, c-format msgid "%s: File contains duplicate label for value `%.*s' for variable %s." msgstr "" -#: src/sfm-read.c:1087 src/sfm-read.c:1351 +#: src/sfm-read.c:1158 src/sfm-read.c:1422 #, c-format msgid "%s: Reading system file: %s." msgstr "" -#: src/sfm-read.c:1090 src/sfm-read.c:1192 src/sfm-read.c:1234 +#: src/sfm-read.c:1161 src/sfm-read.c:1263 src/sfm-read.c:1305 #, c-format msgid "%s: Unexpected end of file." msgstr "" -#: src/sfm-read.c:1107 +#: src/sfm-read.c:1178 #, c-format msgid "%s: System file contains multiple type 6 (document) records." msgstr "" -#: src/sfm-read.c:1113 +#: src/sfm-read.c:1184 #, c-format msgid "%s: Number of document lines (%ld) must be greater than 0." msgstr "" -#: src/sfm-read.c:1145 +#: src/sfm-read.c:1216 #, c-format msgid "%s: Error reading file: %s." msgstr "" -#: src/sfm-read.c:1182 +#: src/sfm-read.c:1253 #, c-format msgid "%s: Compressed data is corrupted. Data ends in partial case." msgstr "" -#: src/sfm-read.c:1354 +#: src/sfm-read.c:1425 #, c-format msgid "%s: Partial record at end of system file." msgstr "" -#: src/sfm-write.c:143 +#: src/sfm-write.c:153 #, c-format msgid "Error opening \"%s\" for writing as a system file: %s." msgstr "" -#: src/sfm-write.c:628 +#: src/sfm-write.c:738 #, c-format msgid "%s: Writing system file: %s." msgstr "" -#: src/sort.c:203 +#: src/sort.c:103 +msgid "Buffer limit must be at least 2." +msgstr "" + +#: src/sort.c:221 msgid "`A' or `D' expected inside parentheses." msgstr "" -#: src/sort.c:208 +#: src/sort.c:226 msgid "`)' expected." msgstr "" -#: src/sort.c:572 src/sort.c:750 +#: src/sort.c:573 #, c-format msgid "" "Out of memory. Could not allocate room for minimum of %d cases of %d bytes " @@ -3573,28 +3613,28 @@ msgstr "" msgid "Truncating variable label to 255 characters." msgstr "" -#: src/vars-atr.c:248 +#: src/vars-atr.c:249 msgid "Variable names must be at least 1 character long." msgstr "" -#: src/vars-atr.c:254 +#: src/vars-atr.c:255 #, c-format msgid "Variable name %s exceeds %d-character limit." msgstr "" -#: src/vars-atr.c:263 +#: src/vars-atr.c:264 #, c-format msgid "Character `%c' (in %s) may not appear in a variable name." msgstr "" -#: src/vars-atr.c:272 +#: src/vars-atr.c:273 #, c-format msgid "" "Character `%c' (in %s), may not appear as the first character in a variable " "name." msgstr "" -#: src/vars-atr.c:280 +#: src/vars-atr.c:281 #, c-format msgid "%s may not be used as a variable name because it is a reserved word." msgstr "" @@ -3620,36 +3660,36 @@ msgstr "" msgid "scratch" msgstr "" -#: src/vars-prs.c:174 +#: src/vars-prs.c:175 #, c-format msgid "" "%s is not a numeric variable. It will not be included in the variable list." msgstr "" -#: src/vars-prs.c:177 +#: src/vars-prs.c:178 #, c-format msgid "" "%s is not a string variable. It will not be included in the variable list." msgstr "" -#: src/vars-prs.c:181 +#: src/vars-prs.c:182 #, c-format msgid "Scratch variables (such as %s) are not allowed here." msgstr "" -#: src/vars-prs.c:184 +#: src/vars-prs.c:185 #, c-format msgid "" "%s and %s are not the same type. All variables in this variable list must " "be of the same type. %s will be omitted from list." msgstr "" -#: src/vars-prs.c:189 +#: src/vars-prs.c:190 #, c-format msgid "Variable %s appears twice in variable list." msgstr "" -#: src/vars-prs.c:299 +#: src/vars-prs.c:300 #, c-format msgid "%s TO %s is not valid syntax since %s precedes %s in the dictionary." msgstr "" diff --git a/pref.h.orig b/pref.h.orig index be045115..2193c6b4 100644 --- a/pref.h.orig +++ b/pref.h.orig @@ -96,3 +96,6 @@ #ifndef P_tmpdir #define P_tmpdir "/tmp" #endif + +#define SHORT_NAME_LEN 8 +#define LONG_NAME_LEN 64 diff --git a/src/ChangeLog b/src/ChangeLog index 68d0d089..498afac3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ + * var-display.c: New file. + + * format.h var.h sfm-read.c sfm-write.c dictionary.c : Added + display_width, measure and alignment parameters to variables. + + * aggregate.c command.def compute.c count.c data-list.c descript.c + dictionary.c dictionary.h expr-prs.c file-type.c flip.c get.c lexer.c + lexer.h loop.c modify-vars.c pfm-read.c recode.c repeat.c sfm-read.c + sfm-write.c sfm-write.h sfmP.h val-labs.c val.h var.h vars-prs.c + vector.c : + - Replaced literal constants representing maximum variable name + length with macro definitions. + - Added support for long variable names. + - Changed lexer such that it no longer makes tokens upper case, but + relies upon case insensitive behaviour of commands. + Mon Apr 4 22:27:34 2005 Ben Pfaff * aggregate.c: (parse_aggregate_functions) If dict_create_var() @@ -71,6 +87,7 @@ Mon Mar 14 21:05:13 2005 Ben Pfaff * flip.c: (cmd_flip) Ditto. +>>>>>>> 1.161 Sun Mar 13 22:52:05 2005 Ben Pfaff * file-handle.q: (struct file_handle) `open_mode' should not be @@ -121,6 +138,7 @@ Sun Mar 13 22:35:55 2005 Ben Pfaff (initialize_aggregate_info) Fix initialization for MIN, MAX for strings. +>>>>>>> 1.160 Sat Mar 12 23:26:21 2005 Ben Pfaff Start work on testing and debugging AGGREGATE. diff --git a/src/Makefile.am b/src/Makefile.am index 6f03ed91..d3297630 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -69,6 +69,7 @@ sfm-read.c sfm-read.h sfm-write.c sfm-write.h sfmP.h som.c som.h \ sort.c sort.h split-file.c str.c str.h subclist.c subclist.h \ sysfile-info.c tab.c tab.h temporary.c stat.h mkfile.c mkfile.h \ title.c val.h val-labs.c value-labels.c value-labels.h \ +var-display.c \ var-labs.c var.h vars-atr.c vars-prs.c vector.c version.h \ vfm.c vfm.h vfmP.h weight.c diff --git a/src/aggregate.c b/src/aggregate.c index fa89cc49..6da6242c 100644 --- a/src/aggregate.c +++ b/src/aggregate.c @@ -213,7 +213,9 @@ cmd_aggregate (void) for (i = 0; i < agr.break_var_cnt; i++) { struct variable *v = dict_clone_var (agr.dict, agr.break_vars[i], - agr.break_vars[i]->name); + agr.break_vars[i]->name, + agr.break_vars[i]->longname + ); assert (v != NULL); } @@ -276,7 +278,7 @@ cmd_aggregate (void) } else { - agr.writer = sfm_open_writer (out_file, agr.dict, get_scompression ()); + agr.writer = sfm_open_writer (out_file, agr.dict, get_scompression (), 0); if (agr.writer == NULL) goto error; @@ -396,7 +398,7 @@ parse_aggregate_functions (struct agr_proc *agr) } for (function = agr_func_tab; function->name; function++) - if (!strcmp (function->name, tokid)) + if (!strcasecmp (function->name, tokid)) break; if (NULL == function->name) { @@ -540,7 +542,7 @@ parse_aggregate_functions (struct agr_proc *agr) } if (function->alpha_type == ALPHA) - destvar = dict_clone_var (agr->dict, v->src, dest[i]); + destvar = dict_clone_var (agr->dict, v->src, 0, dest[i] ); else if (v->src->type == NUMERIC || function->alpha_type == NUMERIC) { diff --git a/src/command.def b/src/command.def index ddad0ae7..345b2c81 100644 --- a/src/command.def +++ b/src/command.def @@ -30,6 +30,8 @@ DEFCMD ("ADD VALUE LABELS", ERRO, INPU, TRAN, TRAN, cmd_add_value_labels) DEFCMD ("AGGREGATE", ERRO, ERRO, PROC, TRAN, cmd_aggregate) UNIMPL ("ANOVA", ERRO, ERRO, ERRO, ERRO) DEFCMD ("APPLY DICTIONARY", ERRO, ERRO, TRAN, TRAN, cmd_apply_dictionary) +UNIMPL ("AREG", ERRO, ERRO, ERRO, ERRO) +UNIMPL ("ARIMA", ERRO, ERRO, ERRO, ERRO) DEFCMD ("AUTORECODE", ERRO, ERRO, PROC, PROC, cmd_autorecode) SPCCMD ("BEGIN DATA", ERRO, ERRO, PROC, PROC, cmd_begin_data) DEFCMD ("BREAK", ERRO, INPU, TRAN, TRAN, cmd_break) @@ -38,10 +40,10 @@ UNIMPL ("CASESTOVARS", ERRO, ERRO, ERRO, ERRO) UNIMPL ("CCF", ERRO, ERRO, ERRO, ERRO) DEFCMD ("CLEAR TRANSFORMATIONS", ERRO, INPU, TRAN, TRAN, cmd_clear_transformations) UNIMPL ("CLUSTER", ERRO, ERRO, ERRO, ERRO) -UNIMPL ("COMMENT", ERRO, ERRO, ERRO, ERRO) DEFCMD ("COMPUTE", ERRO, INPU, TRAN, TRAN, cmd_compute) UNIMPL ("CONJOINT", ERRO, ERRO, ERRO, ERRO) DEFCMD ("CORRELATIONS", ERRO, ERRO, PROC, PROC, cmd_correlations) +UNIMPL ("COXREG", ERRO, ERRO, ERRO, ERRO) DEFCMD ("COUNT", ERRO, INPU, TRAN, TRAN, cmd_count) UNIMPL ("CREATE", ERRO, ERRO, ERRO, ERRO) DEFCMD ("CROSSTABS", ERRO, ERRO, PROC, PROC, cmd_crosstabs) @@ -52,6 +54,7 @@ DBGCMD ("DEBUG CASEFILE", INIT, INPU, TRAN, PROC, cmd_debug_casefile) DBGCMD ("DEBUG EVALUATE", INIT, INPU, TRAN, PROC, cmd_debug_evaluate) DBGCMD ("DEBUG MOMENTS", INIT, INPU, TRAN, PROC, cmd_debug_moments) DBGCMD ("DEBUG POOL", INIT, INPU, TRAN, PROC, cmd_debug_pool) +UNIMPL ("DELETE VARIABLES", ERRO, ERRO, ERRO, ERRO) DEFCMD ("DESCRIPTIVES", ERRO, ERRO, PROC, PROC, cmd_descriptives) UNIMPL ("DISCRIMINANT", ERRO, ERRO, ERRO, ERRO) DEFCMD ("DISPLAY", ERRO, INPU, TRAN, PROC, cmd_display) @@ -84,10 +87,12 @@ UNIMPL ("FIT", ERRO, ERRO, ERRO, ERRO) DEFCMD ("FLIP", ERRO, ERRO, PROC, PROC, cmd_flip) DEFCMD ("FORMATS", INIT, INPU, TRAN, PROC, cmd_formats) DEFCMD ("FREQUENCIES", ERRO, ERRO, PROC, PROC, cmd_frequencies) +UNIMPL ("GENLOG", ERRO, ERRO, ERRO, ERRO) DEFCMD ("GET", TRAN, ERRO, TRAN, TRAN, cmd_get) UNIMPL ("GET TRANSLATE", ERRO, ERRO, ERRO, ERRO) UNIMPL ("GLM", ERRO, ERRO, ERRO, ERRO) UNIMPL ("GRAPH", ERRO, ERRO, ERRO, ERRO) +UNIMPL ("HILOGLINEAR", ERRO, ERRO, ERRO, ERRO) DEFCMD ("HOST", INIT, INPU, TRAN, PROC, cmd_host) DEFCMD ("IF", ERRO, INPU, TRAN, TRAN, cmd_if) UNIMPL ("IGRAPH", ERRO, ERRO, ERRO, ERRO) @@ -99,6 +104,8 @@ DEFCMD ("INPUT PROGRAM", INPU, ERRO, INPU, INPU, cmd_input_program) UNIMPL ("KEYED DATA LIST", ERRO, ERRO, ERRO, ERRO) DEFCMD ("LEAVE", ERRO, INPU, TRAN, TRAN, cmd_leave) DEFCMD ("LIST", ERRO, ERRO, PROC, PROC, cmd_list) +UNIMPL ("LOGLINEAR", ERRO, ERRO, ERRO, ERRO) +UNIMPL ("LOGISITIC REGRESSION", ERRO, ERRO, ERRO, ERRO) DEFCMD ("LOOP", ERRO, INPU, TRAN, TRAN, cmd_loop) DEFCMD ("MATCH FILES", TRAN, ERRO, TRAN, PROC, cmd_match_files) DEFCMD ("MATRIX DATA", TRAN, ERRO, TRAN, TRAN, cmd_matrix_data) @@ -107,14 +114,19 @@ DEFCMD ("MEANS", ERRO, ERRO, PROC, PROC, cmd_means) DEFCMD ("MISSING VALUES", ERRO, INPU, TRAN, TRAN, cmd_missing_values) DEFCMD ("MODIFY VARS", ERRO, ERRO, TRAN, PROC, cmd_modify_vars) UNIMPL ("MULT RESPONSE", ERRO, ERRO, ERRO, ERRO) +UNIMPL ("MVA", ERRO, ERRO, ERRO, ERRO) DEFCMD ("NEW FILE", INIT, ERRO, INIT, INIT, cmd_new_file) DEFCMD ("N", INIT, INPU, TRAN, TRAN, cmd_n_of_cases) DEFCMD ("N OF CASES", INIT, INPU, TRAN, TRAN, cmd_n_of_cases) +UNIMPL ("NLR", ERRO, ERRO, ERRO, ERRO) UNIMPL ("NONPAR CORR", ERRO, ERRO, ERRO, ERRO) UNIMPL ("NPAR TESTS", ERRO, ERRO, ERRO, ERRO) UNIMPL ("NUMBERED", ERRO, ERRO, ERRO, ERRO) DEFCMD ("NUMERIC", ERRO, INPU, TRAN, TRAN, cmd_numeric) +UNIMPL ("OLAP CUBES", ERRO, ERRO, ERRO, ERRO) +UNIMPL ("OMS", ERRO, ERRO, ERRO, ERRO) DEFCMD ("ONEWAY", ERRO, ERRO, PROC, PROC, cmd_oneway) +UNIMPL ("ORTHOPLAN", ERRO, ERRO, ERRO, ERRO) UNIMPL ("PACF", ERRO, ERRO, ERRO, ERRO) UNIMPL ("PARTIAL CORR", ERRO, ERRO, ERRO, ERRO) DEFCMD ("PEARSON CORRELATIONS", ERRO, ERRO, PROC, PROC, cmd_correlations) @@ -172,8 +184,10 @@ UNIMPL ("UNNUMBERED", ERRO, ERRO, ERRO, ERRO) UNIMPL ("UPDATE", ERRO, ERRO, ERRO, ERRO) DEFCMD ("USE", ERRO, ERRO, TRAN, TRAN, cmd_use) DEFCMD ("VALUE LABELS", ERRO, INPU, TRAN, TRAN, cmd_value_labels) +DEFCMD ("VARIABLE ALIGNMENT", ERRO, INPU, TRAN, TRAN, cmd_variable_alignment) DEFCMD ("VARIABLE LABELS", ERRO, INPU, TRAN, TRAN, cmd_variable_labels) -UNIMPL ("VARIABLE LEVEL", ERRO, ERRO, ERRO, ERRO) +DEFCMD ("VARIABLE LEVEL", ERRO, INPU, TRAN, TRAN, cmd_variable_level) +DEFCMD ("VARIABLE WIDTH", ERRO, INPU, TRAN, TRAN, cmd_variable_width) UNIMPL ("VARSTOCASES", ERRO, ERRO, ERRO, ERRO) DEFCMD ("VECTOR", ERRO, INPU, TRAN, TRAN, cmd_vector) UNIMPL ("VERIFY", ERRO, ERRO, ERRO, ERRO) diff --git a/src/compute.c b/src/compute.c index e6afe0b6..2152b6db 100644 --- a/src/compute.c +++ b/src/compute.c @@ -310,7 +310,7 @@ compute_trns_free (struct trns_header *compute_) /* COMPUTE or IF target variable or vector element. */ struct lvalue { - char var_name[9]; /* Destination variable name, or "". */ + char var_name[LONG_NAME_LEN + 1]; /* Destination variable name, or "". */ const struct vector *vector; /* Destination vector, if any, or NULL. */ struct expression *element; /* Destination vector element, or NULL. */ }; @@ -353,8 +353,8 @@ lvalue_parse (void) else { /* Variable name. */ - strncpy (lvalue->var_name, tokid, 8); - lvalue->var_name[8] = '\0'; + strncpy (lvalue->var_name, tokid, LONG_NAME_LEN); + lvalue->var_name[LONG_NAME_LEN] = '\0'; lex_get (); } return lvalue; diff --git a/src/count.c b/src/count.c index af9642b8..665248de 100644 --- a/src/count.c +++ b/src/count.c @@ -108,7 +108,7 @@ struct cnt_var_info struct cnt_var_info *next; struct variable *d; /* Destination variable. */ - char n[9]; /* Name of dest var. */ + char n[SHORT_NAME_LEN + 1]; /* Name of dest var. */ struct counting *c; /* The counting specifications. */ }; diff --git a/src/data-list.c b/src/data-list.c index 4d7a315d..381d6f2c 100644 --- a/src/data-list.c +++ b/src/data-list.c @@ -65,7 +65,7 @@ struct dls_var_spec int fc, lc; /* Column numbers in record. */ /* Free format only. */ - char name[9]; /* Name of variable. */ + char name[SHORT_NAME_LEN + 1]; /* Name of variable. */ }; /* Constants for DATA LIST type. */ @@ -841,6 +841,7 @@ parse_free (struct dls_var_spec **first, struct dls_var_spec **last) if (!parse_DATA_LIST_vars (&name, &name_cnt, PV_NONE)) return 0; + if (lex_match ('(')) { if (!parse_format_specifier (&input, 0) @@ -873,6 +874,7 @@ parse_free (struct dls_var_spec **first, struct dls_var_spec **last) struct variable *v; v = dict_create_var (default_dict, name[i], width); + if (!v) { msg (SE, _("%s is a duplicate variable name."), name[i]); @@ -887,7 +889,7 @@ parse_free (struct dls_var_spec **first, struct dls_var_spec **last) spec->input = input; spec->v = v; spec->fv = v->fv; - strcpy (spec->name, name[i]); + strcpy (spec->name, v->name); append_var_spec (first, last, spec); } for (i = 0; i < name_cnt; i++) diff --git a/src/descript.c b/src/descript.c index e84733ac..7fea8328 100644 --- a/src/descript.c +++ b/src/descript.c @@ -120,7 +120,7 @@ static const struct dsc_statistic_info dsc_info[DSC_N_STATS] = struct dsc_var { struct variable *v; /* Variable to calculate on. */ - char z_name[9]; /* Name for z-score variable. */ + char z_name[SHORT_NAME_LEN + 1];/* Name for z-score variable. */ double valid, missing; /* Valid, missing counts. */ struct moments *moments; /* Moments. */ double min, max; /* Maximum and mimimum values. */ @@ -483,7 +483,7 @@ generate_z_varname (struct dsc_proc *dsc, char *z_name, /* Try a name based on the original variable name. */ name[0] = 'Z'; strcpy (name + 1, var_name); - name[8] = '\0'; + name[SHORT_NAME_LEN] = '\0'; if (try_name (dsc, name)) { strcpy (z_name, name); diff --git a/src/dictionary.c b/src/dictionary.c index 99ea5b8b..86076f9c 100644 --- a/src/dictionary.c +++ b/src/dictionary.c @@ -20,6 +20,7 @@ #include #include "dictionary.h" #include +#include #include "algorithm.h" #include "alloc.h" #include "case.h" @@ -36,6 +37,7 @@ struct dictionary struct variable **var; /* Variables. */ size_t var_cnt, var_cap; /* Number of variables, capacity. */ struct hsh_table *name_tab; /* Variable index by name. */ + struct hsh_table *long_name_tab; /* Variable indexed by long name */ int next_value_idx; /* Index of next `union value' to allocate. */ struct variable **split; /* SPLIT FILE vars. */ size_t split_cnt; /* SPLIT FILE count. */ @@ -48,6 +50,43 @@ struct dictionary size_t vector_cnt; /* Number of vectors. */ }; + + + + +int +compare_long_names(const void *a_, const void *b_, void *aux UNUSED) +{ + const struct name_table_entry *a = a_; + const struct name_table_entry *b = b_; + + return strcasecmp(a->longname, b->longname); +} + + +/* Long names use case insensitive comparison */ +unsigned int +hash_long_name (const void *e_, void *aux UNUSED) +{ + const struct name_table_entry *e = e_; + unsigned int hash; + int i; + + char *s = strdup(e->longname); + + for ( i = 0 ; i < strlen(s) ; ++i ) + s[i] = toupper(s[i]); + + hash = hsh_hash_string (s); + + free (s); + + return hash; +} + +static char *make_short_name(struct dictionary *dict, const char *longname) ; + + /* Creates and returns a new dictionary. */ struct dictionary * dict_create (void) @@ -57,6 +96,7 @@ dict_create (void) d->var = NULL; d->var_cnt = d->var_cap = 0; d->name_tab = hsh_create (8, compare_var_names, hash_var_name, NULL, NULL); + d->long_name_tab = hsh_create (8, compare_long_names, hash_long_name, NULL, NULL); d->next_value_idx = 0; d->split = NULL; d->split_cnt = 0; @@ -78,12 +118,14 @@ dict_clone (const struct dictionary *s) { struct dictionary *d; size_t i; - + assert (s != NULL); - + d = dict_create (); + for (i = 0; i < s->var_cnt; i++) - dict_clone_var (d, s->var[i], s->var[i]->name); + dict_clone_var (d, s->var[i], s->var[i]->name, s->var[i]->longname); + d->next_value_idx = s->next_value_idx; d->split_cnt = s->split_cnt; @@ -134,6 +176,8 @@ dict_clear (struct dictionary *d) d->var = NULL; d->var_cnt = d->var_cap = 0; hsh_clear (d->name_tab); + if ( d->long_name_tab) + hsh_clear (d->long_name_tab); d->next_value_idx = 0; free (d->split); d->split = NULL; @@ -148,6 +192,78 @@ dict_clear (struct dictionary *d) dict_clear_vectors (d); } +/* Allocate the pointer TEXT and fill it with text representing the + long variable name buffer. SIZE will contain the size of TEXT. + TEXT must be freed by the caller when no longer required. +*/ +void +dict_get_varname_block(const struct dictionary *dict, char **text, int *size) +{ + char *buf = 0; + int bufsize = 0; + struct hsh_iterator hi; + struct name_table_entry *nte; + short first = 1; + + for ( nte = hsh_first(dict->long_name_tab, &hi); + nte; + nte = hsh_next(dict->long_name_tab, &hi)) + { + bufsize += strlen(nte->name) + strlen(nte->longname) + 2; + buf = xrealloc(buf, bufsize + 1); + if ( first ) + strcpy(buf, ""); + first = 0; + + strcat(buf, nte->name); + strcat(buf, "="); + strcat(buf, nte->longname); + strcat(buf, "\t"); + } + + if ( bufsize > 0 ) + { + /* Loose the final delimiting TAB */ + buf[bufsize]='\0'; + bufsize--; + } + + *text = buf; + *size = bufsize; +} + + +/* Add a new entry into the dictionary's long name table, and update the + corresponding varible with the relevant long name. +*/ +void +dict_add_longvar_entry(struct dictionary *d, + const char *name, + const char *longname) +{ + struct variable *v; + assert ( name ) ; + assert ( longname ); + struct name_table_entry *nte = xmalloc (sizeof (struct name_table_entry)); + nte->longname = strdup(longname); + nte->name = strdup(name); + + + /* Look up the name in name_tab */ + v = hsh_find ( d->name_tab, name); + if ( !v ) + { + msg (FE, _("The entry \"%s\" in the variable name map, has no corresponding variable"), name); + return ; + } + assert ( 0 == strcmp(v->name, name) ); + v->longname = nte->longname; + + hsh_insert(d->long_name_tab, nte); + + +} + /* Destroys the aux data for every variable in D, by calling var_clear_aux() for each variable. */ void @@ -169,6 +285,7 @@ dict_destroy (struct dictionary *d) { dict_clear (d); hsh_destroy (d->name_tab); + hsh_destroy (d->long_name_tab); free (d); } } @@ -225,18 +342,59 @@ dict_get_vars (const struct dictionary *d, struct variable ***vars, assert (*cnt == count); } -/* Creates and returns a new variable in D with the given NAME - and WIDTH. Returns a null pointer if the given NAME would - duplicate that of an existing variable in the dictionary. */ + +static struct variable * dict_create_var_x (struct dictionary *d, + const char *name, int width, + short name_is_short) ; + +/* Creates and returns a new variable in D with the given LONGNAME + and WIDTH. Returns a null pointer if the given LONGNAME would + duplicate that of an existing variable in the dictionary. +*/ struct variable * -dict_create_var (struct dictionary *d, const char *name, int width) +dict_create_var (struct dictionary *d, const char *longname, int width) +{ + return dict_create_var_x(d, longname, width, 0); +} + + +/* Creates and returns a new variable in D with the given SHORTNAME and + WIDTH. The long name table is not updated */ +struct variable * +dict_create_var_from_short (struct dictionary *d, const char *shortname, + int width) +{ + return dict_create_var_x(d, shortname, width, 1); +} + + + +/* Creates and returns a new variable in D with the given NAME + and WIDTH. + If NAME_IS_SHORT, assume NAME is the short name. Otherwise assumes + NAME is the long name, and creates the corresponding entry in the + Dictionary's lookup name table . + Returns a null pointer if the given NAME would + duplicate that of an existing variable in the dictionary. + +*/ +static struct variable * +dict_create_var_x (struct dictionary *d, const char *name, int width, + short name_is_short) { struct variable *v; assert (d != NULL); assert (name != NULL); - assert (strlen (name) >= 1 && strlen (name) <= 8); + + assert (strlen (name) >= 1); + assert (width >= 0 && width < 256); + + if ( name_is_short ) + assert(strlen (name) <= SHORT_NAME_LEN); + else + assert(strlen (name) <= LONG_NAME_LEN); /* Make sure there's not already a variable by that name. */ if (dict_lookup_var (d, name) != NULL) @@ -244,27 +402,43 @@ dict_create_var (struct dictionary *d, const char *name, int width) /* Allocate and initialize variable. */ v = xmalloc (sizeof *v); - strncpy (v->name, name, sizeof v->name); - v->name[8] = '\0'; + + if ( name_is_short ) + { + strncpy (v->name, name, sizeof v->name); + v->name[SHORT_NAME_LEN] = '\0'; + } + else + strcpy(v->name,make_short_name(d, name)); + + v->index = d->var_cnt; v->type = width == 0 ? NUMERIC : ALPHA; v->width = width; v->fv = d->next_value_idx; v->nv = width == 0 ? 1 : DIV_RND_UP (width, 8); v->init = 1; - v->reinit = dict_class_from_id (name) != DC_SCRATCH; + v->reinit = dict_class_from_id (v->name) != DC_SCRATCH; v->miss_type = MISSING_NONE; if (v->type == NUMERIC) { v->print.type = FMT_F; v->print.w = 8; v->print.d = 2; + + v->alignment = ALIGN_RIGHT; + v->display_width = 8; + v->measure = MEASURE_SCALE; } else { v->print.type = FMT_A; v->print.w = v->width; v->print.d = 0; + + v->alignment = ALIGN_LEFT; + v->display_width = 8; + v->measure = MEASURE_NOMINAL; } v->write = v->print; v->val_labs = val_labs_create (v->width); @@ -281,6 +455,10 @@ dict_create_var (struct dictionary *d, const char *name, int width) d->var[v->index] = v; d->var_cnt++; hsh_force_insert (d->name_tab, v); + + if ( ! name_is_short) + dict_add_longvar_entry(d, v->name, name); + d->next_value_idx += v->nv; return v; @@ -290,30 +468,49 @@ dict_create_var (struct dictionary *d, const char *name, int width) and WIDTH. Assert-fails if the given NAME would duplicate that of an existing variable in the dictionary. */ struct variable * -dict_create_var_assert (struct dictionary *d, const char *name, int width) +dict_create_var_assert (struct dictionary *d, const char *longname, int width) { - struct variable *v = dict_create_var (d, name, width); + struct variable *v = dict_create_var (d, longname, width); assert (v != NULL); return v; } -/* Creates a new variable in D named NAME, as a copy of existing - variable OV, which need not be in D or in any dictionary. */ +/* Creates a new variable in D with longname LONGNAME, as a copy of + existing variable OV, which need not be in D or in any + dictionary. + If SHORTNAME is non null, it will be used as the short name + otherwise a new short name will be generated. +*/ struct variable * dict_clone_var (struct dictionary *d, const struct variable *ov, - const char *name) + const char *name, const char *longname) { struct variable *nv; assert (d != NULL); assert (ov != NULL); - assert (name != NULL); - assert (strlen (name) >= 1 && strlen (name) <= 8); + assert (strlen (longname) <= LONG_NAME_LEN); + + struct name_table_entry *nte = xmalloc (sizeof (struct name_table_entry)); + + nte->longname = strdup(longname); + if ( name ) + { + assert (strlen (name) >= 1); + assert (strlen (name) <= SHORT_NAME_LEN); + nte->name = strdup(name); + } + else + nte->name = make_short_name(d, longname); - nv = dict_create_var (d, name, ov->width); + + nv = dict_create_var_from_short (d, nte->name, ov->width); if (nv == NULL) return NULL; + hsh_insert(d->long_name_tab, nte); + nv->longname = nte->longname; + nv->init = 1; nv->reinit = ov->reinit; nv->miss_type = ov->miss_type; @@ -325,6 +522,10 @@ dict_clone_var (struct dictionary *d, const struct variable *ov, if (ov->label != NULL) nv->label = xstrdup (ov->label); + nv->alignment = ov->alignment; + nv->measure = ov->measure; + nv->display_width = ov->display_width; + return nv; } @@ -338,7 +539,7 @@ dict_rename_var (struct dictionary *d, struct variable *v, assert (d != NULL); assert (v != NULL); assert (new_name != NULL); - assert (strlen (new_name) >= 1 && strlen (new_name) <= 8); + assert (strlen (new_name) >= 1 && strlen (new_name) <= SHORT_NAME_LEN); assert (dict_contains_var (d, v)); if (!strcmp (v->name, new_name)) @@ -348,7 +549,7 @@ dict_rename_var (struct dictionary *d, struct variable *v, hsh_force_delete (d->name_tab, v); strncpy (v->name, new_name, sizeof v->name); - v->name[8] = '\0'; + v->name[SHORT_NAME_LEN] = '\0'; hsh_force_insert (d->name_tab, v); } @@ -358,17 +559,35 @@ struct variable * dict_lookup_var (const struct dictionary *d, const char *name) { struct variable v; + struct variable *vr; + char *short_name; + struct name_table_entry key; + struct name_table_entry *nte; + assert (d != NULL); assert (name != NULL); - assert (strlen (name) >= 1 && strlen (name) <= 8); + assert (strlen (name) >= 1 && strlen (name) <= LONG_NAME_LEN); + + key.longname = name; + nte = hsh_find (d->long_name_tab, &key); + + if ( ! nte ) + { + return 0; + } + + short_name = nte->name ; - strncpy (v.name, name, sizeof v.name); - v.name[8] = '\0'; + strncpy (v.name, short_name, sizeof v.name); + v.name[SHORT_NAME_LEN] = '\0'; - return hsh_find (d->name_tab, &v); + vr = hsh_find (d->name_tab, &v); + + return vr; } + /* Returns the variable named NAME in D. Assert-fails if no variable has that name. */ struct variable * @@ -516,10 +735,12 @@ dict_rename_vars (struct dictionary *d, size_t i; int success = 1; + assert (d != NULL); assert (count == 0 || vars != NULL); assert (count == 0 || new_names != NULL); + old_names = xmalloc (count * sizeof *old_names); for (i = 0; i < count; i++) { @@ -530,11 +751,22 @@ dict_rename_vars (struct dictionary *d, for (i = 0; i < count; i++) { + struct name_table_entry key; + struct name_table_entry *nte; assert (new_names[i] != NULL); assert (*new_names[i] != '\0'); - assert (strlen (new_names[i]) < 9); - strcpy (vars[i]->name, new_names[i]); - if (hsh_insert (d->name_tab, vars[i]) != NULL) + assert (strlen (new_names[i]) <= LONG_NAME_LEN ); + strcpy (vars[i]->name, make_short_name(d, new_names[i])); + + + key.longname = vars[i]->longname; + nte = hsh_find (d->long_name_tab, &key); + + free( nte->longname ) ; + nte->longname = strdup ( new_names[i]); + vars[i]->longname = nte->longname; + + if (hsh_insert (d->name_tab, vars[i]) != NULL ) { size_t fail_idx = i; if (err_name != NULL) @@ -547,6 +779,14 @@ dict_rename_vars (struct dictionary *d, { strcpy (vars[i]->name, old_names[i]); hsh_force_insert (d->name_tab, vars[i]); + + key.longname = vars[i]->longname; + nte = hsh_find (d->long_name_tab, &key); + + free( nte->longname ) ; + nte->longname = strdup ( old_names[i]); + vars[i]->longname = nte->longname; + } success = 0; @@ -867,7 +1107,7 @@ dict_create_vector (struct dictionary *d, assert (d != NULL); assert (name != NULL); - assert (strlen (name) > 0 && strlen (name) < 9); + assert (strlen (name) > 0 && strlen (name) <= SHORT_NAME_LEN ); assert (var != NULL); assert (cnt > 0); @@ -877,8 +1117,8 @@ dict_create_vector (struct dictionary *d, d->vector = xrealloc (d->vector, (d->vector_cnt + 1) * sizeof *d->vector); vector = d->vector[d->vector_cnt] = xmalloc (sizeof *vector); vector->idx = d->vector_cnt++; - strncpy (vector->name, name, 8); - vector->name[8] = '\0'; + strncpy (vector->name, name, SHORT_NAME_LEN); + vector->name[SHORT_NAME_LEN] = '\0'; vector->var = xmalloc (cnt * sizeof *var); memcpy (vector->var, var, cnt * sizeof *var); vector->cnt = cnt; @@ -939,3 +1179,82 @@ dict_clear_vectors (struct dictionary *d) d->vector = NULL; d->vector_cnt = 0; } + + +static const char * quasi_base27(int i); + + +/* Convert I to quasi base 27 + The result is a staticly allocated string. +*/ +static const char * +quasi_base27(int i) +{ + static char result[SHORT_NAME_LEN + 1]; + static char reverse[SHORT_NAME_LEN + 1]; + + /* FIXME: check the result cant overflow these arrays */ + + char *s = result ; + const int radix = 27; + int units; + + /* and here's the quasi-ness of this routine */ + i = i + ( i / radix ); + + strcpy(result,""); + do { + units = i % radix; + *s++ = (units > 0 ) ? units + 'A' - 1 : 'A'; + i = i / radix; + } while (i > 0 ) ; + *s = '\0'; + + /* Reverse the result */ + i = strlen(result); + s = reverse; + while(i >= 0) + *s++ = result[--i]; + *s = '\0'; + + return reverse; +} + + +/* Generate a short name, given a long name. + The return value of this function must be freed by the caller. +*/ +static char * +make_short_name(struct dictionary *dict, const char *longname) +{ + int i = 0; + char *p; + + + char *d = xmalloc ( SHORT_NAME_LEN + 1); + + /* Truncate the name */ + strncpy(d, longname, SHORT_NAME_LEN); + d[SHORT_NAME_LEN] = '\0'; + + /* Convert to upper case */ + for ( p = d; *p ; ++p ) + *p = toupper(*p); + + /* If a variable with that name already exists, then munge it + until there's no conflict */ + while (0 != hsh_find (dict->name_tab, d)) + { + const char *suffix = quasi_base27(i++); + + d[SHORT_NAME_LEN - strlen(suffix) - 1 ] = '_'; + d[SHORT_NAME_LEN - strlen(suffix) ] = '\0'; + strcat(d, suffix); + } + + return d; +} + + + + diff --git a/src/dictionary.h b/src/dictionary.h index f375ecc6..e5badf27 100644 --- a/src/dictionary.h +++ b/src/dictionary.h @@ -39,10 +39,15 @@ void dict_get_vars (const struct dictionary *, struct variable *dict_create_var (struct dictionary *, const char *, int width); + +struct variable *dict_create_var_from_short (struct dictionary *d, + const char *shortname, + int width); + struct variable *dict_create_var_assert (struct dictionary *, const char *, int width); struct variable *dict_clone_var (struct dictionary *, const struct variable *, - const char *); + const char *shortname, const char *longname); void dict_rename_var (struct dictionary *, struct variable *, const char *); struct variable *dict_lookup_var (const struct dictionary *, const char *); @@ -100,4 +105,12 @@ const struct vector *dict_lookup_vector (const struct dictionary *, const char *name); void dict_clear_vectors (struct dictionary *); +void dict_get_varname_block(const struct dictionary *dict, char **buf, int *size); + +void dict_add_longvar_entry(struct dictionary *d, const char *name, + const char *longname); + + + + #endif /* dictionary.h */ diff --git a/src/expressions/evaluate.c b/src/expressions/evaluate.c index 5084ba6a..07e4d8ae 100644 --- a/src/expressions/evaluate.c +++ b/src/expressions/evaluate.c @@ -127,7 +127,7 @@ cmd_debug_evaluate (void) dump_postfix = 1; else if (lex_match ('(')) { - char name[MAX_VAR_NAME_LEN + 1]; + char name[LONG_NAME_LEN + 1]; struct variable *v; size_t old_value_cnt; int width; diff --git a/src/file-handle.q b/src/file-handle.q index 5c480079..3a688a7f 100644 --- a/src/file-handle.q +++ b/src/file-handle.q @@ -421,10 +421,11 @@ fh_init(void) void fh_done(void) { - assert(handle_list); - - ll_destroy(handle_list); - handle_list = 0; + if ( handle_list ) + { + ll_destroy(handle_list); + handle_list = 0; + } } diff --git a/src/file-type.c b/src/file-type.c index a4940c23..adf81a99 100644 --- a/src/file-type.c +++ b/src/file-type.c @@ -44,7 +44,7 @@ enum /* Limited variable column specifications. */ struct col_spec { - char name[9]; /* Variable name. */ + char name[SHORT_NAME_LEN + 1]; /* Variable name. */ int fc, nc; /* First column (1-based), # of columns. */ int fmt; /* Format type. */ struct variable *v; /* Variable. */ diff --git a/src/flip.c b/src/flip.c index 9ff81d79..d0949980 100644 --- a/src/flip.c +++ b/src/flip.c @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" #include "error.h" #include #include @@ -34,14 +34,16 @@ #include "misc.h" #include "settings.h" #include "str.h" +#include "val.h" #include "var.h" #include "vfm.h" + /* List of variable names. */ struct varname { struct varname *next; - char name[9]; + char name[SHORT_NAME_LEN + 1]; }; /* Represents a FLIP input program. */ @@ -204,8 +206,8 @@ make_new_var (char name[]) /* Add numeric extensions until acceptable. */ { - int len = (int) strlen (name); - char n[9]; + const int len = (int) strlen (name); + char n[SHORT_NAME_LEN + 1]; int i; for (i = 1; i < 10000000; i++) @@ -242,7 +244,7 @@ build_dictionary (struct flip_pgm *flip) for (i = 0; i < flip->case_cnt; i++) { struct variable *v; - char s[9]; + char s[SHORT_NAME_LEN + 1]; sprintf (s, "VAR%03d", i); v = dict_create_var_assert (default_dict, s, 0); @@ -283,7 +285,7 @@ flip_sink_create (struct flip_pgm *flip) /* Write variable names as first case. */ for (i = 0; i < flip->var_cnt; i++) - st_bare_pad_copy (info->output_buf[i].s, flip->var[i]->name, 8); + st_bare_pad_copy (info->output_buf[i].s, flip->var[i]->name, MAX_SHORT_STRING); if (fwrite (info->output_buf, sizeof *info->output_buf, flip->var_cnt, flip->file) != (size_t) flip->var_cnt) msg (FE, _("Error writing FLIP file: %s."), strerror (errno)); @@ -321,13 +323,13 @@ flip_sink_write (struct case_sink *sink, const struct ccase *c) { char name[INT_DIGITS + 2]; sprintf (name, "V%d", (int) f); - strncpy (v->name, name, 8); - name[8] = 0; + strncpy (v->name, name, SHORT_NAME_LEN); + name[SHORT_NAME_LEN] = 0; } } else { - int width = min (flip->new_names->width, 8); + int width = min (flip->new_names->width, MAX_SHORT_STRING); memcpy (v->name, case_str (c, flip->idx_to_fv[flip->new_names->index]), width); v->name[width] = 0; diff --git a/src/format.h b/src/format.h index 470c45cb..7b8b432e 100644 --- a/src/format.h +++ b/src/format.h @@ -71,6 +71,24 @@ struct fmt_spec int d; /* Number of implied decimal places. */ }; + +enum alignment + { + ALIGN_LEFT = 0, + ALIGN_RIGHT = 1, + ALIGN_CENTRE = 2 + }; + + +enum measure + { + MEASURE_NOMINAL=1, + MEASURE_ORDINAL=2, + MEASURE_SCALE=3 + }; + + + /* Descriptions of all the display formats above. */ extern struct fmt_desc formats[]; diff --git a/src/get.c b/src/get.c index 057b5072..953ca7c5 100644 --- a/src/get.c +++ b/src/get.c @@ -191,10 +191,13 @@ static trns_free_func save_trns_free; static struct save_trns * cmd_save_internal (void) { - struct file_handle *fh; + struct file_handle *fh = NULL; struct dictionary *dict = NULL; struct save_trns *t = NULL; int compress = get_scompression (); + const int default_version = 3; + int version = default_version; + short no_name_table = 0; t = xmalloc (sizeof *t); t->h.proc = save_trns_proc; @@ -203,12 +206,59 @@ cmd_save_internal (void) t->map = NULL; case_nullify (&t->bounce); - lex_match ('/'); - if (lex_match_id ("OUTFILE")) - lex_match ('='); - fh = fh_parse (); - if (fh == NULL) - goto error; + + /* Read most of the subcommands. */ + for (;;) + { + if (lex_match_id ("VERSION")) + { + lex_match ('='); + if ( lex_force_num() ) + { + lex_get(); + version = tokval; + + if ( 0 == strncasecmp (tokid,"x", 1) ) + { + lex_get(); + no_name_table = 1; + } + + } + } + else if (lex_match_id ("OUTFILE")) + { + lex_match ('='); + + fh = fh_parse (); + if (fh == NULL) + goto error; + + } + if ( ! lex_match('/') ) + break; + + } + + if (token != '.') + { + lex_error (_("expecting end of command")); + goto error; + } + + if ( fh == NULL ) + { + msg ( ME, _("The required %s subcommand was not present"), "OUTFILE"); + goto error; + } + + if ( version != default_version ) + { + msg (MW, _("Unsupported sysfile version: %d. Using version %d instead."), + version, default_version); + + version = default_version; + } dict = dict_clone (default_dict); start_case_map (dict); @@ -218,7 +268,7 @@ cmd_save_internal (void) if (t->map != NULL) case_create (&t->bounce, dict_get_next_value_idx (dict)); - t->writer = sfm_open_writer (fh, dict, compress); + t->writer = sfm_open_writer (fh, dict, compress, no_name_table); if (t->writer == NULL) goto error; @@ -439,7 +489,7 @@ rename_variables (struct dictionary *dict) if (!lex_force_match ('=') || !lex_force_id ()) return 0; - if (!strncmp (tokid, v->name, 8)) + if (!strncmp (tokid, v->name, SHORT_NAME_LEN)) return 1; if (dict_lookup_var (dict, tokid) != NULL) { @@ -610,8 +660,9 @@ struct mtf_file struct file_handle *handle; /* File handle. */ struct sfm_reader *reader; /* System file reader. */ struct dictionary *dict; /* Dictionary from system file. */ - char in[9]; /* Name of the variable from IN=. */ - char first[9], last[9]; /* Name of the variables from FIRST=, LAST=. */ + char in[SHORT_NAME_LEN + 1]; /* Name of the variable from IN=. */ + char first[SHORT_NAME_LEN + 1]; + char last[SHORT_NAME_LEN + 1]; /* Name of the variables from FIRST=, LAST=. */ struct ccase input; /* Input record. */ }; @@ -1385,7 +1436,7 @@ mtf_merge_dictionary (struct dictionary *const m, struct mtf_file *f) mv->label = xstrdup (dv->label); if (!mv) { - mv = dict_clone_var (m, dv, dv->name); + mv = dict_clone_var (m, dv, dv->name, dv->longname); assert (mv != NULL); } else if (mv->width != dv->width) diff --git a/src/lexer.c b/src/lexer.c index e4b6aaee..568a87e3 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -48,10 +48,10 @@ int token; double tokval; /* T_ID: the identifier. */ -char tokid[9]; +char tokid[LONG_NAME_LEN + 1]; /* T_ID, T_STRING: token string value. - For T_ID, this is not truncated to 8 characters as is tokid. */ + For T_ID, this is not truncated to SHORT_NAME_LEN characters as is tokid. */ struct string tokstr; /* Static variables. */ @@ -116,8 +116,8 @@ restore_token (void) assert (put_token != 0); token = put_token; ds_replace (&tokstr, ds_c_str (&put_tokstr)); - strncpy (tokid, ds_c_str (&put_tokstr), 8); - tokid[8] = 0; + strncpy (tokid, ds_c_str (&put_tokstr), SHORT_NAME_LEN); + tokid[SHORT_NAME_LEN] = 0; tokval = put_tokval; put_token = 0; } @@ -137,6 +137,8 @@ save_token (void) void lex_get (void) { + int i; + /* If a token was pushed ahead, return it. */ if (put_token) { @@ -354,13 +356,17 @@ lex_get (void) } /* Copy id to tokstr. */ - ds_putc (&tokstr, toupper ((unsigned char) *prog++)); + ds_putc (&tokstr, *prog++); while (CHAR_IS_IDN (*prog)) - ds_putc (&tokstr, toupper ((unsigned char) *prog++)); + ds_putc (&tokstr, *prog++); + + /* Copy tokstr to tokid, truncating it to LONG_NAME_LEN characters.*/ + strncpy (tokid, ds_c_str (&tokstr), LONG_NAME_LEN); + tokid[LONG_NAME_LEN] = 0; - /* Copy tokstr to tokid, truncating it to 8 characters. */ - strncpy (tokid, ds_c_str (&tokstr), 8); - tokid[8] = 0; + /* Convert to upper case */ + for ( i = 0 ; i < ds_length(&tokstr) ; ++i ) + tokstr.string[i] = toupper(tokstr.string[i]); token = lex_id_to_token (ds_c_str (&tokstr), ds_length (&tokstr)); break; @@ -714,8 +720,8 @@ lex_put_back_id (const char *id) save_token (); token = T_ID; ds_replace (&tokstr, id); - strncpy (tokid, ds_c_str (&tokstr), 8); - tokid[8] = 0; + strncpy (tokid, ds_c_str (&tokstr), SHORT_NAME_LEN); + tokid[SHORT_NAME_LEN] = 0; } /* Weird line processing functions. */ diff --git a/src/lexer.h b/src/lexer.h index 95553f10..71e24af0 100644 --- a/src/lexer.h +++ b/src/lexer.h @@ -20,6 +20,7 @@ #if !lexer_h #define lexer_h 1 +#include "var.h" #include #include "bool.h" @@ -72,10 +73,9 @@ enum T_N_KEYWORDS = T_LAST_KEYWORD - T_FIRST_KEYWORD + 1 }; - extern int token; extern double tokval; -extern char tokid[9]; +extern char tokid[LONG_NAME_LEN + 1]; extern struct string tokstr; #include diff --git a/src/loop.c b/src/loop.c index 6470d7ce..bfe04d11 100644 --- a/src/loop.c +++ b/src/loop.c @@ -166,7 +166,7 @@ static int internal_cmd_loop (void) { /* Name of indexing variable if applicable. */ - char name[9]; + char name[SHORT_NAME_LEN + 1]; /* Create and initialize transformations to facilitate error-handling. */ diff --git a/src/modify-vars.c b/src/modify-vars.c index 5cddfe15..4911664d 100644 --- a/src/modify-vars.c +++ b/src/modify-vars.c @@ -358,7 +358,7 @@ compare_variables_given_ordering (const void *a_, const void *b_, struct var_renaming { struct variable *var; - char new_name[9]; + char new_name[SHORT_NAME_LEN + 1]; }; /* A algo_compare_func that compares new_name members in struct diff --git a/src/pfm-read.c b/src/pfm-read.c index 50b15c54..d55f2f6e 100644 --- a/src/pfm-read.c +++ b/src/pfm-read.c @@ -497,7 +497,7 @@ read_variables (struct pfm_reader *r, struct dictionary *dict) if (match (r, '6')) { weight_name = read_pool_string (r); - if (strlen (weight_name) > 8) + if (strlen (weight_name) > SHORT_NAME_LEN) error (r, _("Weight variable name (%s) truncated."), weight_name); } @@ -520,7 +520,29 @@ read_variables (struct pfm_reader *r, struct dictionary *dict) read_string (r, name); for (j = 0; j < 6; j++) fmt[j] = read_int (r); +#if 0 + /* Weirdly enough, there is no # character in the SPSS portable + character set, so we can't check for it. */ + if (strlen (name) > SHORT_NAME_LEN) + lose ((r, _("position %d: Variable name has %u characters."), + i, strlen (name))); + if ((name[0] < 74 /* A */ || name[0] > 125 /* Z */) + && name[0] != 152 /* @ */) + lose ((r, _("position %d: Variable name begins with invalid " + "character."), i)); + if (name[0] >= 100 /* a */ && name[0] <= 125 /* z */) + { + corrupt_msg (r, _("position %d: Variable name begins with " + "lowercase letter %c."), + i, name[0] - 100 + 'a'); + name[0] -= 26 /* a - A */; + } + /* Verify remaining characters of variable name. */ + for (j = 1; j < (int) strlen (name); j++) + { + int c = name[j]; +#endif if (!var_is_valid_name (name, false) || *name == '#') error (r, _("position %d: Invalid variable name `%s'."), name); st_uppercase (name); diff --git a/src/plot-chart.c b/src/plot-chart.c index ae90a7e3..f0119b55 100644 --- a/src/plot-chart.c +++ b/src/plot-chart.c @@ -166,7 +166,8 @@ chart_write_title(struct chart *chart, const char *title, ...) va_list ap; char buf[100]; - assert(chart); + if ( ! chart ) + return ; pl_savestate_r(chart->lp); pl_ffontsize_r(chart->lp,chart->font_size * 1.5); @@ -250,8 +251,8 @@ chart_write_yscale(struct chart *ch, double smin, double smax, int ticks) chart_rounded_tick( (smax - smin) / (double) ticks); - assert (ch) ; - + if ( !ch ) + return; ch->y_max = ceil ( smax / tick_interval ) * tick_interval ; ch->y_min = floor ( smin / tick_interval ) * tick_interval ; diff --git a/src/plot-hist.c b/src/plot-hist.c index ebfcd3f1..6b2e7f9f 100644 --- a/src/plot-hist.c +++ b/src/plot-hist.c @@ -39,6 +39,9 @@ void histogram_write_legend(struct chart *ch, const struct normal_curve *norm) { char buf[100]; + if ( !ch ) + return ; + pl_savestate_r(ch->lp); sprintf(buf,"N = %.2f",norm->N); @@ -66,6 +69,8 @@ hist_draw_bar(struct chart *ch, const gsl_histogram *hist, int bar) double lower; double height; + if ( !ch ) + return ; const size_t bins = gsl_histogram_bins(hist); const double x_pos = (ch->data_right - ch->data_left) * bar / (double) bins ; const double width = (ch->data_right - ch->data_left) / (double) bins ; diff --git a/src/recode.c b/src/recode.c index 0a0aa61a..36bb590e 100644 --- a/src/recode.c +++ b/src/recode.c @@ -66,7 +66,7 @@ struct rcd_var struct variable *src; /* Source variable. */ struct variable *dest; /* Destination variable. */ - char dest_name[9]; /* Name of dest variable if we're creating it. */ + char dest_name[SHORT_NAME_LEN + 1]; /* Name of dest variable if we're creating it. */ int has_sysmis; /* Do we recode for SYSMIS? */ union value sysmis; /* Coding for SYSMIS (if src is numeric). */ diff --git a/src/repeat.c b/src/repeat.c index 4a5bf2f9..42467096 100644 --- a/src/repeat.c +++ b/src/repeat.c @@ -40,7 +40,7 @@ struct repeat_entry { int type; /* 1=variable names, 0=any other. */ - char id[9]; /* Macro identifier. */ + char id[SHORT_NAME_LEN + 1]; /* Macro identifier. */ char **replacement; /* Macro replacement. */ struct repeat_entry *next; }; @@ -125,7 +125,7 @@ static int internal_cmd_do_repeat (void) { /* Name of first DO REPEAT macro. */ - char first_name[9]; + char first_name[SHORT_NAME_LEN + 1]; /* Current filename. */ const char *current_filename = NULL; @@ -553,12 +553,12 @@ perform_DO_REPEAT_substitutions (void) /* Collect an identifier. */ { - char name[9]; + char name[SHORT_NAME_LEN + 1]; char *start = cp; char *np = name; char *substitution; - while (CHAR_IS_IDN (*cp) && np < &name[8]) + while (CHAR_IS_IDN (*cp) && np < &name[SHORT_NAME_LEN]) *np++ = *cp++; while (CHAR_IS_IDN (*cp)) cp++; diff --git a/src/sfm-read.c b/src/sfm-read.c index d4829122..e854e1ba 100644 --- a/src/sfm-read.c +++ b/src/sfm-read.c @@ -320,10 +320,69 @@ sfm_open_reader (struct file_handle *fh, struct dictionary **dict, break; case 5: - case 6: - case 11: /* ?? Used by SPSS 8.0. */ + case 6: /* ?? Used by SPSS 8.0. */ skip = 1; break; + + case 11: /* Variable display parameters */ + { + const int n_vars = data.count / 3 ; + int i; + if ( data.count % 3 ) + { + msg (MW, _("%s: Invalid subrecord length. " + "Record: 7; Subrecord: 11"), + handle_get_filename (r->fh)); + skip = 1; + } + + for ( i = 0 ; i < n_vars ; ++i ) + { + struct + { + int32 measure P; + int32 width P; + int32 align P; + } + params; + + struct variable *v; + + assertive_buf_read (r, ¶ms, sizeof(params), 0); + + v = dict_get_var(*dict, i); + + v->measure = params.measure; + v->display_width = params.width; + v->alignment = params.align; + } + } + break; + + case 13: /* SPSS 12.0 Long variable name map */ + { + + char *s; + char *buf = xmalloc(data.size * data.count + 1); + char *tbuf ; + assertive_buf_read (r, buf, data.size * data.count, 0); + buf[data.size * data.count]='\0'; + + s = strtok_r(buf, "\t", &tbuf); + while ( s ) + { + char *shortname, *longname; + shortname = strsep(&s,"="); + longname = strsep(&s,"="); + + dict_add_longvar_entry(*dict, shortname, longname); + + s = strtok_r(0,"\t", &tbuf); + } + + free (buf); + } + break; default: msg (MW, _("%s: Unrecognized record type 7, subtype %d " @@ -628,6 +687,8 @@ read_variables (struct sfm_reader *r, int next_value = 0; /* Index to next `value' structure. */ size_t var_cap = 0; + assert(r); + /* Allocate variables. */ *var_by_idx = xmalloc (sizeof **var_by_idx * r->value_cnt); @@ -706,7 +767,7 @@ read_variables (struct sfm_reader *r, name[0] = toupper ((unsigned char) (sv.name[0])); /* Copy remaining characters of variable name. */ - for (j = 1; j < 8; j++) + for (j = 1; j < SHORT_NAME_LEN; j++) { int c = (unsigned char) sv.name[j]; @@ -730,7 +791,7 @@ read_variables (struct sfm_reader *r, name[j] = 0; /* Create variable. */ - vv = (*var_by_idx)[i] = dict_create_var (dict, name, sv.type); + vv = (*var_by_idx)[i] = dict_create_var_from_short (dict, name, sv.type); if (vv == NULL) lose ((ME, _("%s: Duplicate variable name `%s' within system file."), handle_get_filename (r->fh), name)); @@ -757,11 +818,14 @@ read_variables (struct sfm_reader *r, "length %d."), handle_get_filename (r->fh), vv->name, len)); - /* Read label into variable structure. */ - vv->label = buf_read (r, NULL, ROUND_UP (len, sizeof (int32)), len + 1); - if (vv->label == NULL) - goto error; - vv->label[len] = '\0'; + if ( len != 0 ) + { + /* Read label into variable structure. */ + vv->label = buf_read (r, NULL, ROUND_UP (len, sizeof (int32)), len + 1); + if (vv->label == NULL) + goto error; + vv->label[len] = '\0'; + } } /* Set missing values. */ @@ -1079,8 +1143,15 @@ error: static void * buf_read (struct sfm_reader *r, void *buf, size_t byte_cnt, size_t min_alloc) { - if (buf == NULL) + assert (r); + + if (buf == NULL && byte_cnt > 0 ) buf = xmalloc (max (byte_cnt, min_alloc)); + + if ( byte_cnt == 0 ) + return buf; + + if (1 != fread (buf, byte_cnt, 1, r->file)) { if (ferror (r->file)) diff --git a/src/sfm-write.c b/src/sfm-write.c index aedb5a8a..f09834b3 100644 --- a/src/sfm-write.c +++ b/src/sfm-write.c @@ -87,6 +87,14 @@ static int write_variable (struct sfm_writer *, struct variable *); static int write_value_labels (struct sfm_writer *, struct variable *, int idx); static int write_rec_7_34 (struct sfm_writer *); + +static int write_longvar_table (struct sfm_writer *w, + const struct dictionary *dict); + +static int write_variable_display_parameters (struct sfm_writer *w, + const struct dictionary *dict); + + static int write_documents (struct sfm_writer *, const struct dictionary *); static int does_dict_need_translation (const struct dictionary *); @@ -98,13 +106,15 @@ var_flt64_cnt (const struct variable *v) /* Opens the system file designated by file handle FH for writing cases from dictionary D. If COMPRESS is nonzero, the - system file will be compressed. + system file will be compressed. If OMIT_LONGNAMES is nonzero, the + long name table will be omitted. No reference to D is retained, so it may be modified or destroyed at will after this function returns. */ struct sfm_writer * sfm_open_writer (struct file_handle *fh, - const struct dictionary *d, int compress) + const struct dictionary *d, int compress, + short omit_longnames) { struct sfm_writer *w = NULL; int idx; @@ -167,9 +177,22 @@ sfm_open_writer (struct file_handle *fh, if (dict_get_documents (d) != NULL && !write_documents (w, d)) goto error; + if (!write_rec_7_34 (w)) goto error; + + /* Write variable display info. */ + if ( !write_variable_display_parameters(w, d)) + goto error; + + + if ( ! omit_longnames ) + { + if (!write_longvar_table (w, d)) + goto error; + } + /* Write record 999. */ { struct @@ -397,7 +420,7 @@ write_variable (struct sfm_writer *w, struct variable *v) write_format_spec (&v->print, &sv.print); write_format_spec (&v->write, &sv.write); memcpy (sv.name, v->name, strlen (v->name)); - memset (&sv.name[strlen (v->name)], ' ', 8 - strlen (v->name)); + memset (&sv.name[strlen (v->name)], ' ', SHORT_NAME_LEN - strlen (v->name)); if (!buf_write (w, &sv, sizeof sv)) return 0; @@ -543,6 +566,93 @@ write_documents (struct sfm_writer *w, const struct dictionary *d) return 1; } +/* Write the alignment, width and scale values */ +static int +write_variable_display_parameters (struct sfm_writer *w, + const struct dictionary *dict) +{ + int i; + + struct + { + int32 rec_type P; + int32 subtype P; + int32 elem_size P; + int32 n_elem P; + } vdp_hdr; + + vdp_hdr.rec_type = 7; + vdp_hdr.subtype = 11; + vdp_hdr.elem_size = 4; + vdp_hdr.n_elem = w->var_cnt * 3; + + if (!buf_write (w, &vdp_hdr, sizeof vdp_hdr)) + return 0; + + for ( i = 0 ; i < w->var_cnt ; ++i ) + { + struct variable *v; + struct + { + int32 measure P; + int32 width P; + int32 align P; + } + params; + + v = dict_get_var(dict, i); + + params.measure = v->measure; + params.width = v->display_width; + params.align = v->alignment; + + if (!buf_write (w, ¶ms, sizeof(params))) + return 0; + } + + return 1; +} + +/* Writes the long variable name table */ +static int +write_longvar_table (struct sfm_writer *w, const struct dictionary *dict) +{ + char *buf = 0; + int bufsize = 0; + + struct + { + int32 rec_type P; + int32 subtype P; + int32 elem_size P; + int32 n_elem P; + } lv_hdr; + + lv_hdr.rec_type = 7; + lv_hdr.subtype = 13; + lv_hdr.elem_size = 1; + + + dict_get_varname_block(dict, &buf, &bufsize); + + if ( bufsize == 0 ) + return 1; + + lv_hdr.n_elem = bufsize ; + + if (!buf_write (w, &lv_hdr, sizeof(lv_hdr) )) + goto error; + + if (!buf_write (w, buf, bufsize)) + goto error; + + return 1; + + error: + free ( buf ) ; + return 0; +} + /* Writes record type 7, subtypes 3 and 4. */ static int write_rec_7_34 (struct sfm_writer *w) diff --git a/src/sfm-write.h b/src/sfm-write.h index 82cf2c95..f91ffd08 100644 --- a/src/sfm-write.h +++ b/src/sfm-write.h @@ -26,7 +26,9 @@ struct file_handle; struct dictionary; struct ccase; struct sfm_writer *sfm_open_writer (struct file_handle *, - const struct dictionary *, int compress); + const struct dictionary *, + int compress, short omit_longnames); + int sfm_write_case (struct sfm_writer *, struct ccase *); void sfm_close_writer (struct sfm_writer *); diff --git a/src/sfmP.h b/src/sfmP.h index 8fb79e3f..29e8c7cf 100644 --- a/src/sfmP.h +++ b/src/sfmP.h @@ -88,7 +88,7 @@ struct sysfile_variable int32 n_missing_values P; /* Missing value code of -3,-2,0,1,2, or 3. */ int32 print P; /* Print format. */ int32 write P; /* Write format. */ - char name[8] P; /* Variable name. */ + char name[SHORT_NAME_LEN] P; /* Variable name. */ /* The rest of the structure varies. */ }; diff --git a/src/val-labs.c b/src/val-labs.c index 35158b77..12817700 100644 --- a/src/val-labs.c +++ b/src/val-labs.c @@ -113,7 +113,7 @@ verify_val_labs (struct variable **vars, int var_cnt) { struct variable *vp = vars[i]; - if (vp->type == ALPHA && vp->width > 8) + if (vp->type == ALPHA && vp->width > MAX_SHORT_STRING) { msg (SE, _("It is not possible to assign value labels to long " "string variables such as %s."), vp->name); diff --git a/src/val.h b/src/val.h index 353141b9..c4b96b1a 100644 --- a/src/val.h +++ b/src/val.h @@ -36,8 +36,8 @@ then short string missing values can be truncated in system files because there's only room for as many characters as can fit in a flt64. */ -#if MAX_SHORT_STRING > 8 -#error MAX_SHORT_STRING must be less than 8. +#if MAX_SHORT_STRING > SHORT_NAME_LEN +#error MAX_SHORT_STRING must be less than or equal to SHORT_NAME_LEN. #endif /* Special values. */ diff --git a/src/var-display.c b/src/var-display.c new file mode 100644 index 00000000..47147dfb --- /dev/null +++ b/src/var-display.c @@ -0,0 +1,154 @@ +/* PSPP - computes sample statistics. + Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. + Written by John Darrington + + 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#include +#include +#include +#include "alloc.h" +#include "command.h" +#include "error.h" +#include "lexer.h" +#include "str.h" +#include "var.h" + +#include "debug-print.h" + +/* Set variables' alignment + This is the alignment for GUI display only. + It affects nothing but GUIs +*/ +int +cmd_variable_alignment (void) +{ + do + { + struct variable **v; + int nv; + + int i; + enum alignment align; + + + if (!parse_variables (default_dict, &v, &nv, PV_NONE)) + return CMD_PART_SUCCESS_MAYBE; + + if ( lex_force_match('(') ) + { + if ( lex_match_id("LEFT")) + align = ALIGN_LEFT; + else if ( lex_match_id("RIGHT")) + align = ALIGN_RIGHT; + else if ( lex_match_id("CENTER")) + align = ALIGN_CENTRE; + else + return CMD_FAILURE; + + lex_force_match(')'); + } + + for( i = 0 ; i < nv ; ++i ) + v[i]->alignment = align; + + + while (token == '/') + lex_get (); + free (v); + + } + while (token != '.'); + return CMD_SUCCESS; +} + +/* Set variables' display width. + This is the width for GUI display only. + It affects nothing but GUIs +*/ +int +cmd_variable_width (void) +{ + do + { + struct variable **v; + int nv; + int i; + + if (!parse_variables (default_dict, &v, &nv, PV_NONE)) + return CMD_PART_SUCCESS_MAYBE; + + if ( lex_force_match('(') ) + { + if ( lex_force_int()) + lex_get(); + else + return CMD_FAILURE; + lex_force_match(')'); + } + + for( i = 0 ; i < nv ; ++i ) + v[i]->display_width = tokval; + + while (token == '/') + lex_get (); + free (v); + + } + while (token != '.'); + return CMD_SUCCESS; +} + +/* Set variables' measurement level */ +int +cmd_variable_level (void) +{ + do + { + struct variable **v; + int nv; + enum measure level; + int i; + + if (!parse_variables (default_dict, &v, &nv, PV_NONE)) + return CMD_PART_SUCCESS_MAYBE; + + if ( lex_force_match('(') ) + { + if ( lex_match_id("SCALE")) + level = MEASURE_SCALE; + else if ( lex_match_id("ORDINAL")) + level = MEASURE_ORDINAL; + else if ( lex_match_id("NOMINAL")) + level = MEASURE_NOMINAL; + else + return CMD_FAILURE; + + lex_force_match(')'); + } + + for( i = 0 ; i < nv ; ++i ) + v[i]->measure = level ; + + + while (token == '/') + lex_get (); + free (v); + + } + while (token != '.'); + return CMD_SUCCESS; +} diff --git a/src/var.h b/src/var.h index 680a4c3c..f13606be 100644 --- a/src/var.h +++ b/src/var.h @@ -20,11 +20,15 @@ #if !var_h #define var_h 1 + #include +#include "config.h" #include "bool.h" #include "format.h" #include "val.h" + + /* Script variables. */ /* Variable type. */ @@ -54,12 +58,12 @@ enum MISSING_COUNT }; -#define MAX_VAR_NAME_LEN 8 /* A variable's dictionary entry. */ struct variable { - char name[MAX_VAR_NAME_LEN + 1]; /* As a string. */ + char name[SHORT_NAME_LEN + 1]; /* As a string. */ + char *longname; /* Pointer to entry in dictionary's table */ int index; /* Index into its dictionary's var[]. */ int type; /* NUMERIC or ALPHA. */ @@ -80,14 +84,34 @@ struct variable struct val_labs *val_labs; /* Value labels. */ char *label; /* Variable label. */ + + /* GUI display parameters */ + enum measure measure; /* Nominal ordinal or continuous */ + int display_width; /* Width of data editor column */ + enum alignment alignment; /* Alignment of data in gui */ + /* Per-command info. */ void *aux; void (*aux_dtor) (struct variable *); }; + +/* A tuple containing short names and longnames */ +struct name_table_entry +{ + char *longname; + char *name; +}; + bool var_is_valid_name (const char *, bool issue_error); int compare_var_names (const void *, const void *, void *); unsigned hash_var_name (const void *, void *); + + +unsigned hash_long_name (const void *e_, void *aux UNUSED) ; +int compare_long_names(const void *a_, const void *b_, void *aux); + + int compare_var_ptr_names (const void *, const void *, void *); unsigned hash_var_ptr_name (const void *, void *); @@ -112,7 +136,7 @@ const char *dict_class_to_name (enum dict_class dict_class); struct vector { int idx; /* Index for dict_get_vector(). */ - char name[9]; /* Name. */ + char name[SHORT_NAME_LEN + 1]; /* Name. */ struct variable **var; /* Vector of variables. */ int cnt; /* Number of variables. */ }; diff --git a/src/vars-atr.c b/src/vars-atr.c index f8262e1c..19effedc 100644 --- a/src/vars-atr.c +++ b/src/vars-atr.c @@ -249,11 +249,11 @@ var_is_valid_name (const char *name, bool issue_error) msg (SE, _("Variable names must be at least 1 character long.")); return false; } - else if (length > MAX_VAR_NAME_LEN) + else if (length > SHORT_NAME_LEN) { if (issue_error) msg (SE, _("Variable name %s exceeds %d-character limit."), - (int) MAX_VAR_NAME_LEN); + (int) SHORT_NAME_LEN); return false; } diff --git a/src/vars-prs.c b/src/vars-prs.c index 9a559d2e..dbc14755 100644 --- a/src/vars-prs.c +++ b/src/vars-prs.c @@ -134,6 +134,7 @@ parse_variables (const struct dictionary *d, struct variable ***var, assert (var != NULL); assert (cnt != NULL); + vs = var_set_create_from_dict (d); success = parse_var_set_vars (vs, var, cnt, opts); if ( success == 0 ) @@ -266,7 +267,7 @@ parse_var_set_vars (const struct var_set *vs, else included = NULL; - if (lex_match (T_ALL)) +if (lex_match (T_ALL)) add_variables (v, nv, &mv, included, pv_opts, vs, 0, var_set_get_cnt (vs) - 1, DC_ORDINARY); else @@ -302,7 +303,6 @@ parse_var_set_vars (const struct var_set *vs, first_var->name, last_var->name); goto fail; } - if (class != last_class) { msg (SE, _("When using the TO keyword to specify several " @@ -409,10 +409,10 @@ parse_DATA_LIST_vars (char ***names, int *nnames, int pv_opts) *names = NULL; } - name1 = xmalloc (36); - name2 = &name1[1 * 9]; - root1 = &name1[2 * 9]; - root2 = &name1[3 * 9]; + name1 = xmalloc (4 * (SHORT_NAME_LEN + 1)); + name2 = &name1[1 * SHORT_NAME_LEN + 1]; + root1 = &name1[2 * SHORT_NAME_LEN + 1]; + root2 = &name1[3 * SHORT_NAME_LEN + 1]; do { if (token != T_ID) @@ -464,7 +464,7 @@ parse_DATA_LIST_vars (char ***names, int *nnames, int pv_opts) for (n = n1; n <= n2; n++) { - (*names)[nvar] = xmalloc (9); + (*names)[nvar] = xmalloc (SHORT_NAME_LEN + 1); sprintf ((*names)[nvar], "%s%0*d", root1, d1, n); nvar++; } @@ -594,7 +594,7 @@ var_set_lookup_var_idx (const struct var_set *vs, const char *name) { assert (vs != NULL); assert (name != NULL); - assert (strlen (name) < 9); + assert (strlen (name) <= LONG_NAME_LEN ); return vs->lookup_var_idx (vs, name); } @@ -662,6 +662,7 @@ struct array_var_set struct variable *const *var;/* Array of variables. */ size_t var_cnt; /* Number of elements in var. */ struct hsh_table *name_tab; /* Hash from variable names to variables. */ + struct hsh_table *longname_tab; /* Hash of short names indexed by long names */ }; /* Returns the number of variables in VS. */ @@ -688,10 +689,26 @@ array_var_set_get_var (const struct var_set *vs, size_t idx) static int array_var_set_lookup_var_idx (const struct var_set *vs, const char *name) { + char *short_name ; struct array_var_set *avs = vs->aux; struct variable v, *vp, *const *vpp; - strcpy (v.name, name); + struct name_table_entry key; + key.longname = name; + + struct name_table_entry *nte; + + assert (avs->longname_tab); + + + nte = hsh_find (avs->longname_tab, &key); + + if (!nte) + return -1; + + short_name = nte->name; + + strcpy (v.name, short_name); vp = &v; vpp = hsh_find (avs->name_tab, &vp); return vpp != NULL ? vpp - avs->var : -1; @@ -704,6 +721,7 @@ array_var_set_destroy (struct var_set *vs) struct array_var_set *avs = vs->aux; hsh_destroy (avs->name_tab); + hsh_destroy (avs->longname_tab); free (avs); free (vs); } @@ -726,14 +744,35 @@ var_set_create_from_array (struct variable *const *var, size_t var_cnt) avs->var = var; avs->var_cnt = var_cnt; avs->name_tab = hsh_create (2 * var_cnt, - compare_var_ptr_names, hash_var_ptr_name, NULL, - NULL); - for (i = 0; i < var_cnt; i++) - if (hsh_insert (avs->name_tab, (void *) &var[i]) != NULL) - { - var_set_destroy (vs); - return NULL; - } + compare_var_ptr_names, hash_var_ptr_name, + NULL, NULL); + + avs->longname_tab = hsh_create (2 * var_cnt, + compare_long_names, hash_long_name, + NULL, NULL); + for (i = 0; i < var_cnt; i++) + { + struct name_table_entry *nte ; + + if (hsh_insert (avs->name_tab, &var[i]) != NULL) + { + var_set_destroy (vs); + return NULL; + } + + nte = xmalloc (sizeof (*nte)); + nte->name = strdup(var[i]->name); + nte->longname = strdup(var[i]->longname); + + if (hsh_insert (avs->longname_tab, nte) != NULL) + { + var_set_destroy (vs); + free (nte); + return NULL; + } + + } + return vs; } diff --git a/src/vector.c b/src/vector.c index 2a712a62..9a0d7492 100644 --- a/src/vector.c +++ b/src/vector.c @@ -113,7 +113,7 @@ cmd_vector (void) int ndig; /* Name of an individual variable to be created. */ - char name[9]; + char name[SHORT_NAME_LEN + 1]; /* Vector variables. */ struct variable **v; @@ -131,13 +131,13 @@ cmd_vector (void) if (!lex_force_match (')')) goto fail; - /* First check that all the generated variable names are 8 + /* First check that all the generated variable names are SHORT_NAME_LEN characters or shorter. */ ndig = intlog10 (nv); for (cp = vecnames; *cp;) { int len = strlen (cp); - if (len + ndig > 8) + if (len + ndig > SHORT_NAME_LEN) { msg (SE, _("%s%d is too long for a variable name."), cp, nv); goto fail; diff --git a/tests/Makefile.am b/tests/Makefile.am index 57b819d2..2b2196c0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -20,13 +20,17 @@ TESTS = \ command/lag.sh \ command/list.sh \ command/loop.sh \ + command/longvars.sh \ command/oneway.sh \ command/oneway-missing.sh \ command/oneway-with-splits.sh \ command/permissions.sh \ command/print.sh \ + command/rename.sh \ command/sample.sh \ command/sort.sh \ + command/sysfiles.sh \ + command/sysfiles-old.sh \ command/split-file.sh \ command/t-test-1-indep-val.sh \ command/t-test-1-sample-missing-anal.sh \ @@ -71,6 +75,7 @@ TESTS = \ bugs/val-labs-trailing-slash.sh \ bugs/recode-copy-bug.sh \ bugs/computebug.sh \ + bugs/compute-lv.sh \ bugs/temp-freq.sh \ xforms/casefile.sh \ stats/descript-basic.sh \ diff --git a/tests/bugs/compute-lv.sh b/tests/bugs/compute-lv.sh new file mode 100755 index 00000000..3d719942 --- /dev/null +++ b/tests/bugs/compute-lv.sh @@ -0,0 +1,89 @@ +#!/bin/sh + +# This program tests for a bug involving COMPUTE and long variable names + +TEMPDIR=/tmp/pspp-tst-$$ +TESTFILE=$TEMPDIR/`basename $0`.sps + +here=`pwd`; + +# ensure that top_srcdir is absolute +cd $top_srcdir; top_srcdir=`pwd` + +export STAT_CONFIG_PATH=$top_srcdir/config + + +cleanup() +{ + rm -rf $TEMPDIR +} + + +fail() +{ + echo $activity + echo FAILED + cleanup; + exit 1; +} + + +no_result() +{ + echo $activity + echo NO RESULT; + cleanup; + exit 2; +} + +pass() +{ + cleanup; + exit 0; +} + +mkdir -p $TEMPDIR + +cd $TEMPDIR + +activity="Create prog" +cat > $TESTFILE < $TEMPDIR/prog.sps < $TESTFILE < $TEMPDIR/file-lab.stat << EOF - +cat > $TESTFILE << EOF /* Set up a dummy active file in memory. data list /x 1 y 2. @@ -75,8 +74,8 @@ display documents. display file label. /* undocumented feature of PSPP /* Save the active file then get it and display the documents again. -save 'foo.save'. -get 'foo.save'. +save /OUTFILE='foo.save'. +get /FILE='foo.save'. display documents. display file label. /* undocumented feature of PSPP @@ -94,8 +93,8 @@ document There should be another document now. display documents. /* Save and get. -save 'foo.save'. -get 'foo.save'. +save /OUTFILE='foo.save'. +get /FILE='foo.save'. display documents. display file label. /* undocumented feature of PSPP @@ -105,7 +104,7 @@ EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/file-lab.stat +$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi # We need to filter out the dates/times diff --git a/tests/command/filter.sh b/tests/command/filter.sh index 151e43f2..905d21ae 100755 --- a/tests/command/filter.sh +++ b/tests/command/filter.sh @@ -47,7 +47,7 @@ mkdir -p $TEMPDIR cd $TEMPDIR activity="create program" -cat > $TEMPDIR/filter.stat << EOF +cat > $TESTFILE << EOF data list notable /x 1-2. begin data. 1 @@ -76,7 +76,7 @@ if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/filter.stat +$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/list.sh b/tests/command/list.sh index 3bc92aa6..1094f61c 100755 --- a/tests/command/list.sh +++ b/tests/command/list.sh @@ -48,7 +48,7 @@ cd $TEMPDIR activity="create program" -cat > $TEMPDIR/list.stat << foobar +cat > $TESTFILE << EOF *** Single lines. data list file='$top_srcdir/tests/weighting.data'/AVAR 1-5 BVAR 6-10. weight by BVAR. @@ -57,16 +57,16 @@ list. list /format numbered weight. *** Multiple lines. -data list file='$top_srcdir/tests/list.data' notable /X000 to X126 1-127. +data list file='$top_srcdir/tests/list.data' notable /x000 to x126 1-127. *list /cases=from 1 to 25 by 5 /format numbered. list x000 to x030. list /cases=from 1 to 25. -foobar +EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/list.stat +$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TESTFILE if [ $? -ne 0 ] ; then no_result ; fi diff --git a/tests/command/loop.sh b/tests/command/loop.sh index 3fc59788..3c824c9d 100755 --- a/tests/command/loop.sh +++ b/tests/command/loop.sh @@ -48,15 +48,15 @@ cd $TEMPDIR activity="create prog" cat > $TEMPDIR/loop.stat <> $summary_file +done + +cat > "$TEMPDIR/cov.sps" << EOF +DATA LIST FREE FILE='$summary_file' /COVERAGE (PCT8) d1 (a2) lines * d2 (a10) d3 (a10) d4 (a10) d5 (a10) file (a25). + + +AGGREGATE OUTFILE=* + /BREAK=file + /COVERAGE=MIN(COVERAGE). + +SORT CASES BY COVERAGE. + +LIST /COVERAGE file. + +FREQUENCIES /COVERAGE + /HISTOGRAM + /PERCENTILES=25,50,75,90. + +EOF + +src/pspp -o html $TEMPDIR/cov.sps + +rm -rf $TEMPDIR diff --git a/tests/expressions/randist.sh b/tests/expressions/randist.sh index 0f303879..102492ad 100755 --- a/tests/expressions/randist.sh +++ b/tests/expressions/randist.sh @@ -14,8 +14,11 @@ export STAT_CONFIG_PATH=$top_srcdir/config cleanup() { + if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then + echo NOT removing directory $TEMPDIR + return ; + fi rm -rf $TEMPDIR - : } -- 2.30.2