From 985c40f2a83588b25f0e6fe7f7d82863c5d34d43 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Fri, 17 Mar 2006 04:58:24 +0000 Subject: [PATCH] Fixed reading of system files with non-ascii characters in variable names. --- Smake | 2 +- po/en_GB.po | 243 +++++++++++++++------------------ po/pspp.pot | 243 +++++++++++++++------------------ src/data/dictionary.c | 8 +- src/data/identifier.c | 3 +- src/data/sys-file-reader.c | 84 +++++------- src/data/variable.c | 61 +++++++-- src/data/variable.h | 1 + src/language/stats/automake.mk | 3 + 9 files changed, 310 insertions(+), 338 deletions(-) diff --git a/Smake b/Smake index 744bb051..2741599f 100644 --- a/Smake +++ b/Smake @@ -3,7 +3,7 @@ GNULIB = ../gnulib GNULIB_TOOL = $(GNULIB)/gnulib-tool -GNULIB_MODULES = alloca alloca-opt assert full-read full-write \ +GNULIB_MODULES = alloca alloca-opt assert c-ctype full-read full-write \ gethostname getline getlogin_r getopt gettext intprops memcasecmp \ memchr memcmp memmem memmove memset progname readlink restrict \ snprintf stat-macros stdbool stpcpy strcase strcspn strerror strftime \ diff --git a/po/en_GB.po b/po/en_GB.po index 0ce53739..2314c2f5 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: 2006-03-14 15:35+0800\n" +"POT-Creation-Date: 2006-03-17 12:47+0800\n" "PO-Revision-Date: 2004-01-23 13:04+0800\n" "Last-Translator: John Darrington \n" "Language-Team: John Darrington \n" @@ -387,27 +387,27 @@ msgid "%s variables are not compatible with %s format %s." msgstr "" #: src/data/format.c:197 src/data/por-file-reader.c:480 -#: src/data/sys-file-reader.c:1013 src/data/sys-file-reader.c:1022 +#: src/data/sys-file-reader.c:994 src/data/sys-file-reader.c:1003 #: src/ui/gui/psppire-var-store.c:430 msgid "String" msgstr "" #: src/data/format.c:197 src/data/por-file-reader.c:480 -#: src/data/sys-file-reader.c:1013 src/data/sys-file-reader.c:1022 +#: src/data/sys-file-reader.c:994 src/data/sys-file-reader.c:1003 #: src/ui/gui/psppire-var-store.c:423 msgid "Numeric" msgstr "" -#: src/data/format.c:198 src/data/sys-file-reader.c:1015 -#: src/data/sys-file-reader.c:1160 src/data/sys-file-reader.c:1161 +#: src/data/format.c:198 src/data/sys-file-reader.c:996 +#: src/data/sys-file-reader.c:1141 src/data/sys-file-reader.c:1142 #: src/data/variable.c:41 src/language/dictionary/apply-dictionary.c:74 #: src/language/dictionary/apply-dictionary.c:75 #: src/language/xforms/recode.c:465 src/language/xforms/recode.c:466 msgid "numeric" msgstr "" -#: src/data/format.c:198 src/data/sys-file-reader.c:1015 -#: src/data/sys-file-reader.c:1160 src/data/sys-file-reader.c:1161 +#: src/data/format.c:198 src/data/sys-file-reader.c:996 +#: src/data/sys-file-reader.c:1141 src/data/sys-file-reader.c:1142 #: src/data/variable.c:41 src/data/variable.c:49 #: src/language/dictionary/apply-dictionary.c:74 #: src/language/dictionary/apply-dictionary.c:75 @@ -477,12 +477,12 @@ msgstr "" msgid "Bad time string length %d." msgstr "" -#: src/data/por-file-reader.c:472 src/data/sys-file-reader.c:1005 +#: src/data/por-file-reader.c:472 src/data/sys-file-reader.c:986 #, c-format msgid "%s: Bad format specifier byte (%d)." msgstr "" -#: src/data/por-file-reader.c:479 src/data/sys-file-reader.c:1021 +#: src/data/por-file-reader.c:479 src/data/sys-file-reader.c:1002 #, c-format msgid "%s variable %s has invalid format specifier %s." msgstr "" @@ -575,135 +575,135 @@ msgstr "" msgid "Could not access definition for terminal `%s'." msgstr "" -#: src/data/sys-file-reader.c:133 +#: src/data/sys-file-reader.c:134 msgid "corrupt system file: " msgstr "" -#: src/data/sys-file-reader.c:150 +#: src/data/sys-file-reader.c:151 #, c-format msgid "%s: Closing system file: %s." msgstr "" -#: src/data/sys-file-reader.c:241 +#: src/data/sys-file-reader.c:242 #, c-format msgid "" "An error occurred while opening \"%s\" for reading as a system file: %s." msgstr "" -#: src/data/sys-file-reader.c:258 +#: src/data/sys-file-reader.c:259 #, c-format msgid "" "%s: Index of weighting variable (%d) is not between 0 and number of elements " "per case (%d)." msgstr "" -#: src/data/sys-file-reader.c:267 +#: src/data/sys-file-reader.c:268 #, c-format msgid "" "%s: Weighting variable may not be a continuation of a long string variable." msgstr "" -#: src/data/sys-file-reader.c:270 +#: src/data/sys-file-reader.c:271 #, c-format msgid "%s: Weighting variable may not be a string variable." msgstr "" -#: src/data/sys-file-reader.c:295 +#: src/data/sys-file-reader.c:296 #, c-format msgid "" "%s: Orphaned variable index record (type 4). Type 4 records must always " "immediately follow type 3 records." msgstr "" -#: src/data/sys-file-reader.c:353 +#: src/data/sys-file-reader.c:354 #, c-format msgid "%s: Invalid subrecord length. Record: 7; Subrecord: 11" msgstr "" -#: src/data/sys-file-reader.c:407 +#: src/data/sys-file-reader.c:408 #, c-format msgid "%s: Trailing garbage in long variable name map." msgstr "" -#: src/data/sys-file-reader.c:414 +#: src/data/sys-file-reader.c:415 #, c-format msgid "%s: Long variable mapping to invalid variable name `%s'." msgstr "" -#: src/data/sys-file-reader.c:424 +#: src/data/sys-file-reader.c:425 #, c-format msgid "%s: Long variable mapping for nonexistent variable %s." msgstr "" -#: src/data/sys-file-reader.c:433 +#: src/data/sys-file-reader.c:434 #, c-format msgid "%s: Duplicate long variable name `%s' within system file." msgstr "" -#: src/data/sys-file-reader.c:460 +#: src/data/sys-file-reader.c:461 #, c-format msgid "%s: Unrecognized record type 7, subtype %d encountered in system file." msgstr "" -#: src/data/sys-file-reader.c:485 +#: src/data/sys-file-reader.c:486 #, c-format msgid "%s: Unrecognized record type %d." msgstr "" -#: src/data/sys-file-reader.c:517 +#: src/data/sys-file-reader.c:518 #, c-format msgid "" "%s: Bad size (%d) or count (%d) field on record type 7, subtype 3.\tExpected " "size %d, count 8." msgstr "" -#: src/data/sys-file-reader.c:528 +#: src/data/sys-file-reader.c:529 #, c-format msgid "" "%s: Floating-point representation in system file is not IEEE-754. PSPP " "cannot convert between floating-point formats." msgstr "" -#: src/data/sys-file-reader.c:544 +#: src/data/sys-file-reader.c:545 #, c-format msgid "" "%s: File-indicated endianness (%s) does not match endianness intuited from " "file header (%s)." msgstr "" -#: src/data/sys-file-reader.c:547 src/data/sys-file-reader.c:548 +#: src/data/sys-file-reader.c:548 src/data/sys-file-reader.c:549 msgid "big-endian" msgstr "" -#: src/data/sys-file-reader.c:547 src/data/sys-file-reader.c:548 +#: src/data/sys-file-reader.c:548 src/data/sys-file-reader.c:549 msgid "little-endian" msgstr "" -#: src/data/sys-file-reader.c:549 +#: src/data/sys-file-reader.c:550 msgid "unknown" msgstr "" -#: src/data/sys-file-reader.c:553 +#: src/data/sys-file-reader.c:554 #, c-format msgid "%s: File-indicated character representation code (%s) is not ASCII." msgstr "" -#: src/data/sys-file-reader.c:557 +#: src/data/sys-file-reader.c:558 msgid "DEC Kanji" msgstr "" -#: src/data/sys-file-reader.c:557 src/language/dictionary/sys-file-info.c:119 +#: src/data/sys-file-reader.c:558 src/language/dictionary/sys-file-info.c:119 msgid "Unknown" msgstr "" -#: src/data/sys-file-reader.c:573 +#: src/data/sys-file-reader.c:574 #, c-format msgid "" "%s: Bad size (%d) or count (%d) field on record type 7, subtype 4.\tExpected " "size %d, count 8." msgstr "" -#: src/data/sys-file-reader.c:588 +#: src/data/sys-file-reader.c:589 #, c-format msgid "" "%s: File-indicated value is different from internal value for at least one " @@ -711,221 +711,198 @@ msgid "" "%g; LOWEST: %g, %g." msgstr "" -#: src/data/sys-file-reader.c:615 +#: src/data/sys-file-reader.c:616 #, c-format msgid "" "%s: Bad magic. Proper system files begin with the four characters `$FL2'. " "This file will not be read." msgstr "" -#: src/data/sys-file-reader.c:657 +#: src/data/sys-file-reader.c:658 #, c-format msgid "" "%s: File layout code has unexpected value %d. Value should be 2, in big-" "endian or little-endian format." msgstr "" -#: src/data/sys-file-reader.c:685 +#: src/data/sys-file-reader.c:686 #, c-format msgid "%s: Number of cases in file (%ld) is not between -1 and %d." msgstr "" -#: src/data/sys-file-reader.c:690 +#: src/data/sys-file-reader.c:691 #, c-format msgid "%s: Compression bias (%g) is not the usual value of 100." msgstr "" -#: src/data/sys-file-reader.c:813 +#: src/data/sys-file-reader.c:816 #, c-format msgid "" "%s: position %d: String variable does not have proper number of continuation " "records." msgstr "" -#: src/data/sys-file-reader.c:824 +#: src/data/sys-file-reader.c:827 #, c-format msgid "%s: position %d: Superfluous long string continuation record." msgstr "" -#: src/data/sys-file-reader.c:830 +#: src/data/sys-file-reader.c:833 #, c-format msgid "%s: position %d: Bad variable type code %d." msgstr "" -#: src/data/sys-file-reader.c:833 +#: src/data/sys-file-reader.c:836 #, c-format msgid "%s: position %d: Variable label indicator field is not 0 or 1." msgstr "" -#: src/data/sys-file-reader.c:837 +#: src/data/sys-file-reader.c:840 #, c-format msgid "" "%s: position %d: Missing value indicator field is not -3, -2, 0, 1, 2, or 3." msgstr "" -#: src/data/sys-file-reader.c:843 +#: src/data/sys-file-reader.c:845 #, c-format msgid "%s: position %d: Variable name begins with invalid character." msgstr "" -#: src/data/sys-file-reader.c:847 -#, c-format -msgid "%s: position %d: Variable name begins with lowercase letter %c." -msgstr "" - -#: src/data/sys-file-reader.c:851 -#, c-format -msgid "" -"%s: position %d: Variable name begins with octothorpe (`#'). Scratch " -"variables should not appear in system files." -msgstr "" - -#: src/data/sys-file-reader.c:866 -#, c-format -msgid "%s: position %d: Variable name character %d is lowercase letter %c." -msgstr "" - -#: src/data/sys-file-reader.c:875 -#, c-format -msgid "" -"%s: position %d: character `\\%03o' (%c) is not valid in a variable name." -msgstr "" - -#: src/data/sys-file-reader.c:882 +#: src/data/sys-file-reader.c:864 #, c-format msgid "%s: Invalid variable name `%s' within system file." msgstr "" -#: src/data/sys-file-reader.c:889 +#: src/data/sys-file-reader.c:870 #, c-format msgid "%s: Duplicate variable name `%s' within system file." msgstr "" -#: src/data/sys-file-reader.c:912 +#: src/data/sys-file-reader.c:893 #, c-format msgid "%s: Variable %s indicates variable label of invalid length %d." msgstr "" -#: src/data/sys-file-reader.c:933 +#: src/data/sys-file-reader.c:914 #, c-format msgid "%s: Long string variable %s may not have missing values." msgstr "" -#: src/data/sys-file-reader.c:954 +#: src/data/sys-file-reader.c:935 #, c-format msgid "" "%s: String variable %s may not have missing values specified as a range." msgstr "" -#: src/data/sys-file-reader.c:981 +#: src/data/sys-file-reader.c:962 #, c-format msgid "%s: Long string continuation records omitted at end of dictionary." msgstr "" -#: src/data/sys-file-reader.c:986 +#: src/data/sys-file-reader.c:967 #, c-format msgid "" "%s: System file header indicates %d variable positions but %d were read from " "file." msgstr "" -#: src/data/sys-file-reader.c:1011 +#: src/data/sys-file-reader.c:992 #, c-format msgid "%s: %s variable %s has %s format specifier %s." msgstr "" -#: src/data/sys-file-reader.c:1064 +#: src/data/sys-file-reader.c:1045 #, c-format msgid "%s: Invalid number of labels: %d. Ignoring labels." msgstr "" -#: src/data/sys-file-reader.c:1106 +#: src/data/sys-file-reader.c:1087 #, c-format msgid "" "%s: Variable index record (type 4) does not immediately follow value label " "record (type 3) as it should." msgstr "" -#: src/data/sys-file-reader.c:1117 +#: src/data/sys-file-reader.c:1098 #, 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/data/sys-file-reader.c:1133 +#: src/data/sys-file-reader.c:1114 #, c-format msgid "" "%s: Variable index associated with value label (%d) is not between 1 and the " "number of values (%d)." msgstr "" -#: src/data/sys-file-reader.c:1140 +#: src/data/sys-file-reader.c:1121 #, 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/data/sys-file-reader.c:1145 +#: src/data/sys-file-reader.c:1126 #, c-format msgid "%s: Value labels are not allowed on long string variables (%s)." msgstr "" -#: src/data/sys-file-reader.c:1156 +#: src/data/sys-file-reader.c:1137 #, 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/data/sys-file-reader.c:1197 +#: src/data/sys-file-reader.c:1178 #, c-format msgid "%s: File contains duplicate label for value %g for variable %s." msgstr "" -#: src/data/sys-file-reader.c:1201 +#: src/data/sys-file-reader.c:1182 #, c-format msgid "%s: File contains duplicate label for value `%.*s' for variable %s." msgstr "" -#: src/data/sys-file-reader.c:1243 src/data/sys-file-reader.c:1526 +#: src/data/sys-file-reader.c:1224 src/data/sys-file-reader.c:1507 #, c-format msgid "%s: Reading system file: %s." msgstr "" -#: src/data/sys-file-reader.c:1246 src/data/sys-file-reader.c:1364 -#: src/data/sys-file-reader.c:1405 +#: src/data/sys-file-reader.c:1227 src/data/sys-file-reader.c:1345 +#: src/data/sys-file-reader.c:1386 #, c-format msgid "%s: Unexpected end of file." msgstr "" -#: src/data/sys-file-reader.c:1262 +#: src/data/sys-file-reader.c:1243 #, c-format msgid "%s: Seeking system file: %s." msgstr "" -#: src/data/sys-file-reader.c:1277 +#: src/data/sys-file-reader.c:1258 #, c-format msgid "%s: System file contains multiple type 6 (document) records." msgstr "" -#: src/data/sys-file-reader.c:1283 +#: src/data/sys-file-reader.c:1264 #, c-format msgid "%s: Number of document lines (%ld) must be greater than 0." msgstr "" -#: src/data/sys-file-reader.c:1317 +#: src/data/sys-file-reader.c:1298 #, c-format msgid "%s: Error reading file: %s." msgstr "" -#: src/data/sys-file-reader.c:1356 +#: src/data/sys-file-reader.c:1337 #, c-format msgid "%s: Compressed data is corrupted. Data ends in partial case." msgstr "" -#: src/data/sys-file-reader.c:1532 +#: src/data/sys-file-reader.c:1513 #, c-format msgid "%s: Partial record at end of system file." msgstr "" @@ -949,45 +926,45 @@ msgstr "" msgid "number" msgstr "" -#: src/data/variable.c:142 -msgid "Variable name cannot be empty string." -msgstr "" - -#: src/data/variable.c:148 +#: src/data/variable.c:151 #, c-format -msgid "Variable name %s exceeds %d-character limit." +msgid "" +"Character `%c' (in %s), may not appear as the first character in a variable " +"name." msgstr "" -#: src/data/variable.c:157 +#: src/data/variable.c:163 #, c-format msgid "Character `%c' (in %s) may not appear in a variable name." msgstr "" -#: src/data/variable.c:166 +#: src/data/variable.c:192 +msgid "Variable name cannot be empty string." +msgstr "" + +#: src/data/variable.c:198 #, c-format -msgid "" -"Character `%c' (in %s), may not appear as the first character in a variable " -"name." +msgid "Variable name %s exceeds %d-character limit." msgstr "" -#: src/data/variable.c:175 +#: src/data/variable.c:206 #, c-format msgid "`%s' may not be used as a variable name because it is a reserved word." msgstr "" -#: src/data/variable.c:270 +#: src/data/variable.c:301 msgid "Variable suffix too large." msgstr "" -#: src/data/variable.c:311 +#: src/data/variable.c:342 msgid "ordinary" msgstr "" -#: src/data/variable.c:313 +#: src/data/variable.c:344 msgid "system" msgstr "" -#: src/data/variable.c:315 +#: src/data/variable.c:346 msgid "scratch" msgstr "" @@ -2930,7 +2907,7 @@ msgstr "" #: src/language/stats/crosstabs.q:817 src/language/stats/crosstabs.q:1020 #: src/language/stats/crosstabs.q:1734 src/language/stats/examine.q:859 #: src/language/stats/frequencies.q:1221 src/language/stats/oneway.q:312 -#: src/language/stats/oneway.q:475 src/language/stats/regression.q:291 +#: src/language/stats/oneway.q:475 src/language/stats/regression.q:294 msgid "Total" msgstr "" @@ -2986,7 +2963,7 @@ msgid "Statistic" msgstr "" #: src/language/stats/crosstabs.q:1112 src/language/stats/oneway.q:285 -#: src/language/stats/oneway.q:687 src/language/stats/regression.q:284 +#: src/language/stats/oneway.q:687 src/language/stats/regression.q:287 #: src/language/stats/t-test.q:980 src/language/stats/t-test.q:1172 #: src/language/stats/t-test.q:1264 msgid "df" @@ -3296,7 +3273,7 @@ msgid "Lowest" msgstr "" #: src/language/stats/examine.q:1370 src/language/stats/oneway.q:401 -#: src/language/stats/oneway.q:685 src/language/stats/regression.q:187 +#: src/language/stats/oneway.q:685 src/language/stats/regression.q:191 msgid "Std. Error" msgstr "" @@ -3544,21 +3521,21 @@ msgstr "" msgid "`%s' is not a variable name" msgstr "" -#: src/language/stats/oneway.q:284 src/language/stats/regression.q:283 +#: src/language/stats/oneway.q:284 src/language/stats/regression.q:286 msgid "Sum of Squares" msgstr "" -#: src/language/stats/oneway.q:286 src/language/stats/regression.q:285 +#: src/language/stats/oneway.q:286 src/language/stats/regression.q:288 msgid "Mean Square" msgstr "" -#: src/language/stats/oneway.q:287 src/language/stats/regression.q:286 +#: src/language/stats/oneway.q:287 src/language/stats/regression.q:289 #: src/language/stats/t-test.q:977 msgid "F" msgstr "" #: src/language/stats/oneway.q:288 src/language/stats/oneway.q:541 -#: src/language/stats/regression.q:190 src/language/stats/regression.q:287 +#: src/language/stats/regression.q:194 src/language/stats/regression.q:290 msgid "Significance" msgstr "" @@ -3570,7 +3547,7 @@ msgstr "" msgid "Within Groups" msgstr "" -#: src/language/stats/oneway.q:358 src/language/stats/regression.q:313 +#: src/language/stats/oneway.q:358 src/language/stats/regression.q:316 msgid "ANOVA" msgstr "" @@ -3606,7 +3583,7 @@ msgstr "" msgid "Value of Contrast" msgstr "" -#: src/language/stats/oneway.q:686 src/language/stats/regression.q:189 +#: src/language/stats/oneway.q:686 src/language/stats/regression.q:193 #: src/language/stats/t-test.q:979 src/language/stats/t-test.q:1171 #: src/language/stats/t-test.q:1263 msgid "t" @@ -3634,63 +3611,63 @@ msgstr "" msgid "Too many variables in INTO clause." msgstr "" -#: src/language/stats/regression.q:140 +#: src/language/stats/regression.q:145 msgid "R" msgstr "" -#: src/language/stats/regression.q:141 +#: src/language/stats/regression.q:146 msgid "R Square" msgstr "" -#: src/language/stats/regression.q:142 +#: src/language/stats/regression.q:147 msgid "Adjusted R Square" msgstr "" -#: src/language/stats/regression.q:143 +#: src/language/stats/regression.q:148 msgid "Std. Error of the Estimate" msgstr "" -#: src/language/stats/regression.q:148 +#: src/language/stats/regression.q:153 msgid "Model Summary" msgstr "" -#: src/language/stats/regression.q:186 +#: src/language/stats/regression.q:190 msgid "B" msgstr "" -#: src/language/stats/regression.q:188 +#: src/language/stats/regression.q:192 msgid "Beta" msgstr "" -#: src/language/stats/regression.q:191 +#: src/language/stats/regression.q:195 msgid "(Constant)" msgstr "" -#: src/language/stats/regression.q:252 +#: src/language/stats/regression.q:255 msgid "Coefficients" msgstr "" -#: src/language/stats/regression.q:289 +#: src/language/stats/regression.q:292 msgid "Regression" msgstr "" -#: src/language/stats/regression.q:290 +#: src/language/stats/regression.q:293 msgid "Residual" msgstr "" -#: src/language/stats/regression.q:369 +#: src/language/stats/regression.q:371 msgid "Model" msgstr "" -#: src/language/stats/regression.q:370 +#: src/language/stats/regression.q:372 msgid "Covariances" msgstr "" -#: src/language/stats/regression.q:386 +#: src/language/stats/regression.q:387 msgid "Coefficient Correlations" msgstr "" -#: src/language/stats/regression.q:799 +#: src/language/stats/regression.q:885 msgid "Dependent variable must be numeric." msgstr "" diff --git a/po/pspp.pot b/po/pspp.pot index cfadc3ef..2c82c05b 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: 2006-03-14 15:35+0800\n" +"POT-Creation-Date: 2006-03-17 12:47+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -388,27 +388,27 @@ msgid "%s variables are not compatible with %s format %s." msgstr "" #: src/data/format.c:197 src/data/por-file-reader.c:480 -#: src/data/sys-file-reader.c:1013 src/data/sys-file-reader.c:1022 +#: src/data/sys-file-reader.c:994 src/data/sys-file-reader.c:1003 #: src/ui/gui/psppire-var-store.c:430 msgid "String" msgstr "" #: src/data/format.c:197 src/data/por-file-reader.c:480 -#: src/data/sys-file-reader.c:1013 src/data/sys-file-reader.c:1022 +#: src/data/sys-file-reader.c:994 src/data/sys-file-reader.c:1003 #: src/ui/gui/psppire-var-store.c:423 msgid "Numeric" msgstr "" -#: src/data/format.c:198 src/data/sys-file-reader.c:1015 -#: src/data/sys-file-reader.c:1160 src/data/sys-file-reader.c:1161 +#: src/data/format.c:198 src/data/sys-file-reader.c:996 +#: src/data/sys-file-reader.c:1141 src/data/sys-file-reader.c:1142 #: src/data/variable.c:41 src/language/dictionary/apply-dictionary.c:74 #: src/language/dictionary/apply-dictionary.c:75 #: src/language/xforms/recode.c:465 src/language/xforms/recode.c:466 msgid "numeric" msgstr "" -#: src/data/format.c:198 src/data/sys-file-reader.c:1015 -#: src/data/sys-file-reader.c:1160 src/data/sys-file-reader.c:1161 +#: src/data/format.c:198 src/data/sys-file-reader.c:996 +#: src/data/sys-file-reader.c:1141 src/data/sys-file-reader.c:1142 #: src/data/variable.c:41 src/data/variable.c:49 #: src/language/dictionary/apply-dictionary.c:74 #: src/language/dictionary/apply-dictionary.c:75 @@ -478,12 +478,12 @@ msgstr "" msgid "Bad time string length %d." msgstr "" -#: src/data/por-file-reader.c:472 src/data/sys-file-reader.c:1005 +#: src/data/por-file-reader.c:472 src/data/sys-file-reader.c:986 #, c-format msgid "%s: Bad format specifier byte (%d)." msgstr "" -#: src/data/por-file-reader.c:479 src/data/sys-file-reader.c:1021 +#: src/data/por-file-reader.c:479 src/data/sys-file-reader.c:1002 #, c-format msgid "%s variable %s has invalid format specifier %s." msgstr "" @@ -576,135 +576,135 @@ msgstr "" msgid "Could not access definition for terminal `%s'." msgstr "" -#: src/data/sys-file-reader.c:133 +#: src/data/sys-file-reader.c:134 msgid "corrupt system file: " msgstr "" -#: src/data/sys-file-reader.c:150 +#: src/data/sys-file-reader.c:151 #, c-format msgid "%s: Closing system file: %s." msgstr "" -#: src/data/sys-file-reader.c:241 +#: src/data/sys-file-reader.c:242 #, c-format msgid "" "An error occurred while opening \"%s\" for reading as a system file: %s." msgstr "" -#: src/data/sys-file-reader.c:258 +#: src/data/sys-file-reader.c:259 #, c-format msgid "" "%s: Index of weighting variable (%d) is not between 0 and number of elements " "per case (%d)." msgstr "" -#: src/data/sys-file-reader.c:267 +#: src/data/sys-file-reader.c:268 #, c-format msgid "" "%s: Weighting variable may not be a continuation of a long string variable." msgstr "" -#: src/data/sys-file-reader.c:270 +#: src/data/sys-file-reader.c:271 #, c-format msgid "%s: Weighting variable may not be a string variable." msgstr "" -#: src/data/sys-file-reader.c:295 +#: src/data/sys-file-reader.c:296 #, c-format msgid "" "%s: Orphaned variable index record (type 4). Type 4 records must always " "immediately follow type 3 records." msgstr "" -#: src/data/sys-file-reader.c:353 +#: src/data/sys-file-reader.c:354 #, c-format msgid "%s: Invalid subrecord length. Record: 7; Subrecord: 11" msgstr "" -#: src/data/sys-file-reader.c:407 +#: src/data/sys-file-reader.c:408 #, c-format msgid "%s: Trailing garbage in long variable name map." msgstr "" -#: src/data/sys-file-reader.c:414 +#: src/data/sys-file-reader.c:415 #, c-format msgid "%s: Long variable mapping to invalid variable name `%s'." msgstr "" -#: src/data/sys-file-reader.c:424 +#: src/data/sys-file-reader.c:425 #, c-format msgid "%s: Long variable mapping for nonexistent variable %s." msgstr "" -#: src/data/sys-file-reader.c:433 +#: src/data/sys-file-reader.c:434 #, c-format msgid "%s: Duplicate long variable name `%s' within system file." msgstr "" -#: src/data/sys-file-reader.c:460 +#: src/data/sys-file-reader.c:461 #, c-format msgid "%s: Unrecognized record type 7, subtype %d encountered in system file." msgstr "" -#: src/data/sys-file-reader.c:485 +#: src/data/sys-file-reader.c:486 #, c-format msgid "%s: Unrecognized record type %d." msgstr "" -#: src/data/sys-file-reader.c:517 +#: src/data/sys-file-reader.c:518 #, c-format msgid "" "%s: Bad size (%d) or count (%d) field on record type 7, subtype 3.\tExpected " "size %d, count 8." msgstr "" -#: src/data/sys-file-reader.c:528 +#: src/data/sys-file-reader.c:529 #, c-format msgid "" "%s: Floating-point representation in system file is not IEEE-754. PSPP " "cannot convert between floating-point formats." msgstr "" -#: src/data/sys-file-reader.c:544 +#: src/data/sys-file-reader.c:545 #, c-format msgid "" "%s: File-indicated endianness (%s) does not match endianness intuited from " "file header (%s)." msgstr "" -#: src/data/sys-file-reader.c:547 src/data/sys-file-reader.c:548 +#: src/data/sys-file-reader.c:548 src/data/sys-file-reader.c:549 msgid "big-endian" msgstr "" -#: src/data/sys-file-reader.c:547 src/data/sys-file-reader.c:548 +#: src/data/sys-file-reader.c:548 src/data/sys-file-reader.c:549 msgid "little-endian" msgstr "" -#: src/data/sys-file-reader.c:549 +#: src/data/sys-file-reader.c:550 msgid "unknown" msgstr "" -#: src/data/sys-file-reader.c:553 +#: src/data/sys-file-reader.c:554 #, c-format msgid "%s: File-indicated character representation code (%s) is not ASCII." msgstr "" -#: src/data/sys-file-reader.c:557 +#: src/data/sys-file-reader.c:558 msgid "DEC Kanji" msgstr "" -#: src/data/sys-file-reader.c:557 src/language/dictionary/sys-file-info.c:119 +#: src/data/sys-file-reader.c:558 src/language/dictionary/sys-file-info.c:119 msgid "Unknown" msgstr "" -#: src/data/sys-file-reader.c:573 +#: src/data/sys-file-reader.c:574 #, c-format msgid "" "%s: Bad size (%d) or count (%d) field on record type 7, subtype 4.\tExpected " "size %d, count 8." msgstr "" -#: src/data/sys-file-reader.c:588 +#: src/data/sys-file-reader.c:589 #, c-format msgid "" "%s: File-indicated value is different from internal value for at least one " @@ -712,221 +712,198 @@ msgid "" "%g; LOWEST: %g, %g." msgstr "" -#: src/data/sys-file-reader.c:615 +#: src/data/sys-file-reader.c:616 #, c-format msgid "" "%s: Bad magic. Proper system files begin with the four characters `$FL2'. " "This file will not be read." msgstr "" -#: src/data/sys-file-reader.c:657 +#: src/data/sys-file-reader.c:658 #, c-format msgid "" "%s: File layout code has unexpected value %d. Value should be 2, in big-" "endian or little-endian format." msgstr "" -#: src/data/sys-file-reader.c:685 +#: src/data/sys-file-reader.c:686 #, c-format msgid "%s: Number of cases in file (%ld) is not between -1 and %d." msgstr "" -#: src/data/sys-file-reader.c:690 +#: src/data/sys-file-reader.c:691 #, c-format msgid "%s: Compression bias (%g) is not the usual value of 100." msgstr "" -#: src/data/sys-file-reader.c:813 +#: src/data/sys-file-reader.c:816 #, c-format msgid "" "%s: position %d: String variable does not have proper number of continuation " "records." msgstr "" -#: src/data/sys-file-reader.c:824 +#: src/data/sys-file-reader.c:827 #, c-format msgid "%s: position %d: Superfluous long string continuation record." msgstr "" -#: src/data/sys-file-reader.c:830 +#: src/data/sys-file-reader.c:833 #, c-format msgid "%s: position %d: Bad variable type code %d." msgstr "" -#: src/data/sys-file-reader.c:833 +#: src/data/sys-file-reader.c:836 #, c-format msgid "%s: position %d: Variable label indicator field is not 0 or 1." msgstr "" -#: src/data/sys-file-reader.c:837 +#: src/data/sys-file-reader.c:840 #, c-format msgid "" "%s: position %d: Missing value indicator field is not -3, -2, 0, 1, 2, or 3." msgstr "" -#: src/data/sys-file-reader.c:843 +#: src/data/sys-file-reader.c:845 #, c-format msgid "%s: position %d: Variable name begins with invalid character." msgstr "" -#: src/data/sys-file-reader.c:847 -#, c-format -msgid "%s: position %d: Variable name begins with lowercase letter %c." -msgstr "" - -#: src/data/sys-file-reader.c:851 -#, c-format -msgid "" -"%s: position %d: Variable name begins with octothorpe (`#'). Scratch " -"variables should not appear in system files." -msgstr "" - -#: src/data/sys-file-reader.c:866 -#, c-format -msgid "%s: position %d: Variable name character %d is lowercase letter %c." -msgstr "" - -#: src/data/sys-file-reader.c:875 -#, c-format -msgid "" -"%s: position %d: character `\\%03o' (%c) is not valid in a variable name." -msgstr "" - -#: src/data/sys-file-reader.c:882 +#: src/data/sys-file-reader.c:864 #, c-format msgid "%s: Invalid variable name `%s' within system file." msgstr "" -#: src/data/sys-file-reader.c:889 +#: src/data/sys-file-reader.c:870 #, c-format msgid "%s: Duplicate variable name `%s' within system file." msgstr "" -#: src/data/sys-file-reader.c:912 +#: src/data/sys-file-reader.c:893 #, c-format msgid "%s: Variable %s indicates variable label of invalid length %d." msgstr "" -#: src/data/sys-file-reader.c:933 +#: src/data/sys-file-reader.c:914 #, c-format msgid "%s: Long string variable %s may not have missing values." msgstr "" -#: src/data/sys-file-reader.c:954 +#: src/data/sys-file-reader.c:935 #, c-format msgid "" "%s: String variable %s may not have missing values specified as a range." msgstr "" -#: src/data/sys-file-reader.c:981 +#: src/data/sys-file-reader.c:962 #, c-format msgid "%s: Long string continuation records omitted at end of dictionary." msgstr "" -#: src/data/sys-file-reader.c:986 +#: src/data/sys-file-reader.c:967 #, c-format msgid "" "%s: System file header indicates %d variable positions but %d were read from " "file." msgstr "" -#: src/data/sys-file-reader.c:1011 +#: src/data/sys-file-reader.c:992 #, c-format msgid "%s: %s variable %s has %s format specifier %s." msgstr "" -#: src/data/sys-file-reader.c:1064 +#: src/data/sys-file-reader.c:1045 #, c-format msgid "%s: Invalid number of labels: %d. Ignoring labels." msgstr "" -#: src/data/sys-file-reader.c:1106 +#: src/data/sys-file-reader.c:1087 #, c-format msgid "" "%s: Variable index record (type 4) does not immediately follow value label " "record (type 3) as it should." msgstr "" -#: src/data/sys-file-reader.c:1117 +#: src/data/sys-file-reader.c:1098 #, 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/data/sys-file-reader.c:1133 +#: src/data/sys-file-reader.c:1114 #, c-format msgid "" "%s: Variable index associated with value label (%d) is not between 1 and the " "number of values (%d)." msgstr "" -#: src/data/sys-file-reader.c:1140 +#: src/data/sys-file-reader.c:1121 #, 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/data/sys-file-reader.c:1145 +#: src/data/sys-file-reader.c:1126 #, c-format msgid "%s: Value labels are not allowed on long string variables (%s)." msgstr "" -#: src/data/sys-file-reader.c:1156 +#: src/data/sys-file-reader.c:1137 #, 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/data/sys-file-reader.c:1197 +#: src/data/sys-file-reader.c:1178 #, c-format msgid "%s: File contains duplicate label for value %g for variable %s." msgstr "" -#: src/data/sys-file-reader.c:1201 +#: src/data/sys-file-reader.c:1182 #, c-format msgid "%s: File contains duplicate label for value `%.*s' for variable %s." msgstr "" -#: src/data/sys-file-reader.c:1243 src/data/sys-file-reader.c:1526 +#: src/data/sys-file-reader.c:1224 src/data/sys-file-reader.c:1507 #, c-format msgid "%s: Reading system file: %s." msgstr "" -#: src/data/sys-file-reader.c:1246 src/data/sys-file-reader.c:1364 -#: src/data/sys-file-reader.c:1405 +#: src/data/sys-file-reader.c:1227 src/data/sys-file-reader.c:1345 +#: src/data/sys-file-reader.c:1386 #, c-format msgid "%s: Unexpected end of file." msgstr "" -#: src/data/sys-file-reader.c:1262 +#: src/data/sys-file-reader.c:1243 #, c-format msgid "%s: Seeking system file: %s." msgstr "" -#: src/data/sys-file-reader.c:1277 +#: src/data/sys-file-reader.c:1258 #, c-format msgid "%s: System file contains multiple type 6 (document) records." msgstr "" -#: src/data/sys-file-reader.c:1283 +#: src/data/sys-file-reader.c:1264 #, c-format msgid "%s: Number of document lines (%ld) must be greater than 0." msgstr "" -#: src/data/sys-file-reader.c:1317 +#: src/data/sys-file-reader.c:1298 #, c-format msgid "%s: Error reading file: %s." msgstr "" -#: src/data/sys-file-reader.c:1356 +#: src/data/sys-file-reader.c:1337 #, c-format msgid "%s: Compressed data is corrupted. Data ends in partial case." msgstr "" -#: src/data/sys-file-reader.c:1532 +#: src/data/sys-file-reader.c:1513 #, c-format msgid "%s: Partial record at end of system file." msgstr "" @@ -950,45 +927,45 @@ msgstr "" msgid "number" msgstr "" -#: src/data/variable.c:142 -msgid "Variable name cannot be empty string." -msgstr "" - -#: src/data/variable.c:148 +#: src/data/variable.c:151 #, c-format -msgid "Variable name %s exceeds %d-character limit." +msgid "" +"Character `%c' (in %s), may not appear as the first character in a variable " +"name." msgstr "" -#: src/data/variable.c:157 +#: src/data/variable.c:163 #, c-format msgid "Character `%c' (in %s) may not appear in a variable name." msgstr "" -#: src/data/variable.c:166 +#: src/data/variable.c:192 +msgid "Variable name cannot be empty string." +msgstr "" + +#: src/data/variable.c:198 #, c-format -msgid "" -"Character `%c' (in %s), may not appear as the first character in a variable " -"name." +msgid "Variable name %s exceeds %d-character limit." msgstr "" -#: src/data/variable.c:175 +#: src/data/variable.c:206 #, c-format msgid "`%s' may not be used as a variable name because it is a reserved word." msgstr "" -#: src/data/variable.c:270 +#: src/data/variable.c:301 msgid "Variable suffix too large." msgstr "" -#: src/data/variable.c:311 +#: src/data/variable.c:342 msgid "ordinary" msgstr "" -#: src/data/variable.c:313 +#: src/data/variable.c:344 msgid "system" msgstr "" -#: src/data/variable.c:315 +#: src/data/variable.c:346 msgid "scratch" msgstr "" @@ -2931,7 +2908,7 @@ msgstr "" #: src/language/stats/crosstabs.q:817 src/language/stats/crosstabs.q:1020 #: src/language/stats/crosstabs.q:1734 src/language/stats/examine.q:859 #: src/language/stats/frequencies.q:1221 src/language/stats/oneway.q:312 -#: src/language/stats/oneway.q:475 src/language/stats/regression.q:291 +#: src/language/stats/oneway.q:475 src/language/stats/regression.q:294 msgid "Total" msgstr "" @@ -2987,7 +2964,7 @@ msgid "Statistic" msgstr "" #: src/language/stats/crosstabs.q:1112 src/language/stats/oneway.q:285 -#: src/language/stats/oneway.q:687 src/language/stats/regression.q:284 +#: src/language/stats/oneway.q:687 src/language/stats/regression.q:287 #: src/language/stats/t-test.q:980 src/language/stats/t-test.q:1172 #: src/language/stats/t-test.q:1264 msgid "df" @@ -3297,7 +3274,7 @@ msgid "Lowest" msgstr "" #: src/language/stats/examine.q:1370 src/language/stats/oneway.q:401 -#: src/language/stats/oneway.q:685 src/language/stats/regression.q:187 +#: src/language/stats/oneway.q:685 src/language/stats/regression.q:191 msgid "Std. Error" msgstr "" @@ -3545,21 +3522,21 @@ msgstr "" msgid "`%s' is not a variable name" msgstr "" -#: src/language/stats/oneway.q:284 src/language/stats/regression.q:283 +#: src/language/stats/oneway.q:284 src/language/stats/regression.q:286 msgid "Sum of Squares" msgstr "" -#: src/language/stats/oneway.q:286 src/language/stats/regression.q:285 +#: src/language/stats/oneway.q:286 src/language/stats/regression.q:288 msgid "Mean Square" msgstr "" -#: src/language/stats/oneway.q:287 src/language/stats/regression.q:286 +#: src/language/stats/oneway.q:287 src/language/stats/regression.q:289 #: src/language/stats/t-test.q:977 msgid "F" msgstr "" #: src/language/stats/oneway.q:288 src/language/stats/oneway.q:541 -#: src/language/stats/regression.q:190 src/language/stats/regression.q:287 +#: src/language/stats/regression.q:194 src/language/stats/regression.q:290 msgid "Significance" msgstr "" @@ -3571,7 +3548,7 @@ msgstr "" msgid "Within Groups" msgstr "" -#: src/language/stats/oneway.q:358 src/language/stats/regression.q:313 +#: src/language/stats/oneway.q:358 src/language/stats/regression.q:316 msgid "ANOVA" msgstr "" @@ -3607,7 +3584,7 @@ msgstr "" msgid "Value of Contrast" msgstr "" -#: src/language/stats/oneway.q:686 src/language/stats/regression.q:189 +#: src/language/stats/oneway.q:686 src/language/stats/regression.q:193 #: src/language/stats/t-test.q:979 src/language/stats/t-test.q:1171 #: src/language/stats/t-test.q:1263 msgid "t" @@ -3635,63 +3612,63 @@ msgstr "" msgid "Too many variables in INTO clause." msgstr "" -#: src/language/stats/regression.q:140 +#: src/language/stats/regression.q:145 msgid "R" msgstr "" -#: src/language/stats/regression.q:141 +#: src/language/stats/regression.q:146 msgid "R Square" msgstr "" -#: src/language/stats/regression.q:142 +#: src/language/stats/regression.q:147 msgid "Adjusted R Square" msgstr "" -#: src/language/stats/regression.q:143 +#: src/language/stats/regression.q:148 msgid "Std. Error of the Estimate" msgstr "" -#: src/language/stats/regression.q:148 +#: src/language/stats/regression.q:153 msgid "Model Summary" msgstr "" -#: src/language/stats/regression.q:186 +#: src/language/stats/regression.q:190 msgid "B" msgstr "" -#: src/language/stats/regression.q:188 +#: src/language/stats/regression.q:192 msgid "Beta" msgstr "" -#: src/language/stats/regression.q:191 +#: src/language/stats/regression.q:195 msgid "(Constant)" msgstr "" -#: src/language/stats/regression.q:252 +#: src/language/stats/regression.q:255 msgid "Coefficients" msgstr "" -#: src/language/stats/regression.q:289 +#: src/language/stats/regression.q:292 msgid "Regression" msgstr "" -#: src/language/stats/regression.q:290 +#: src/language/stats/regression.q:293 msgid "Residual" msgstr "" -#: src/language/stats/regression.q:369 +#: src/language/stats/regression.q:371 msgid "Model" msgstr "" -#: src/language/stats/regression.q:370 +#: src/language/stats/regression.q:372 msgid "Covariances" msgstr "" -#: src/language/stats/regression.q:386 +#: src/language/stats/regression.q:387 msgid "Coefficient Correlations" msgstr "" -#: src/language/stats/regression.q:799 +#: src/language/stats/regression.q:885 msgid "Dependent variable must be numeric." msgstr "" diff --git a/src/data/dictionary.c b/src/data/dictionary.c index 849e0210..d2d93c3b 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -269,7 +269,7 @@ dict_create_var (struct dictionary *d, const char *name, int width) assert (width >= 0 && width < 256); - assert (var_is_valid_name(name,0)); + assert (var_is_plausible_name(name,0)); /* Make sure there's not already a variable by that name. */ if (dict_lookup_var (d, name) != NULL) @@ -585,7 +585,7 @@ dict_rename_var (struct dictionary *d, struct variable *v, assert (d != NULL); assert (v != NULL); assert (new_name != NULL); - assert (var_is_valid_name (new_name, false)); + assert (var_is_plausible_name (new_name, false)); assert (dict_contains_var (d, v)); assert (!compare_var_names (v->name, new_name, NULL) || dict_lookup_var (d, new_name) == NULL); @@ -623,7 +623,7 @@ dict_rename_vars (struct dictionary *d, for (i = 0; i < count; i++) { assert (d->var[vars[i]->index] == vars[i]); - assert (var_is_valid_name (new_names[i], false)); + assert (var_is_plausible_name (new_names[i], false)); hsh_force_delete (d->name_tab, vars[i]); old_names[i] = xstrdup (vars[i]->name); strcpy (vars[i]->name, new_names[i]); @@ -1064,7 +1064,7 @@ dict_create_vector (struct dictionary *d, assert (d != NULL); assert (name != NULL); - assert (var_is_valid_name (name, false)); + assert (var_is_plausible_name (name, false)); assert (var != NULL); assert (cnt > 0); diff --git a/src/data/identifier.c b/src/data/identifier.c index f90f4be1..4f38e84f 100644 --- a/src/data/identifier.c +++ b/src/data/identifier.c @@ -42,7 +42,7 @@ const char *keywords[T_N_KEYWORDS + 1] = /* Recognizing identifiers. */ /* Returns true if C may be the first character in an - identifier. */ + identifier in the current locale. */ bool lex_is_id1 (char c_) { @@ -50,6 +50,7 @@ lex_is_id1 (char c_) return isalpha (c) || c == '@' || c == '#' || c == '$'; } + /* Returns true if C may be a character in an identifier other than the first. */ bool diff --git a/src/data/sys-file-reader.c b/src/data/sys-file-reader.c index 0a85cffa..8a3cdf51 100644 --- a/src/data/sys-file-reader.c +++ b/src/data/sys-file-reader.c @@ -18,26 +18,27 @@ 02110-1301, USA. */ #include -#include "sys-file-reader.h" -#include "sfm-private.h" -#include + #include -#include #include #include -#include +#include + #include -#include "case.h" +#include #include +#include +#include +#include + +#include "sys-file-reader.h" +#include "sfm-private.h" +#include "case.h" #include "dictionary.h" -#include #include "file-handle-def.h" #include "filename.h" #include "format.h" -#include -#include #include "value-labels.h" -#include #include "variable.h" #include "gettext.h" @@ -619,10 +620,10 @@ read_header (struct sfm_reader *r, /* Check eye-category.her string. */ memcpy (prod_name, hdr.prod_name, sizeof hdr.prod_name); for (i = 0; i < 60; i++) - if (!isprint ((unsigned char) prod_name[i])) + if (!c_isprint ((unsigned char) prod_name[i])) prod_name[i] = ' '; for (i = 59; i >= 0; i--) - if (!isgraph ((unsigned char) prod_name[i])) + if (!c_isgraph ((unsigned char) prod_name[i])) { prod_name[i] = '\0'; break; @@ -697,16 +698,18 @@ read_header (struct sfm_reader *r, int i; for (i = sizeof hdr.file_label - 1; i >= 0; i--) - if (!isspace ((unsigned char) hdr.file_label[i]) - && hdr.file_label[i] != 0) - { - char *label = xmalloc (i + 2); - memcpy (label, hdr.file_label, i + 1); - label[i + 1] = 0; - dict_set_label (dict, label); - free (label); - break; - } + { + if (!c_isspace ((unsigned char) hdr.file_label[i]) + && hdr.file_label[i] != 0) + { + char *label = xmalloc (i + 2); + memcpy (label, hdr.file_label, i + 1); + label[i + 1] = 0; + dict_set_label (dict, label); + free (label); + break; + } + } } if (info) @@ -730,7 +733,7 @@ read_header (struct sfm_reader *r, info->case_cnt = hdr.case_cnt; for (cp = &prod_name[skip_amt]; cp < &prod_name[60]; cp++) - if (isgraph ((unsigned char) *cp)) + if (c_isgraph ((unsigned char) *cp)) break; strcpy (info->product, cp); } @@ -838,52 +841,30 @@ read_variables (struct sfm_reader *r, "-3, -2, 0, 1, 2, or 3."), fh_get_filename (r->fh), i)); /* Copy first character of variable name. */ - if (!isalpha ((unsigned char) sv.name[0]) - && sv.name[0] != '@' && sv.name[0] != '#') + if (sv.name[0] == '@' || sv.name[0] == '#') lose ((ME, _("%s: position %d: Variable name begins with invalid " "character."), fh_get_filename (r->fh), i)); - if (islower ((unsigned char) sv.name[0])) - msg (MW, _("%s: position %d: Variable name begins with lowercase letter " - "%c."), - fh_get_filename (r->fh), i, sv.name[0]); - if (sv.name[0] == '#') - msg (MW, _("%s: position %d: Variable name begins with octothorpe " - "(`#'). Scratch variables should not appear in system " - "files."), - fh_get_filename (r->fh), i); - name[0] = toupper ((unsigned char) (sv.name[0])); + + name[0] = sv.name[0]; /* Copy remaining characters of variable name. */ for (j = 1; j < SHORT_NAME_LEN; j++) { int c = (unsigned char) sv.name[j]; - if (isspace (c)) + if (c == ' ') break; - else if (islower (c)) - { - msg (MW, _("%s: position %d: Variable name character %d is " - "lowercase letter %c."), - fh_get_filename (r->fh), i, j + 1, sv.name[j]); - name[j] = toupper ((unsigned char) (c)); - } - else if (isalnum (c) || c == '.' || c == '@' - || c == '#' || c == '$' || c == '_') + else name[j] = c; - else - lose ((ME, _("%s: position %d: character `\\%03o' (%c) is not valid in a " - "variable name."), - fh_get_filename (r->fh), i, c, c)); } name[j] = 0; - if ( ! var_is_valid_name(name, false) ) + if ( ! var_is_plausible_name(name, false) ) lose ((ME, _("%s: Invalid variable name `%s' within system file."), fh_get_filename (r->fh), name)); /* Create variable. */ - vv = (*var_by_idx)[i] = dict_create_var (dict, name, sv.type); if (vv == NULL) lose ((ME, _("%s: Duplicate variable name `%s' within system file."), @@ -1558,3 +1539,4 @@ sfm_detect (FILE *file) return false; return true; } + diff --git a/src/data/variable.c b/src/data/variable.c index 78f0cb44..3c170c84 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -135,22 +135,28 @@ var_is_valid_name (const char *name, bool issue_error) assert (name != NULL); + /* Note that strlen returns number of BYTES, not the number of + CHARACTERS */ length = strlen (name); - if (length < 1) - { - if (issue_error) - msg (SE, _("Variable name cannot be empty string.")); - return false; - } - else if (length > LONG_NAME_LEN) + + bool plausible = var_is_plausible_name(name, issue_error); + + if ( ! plausible ) + return false; + + + if (!lex_is_id1 (name[0])) { if (issue_error) - msg (SE, _("Variable name %s exceeds %d-character limit."), - name, (int) LONG_NAME_LEN); + msg (SE, _("Character `%c' (in %s), may not appear " + "as the first character in a variable name."), + name[0], name); return false; } + for (i = 0; i < length; i++) + { if (!lex_is_idn (name[i])) { if (issue_error) @@ -159,13 +165,38 @@ var_is_valid_name (const char *name, bool issue_error) name[i], name); return false; } - - if (!lex_is_id1 (name[0])) + } + + return true; +} + +/* + Returns true if NAME is an plausible name for a variable, + false otherwise. If ISSUE_ERROR is true, issues an + explanatory error message on failure. + This function makes no use of LC_CTYPE. +*/ +bool +var_is_plausible_name (const char *name, bool issue_error) +{ + size_t length; + + assert (name != NULL); + + /* Note that strlen returns number of BYTES, not the number of + CHARACTERS */ + length = strlen (name); + if (length < 1) { if (issue_error) - msg (SE, _("Character `%c' (in %s), may not appear " - "as the first character in a variable name."), - name[0], name); + msg (SE, _("Variable name cannot be empty string.")); + return false; + } + else if (length > LONG_NAME_LEN) + { + if (issue_error) + msg (SE, _("Variable name %s exceeds %d-character limit."), + name, (int) LONG_NAME_LEN); return false; } @@ -228,7 +259,7 @@ void var_set_short_name (struct variable *v, const char *short_name) { assert (v != NULL); - assert (short_name[0] == '\0' || var_is_valid_name (short_name, false)); + assert (short_name[0] == '\0' || var_is_plausible_name (short_name, false)); str_copy_trunc (v->short_name, sizeof v->short_name, short_name); str_uppercase (v->short_name); diff --git a/src/data/variable.h b/src/data/variable.h index 2bc3442d..47945241 100644 --- a/src/data/variable.h +++ b/src/data/variable.h @@ -87,6 +87,7 @@ struct variable /* Variable names. */ bool var_is_valid_name (const char *, bool issue_error); +bool var_is_plausible_name (const char *name, bool issue_error); int compare_var_names (const void *, const void *, void *); unsigned hash_var_name (const void *, void *); diff --git a/src/language/stats/automake.mk b/src/language/stats/automake.mk index a8a23590..0311608c 100644 --- a/src/language/stats/automake.mk +++ b/src/language/stats/automake.mk @@ -30,6 +30,9 @@ EXTRA_DIST += $(src_language_stats_q_sources_q) nodist_src_language_stats_libstats_a_SOURCES = $(src_language_stats_q_sources_c) CLEANFILES += $(src_language_stats_q_sources_c) +src_language_stats_libstats_a_CPPFLAGS = $(AM_CPPFLAGS) \ + -I$(top_srcdir)/src/language/stats + src_language_stats_libstats_a_SOURCES = \ src/language/stats/aggregate.c \ src/language/stats/autorecode.c \ -- 2.30.2