From: John Darrington Date: Sat, 19 Jan 2008 06:58:03 +0000 (+0000) Subject: Reworked settings so as to use one large struct instead of lots of static X-Git-Tag: v0.6.0~148 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b94efd7513afdb12a6023024e00e50801532fee;p=pspp-builds.git Reworked settings so as to use one large struct instead of lots of static variables. Closes patch #6363 --- diff --git a/doc/dev/concepts.texi b/doc/dev/concepts.texi index 29d2b584..5876ce36 100644 --- a/doc/dev/concepts.texi +++ b/doc/dev/concepts.texi @@ -259,6 +259,8 @@ the data in fields represented by formats. These functions construct @struct{fmt_spec}s and verify that they are valid. + + @deftypefun {struct fmt_spec} fmt_for_input (enum fmt_type @var{type}, int @var{w}, int @var{d}) @deftypefunx {struct fmt_spec} fmt_for_output (enum fmt_type @var{type}, int @var{w}, int @var{d}) Constructs a @struct{fmt_spec} with the given @var{type}, @var{w}, and @@ -340,6 +342,10 @@ identical, false otherwise. @var{format} need not be a valid input or output format specifier. @end deftypefun +@deftypefun void fmt_resize (struct fmt_spec *@var{fmt}, int @var{width}) +Sets the width of @var{fmt} to a valid format for a @union{value} of size @var{width}. +@end deftypefun + @node Obtaining Properties of Format Types @subsection Obtaining Properties of Format Types @@ -552,16 +558,29 @@ equal to @code{decimal}, or it may be set to 0 to disable grouping. The following functions are provided for working with numeric formatting styles. -@deftypefun {struct fmt_number_style *} fmt_number_style_create (void) -Creates and returns a new @struct{fmt_number_style} with all of the +@deftypefun void fmt_number_style_init (struct fmt_number_style *@var{style}) +Initialises a @struct{fmt_number_style} with all of the prefixes and suffixes set to the empty string, @samp{.} as the decimal point character, and grouping disables. @end deftypefun + @deftypefun void fmt_number_style_destroy (struct fmt_number_style *@var{style}) Destroys @var{style}, freeing its storage. @end deftypefun +@deftypefun {struct fmt_number_style} *fmt_create (void) +A function which creates an array of all the styles used by pspp, and +calls fmt_number_style_init on each of them. +@end deftypefun + +@deftypefun void fmt_done (struct fmt_number_style *@var{styles}) +A wrapper function which takes an array of @struct{fmt_number_style}, calls +fmt_number_style_destroy on each of them, and then frees the array. +@end deftypefun + + + @deftypefun int fmt_affix_width (const struct fmt_number_style *@var{style}) Returns the total length of @var{style}'s @code{prefix} and @code{suffix}. @end deftypefun @@ -579,31 +598,16 @@ work with these global styles: Returns the numeric style for the given format @var{type}. @end deftypefun -@deftypefun void fmt_set_style (enum fmt_type @var{type}, struct fmt_number_style *@var{style}) -Replaces the current numeric style for format @var{type} by the given -@var{style}, which becomes owned by the callee. @var{type} must be a -custom currency format and @var{style} must follow all the rules for -numeric styles explained above. +@deftypefun void fmt_check_style (const struct fmt_number_style *@var{style}) +Asserts that style is self consistent. @end deftypefun -@deftypefun int fmt_decimal_char (enum fmt_type @var{type}) -Returns the decimal point character for the given format @var{type}. -Equivalent to @code{fmt_get_style (@var{type})->decimal}. -@end deftypefun -@deftypefun int fmt_grouping_char (enum fmt_type @var{type}) -Returns the grouping character for the given format @var{type}, or 0 -if @var{type} output should not be grouped. Equivalent to -@code{fmt_get_style (@var{type})->grouping}. +@deftypefun {const char *} fmt_name (enum fmt_type @var{type}) +Returns the name of the given format @var{type}. @end deftypefun -@deftypefun void fmt_set_decimal (char @var{decimal}) -Changes the decimal point character for the basic numeric formats to -@var{decimal}, which must be @samp{.} or @samp{,}. The F, E, COMMA, -DOLLAR, and PCT will use the specified decimal point character, and the -opposite character for grouping where appropriate. The DOT format -uses the reverse choices. -@end deftypefun + @node Formatted Data Input and Output @subsection Formatted Data Input and Output @@ -1281,7 +1285,7 @@ Returns true if @var{var} is a string variable of width @code{MAX_SHORT_STRING} or less, false otherwise. @end deftypefun -@deftypefun bool var_is_long_string (const struct variable *var{var}) +@deftypefun bool var_is_long_string (const struct variable *@var{var}) Returns true if @var{var} is a string variable of width greater than @code{MAX_SHORT_STRING}, false otherwise. @end deftypefun diff --git a/po/de.po b/po/de.po index 7f608842..008819c8 100644 --- a/po/de.po +++ b/po/de.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: PSPP 0.4.3\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2008-01-10 11:14+0900\n" +"POT-Creation-Date: 2008-01-19 15:35+0900\n" "PO-Revision-Date: 2006-07-28 19:32+0800\n" "Last-Translator: John Darrington \n" "Language-Team: German \n" @@ -47,12 +47,6 @@ msgstr "Tag %d muß zwischen 0 bit 31 sein." msgid "Date %04d-%d-%d is before the earliest acceptable date of 1582-10-15." msgstr "" -#: src/data/casereader-filter.c:221 -msgid "" -"At least one case in the data read had a weight value that was user-missing, " -"system-missing, zero, or negative. These case(s) were ignored." -msgstr "" - #: src/data/case-tmpfile.c:57 msgid "failed to create temporary file" msgstr "" @@ -73,131 +67,137 @@ msgstr "plotzlich ist der Datei beendet" msgid "writing to temporary file" msgstr "" -#: src/data/data-in.c:287 src/data/data-in.c:477 +#: src/data/casereader-filter.c:221 +msgid "" +"At least one case in the data read had a weight value that was user-missing, " +"system-missing, zero, or negative. These case(s) were ignored." +msgstr "" + +#: src/data/data-in.c:254 src/data/data-in.c:444 msgid "Field contents are not numeric." msgstr "" -#: src/data/data-in.c:289 src/data/data-in.c:479 +#: src/data/data-in.c:256 src/data/data-in.c:446 msgid "Number followed by garbage." msgstr "" -#: src/data/data-in.c:300 +#: src/data/data-in.c:267 msgid "Invalid numeric syntax." msgstr "" -#: src/data/data-in.c:309 src/data/data-in.c:492 +#: src/data/data-in.c:276 src/data/data-in.c:459 msgid "Too-large number set to system-missing." msgstr "" -#: src/data/data-in.c:314 src/data/data-in.c:497 +#: src/data/data-in.c:281 src/data/data-in.c:464 msgid "Too-small number set to zero." msgstr "" -#: src/data/data-in.c:340 +#: src/data/data-in.c:307 msgid "All characters in field must be digits." msgstr "" -#: src/data/data-in.c:363 +#: src/data/data-in.c:330 msgid "Unrecognized character in field." msgstr "" -#: src/data/data-in.c:387 src/data/data-in.c:660 +#: src/data/data-in.c:354 src/data/data-in.c:628 msgid "Field must have even length." msgstr "" -#: src/data/data-in.c:392 src/data/data-in.c:671 +#: src/data/data-in.c:359 src/data/data-in.c:639 msgid "Field must contain only hex digits." msgstr "" -#: src/data/data-in.c:710 src/data/data-in.c:757 +#: src/data/data-in.c:678 src/data/data-in.c:725 msgid "Syntax error in date field." msgstr "" -#: src/data/data-in.c:726 +#: src/data/data-in.c:694 #, c-format msgid "Day (%ld) must be between 1 and 31." msgstr "" -#: src/data/data-in.c:773 +#: src/data/data-in.c:741 msgid "Delimiter expected between fields in date." msgstr "" -#: src/data/data-in.c:847 +#: src/data/data-in.c:815 msgid "" "Unrecognized month format. Months may be specified as Arabic or Roman " "numerals or as at least 3 letters of their English names." msgstr "" -#: src/data/data-in.c:874 +#: src/data/data-in.c:842 #, c-format msgid "Year (%ld) must be between 1582 and 19999." msgstr "" -#: src/data/data-in.c:886 +#: src/data/data-in.c:854 #, c-format msgid "Trailing garbage \"%.*s\" following date." msgstr "" -#: src/data/data-in.c:902 +#: src/data/data-in.c:870 msgid "Julian day must have exactly three digits." msgstr "" -#: src/data/data-in.c:907 +#: src/data/data-in.c:875 #, c-format msgid "Julian day (%ld) must be between 1 and 366." msgstr "" -#: src/data/data-in.c:931 +#: src/data/data-in.c:899 #, c-format msgid "Quarter (%ld) must be between 1 and 4." msgstr "" -#: src/data/data-in.c:951 +#: src/data/data-in.c:919 #, c-format msgid "Week (%ld) must be between 1 and 53." msgstr "" -#: src/data/data-in.c:964 +#: src/data/data-in.c:932 msgid "Delimiter expected between fields in time." msgstr "" -#: src/data/data-in.c:984 +#: src/data/data-in.c:952 #, c-format msgid "Minute (%ld) must be between 0 and 59." msgstr "" -#: src/data/data-in.c:1024 +#: src/data/data-in.c:992 msgid "" "Unrecognized weekday name. At least the first two letters of an English " "weekday name must be specified." msgstr "" -#: src/data/data-in.c:1162 +#: src/data/data-in.c:1130 #, c-format msgid "`%c' expected in date field." msgstr "" -#: src/data/data-in.c:1203 +#: src/data/data-in.c:1171 #, c-format msgid "column %d" msgstr "Spalten %d" -#: src/data/data-in.c:1205 +#: src/data/data-in.c:1173 #, fuzzy, c-format msgid "columns %d-%d" msgstr "Spalten" -#: src/data/data-in.c:1209 +#: src/data/data-in.c:1177 #, c-format msgid "%s field) " msgstr "" -#: src/data/data-out.c:476 +#: src/data/data-out.c:446 #, c-format msgid "Weekday number %f is not between 1 and 7." msgstr "" -#: src/data/data-out.c:497 +#: src/data/data-out.c:467 #, c-format msgid "Month number %f is not between 1 and 12." msgstr "" @@ -261,30 +261,30 @@ msgstr "" msgid "Not opening pipe file `%s' because SAFER option set." msgstr "" -#: src/data/format.c:226 +#: src/data/format.c:238 msgid "Input format" msgstr "" -#: src/data/format.c:226 +#: src/data/format.c:238 msgid "Output format" msgstr "" -#: src/data/format.c:235 +#: src/data/format.c:247 #, c-format msgid "Format %s may not be used for input." msgstr "" -#: src/data/format.c:242 +#: src/data/format.c:254 #, c-format msgid "%s specifies width %d, but %s requires an even width." msgstr "" -#: src/data/format.c:251 +#: src/data/format.c:263 #, c-format msgid "%s %s specifies width %d, but %s requires a width between %d and %d." msgstr "" -#: src/data/format.c:260 +#: src/data/format.c:272 #, c-format msgid "%s %s specifies %d decimal place, but %s does not allow any decimals." msgid_plural "" @@ -292,7 +292,7 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/data/format.c:271 +#: src/data/format.c:283 #, c-format msgid "" "%s %s specifies %d decimal place, but the given width allows at most %d " @@ -303,7 +303,7 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/data/format.c:278 +#: src/data/format.c:290 #, c-format msgid "" "%s %s specifies %d decimal place, but the given width does not allow for any " @@ -314,24 +314,24 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/data/format.c:317 +#: src/data/format.c:329 #, c-format msgid "%s variables are not compatible with %s format %s." msgstr "" -#: src/data/format.c:318 src/data/sys-file-reader.c:639 -#: src/ui/gui/data-editor.glade:1304 src/ui/gui/psppire.glade:2176 -#: src/ui/gui/psppire-var-store.c:493 +#: src/data/format.c:330 src/data/sys-file-reader.c:639 +#: src/ui/gui/data-editor.glade:1304 src/ui/gui/psppire-var-store.c:493 +#: src/ui/gui/psppire.glade:2176 msgid "String" msgstr "Zeichenkette" -#: src/data/format.c:318 src/data/sys-file-reader.c:639 -#: src/ui/gui/data-editor.glade:1193 src/ui/gui/psppire.glade:2131 -#: src/ui/gui/psppire-var-store.c:486 +#: src/data/format.c:330 src/data/sys-file-reader.c:639 +#: src/ui/gui/data-editor.glade:1193 src/ui/gui/psppire-var-store.c:486 +#: src/ui/gui/psppire.glade:2131 msgid "Numeric" msgstr "Nummer" -#: src/data/format.c:319 src/data/sys-file-reader.c:1133 +#: src/data/format.c:331 src/data/sys-file-reader.c:1133 #: src/data/sys-file-reader.c:1135 #: src/language/dictionary/apply-dictionary.c:78 #: src/language/dictionary/apply-dictionary.c:79 @@ -340,7 +340,7 @@ msgstr "Nummer" msgid "numeric" msgstr "numerisch" -#: src/data/format.c:319 src/data/sys-file-reader.c:1133 +#: src/data/format.c:331 src/data/sys-file-reader.c:1133 #: src/data/sys-file-reader.c:1135 #: src/language/dictionary/apply-dictionary.c:78 #: src/language/dictionary/apply-dictionary.c:79 @@ -349,7 +349,7 @@ msgstr "numerisch" msgid "string" msgstr "kette" -#: src/data/format.c:337 +#: src/data/format.c:349 #, c-format msgid "String variable with width %d is not compatible with format %s." msgstr "" @@ -596,6 +596,13 @@ msgstr "" msgid "scratch file" msgstr "" +#: src/data/settings.c:685 +#, c-format +msgid "" +"%s: Custom currency string `%s' does not contain exactly three periods or " +"commas (or it contains both)." +msgstr "" + #: src/data/short-names.c:71 msgid "Variable suffix too large." msgstr "" @@ -1368,6 +1375,61 @@ msgstr "" msgid "Handle for %s not allowed here." msgstr "" +#: src/language/data-io/get-data.c:57 +#, c-format +msgid "Unsupported TYPE %s" +msgstr "" + +#: src/language/data-io/get-data.c:181 +#, c-format +msgid "" +"%s is allowed only with %s arrangement, but %s arrangement was stated or " +"implied earlier in this command." +msgstr "" + +#: src/language/data-io/get-data.c:236 +msgid "expecting FIXED or DELIMITED" +msgstr "" + +#: src/language/data-io/get-data.c:249 +msgid "Value of FIRSTCASE must be 1 or greater." +msgstr "" + +#: src/language/data-io/get-data.c:274 +msgid "expecting LINE or VARIABLES" +msgstr "" + +#: src/language/data-io/get-data.c:287 +msgid "Value of FIXCASE must be at least 1." +msgstr "" + +#: src/language/data-io/get-data.c:307 +msgid "Value of FIRST must be at least 1." +msgstr "" + +#: src/language/data-io/get-data.c:319 +msgid "Value of PERCENT must be between 1 and 100." +msgstr "" + +#: src/language/data-io/get-data.c:372 +msgid "expecting VARIABLES" +msgstr "" + +#: src/language/data-io/get-data.c:394 +#: src/language/data-io/placement-parser.c:376 +#, c-format +msgid "" +"The record number specified, %ld, is at or before the previous record, %d. " +"Data fields must be listed in order of increasing record number." +msgstr "" + +#: src/language/data-io/get-data.c:403 +#, c-format +msgid "" +"The record number specified, %ld, exceeds the number of records per case " +"specified on FIXCASE, %d." +msgstr "" + #: src/language/data-io/get.c:99 msgid "expecting COMM or TAPE" msgstr "" @@ -1457,61 +1519,6 @@ msgid "" "variable in earlier file (%s)." msgstr "" -#: src/language/data-io/get-data.c:57 -#, c-format -msgid "Unsupported TYPE %s" -msgstr "" - -#: src/language/data-io/get-data.c:181 -#, c-format -msgid "" -"%s is allowed only with %s arrangement, but %s arrangement was stated or " -"implied earlier in this command." -msgstr "" - -#: src/language/data-io/get-data.c:236 -msgid "expecting FIXED or DELIMITED" -msgstr "" - -#: src/language/data-io/get-data.c:249 -msgid "Value of FIRSTCASE must be 1 or greater." -msgstr "" - -#: src/language/data-io/get-data.c:274 -msgid "expecting LINE or VARIABLES" -msgstr "" - -#: src/language/data-io/get-data.c:287 -msgid "Value of FIXCASE must be at least 1." -msgstr "" - -#: src/language/data-io/get-data.c:307 -msgid "Value of FIRST must be at least 1." -msgstr "" - -#: src/language/data-io/get-data.c:319 -msgid "Value of PERCENT must be between 1 and 100." -msgstr "" - -#: src/language/data-io/get-data.c:372 -msgid "expecting VARIABLES" -msgstr "" - -#: src/language/data-io/get-data.c:394 -#: src/language/data-io/placement-parser.c:376 -#, c-format -msgid "" -"The record number specified, %ld, is at or before the previous record, %d. " -"Data fields must be listed in order of increasing record number." -msgstr "" - -#: src/language/data-io/get-data.c:403 -#, c-format -msgid "" -"The record number specified, %ld, exceeds the number of records per case " -"specified on FIXCASE, %d." -msgstr "" - #: src/language/data-io/inpt-pgm.c:129 msgid "Unexpected end-of-file within INPUT PROGRAM." msgstr "" @@ -1601,6 +1608,20 @@ msgstr "" msgid "The ending column for a field must be greater than the starting column." msgstr "" +#: src/language/data-io/print-space.c:73 src/language/lexer/lexer.c:476 +#: src/language/stats/autorecode.c:154 src/language/xforms/select-if.c:60 +msgid "expecting end of command" +msgstr "" + +#: src/language/data-io/print-space.c:116 +msgid "The expression on PRINT SPACE evaluated to the system-missing value." +msgstr "" + +#: src/language/data-io/print-space.c:119 +#, c-format +msgid "The expression on PRINT SPACE evaluated to %g." +msgstr "" + #: src/language/data-io/print.c:265 #, c-format msgid "Output calls for %d records but %zu specified on RECORDS subcommand." @@ -1620,20 +1641,6 @@ msgid_plural "Writing %d records." msgstr[0] "" msgstr[1] "" -#: src/language/data-io/print-space.c:73 src/language/lexer/lexer.c:476 -#: src/language/stats/autorecode.c:154 src/language/xforms/select-if.c:60 -msgid "expecting end of command" -msgstr "" - -#: src/language/data-io/print-space.c:116 -msgid "The expression on PRINT SPACE evaluated to the system-missing value." -msgstr "" - -#: src/language/data-io/print-space.c:119 -#, c-format -msgid "The expression on PRINT SPACE evaluated to %g." -msgstr "" - #: src/language/dictionary/apply-dictionary.c:75 #, c-format msgid "Variable %s is %s in target file, but %s in source file." @@ -3313,6 +3320,22 @@ msgstr "" msgid "TABLES subcommand may not appear more than once." msgstr "" +#: src/language/stats/npar-summary.c:108 +msgid "Descriptive Statistics" +msgstr "" + +#: src/language/stats/npar-summary.c:145 +msgid "25th" +msgstr "" + +#: src/language/stats/npar-summary.c:148 +msgid "50th (Median)" +msgstr "" + +#: src/language/stats/npar-summary.c:151 +msgid "75th" +msgstr "" + #: src/language/stats/npar.q:98 msgid "NPAR subcommand not currently implemented." msgstr "" @@ -3337,22 +3360,6 @@ msgid "" "not match the number following (%zu)." msgstr "" -#: src/language/stats/npar-summary.c:108 -msgid "Descriptive Statistics" -msgstr "" - -#: src/language/stats/npar-summary.c:145 -msgid "25th" -msgstr "" - -#: src/language/stats/npar-summary.c:148 -msgid "50th (Median)" -msgstr "" - -#: src/language/stats/npar-summary.c:151 -msgid "75th" -msgstr "" - #: src/language/stats/oneway.q:169 msgid "Number of contrast coefficients must equal the number of groups" msgstr "" @@ -3828,121 +3835,114 @@ msgstr "" msgid "Active file compression is not implemented." msgstr "" -#: src/language/utilities/set.q:347 -#, c-format -msgid "" -"%s: Custom currency string `%s' does not contain exactly three periods or " -"commas (or it contains both)." -msgstr "" - -#: src/language/utilities/set.q:403 +#: src/language/utilities/set.q:318 msgid "EPOCH must be 1500 or later." msgstr "" -#: src/language/utilities/set.q:410 +#: src/language/utilities/set.q:325 msgid "expecting AUTOMATIC or year" msgstr "" -#: src/language/utilities/set.q:431 +#: src/language/utilities/set.q:346 msgid "LENGTH must be at least 1." msgstr "" -#: src/language/utilities/set.q:475 +#: src/language/utilities/set.q:390 msgid "WIDTH must be at least 40." msgstr "" -#: src/language/utilities/set.q:498 +#: src/language/utilities/set.q:413 #, c-format msgid "" "FORMAT requires numeric output format as an argument. Specified format %s " "is of type string." msgstr "" -#: src/language/utilities/set.q:565 +#: src/language/utilities/set.q:480 msgid "BLANKS is SYSMIS." msgstr "" -#: src/language/utilities/set.q:567 +#: src/language/utilities/set.q:482 #, c-format msgid "BLANKS is %g." msgstr "" -#: src/language/utilities/set.q:602 +#: src/language/utilities/set.q:517 #, c-format msgid "%s is \"%s\"." msgstr "" -#: src/language/utilities/set.q:638 +#: src/language/utilities/set.q:553 #, c-format msgid "DECIMAL is \"%c\"." msgstr "" -#: src/language/utilities/set.q:644 +#: src/language/utilities/set.q:559 #, c-format msgid "ENDCMD is \"%c\"." msgstr "" -#: src/language/utilities/set.q:652 +#: src/language/utilities/set.q:567 #, c-format msgid "ERRORS is \"%s\"." msgstr "" -#: src/language/utilities/set.q:663 +#: src/language/utilities/set.q:578 #, c-format msgid "FORMAT is %s." msgstr "" -#: src/language/utilities/set.q:669 +#: src/language/utilities/set.q:584 #, c-format msgid "LENGTH is %d." msgstr "" -#: src/language/utilities/set.q:675 +#: src/language/utilities/set.q:590 #, c-format msgid "MXERRS is %d." msgstr "" -#: src/language/utilities/set.q:681 +#: src/language/utilities/set.q:596 #, c-format msgid "MXLOOPS is %d." msgstr "" -#: src/language/utilities/set.q:687 +#: src/language/utilities/set.q:602 #, c-format msgid "MXWARNS is %d." msgstr "" -#: src/language/utilities/set.q:694 src/language/utilities/set.q:745 +#: src/language/utilities/set.q:609 src/language/utilities/set.q:660 #, c-format msgid "%s is %s (%s)." msgstr "" -#: src/language/utilities/set.q:766 +#: src/language/utilities/set.q:681 msgid "SCOMPRESSION is ON." msgstr "" -#: src/language/utilities/set.q:768 +#: src/language/utilities/set.q:683 msgid "SCOMPRESSION is OFF." msgstr "" -#: src/language/utilities/set.q:775 +#: src/language/utilities/set.q:690 msgid "UNDEFINED is WARN." msgstr "" -#: src/language/utilities/set.q:777 +#: src/language/utilities/set.q:692 msgid "UNDEFINED is NOWARN." msgstr "" -#: src/language/utilities/set.q:785 +#: src/language/utilities/set.q:700 msgid "WEIGHT is off." msgstr "" -#: src/language/utilities/set.q:787 +#: src/language/utilities/set.q:702 #, c-format msgid "WEIGHT is variable %s." msgstr "" -#: src/language/utilities/set.q:805 +#: src/language/utilities/set.q:720 #, c-format msgid "WIDTH is %d." msgstr "" @@ -5378,15 +5378,6 @@ msgstr "xyzzy" msgid "Paste" msgstr "Datum" -#: src/ui/gui/psppire.c:199 -msgid "_Reset" -msgstr "_Zurücksetzen" - -#: src/ui/gui/psppire.c:200 -#, fuzzy -msgid "_Select" -msgstr "Schriftwahlung" - #: src/ui/gui/psppire-data-store.c:816 msgid "var" msgstr "" @@ -5396,6 +5387,33 @@ msgstr "" msgid "%ld" msgstr "" +#: src/ui/gui/psppire-var-store.c:479 src/ui/gui/var-display.c:14 +msgid "None" +msgstr "Keine" + +#: src/ui/gui/psppire-var-store.c:489 +msgid "Scientific" +msgstr "Wissenschäflich" + +#: src/ui/gui/psppire-var-store.c:492 +msgid "Custom" +msgstr "Spezial" + +#: src/ui/gui/psppire-var-store.c:563 src/ui/gui/psppire-var-store.c:573 +#: src/ui/gui/psppire-var-store.c:583 +#, c-format +msgid "%d" +msgstr "" + +#: src/ui/gui/psppire.c:198 +msgid "_Reset" +msgstr "_Zurücksetzen" + +#: src/ui/gui/psppire.c:199 +#, fuzzy +msgid "_Select" +msgstr "Schriftwahlung" + #: src/ui/gui/psppire.glade:11 #, fuzzy msgid "This is pre-alpha software. Use at your own risk." @@ -5635,24 +5653,6 @@ msgstr "" msgid "Search backward" msgstr "" -#: src/ui/gui/psppire-var-store.c:479 src/ui/gui/var-display.c:14 -msgid "None" -msgstr "Keine" - -#: src/ui/gui/psppire-var-store.c:489 -msgid "Scientific" -msgstr "Wissenschäflich" - -#: src/ui/gui/psppire-var-store.c:492 -msgid "Custom" -msgstr "Spezial" - -#: src/ui/gui/psppire-var-store.c:563 src/ui/gui/psppire-var-store.c:573 -#: src/ui/gui/psppire-var-store.c:583 -#, c-format -msgid "%d" -msgstr "" - #: src/ui/gui/rank.glade:111 msgid "By:" msgstr "" @@ -5932,6 +5932,11 @@ msgstr "" msgid "To End" msgstr "" +#: src/ui/gui/t-test-options.c:60 +#, c-format +msgid "Confidence Interval: %2d %%" +msgstr "" + #: src/ui/gui/t-test.glade:53 src/ui/gui/t-test.glade:161 msgid "Define Groups" msgstr "" @@ -5974,10 +5979,25 @@ msgstr "" msgid "Test Value: " msgstr "Werte:" -#: src/ui/gui/t-test-options.c:60 -#, c-format -msgid "Confidence Interval: %2d %%" -msgstr "" +#: src/ui/gui/var-sheet.c:65 +msgid "Name" +msgstr "Name" + +#: src/ui/gui/var-sheet.c:68 +msgid "Decimals" +msgstr "Dezimalstellen" + +#: src/ui/gui/var-sheet.c:70 +msgid "Values" +msgstr "Werten" + +#: src/ui/gui/var-sheet.c:73 +msgid "Align" +msgstr "Einstellung" + +#: src/ui/gui/var-sheet.c:74 +msgid "Measure" +msgstr "Messe" #: src/ui/gui/variable-info-dialog.c:88 #, fuzzy, c-format @@ -6009,26 +6029,6 @@ msgstr "Werten" msgid "%s %s\n" msgstr "" -#: src/ui/gui/var-sheet.c:65 -msgid "Name" -msgstr "Name" - -#: src/ui/gui/var-sheet.c:68 -msgid "Decimals" -msgstr "Dezimalstellen" - -#: src/ui/gui/var-sheet.c:70 -msgid "Values" -msgstr "Werten" - -#: src/ui/gui/var-sheet.c:73 -msgid "Align" -msgstr "Einstellung" - -#: src/ui/gui/var-sheet.c:74 -msgid "Measure" -msgstr "Messe" - #: src/ui/gui/weight-cases-dialog.c:88 #, c-format msgid "Weight cases by %s" @@ -6117,7 +6117,7 @@ msgid "" "Report bugs to <%s>.\n" msgstr "" -#: src/ui/terminal/main.c:132 +#: src/ui/terminal/main.c:131 msgid "" "Stopping syntax file processing here to avoid a cascade of dependent command " "failures." diff --git a/po/en_GB.po b/po/en_GB.po index b450b048..084543a9 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PSPP 0.4.3\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2008-01-10 11:14+0900\n" +"POT-Creation-Date: 2008-01-19 15:35+0900\n" "PO-Revision-Date: 2007-09-15 08:29+0800\n" "Last-Translator: John Darrington \n" "Language-Team: John Darrington \n" @@ -44,12 +44,6 @@ msgstr "" msgid "Date %04d-%d-%d is before the earliest acceptable date of 1582-10-15." msgstr "" -#: src/data/casereader-filter.c:221 -msgid "" -"At least one case in the data read had a weight value that was user-missing, " -"system-missing, zero, or negative. These case(s) were ignored." -msgstr "" - #: src/data/case-tmpfile.c:57 msgid "failed to create temporary file" msgstr "" @@ -70,131 +64,137 @@ msgstr "" msgid "writing to temporary file" msgstr "" -#: src/data/data-in.c:287 src/data/data-in.c:477 +#: src/data/casereader-filter.c:221 +msgid "" +"At least one case in the data read had a weight value that was user-missing, " +"system-missing, zero, or negative. These case(s) were ignored." +msgstr "" + +#: src/data/data-in.c:254 src/data/data-in.c:444 msgid "Field contents are not numeric." msgstr "" -#: src/data/data-in.c:289 src/data/data-in.c:479 +#: src/data/data-in.c:256 src/data/data-in.c:446 msgid "Number followed by garbage." msgstr "" -#: src/data/data-in.c:300 +#: src/data/data-in.c:267 msgid "Invalid numeric syntax." msgstr "" -#: src/data/data-in.c:309 src/data/data-in.c:492 +#: src/data/data-in.c:276 src/data/data-in.c:459 msgid "Too-large number set to system-missing." msgstr "" -#: src/data/data-in.c:314 src/data/data-in.c:497 +#: src/data/data-in.c:281 src/data/data-in.c:464 msgid "Too-small number set to zero." msgstr "" -#: src/data/data-in.c:340 +#: src/data/data-in.c:307 msgid "All characters in field must be digits." msgstr "" -#: src/data/data-in.c:363 +#: src/data/data-in.c:330 msgid "Unrecognized character in field." msgstr "" -#: src/data/data-in.c:387 src/data/data-in.c:660 +#: src/data/data-in.c:354 src/data/data-in.c:628 msgid "Field must have even length." msgstr "" -#: src/data/data-in.c:392 src/data/data-in.c:671 +#: src/data/data-in.c:359 src/data/data-in.c:639 msgid "Field must contain only hex digits." msgstr "" -#: src/data/data-in.c:710 src/data/data-in.c:757 +#: src/data/data-in.c:678 src/data/data-in.c:725 msgid "Syntax error in date field." msgstr "" -#: src/data/data-in.c:726 +#: src/data/data-in.c:694 #, c-format msgid "Day (%ld) must be between 1 and 31." msgstr "" -#: src/data/data-in.c:773 +#: src/data/data-in.c:741 msgid "Delimiter expected between fields in date." msgstr "" -#: src/data/data-in.c:847 +#: src/data/data-in.c:815 msgid "" "Unrecognized month format. Months may be specified as Arabic or Roman " "numerals or as at least 3 letters of their English names." msgstr "" -#: src/data/data-in.c:874 +#: src/data/data-in.c:842 #, c-format msgid "Year (%ld) must be between 1582 and 19999." msgstr "" -#: src/data/data-in.c:886 +#: src/data/data-in.c:854 #, c-format msgid "Trailing garbage \"%.*s\" following date." msgstr "" -#: src/data/data-in.c:902 +#: src/data/data-in.c:870 msgid "Julian day must have exactly three digits." msgstr "" -#: src/data/data-in.c:907 +#: src/data/data-in.c:875 #, c-format msgid "Julian day (%ld) must be between 1 and 366." msgstr "" -#: src/data/data-in.c:931 +#: src/data/data-in.c:899 #, c-format msgid "Quarter (%ld) must be between 1 and 4." msgstr "" -#: src/data/data-in.c:951 +#: src/data/data-in.c:919 #, c-format msgid "Week (%ld) must be between 1 and 53." msgstr "" -#: src/data/data-in.c:964 +#: src/data/data-in.c:932 msgid "Delimiter expected between fields in time." msgstr "" -#: src/data/data-in.c:984 +#: src/data/data-in.c:952 #, c-format msgid "Minute (%ld) must be between 0 and 59." msgstr "" -#: src/data/data-in.c:1024 +#: src/data/data-in.c:992 msgid "" "Unrecognized weekday name. At least the first two letters of an English " "weekday name must be specified." msgstr "" -#: src/data/data-in.c:1162 +#: src/data/data-in.c:1130 #, c-format msgid "`%c' expected in date field." msgstr "" -#: src/data/data-in.c:1203 +#: src/data/data-in.c:1171 #, c-format msgid "column %d" msgstr "" -#: src/data/data-in.c:1205 +#: src/data/data-in.c:1173 #, c-format msgid "columns %d-%d" msgstr "" -#: src/data/data-in.c:1209 +#: src/data/data-in.c:1177 #, c-format msgid "%s field) " msgstr "" -#: src/data/data-out.c:476 +#: src/data/data-out.c:446 #, c-format msgid "Weekday number %f is not between 1 and 7." msgstr "" -#: src/data/data-out.c:497 +#: src/data/data-out.c:467 #, c-format msgid "Month number %f is not between 1 and 12." msgstr "" @@ -256,30 +256,30 @@ msgstr "" msgid "Not opening pipe file `%s' because SAFER option set." msgstr "" -#: src/data/format.c:226 +#: src/data/format.c:238 msgid "Input format" msgstr "" -#: src/data/format.c:226 +#: src/data/format.c:238 msgid "Output format" msgstr "" -#: src/data/format.c:235 +#: src/data/format.c:247 #, c-format msgid "Format %s may not be used for input." msgstr "" -#: src/data/format.c:242 +#: src/data/format.c:254 #, c-format msgid "%s specifies width %d, but %s requires an even width." msgstr "" -#: src/data/format.c:251 +#: src/data/format.c:263 #, c-format msgid "%s %s specifies width %d, but %s requires a width between %d and %d." msgstr "" -#: src/data/format.c:260 +#: src/data/format.c:272 #, c-format msgid "%s %s specifies %d decimal place, but %s does not allow any decimals." msgid_plural "" @@ -287,7 +287,7 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/data/format.c:271 +#: src/data/format.c:283 #, c-format msgid "" "%s %s specifies %d decimal place, but the given width allows at most %d " @@ -298,7 +298,7 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/data/format.c:278 +#: src/data/format.c:290 #, c-format msgid "" "%s %s specifies %d decimal place, but the given width does not allow for any " @@ -309,24 +309,24 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: src/data/format.c:317 +#: src/data/format.c:329 #, c-format msgid "%s variables are not compatible with %s format %s." msgstr "" -#: src/data/format.c:318 src/data/sys-file-reader.c:639 -#: src/ui/gui/data-editor.glade:1304 src/ui/gui/psppire.glade:2176 -#: src/ui/gui/psppire-var-store.c:493 +#: src/data/format.c:330 src/data/sys-file-reader.c:639 +#: src/ui/gui/data-editor.glade:1304 src/ui/gui/psppire-var-store.c:493 +#: src/ui/gui/psppire.glade:2176 msgid "String" msgstr "" -#: src/data/format.c:318 src/data/sys-file-reader.c:639 -#: src/ui/gui/data-editor.glade:1193 src/ui/gui/psppire.glade:2131 -#: src/ui/gui/psppire-var-store.c:486 +#: src/data/format.c:330 src/data/sys-file-reader.c:639 +#: src/ui/gui/data-editor.glade:1193 src/ui/gui/psppire-var-store.c:486 +#: src/ui/gui/psppire.glade:2131 msgid "Numeric" msgstr "" -#: src/data/format.c:319 src/data/sys-file-reader.c:1133 +#: src/data/format.c:331 src/data/sys-file-reader.c:1133 #: src/data/sys-file-reader.c:1135 #: src/language/dictionary/apply-dictionary.c:78 #: src/language/dictionary/apply-dictionary.c:79 @@ -335,7 +335,7 @@ msgstr "" msgid "numeric" msgstr "" -#: src/data/format.c:319 src/data/sys-file-reader.c:1133 +#: src/data/format.c:331 src/data/sys-file-reader.c:1133 #: src/data/sys-file-reader.c:1135 #: src/language/dictionary/apply-dictionary.c:78 #: src/language/dictionary/apply-dictionary.c:79 @@ -344,7 +344,7 @@ msgstr "" msgid "string" msgstr "" -#: src/data/format.c:337 +#: src/data/format.c:349 #, c-format msgid "String variable with width %d is not compatible with format %s." msgstr "" @@ -590,6 +590,13 @@ msgstr "" msgid "scratch file" msgstr "" +#: src/data/settings.c:685 +#, c-format +msgid "" +"%s: Custom currency string `%s' does not contain exactly three periods or " +"commas (or it contains both)." +msgstr "" + #: src/data/short-names.c:71 msgid "Variable suffix too large." msgstr "" @@ -1359,6 +1366,61 @@ msgstr "" msgid "Handle for %s not allowed here." msgstr "" +#: src/language/data-io/get-data.c:57 +#, c-format +msgid "Unsupported TYPE %s" +msgstr "" + +#: src/language/data-io/get-data.c:181 +#, c-format +msgid "" +"%s is allowed only with %s arrangement, but %s arrangement was stated or " +"implied earlier in this command." +msgstr "" + +#: src/language/data-io/get-data.c:236 +msgid "expecting FIXED or DELIMITED" +msgstr "" + +#: src/language/data-io/get-data.c:249 +msgid "Value of FIRSTCASE must be 1 or greater." +msgstr "" + +#: src/language/data-io/get-data.c:274 +msgid "expecting LINE or VARIABLES" +msgstr "" + +#: src/language/data-io/get-data.c:287 +msgid "Value of FIXCASE must be at least 1." +msgstr "" + +#: src/language/data-io/get-data.c:307 +msgid "Value of FIRST must be at least 1." +msgstr "" + +#: src/language/data-io/get-data.c:319 +msgid "Value of PERCENT must be between 1 and 100." +msgstr "" + +#: src/language/data-io/get-data.c:372 +msgid "expecting VARIABLES" +msgstr "" + +#: src/language/data-io/get-data.c:394 +#: src/language/data-io/placement-parser.c:376 +#, c-format +msgid "" +"The record number specified, %ld, is at or before the previous record, %d. " +"Data fields must be listed in order of increasing record number." +msgstr "" + +#: src/language/data-io/get-data.c:403 +#, c-format +msgid "" +"The record number specified, %ld, exceeds the number of records per case " +"specified on FIXCASE, %d." +msgstr "" + #: src/language/data-io/get.c:99 msgid "expecting COMM or TAPE" msgstr "" @@ -1448,61 +1510,6 @@ msgid "" "variable in earlier file (%s)." msgstr "" -#: src/language/data-io/get-data.c:57 -#, c-format -msgid "Unsupported TYPE %s" -msgstr "" - -#: src/language/data-io/get-data.c:181 -#, c-format -msgid "" -"%s is allowed only with %s arrangement, but %s arrangement was stated or " -"implied earlier in this command." -msgstr "" - -#: src/language/data-io/get-data.c:236 -msgid "expecting FIXED or DELIMITED" -msgstr "" - -#: src/language/data-io/get-data.c:249 -msgid "Value of FIRSTCASE must be 1 or greater." -msgstr "" - -#: src/language/data-io/get-data.c:274 -msgid "expecting LINE or VARIABLES" -msgstr "" - -#: src/language/data-io/get-data.c:287 -msgid "Value of FIXCASE must be at least 1." -msgstr "" - -#: src/language/data-io/get-data.c:307 -msgid "Value of FIRST must be at least 1." -msgstr "" - -#: src/language/data-io/get-data.c:319 -msgid "Value of PERCENT must be between 1 and 100." -msgstr "" - -#: src/language/data-io/get-data.c:372 -msgid "expecting VARIABLES" -msgstr "" - -#: src/language/data-io/get-data.c:394 -#: src/language/data-io/placement-parser.c:376 -#, c-format -msgid "" -"The record number specified, %ld, is at or before the previous record, %d. " -"Data fields must be listed in order of increasing record number." -msgstr "" - -#: src/language/data-io/get-data.c:403 -#, c-format -msgid "" -"The record number specified, %ld, exceeds the number of records per case " -"specified on FIXCASE, %d." -msgstr "" - #: src/language/data-io/inpt-pgm.c:129 msgid "Unexpected end-of-file within INPUT PROGRAM." msgstr "" @@ -1592,6 +1599,20 @@ msgstr "" msgid "The ending column for a field must be greater than the starting column." msgstr "" +#: src/language/data-io/print-space.c:73 src/language/lexer/lexer.c:476 +#: src/language/stats/autorecode.c:154 src/language/xforms/select-if.c:60 +msgid "expecting end of command" +msgstr "" + +#: src/language/data-io/print-space.c:116 +msgid "The expression on PRINT SPACE evaluated to the system-missing value." +msgstr "" + +#: src/language/data-io/print-space.c:119 +#, c-format +msgid "The expression on PRINT SPACE evaluated to %g." +msgstr "" + #: src/language/data-io/print.c:265 #, c-format msgid "Output calls for %d records but %zu specified on RECORDS subcommand." @@ -1611,20 +1632,6 @@ msgid_plural "Writing %d records." msgstr[0] "" msgstr[1] "" -#: src/language/data-io/print-space.c:73 src/language/lexer/lexer.c:476 -#: src/language/stats/autorecode.c:154 src/language/xforms/select-if.c:60 -msgid "expecting end of command" -msgstr "" - -#: src/language/data-io/print-space.c:116 -msgid "The expression on PRINT SPACE evaluated to the system-missing value." -msgstr "" - -#: src/language/data-io/print-space.c:119 -#, c-format -msgid "The expression on PRINT SPACE evaluated to %g." -msgstr "" - #: src/language/dictionary/apply-dictionary.c:75 #, c-format msgid "Variable %s is %s in target file, but %s in source file." @@ -3304,6 +3311,22 @@ msgstr "" msgid "TABLES subcommand may not appear more than once." msgstr "" +#: src/language/stats/npar-summary.c:108 +msgid "Descriptive Statistics" +msgstr "" + +#: src/language/stats/npar-summary.c:145 +msgid "25th" +msgstr "" + +#: src/language/stats/npar-summary.c:148 +msgid "50th (Median)" +msgstr "" + +#: src/language/stats/npar-summary.c:151 +msgid "75th" +msgstr "" + #: src/language/stats/npar.q:98 msgid "NPAR subcommand not currently implemented." msgstr "" @@ -3328,22 +3351,6 @@ msgid "" "not match the number following (%zu)." msgstr "" -#: src/language/stats/npar-summary.c:108 -msgid "Descriptive Statistics" -msgstr "" - -#: src/language/stats/npar-summary.c:145 -msgid "25th" -msgstr "" - -#: src/language/stats/npar-summary.c:148 -msgid "50th (Median)" -msgstr "" - -#: src/language/stats/npar-summary.c:151 -msgid "75th" -msgstr "" - #: src/language/stats/oneway.q:169 msgid "Number of contrast coefficients must equal the number of groups" msgstr "" @@ -3819,121 +3826,114 @@ msgstr "" msgid "Active file compression is not implemented." msgstr "" -#: src/language/utilities/set.q:347 -#, c-format -msgid "" -"%s: Custom currency string `%s' does not contain exactly three periods or " -"commas (or it contains both)." -msgstr "" - -#: src/language/utilities/set.q:403 +#: src/language/utilities/set.q:318 msgid "EPOCH must be 1500 or later." msgstr "" -#: src/language/utilities/set.q:410 +#: src/language/utilities/set.q:325 msgid "expecting AUTOMATIC or year" msgstr "" -#: src/language/utilities/set.q:431 +#: src/language/utilities/set.q:346 msgid "LENGTH must be at least 1." msgstr "" -#: src/language/utilities/set.q:475 +#: src/language/utilities/set.q:390 msgid "WIDTH must be at least 40." msgstr "" -#: src/language/utilities/set.q:498 +#: src/language/utilities/set.q:413 #, c-format msgid "" "FORMAT requires numeric output format as an argument. Specified format %s " "is of type string." msgstr "" -#: src/language/utilities/set.q:565 +#: src/language/utilities/set.q:480 msgid "BLANKS is SYSMIS." msgstr "" -#: src/language/utilities/set.q:567 +#: src/language/utilities/set.q:482 #, c-format msgid "BLANKS is %g." msgstr "" -#: src/language/utilities/set.q:602 +#: src/language/utilities/set.q:517 #, c-format msgid "%s is \"%s\"." msgstr "" -#: src/language/utilities/set.q:638 +#: src/language/utilities/set.q:553 #, c-format msgid "DECIMAL is \"%c\"." msgstr "" -#: src/language/utilities/set.q:644 +#: src/language/utilities/set.q:559 #, c-format msgid "ENDCMD is \"%c\"." msgstr "" -#: src/language/utilities/set.q:652 +#: src/language/utilities/set.q:567 #, c-format msgid "ERRORS is \"%s\"." msgstr "" -#: src/language/utilities/set.q:663 +#: src/language/utilities/set.q:578 #, c-format msgid "FORMAT is %s." msgstr "" -#: src/language/utilities/set.q:669 +#: src/language/utilities/set.q:584 #, c-format msgid "LENGTH is %d." msgstr "" -#: src/language/utilities/set.q:675 +#: src/language/utilities/set.q:590 #, c-format msgid "MXERRS is %d." msgstr "" -#: src/language/utilities/set.q:681 +#: src/language/utilities/set.q:596 #, c-format msgid "MXLOOPS is %d." msgstr "" -#: src/language/utilities/set.q:687 +#: src/language/utilities/set.q:602 #, c-format msgid "MXWARNS is %d." msgstr "" -#: src/language/utilities/set.q:694 src/language/utilities/set.q:745 +#: src/language/utilities/set.q:609 src/language/utilities/set.q:660 #, c-format msgid "%s is %s (%s)." msgstr "" -#: src/language/utilities/set.q:766 +#: src/language/utilities/set.q:681 msgid "SCOMPRESSION is ON." msgstr "" -#: src/language/utilities/set.q:768 +#: src/language/utilities/set.q:683 msgid "SCOMPRESSION is OFF." msgstr "" -#: src/language/utilities/set.q:775 +#: src/language/utilities/set.q:690 msgid "UNDEFINED is WARN." msgstr "" -#: src/language/utilities/set.q:777 +#: src/language/utilities/set.q:692 msgid "UNDEFINED is NOWARN." msgstr "" -#: src/language/utilities/set.q:785 +#: src/language/utilities/set.q:700 msgid "WEIGHT is off." msgstr "" -#: src/language/utilities/set.q:787 +#: src/language/utilities/set.q:702 #, c-format msgid "WEIGHT is variable %s." msgstr "" -#: src/language/utilities/set.q:805 +#: src/language/utilities/set.q:720 #, c-format msgid "WIDTH is %d." msgstr "" @@ -5322,14 +5322,6 @@ msgstr "" msgid "Paste" msgstr "" -#: src/ui/gui/psppire.c:199 -msgid "_Reset" -msgstr "" - -#: src/ui/gui/psppire.c:200 -msgid "_Select" -msgstr "" - #: src/ui/gui/psppire-data-store.c:816 msgid "var" msgstr "" @@ -5339,6 +5331,32 @@ msgstr "" msgid "%ld" msgstr "" +#: src/ui/gui/psppire-var-store.c:479 src/ui/gui/var-display.c:14 +msgid "None" +msgstr "" + +#: src/ui/gui/psppire-var-store.c:489 +msgid "Scientific" +msgstr "" + +#: src/ui/gui/psppire-var-store.c:492 +msgid "Custom" +msgstr "" + +#: src/ui/gui/psppire-var-store.c:563 src/ui/gui/psppire-var-store.c:573 +#: src/ui/gui/psppire-var-store.c:583 +#, c-format +msgid "%d" +msgstr "" + +#: src/ui/gui/psppire.c:198 +msgid "_Reset" +msgstr "" + +#: src/ui/gui/psppire.c:199 +msgid "_Select" +msgstr "" + #: src/ui/gui/psppire.glade:11 msgid "This is pre-alpha software. Use at your own risk." msgstr "" @@ -5563,24 +5581,6 @@ msgstr "" msgid "Search backward" msgstr "" -#: src/ui/gui/psppire-var-store.c:479 src/ui/gui/var-display.c:14 -msgid "None" -msgstr "" - -#: src/ui/gui/psppire-var-store.c:489 -msgid "Scientific" -msgstr "" - -#: src/ui/gui/psppire-var-store.c:492 -msgid "Custom" -msgstr "" - -#: src/ui/gui/psppire-var-store.c:563 src/ui/gui/psppire-var-store.c:573 -#: src/ui/gui/psppire-var-store.c:583 -#, c-format -msgid "%d" -msgstr "" - #: src/ui/gui/rank.glade:111 msgid "By:" msgstr "" @@ -5837,6 +5837,11 @@ msgstr "" msgid "To End" msgstr "" +#: src/ui/gui/t-test-options.c:60 +#, c-format +msgid "Confidence Interval: %2d %%" +msgstr "" + #: src/ui/gui/t-test.glade:53 src/ui/gui/t-test.glade:161 msgid "Define Groups" msgstr "" @@ -5877,9 +5882,24 @@ msgstr "" msgid "Test Value: " msgstr "" -#: src/ui/gui/t-test-options.c:60 -#, c-format -msgid "Confidence Interval: %2d %%" +#: src/ui/gui/var-sheet.c:65 +msgid "Name" +msgstr "" + +#: src/ui/gui/var-sheet.c:68 +msgid "Decimals" +msgstr "" + +#: src/ui/gui/var-sheet.c:70 +msgid "Values" +msgstr "" + +#: src/ui/gui/var-sheet.c:73 +msgid "Align" +msgstr "" + +#: src/ui/gui/var-sheet.c:74 +msgid "Measure" msgstr "" #: src/ui/gui/variable-info-dialog.c:88 @@ -5911,26 +5931,6 @@ msgstr "" msgid "%s %s\n" msgstr "" -#: src/ui/gui/var-sheet.c:65 -msgid "Name" -msgstr "" - -#: src/ui/gui/var-sheet.c:68 -msgid "Decimals" -msgstr "" - -#: src/ui/gui/var-sheet.c:70 -msgid "Values" -msgstr "" - -#: src/ui/gui/var-sheet.c:73 -msgid "Align" -msgstr "" - -#: src/ui/gui/var-sheet.c:74 -msgid "Measure" -msgstr "" - #: src/ui/gui/weight-cases-dialog.c:88 #, c-format msgid "Weight cases by %s" @@ -6019,7 +6019,7 @@ msgid "" "Report bugs to <%s>.\n" msgstr "" -#: src/ui/terminal/main.c:132 +#: src/ui/terminal/main.c:131 msgid "" "Stopping syntax file processing here to avoid a cascade of dependent command " "failures." diff --git a/src/data/ChangeLog b/src/data/ChangeLog index e645a823..27619661 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,8 @@ +2008-01-19 John Darrington + + * settings.c settings.h: Moved static variables into a + single struct. Renamed functions to have a settings_ prefix. + 2008-01-14 John Darrington * data-out.c (output_AHEX): Corrected number of bytes in diff --git a/src/data/calendar.c b/src/data/calendar.c index ac37f869..eb9e6725 100644 --- a/src/data/calendar.c +++ b/src/data/calendar.c @@ -58,7 +58,7 @@ calendar_gregorian_to_offset (int y, int m, int d, /* Normalize year. */ if (y >= 0 && y < 100) { - int epoch = get_epoch (); + int epoch = settings_get_epoch (); int century = epoch / 100 + (y < epoch % 100); y += century * 100; } diff --git a/src/data/casereader.c b/src/data/casereader.c index 092f7708..ee7facb7 100644 --- a/src/data/casereader.c +++ b/src/data/casereader.c @@ -589,7 +589,7 @@ insert_shim (struct casereader *reader) size_t value_cnt = casereader_get_value_cnt (reader); casenumber case_cnt = casereader_get_case_cnt (reader); struct shim *b = xmalloc (sizeof *b); - b->window = casewindow_create (value_cnt, get_workspace_cases (value_cnt)); + b->window = casewindow_create (value_cnt, settings_get_workspace_cases (value_cnt)); b->subreader = casereader_create_random (value_cnt, case_cnt, &shim_class, b); casereader_swap (reader, b->subreader); diff --git a/src/data/casewriter.c b/src/data/casewriter.c index eac02b16..a30e50e2 100644 --- a/src/data/casewriter.c +++ b/src/data/casewriter.c @@ -170,7 +170,7 @@ casewriter_create (size_t value_cnt, struct casewriter * autopaging_writer_create (size_t value_cnt) { - return create_casewriter_window (value_cnt, get_workspace_cases (value_cnt)); + return create_casewriter_window (value_cnt, settings_get_workspace_cases (value_cnt)); } /* Returns a casewriter for cases with VALUE_CNT struct values diff --git a/src/data/data-in.c b/src/data/data-in.c index d84b806a..3f2f8074 100644 --- a/src/data/data-in.c +++ b/src/data/data-in.c @@ -63,11 +63,7 @@ struct data_in int last_column; /* Last column. */ }; -/* Integer format used for IB and PIB input. */ -static enum integer_format input_integer_format = INTEGER_NATIVE; -/* Floating-point format used for RB and RBHEX input. */ -static enum float_format input_float_format = FLOAT_NATIVE_DOUBLE; typedef bool data_in_parser_func (struct data_in *); #define FMT(NAME, METHOD, IMIN, OMIN, IO, CATEGORY) \ @@ -155,36 +151,6 @@ data_in (struct substring input, enum legacy_encoding encoding, return ok; } -/* Returns the integer format used for IB and PIB input. */ -enum integer_format -data_in_get_integer_format (void) -{ - return input_integer_format; -} - -/* Sets the integer format used for IB and PIB input to - FORMAT. */ -void -data_in_set_integer_format (enum integer_format format) -{ - input_integer_format = format; -} - -/* Returns the floating-point format used for RB and RBHEX - input. */ -enum float_format -data_in_get_float_format (void) -{ - return input_float_format; -} - -/* Sets the floating-point format used for RB and RBHEX input to - FORMAT. */ -void -data_in_set_float_format (enum float_format format) -{ - input_float_format = format; -} /* Format parsers. */ @@ -192,7 +158,8 @@ data_in_set_float_format (enum float_format format) static bool parse_number (struct data_in *i) { - const struct fmt_number_style *style = fmt_get_style (i->format); + const struct fmt_number_style *style = + settings_get_style (i->format); struct string tmp; @@ -518,7 +485,7 @@ parse_IB (struct data_in *i) uint64_t sign_bit; bytes = MIN (8, ss_length (i->input)); - value = integer_get (input_integer_format, ss_data (i->input), bytes); + value = integer_get (settings_get_input_integer_format (), ss_data (i->input), bytes); sign_bit = UINT64_C(1) << (8 * bytes - 1); if (!(value & sign_bit)) @@ -539,7 +506,7 @@ parse_IB (struct data_in *i) static bool parse_PIB (struct data_in *i) { - i->output->f = integer_get (input_integer_format, ss_data (i->input), + i->output->f = integer_get (settings_get_input_integer_format (), ss_data (i->input), MIN (8, ss_length (i->input))); apply_implied_decimals (i); @@ -615,9 +582,10 @@ parse_PK (struct data_in *i) static bool parse_RB (struct data_in *i) { - size_t size = float_get_size (input_float_format); + enum float_format ff = settings_get_input_float_format (); + size_t size = float_get_size (ff); if (ss_length (i->input) >= size) - float_convert (input_float_format, ss_data (i->input), + float_convert (ff, ss_data (i->input), FLOAT_NATIVE_DOUBLE, &i->output->f); else i->output->f = SYSMIS; @@ -860,7 +828,7 @@ parse_year (struct data_in *i, long *year, size_t max_digits) if (*year >= 0 && *year <= 99) { - int epoch = get_epoch (); + int epoch = settings_get_epoch (); int epoch_century = ROUND_DOWN (epoch, 100); int epoch_offset = epoch - epoch_century; if (*year >= epoch_offset) @@ -995,7 +963,7 @@ parse_minute_second (struct data_in *i, double *time) cp = buf; while (c_isdigit (ss_first (i->input))) *cp++ = ss_get_char (&i->input); - if (ss_match_char (&i->input, fmt_decimal_char (FMT_F))) + if (ss_match_char (&i->input, settings_get_decimal_char (FMT_F))) *cp++ = '.'; while (c_isdigit (ss_first (i->input))) *cp++ = ss_get_char (&i->input); @@ -1246,7 +1214,7 @@ default_result (struct data_in *i) if (fmt_is_string (i->format)) memset (i->output->s, ' ', i->width); else - i->output->f = get_blanks (); + i->output->f = settings_get_blanks (); } /* Trims leading and trailing spaces from I. diff --git a/src/data/data-in.h b/src/data/data-in.h index d66b1c64..52301c8c 100644 --- a/src/data/data-in.h +++ b/src/data/data-in.h @@ -24,11 +24,6 @@ #include #include -enum integer_format data_in_get_integer_format (void); -void data_in_set_integer_format (enum integer_format); - -enum float_format data_in_get_float_format (void); -void data_in_set_float_format (enum float_format); union value; bool data_in (struct substring input, enum legacy_encoding, diff --git a/src/data/data-out.c b/src/data/data-out.c index a896b98e..86688a67 100644 --- a/src/data/data-out.c +++ b/src/data/data-out.c @@ -60,12 +60,6 @@ static int rounder_width (const struct rounder *, int decimals, static void rounder_format (const struct rounder *, int decimals, char *output); -/* Format of integers in output (SET WIB). */ -static enum integer_format output_integer_format = INTEGER_NATIVE; - -/* Format of reals in output (SET WRB). */ -static enum float_format output_float_format = FLOAT_NATIVE_DOUBLE; - typedef void data_out_converter_func (const union value *, const struct fmt_spec *, char *); @@ -120,33 +114,6 @@ data_out (const union value *value, const struct fmt_spec *format, return data_out_legacy (value, LEGACY_NATIVE, format, output); } -/* Returns the current output integer format. */ -enum integer_format -data_out_get_integer_format (void) -{ - return output_integer_format; -} - -/* Sets the output integer format to INTEGER_FORMAT. */ -void -data_out_set_integer_format (enum integer_format integer_format) -{ - output_integer_format = integer_format; -} - -/* Returns the current output float format. */ -enum float_format -data_out_get_float_format (void) -{ - return output_float_format; -} - -/* Sets the output float format to FLOAT_FORMAT. */ -void -data_out_set_float_format (enum float_format float_format) -{ - output_float_format = float_format; -} /* Main conversion functions. */ @@ -260,7 +227,8 @@ output_IB (const union value *input, const struct fmt_spec *format, uint64_t integer = fabs (number); if (number < 0) integer = -integer; - output_binary_integer (integer, format->w, output_integer_format, + output_binary_integer (integer, format->w, + settings_get_output_integer_format (), output); } } @@ -275,7 +243,8 @@ output_PIB (const union value *input, const struct fmt_spec *format, || number < 0 || number >= power256 (format->w)) memset (output, 0, format->w); else - output_binary_integer (number, format->w, output_integer_format, output); + output_binary_integer (number, format->w, + settings_get_output_integer_format (), output); } /* Outputs PIBHEX format. */ @@ -386,7 +355,8 @@ output_date (const union value *input, const struct fmt_spec *format, } else { - int offset = year - get_epoch (); + int epoch = settings_get_epoch (); + int offset = year - epoch; if (offset < 0 || offset > 99) goto overflow; p += sprintf (p, "%02d", abs (year) % 100); @@ -426,11 +396,11 @@ output_date (const union value *input, const struct fmt_spec *format, int d = MIN (format->d, excess_width - 4); int w = d + 3; sprintf (p, ":%0*.*f", w, d, number); - if (fmt_decimal_char (FMT_F) != '.') + if (settings_get_decimal_char (FMT_F) != '.') { char *cp = strchr (p, '.'); if (cp != NULL) - *cp = fmt_decimal_char (FMT_F); + *cp = settings_get_decimal_char (FMT_F); } p += strlen (p); } @@ -543,7 +513,9 @@ static bool output_decimal (const struct rounder *r, const struct fmt_spec *format, bool require_affixes, char *output) { - const struct fmt_number_style *style = fmt_get_style (format->type); + const struct fmt_number_style *style = + settings_get_style (format->type); + int decimals; for (decimals = format->d; decimals >= 0; decimals--) @@ -645,7 +617,8 @@ static bool output_scientific (double number, const struct fmt_spec *format, bool require_affixes, char *output) { - const struct fmt_number_style *style = fmt_get_style (format->type); + const struct fmt_number_style *style = + settings_get_style (format->type); int width; int fraction_width; bool add_affixes; diff --git a/src/data/data-out.h b/src/data/data-out.h index 85831b30..f9f70da9 100644 --- a/src/data/data-out.h +++ b/src/data/data-out.h @@ -30,10 +30,4 @@ void data_out (const union value *, const struct fmt_spec *, char *); void data_out_legacy (const union value *, enum legacy_encoding, const struct fmt_spec *, char *); -enum integer_format data_out_get_integer_format (void); -void data_out_set_integer_format (enum integer_format); - -enum float_format data_out_get_float_format (void); -void data_out_set_float_format (enum float_format); - #endif /* data-out.h */ diff --git a/src/data/dictionary.c b/src/data/dictionary.c index 94a0292e..85b6a349 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -653,7 +653,7 @@ dict_rename_var (struct dictionary *d, struct variable *v, rename_var (d, v, new_name); hsh_force_insert (d->name_tab, v); - if (get_algorithm () == ENHANCED) + if (settings_get_algorithm () == ENHANCED) var_clear_short_names (v); if ( d->callbacks && d->callbacks->var_changed ) @@ -718,7 +718,7 @@ dict_rename_vars (struct dictionary *d, } /* Clear short names. */ - if (get_algorithm () == ENHANCED) + if (settings_get_algorithm () == ENHANCED) for (i = 0; i < count; i++) var_clear_short_names (vars[i]); diff --git a/src/data/file-name.c b/src/data/file-name.c index 2fd79428..c6f91b56 100644 --- a/src/data/file-name.c +++ b/src/data/file-name.c @@ -269,7 +269,7 @@ fn_open (const char *fn, const char *mode) #if HAVE_POPEN if (fn[0] == '|') { - if (get_safer_mode ()) + if (settings_get_safer_mode ()) return safety_violation (fn); return popen (&fn[1], mode[0] == 'r' ? "r" : "w"); @@ -279,7 +279,7 @@ fn_open (const char *fn, const char *mode) char *s; FILE *f; - if (get_safer_mode ()) + if (settings_get_safer_mode ()) return safety_violation (fn); s = xmalloca (strlen (fn)); diff --git a/src/data/format.c b/src/data/format.c index c90ff95b..d7368fe2 100644 --- a/src/data/format.c +++ b/src/data/format.c @@ -37,7 +37,9 @@ #include "gettext.h" #define _(msgid) gettext (msgid) -static bool is_fmt_type (enum fmt_type); + + +bool is_fmt_type (enum fmt_type); static int min_width (enum fmt_type, bool for_input); static int max_width (enum fmt_type); @@ -46,27 +48,35 @@ static int max_decimals (enum fmt_type, int width, bool for_input); static int max_digits_for_bytes (int bytes); +void fmt_number_style_init (struct fmt_number_style *style); + + /* Initialize the format module. */ -void -fmt_init (void) +struct fmt_number_style * +fmt_create (void) { - static bool inited = false; - if (!inited) - { - inited = true; - fmt_set_decimal ('.'); - } + struct fmt_number_style *styles = + xcalloc (FMT_NUMBER_OF_FORMATS, sizeof (*styles)); + + int t; + for (t = 0 ; t < FMT_NUMBER_OF_FORMATS ; ++t ) + fmt_number_style_init (&styles[t]); + + fmt_set_decimal (styles, '.'); + + return styles; } -static struct fmt_number_style *styles[FMT_NUMBER_OF_FORMATS]; /* Deinitialize the format module. */ void -fmt_done (void) +fmt_done (struct fmt_number_style *styles) { int t; for (t = 0 ; t < FMT_NUMBER_OF_FORMATS ; ++t ) - fmt_number_style_destroy (styles[t]); + fmt_number_style_destroy (&styles[t]); + + free (styles); } /* Returns an input format specification with type TYPE, width W, @@ -126,7 +136,9 @@ fmt_for_output_from_input (const struct fmt_spec *input) case FMT_DOLLAR: case FMT_PCT: { - const struct fmt_number_style *style = fmt_get_style (input->type); + const struct fmt_number_style *style = + settings_get_style (input->type); + output.w += fmt_affix_width (style); if (style->grouping != 0 && input->w - input->d >= 3) output.w += (input->w - input->d - 1) / 3; @@ -380,7 +392,7 @@ fmt_equal (const struct fmt_spec *a, const struct fmt_spec *b) /* Adjusts FMT to be valid for a value of the given WIDTH. */ void -fmt_resize (struct fmt_spec *fmt, int width) +fmt_resize (struct fmt_spec *fmt, int width) { if ((width > 0) != fmt_is_string (fmt->type)) { @@ -394,7 +406,7 @@ fmt_resize (struct fmt_spec *fmt, int width) width. */ fmt->w = fmt->type == FMT_AHEX ? width * 2 : width; } - else + else { /* Still numeric. */ } @@ -617,39 +629,10 @@ fmt_date_template (enum fmt_type type) } } -/* Returns a string of the form "$#,###.##" according to FMT, - which must be of type FMT_DOLLAR. The caller must free the - string. */ -char * -fmt_dollar_template (const struct fmt_spec *fmt) -{ - struct string s = DS_EMPTY_INITIALIZER; - int c; - - assert (fmt->type == FMT_DOLLAR); - - ds_put_char (&s, '$'); - for (c = MAX (fmt->w - fmt->d - 1, 0); c > 0; ) - { - ds_put_char (&s, '#'); - if (--c % 4 == 0 && c > 0) - { - ds_put_char (&s, fmt_grouping_char (fmt->type)); - --c; - } - } - if (fmt->d > 0) - { - ds_put_char (&s, fmt_decimal_char (fmt->type)); - ds_put_char_multiple (&s, '#', fmt->d); - } - - return ds_cstr (&s); -} /* Returns true if TYPE is a valid format type, false otherwise. */ -static bool +bool is_fmt_type (enum fmt_type type) { return type < FMT_NUMBER_OF_FORMATS; @@ -819,21 +802,19 @@ max_digits_for_bytes (int bytes) } -/* Creates and returns a new struct fmt_number_style, - initializing all affixes to empty strings. */ -struct fmt_number_style * -fmt_number_style_create (void) + +void +fmt_number_style_init (struct fmt_number_style *style) { - struct fmt_number_style *style = xmalloc (sizeof *style); style->neg_prefix = ss_empty (); style->prefix = ss_empty (); style->suffix = ss_empty (); style->neg_suffix = ss_empty (); style->decimal = '.'; style->grouping = 0; - return style; } + /* Destroys a struct fmt_number_style. */ void fmt_number_style_destroy (struct fmt_number_style *style) @@ -844,24 +825,22 @@ fmt_number_style_destroy (struct fmt_number_style *style) ss_dealloc (&style->prefix); ss_dealloc (&style->suffix); ss_dealloc (&style->neg_suffix); - free (style); } } /* Returns the number formatting style associated with the given format TYPE. */ const struct fmt_number_style * -fmt_get_style (enum fmt_type type) +fmt_get_style (const struct fmt_number_style *styles, enum fmt_type type) { assert (is_fmt_type (type)); - assert (styles[type] != NULL); - return styles[type]; + return &styles[type]; } -/* Sets STYLE as the number formatting style associated with the - given format TYPE, transferring ownership of STYLE. */ + +/* Checks that style is STYLE sane */ void -fmt_set_style (enum fmt_type type, struct fmt_number_style *style) +fmt_check_style (const struct fmt_number_style *style) { assert (ss_length (style->neg_prefix) <= FMT_STYLE_AFFIX_MAX); assert (ss_length (style->prefix) <= FMT_STYLE_AFFIX_MAX); @@ -871,14 +850,9 @@ fmt_set_style (enum fmt_type type, struct fmt_number_style *style) assert (style->grouping == '.' || style->grouping == ',' || style->grouping == 0); assert (style->grouping != style->decimal); - - assert (fmt_get_category (type) == FMT_CAT_CUSTOM); - assert (styles[type] != NULL); - - fmt_number_style_destroy (styles[type]); - styles[type] = style; } + /* Returns the total width of the standard prefix and suffix for STYLE. */ int @@ -895,28 +869,13 @@ fmt_neg_affix_width (const struct fmt_number_style *style) return ss_length (style->neg_prefix) + ss_length (style->neg_suffix); } -/* Returns the decimal point character for the given format - TYPE. */ -int -fmt_decimal_char (enum fmt_type type) -{ - return fmt_get_style (type)->decimal; -} - -/* Returns the grouping character for the given format TYPE, or 0 - if the format type does not group digits. */ -int -fmt_grouping_char (enum fmt_type type) -{ - return fmt_get_style (type)->grouping; -} /* Sets the number style for TYPE to have the given standard PREFIX and SUFFIX, "-" as prefix suffix, an empty negative suffix, DECIMAL as the decimal point character, and GROUPING as the grouping character. */ static void -set_style (enum fmt_type type, +set_style (struct fmt_number_style *styles, enum fmt_type type, const char *prefix, const char *suffix, char decimal, char grouping) { @@ -924,9 +883,10 @@ set_style (enum fmt_type type, assert (is_fmt_type (type)); - fmt_number_style_destroy (styles[type]); + style = &styles[type] ; + + fmt_number_style_destroy (style); - style = styles[type] = fmt_number_style_create (); ss_alloc_substring (&style->neg_prefix, ss_cstr ("-")); ss_alloc_substring (&style->prefix, ss_cstr (prefix)); ss_alloc_substring (&style->suffix, ss_cstr (suffix)); @@ -934,37 +894,19 @@ set_style (enum fmt_type type, style->grouping = grouping; } -/* Sets the number style for TYPE as with set_style, but only if - TYPE has not already been initialized. */ -static void -init_style (enum fmt_type type, - const char *prefix, const char *suffix, - char decimal, char grouping) -{ - assert (is_fmt_type (type)); - if (styles[type] == NULL) - set_style (type, prefix, suffix, decimal, grouping); -} - /* Sets the decimal point character to DECIMAL. */ void -fmt_set_decimal (char decimal) +fmt_set_decimal (struct fmt_number_style *styles, char decimal) { int grouping = decimal == '.' ? ',' : '.'; assert (decimal == '.' || decimal == ','); - set_style (FMT_F, "", "", decimal, 0); - set_style (FMT_E, "", "", decimal, 0); - set_style (FMT_COMMA, "", "", decimal, grouping); - set_style (FMT_DOT, "", "", grouping, decimal); - set_style (FMT_DOLLAR, "$", "", decimal, grouping); - set_style (FMT_PCT, "", "%", decimal, 0); - - init_style (FMT_CCA, "", "", decimal, grouping); - init_style (FMT_CCB, "", "", decimal, grouping); - init_style (FMT_CCC, "", "", decimal, grouping); - init_style (FMT_CCD, "", "", decimal, grouping); - init_style (FMT_CCE, "", "", decimal, grouping); + set_style (styles, FMT_F, "", "", decimal, 0); + set_style (styles, FMT_E, "", "", decimal, 0); + set_style (styles, FMT_COMMA, "", "", decimal, grouping); + set_style (styles, FMT_DOT, "", "", grouping, decimal); + set_style (styles, FMT_DOLLAR, "$", "", decimal, grouping); + set_style (styles, FMT_PCT, "", "%", decimal, 0); } /* Returns the struct fmt_desc for the given format TYPE. */ diff --git a/src/data/format.h b/src/data/format.h index d00cb1d9..88b49a5a 100644 --- a/src/data/format.h +++ b/src/data/format.h @@ -69,9 +69,25 @@ struct fmt_spec int d; /* Number of implied decimal places. */ }; + +/* A numeric output style. */ +struct fmt_number_style + { + struct substring neg_prefix; /* Negative prefix. */ + struct substring prefix; /* Prefix. */ + struct substring suffix; /* Suffix. */ + struct substring neg_suffix; /* Negative suffix. */ + char decimal; /* Decimal point: '.' or ','. */ + char grouping; /* Grouping character: ',', '.', or 0. */ + }; + + +extern struct fmt_number_style *the_styles ; + + /* Initialization. */ -void fmt_init (void); -void fmt_done (void); +struct fmt_number_style * fmt_create (void); +void fmt_done (struct fmt_number_style *); /* Constructing formats. */ struct fmt_spec fmt_for_input (enum fmt_type, int w, int d) PURE_FUNCTION; @@ -117,22 +133,11 @@ int fmt_to_io (enum fmt_type) PURE_FUNCTION; bool fmt_from_io (int io, enum fmt_type *); const char *fmt_date_template (enum fmt_type) PURE_FUNCTION; -char *fmt_dollar_template (const struct fmt_spec *); /* Maximum length of prefix or suffix string in struct fmt_number_style. */ #define FMT_STYLE_AFFIX_MAX 16 -/* A numeric output style. */ -struct fmt_number_style - { - struct substring neg_prefix; /* Negative prefix. */ - struct substring prefix; /* Prefix. */ - struct substring suffix; /* Suffix. */ - struct substring neg_suffix; /* Negative suffix. */ - char decimal; /* Decimal point: '.' or ','. */ - char grouping; /* Grouping character: ',', '.', or 0. */ - }; struct fmt_number_style *fmt_number_style_create (void); void fmt_number_style_destroy (struct fmt_number_style *); @@ -140,12 +145,14 @@ void fmt_number_style_destroy (struct fmt_number_style *); int fmt_affix_width (const struct fmt_number_style *); int fmt_neg_affix_width (const struct fmt_number_style *); -const struct fmt_number_style *fmt_get_style (enum fmt_type); -void fmt_set_style (enum fmt_type, struct fmt_number_style *); +bool is_fmt_type (enum fmt_type); + +const struct fmt_number_style *fmt_get_style (const struct fmt_number_style *, enum fmt_type); + +void fmt_check_style (const struct fmt_number_style *style); -int fmt_decimal_char (enum fmt_type); -int fmt_grouping_char (enum fmt_type); +int fmt_grouping_char (const struct fmt_number_style *, enum fmt_type); -void fmt_set_decimal (char); +void fmt_set_decimal (struct fmt_number_style *, char); #endif /* data/format.h */ diff --git a/src/data/settings.c b/src/data/settings.c index 4d0ef3eb..5b791dc2 100644 --- a/src/data/settings.c +++ b/src/data/settings.c @@ -23,151 +23,290 @@ #include "value.h" #include "xalloc.h" #include +#include +#include #include "error.h" #include "gettext.h" #define _(msgid) gettext (msgid) -static int *viewlength = NULL; -static int *viewwidth = NULL; - -static bool safer_mode = false; - -static bool do_echo = false; -static bool include = true; - -static int epoch = -1; - -static bool errorbreak = false; - -static bool route_errors_to_terminal = true; -static bool route_errors_to_listing = true; - -static bool scompress = true; - -static bool undefined = true; -static double blanks = SYSMIS; - -static int mxwarns = 100; -static int mxerrs = 100; - -static bool printback = true; -static bool mprint = true; - -static int mxloops = 1; +static int global_algorithm = ENHANCED; -static bool nulline = true; +struct settings +{ + /* Integer format used for IB and PIB input. */ + enum integer_format input_integer_format; + + /* Floating-point format used for RB and RBHEX input. */ + enum float_format input_float_format; + + /* Format of integers in output (SET WIB). */ + enum integer_format output_integer_format; + + /* Format of reals in output (SET WRB). */ + enum float_format output_float_format; + + int *viewlength; + int *viewwidth; + bool safer_mode; + bool do_echo; + bool include; + int epoch; + bool errorbreak; + bool route_errors_to_terminal; + bool route_errors_to_listing; + bool scompress; + bool undefined; + double blanks; + int mxwarns; + int mxerrs; + bool printback; + bool mprint; + int mxloops; + bool nulline; + char endcmd; + size_t workspace; + struct fmt_spec default_format; + bool testing_mode; + + int cmd_algorithm; + int *algorithm; + int syntax; + + struct fmt_number_style *styles; +}; + +static struct settings the_settings = { + /* input_integer_format */ + INTEGER_NATIVE, + /* input_float_format */ + FLOAT_NATIVE_DOUBLE, + /* output_integer_format */ + INTEGER_NATIVE, + /* output_float_format */ + FLOAT_NATIVE_DOUBLE, + /* viewlength */ + NULL, + /* viewwidth */ + NULL, + /* safer_mode */ + false, + /* do_echo */ + false, + /* include */ + true, + /* epoch */ + -1, + /* errorbreak */ + false, + /* route_errors_to_terminal */ + true, + /* route_errors_to_listing */ + true, + /* scompress */ + true, + /* undefined */ + true, + /* blanks */ + SYSMIS, + /* mxwarns */ + 100, + /* mxerrs */ + 100, + /* printback */ + true, + /* mprint */ + true, + /* mxloops */ + 1, + /* nulline */ + true, + /* endcmd */ + '.', + /* workspace */ + 4L * 1024 * 1024, + /* default_format */ + {FMT_F, 8, 2}, + /* testing_mode */ + false, + /* cmd_algorithm */ + ENHANCED, + /* algorithm */ + &global_algorithm, + /* syntax */ + ENHANCED, + /* styles */ + NULL +}; + +static void init_viewport ( int *, int *); -static char endcmd = '.'; +void +settings_init (int *width, int *length) +{ + init_viewport (width, length); + settings_set_epoch (-1); + i18n_init (); + the_settings.styles = fmt_create (); +} -static size_t workspace = 4L * 1024 * 1024; +void +settings_done (void) +{ + fmt_done (the_settings.styles); + i18n_done (); +} -static struct fmt_spec default_format = {FMT_F, 8, 2}; +/* Returns the floating-point format used for RB and RBHEX + input. */ +enum float_format +settings_get_input_float_format (void) +{ + return the_settings.input_float_format; +} -static bool testing_mode = false; +/* Sets the floating-point format used for RB and RBHEX input to + FORMAT. */ +void +settings_set_input_float_format ( enum float_format format) +{ + the_settings.input_float_format = format; +} -static int global_algorithm = ENHANCED; -static int cmd_algorithm = ENHANCED; -static int *algorithm = &global_algorithm; +/* Returns the integer format used for IB and PIB input. */ +enum integer_format +settings_get_input_integer_format (void) +{ + return the_settings.input_integer_format; +} -static int syntax = ENHANCED; +/* Sets the integer format used for IB and PIB input to + FORMAT. */ +void +settings_set_input_integer_format ( enum integer_format format) +{ + the_settings.input_integer_format = format; +} -static void init_viewport (int *, int *); +/* Returns the current output integer format. */ +enum integer_format +settings_get_output_integer_format (void) +{ + return the_settings.output_integer_format; +} +/* Sets the output integer format to INTEGER_FORMAT. */ void -settings_init (int *width, int *length) +settings_set_output_integer_format ( + enum integer_format integer_format) { - init_viewport (width, length); - i18n_init (); + the_settings.output_integer_format = integer_format; +} + +/* Returns the current output float format. */ +enum float_format +settings_get_output_float_format (void) +{ + return the_settings.output_float_format; } +/* Sets the output float format to FLOAT_FORMAT. */ void -settings_done (void) +settings_set_output_float_format ( enum float_format float_format) { - i18n_done (); + the_settings.output_float_format = float_format; } /* Screen length in lines. */ int -get_viewlength (void) +settings_get_viewlength (void) { - return *viewlength; + return *the_settings.viewlength; } /* Sets the view length. */ void -set_viewlength (int viewlength_) +settings_set_viewlength ( int viewlength_) { - *viewlength = viewlength_; + *the_settings.viewlength = viewlength_; } /* Screen width. */ int -get_viewwidth(void) +settings_get_viewwidth(void) { - return *viewwidth; + return *the_settings.viewwidth; } /* Sets the screen width. */ void -set_viewwidth (int viewwidth_) +settings_set_viewwidth ( int viewwidth_) { - *viewwidth = viewwidth_; + *the_settings.viewwidth = viewwidth_; } static void -init_viewport (int *width, int *length) +init_viewport ( int *width, int *length) { - viewwidth = width; - viewlength = length; + the_settings.viewwidth = width; + the_settings.viewlength = length; } /* Whether PSPP can erase and overwrite files. */ bool -get_safer_mode (void) +settings_get_safer_mode (void) { - return safer_mode; + return the_settings.safer_mode; } /* Set safer mode. */ void -set_safer_mode (void) +settings_set_safer_mode (void) { - safer_mode = true; + the_settings.safer_mode = true; } /* Echo commands to the listing file/printer? */ bool -get_echo (void) +settings_get_echo (void) { - return do_echo; + return the_settings.do_echo; } /* Set echo. */ void -set_echo (bool echo_) +settings_set_echo ( bool echo) { - do_echo = echo_; + the_settings.do_echo = echo; } /* If echo is on, whether commands from include files are echoed. */ bool -get_include (void) +settings_get_include (void) { - return include; + return the_settings.include; } /* Set include file echo. */ void -set_include (bool include_) +settings_set_include ( bool include) { - include = include_; + the_settings.include = include; } /* What year to use as the start of the epoch. */ int -get_epoch (void) +settings_get_epoch (void) +{ + assert (the_settings.epoch >= 0); + + return the_settings.epoch; +} + +/* Sets the year that starts the epoch. */ +void +settings_set_epoch ( int epoch) { if (epoch < 0) { @@ -176,218 +315,212 @@ get_epoch (void) epoch = (tm != NULL ? tm->tm_year + 1900 : 2000) - 69; } - return epoch; -} - -/* Sets the year that starts the epoch. */ -void -set_epoch (int epoch_) -{ - epoch = epoch_; + the_settings.epoch = epoch; + assert (the_settings.epoch >= 0); } /* Does an error stop execution? */ bool -get_errorbreak (void) +settings_get_errorbreak (void) { - return errorbreak; + return the_settings.errorbreak; } /* Sets whether an error stops execution. */ void -set_errorbreak (bool errorbreak_) +settings_set_errorbreak ( bool errorbreak) { - errorbreak = errorbreak_; + the_settings.errorbreak = errorbreak; } /* Route error messages to terminal? */ bool -get_error_routing_to_terminal (void) +settings_get_error_routing_to_terminal (void) { - return route_errors_to_terminal; + return the_settings.route_errors_to_terminal; } /* Sets whether error messages should be routed to the terminal. */ void -set_error_routing_to_terminal (bool route_to_terminal) +settings_set_error_routing_to_terminal ( bool route_to_terminal) { - route_errors_to_terminal = route_to_terminal; + the_settings.route_errors_to_terminal = route_to_terminal; } /* Route error messages to listing file? */ bool -get_error_routing_to_listing (void) +settings_get_error_routing_to_listing (void) { - return route_errors_to_listing; + return the_settings.route_errors_to_listing; } /* Sets whether error messages should be routed to the listing file. */ void -set_error_routing_to_listing (bool route_to_listing) +settings_set_error_routing_to_listing ( bool route_to_listing) { - route_errors_to_listing = route_to_listing; + the_settings.route_errors_to_listing = route_to_listing; } /* Compress system files by default? */ bool -get_scompression (void) +settings_get_scompression (void) { - return scompress; + return the_settings.scompress; } /* Set system file default compression. */ void -set_scompression (bool scompress_) +settings_set_scompression ( bool scompress) { - scompress = scompress_; + the_settings.scompress = scompress; } /* Whether to warn on undefined values in numeric data. */ bool -get_undefined (void) +settings_get_undefined (void) { - return undefined; + return the_settings.undefined; } /* Set whether to warn on undefined values. */ void -set_undefined (bool undefined_) +settings_set_undefined ( bool undefined) { - undefined = undefined_; + the_settings.undefined = undefined; } /* The value that blank numeric fields are set to when read in. */ double -get_blanks (void) +settings_get_blanks (void) { - return blanks; + return the_settings.blanks; } /* Set the value that blank numeric fields are set to when read in. */ void -set_blanks (double blanks_) +settings_set_blanks ( double blanks) { - blanks = blanks_; + the_settings.blanks = blanks; } /* Maximum number of warnings + errors. */ int -get_mxwarns (void) +settings_get_mxwarns (void) { - return mxwarns; + return the_settings.mxwarns; } /* Sets maximum number of warnings + errors. */ void -set_mxwarns (int mxwarns_) +settings_set_mxwarns ( int mxwarns) { - mxwarns = mxwarns_; + the_settings.mxwarns = mxwarns; } /* Maximum number of errors. */ int -get_mxerrs (void) +settings_get_mxerrs (void) { - return mxerrs; + return the_settings.mxerrs; } /* Sets maximum number of errors. */ void -set_mxerrs (int mxerrs_) +settings_set_mxerrs ( int mxerrs) { - mxerrs = mxerrs_; + the_settings.mxerrs = mxerrs; } /* Whether commands are written to the display. */ bool -get_printback (void) +settings_get_printback (void) { - return printback; + return the_settings.printback; } /* Sets whether commands are written to the display. */ void -set_printback (bool printback_) +settings_set_printback ( bool printback) { - printback = printback_; + the_settings.printback = printback; } /* Independent of get_printback, controls whether the commands generated by macro invocations are displayed. */ bool -get_mprint (void) +settings_get_mprint (void) { - return mprint; + return the_settings.mprint; } /* Sets whether the commands generated by macro invocations are displayed. */ void -set_mprint (bool mprint_) +settings_set_mprint ( bool mprint) { - mprint = mprint_; + the_settings.mprint = mprint; } /* Implied limit of unbounded loop. */ int -get_mxloops (void) +settings_get_mxloops (void) { - return mxloops; + return the_settings.mxloops; } /* Set implied limit of unbounded loop. */ void -set_mxloops (int mxloops_) +settings_set_mxloops ( int mxloops) { - mxloops = mxloops_; + the_settings.mxloops = mxloops; } /* Whether a blank line is a command terminator. */ bool -get_nulline (void) +settings_get_nulline (void) { - return nulline; + return the_settings.nulline; } /* Set whether a blank line is a command terminator. */ void -set_nulline (bool nulline_) +settings_set_nulline ( bool nulline) { - nulline = nulline_; + the_settings.nulline = nulline; } /* The character used to terminate commands. */ char -get_endcmd (void) +settings_get_endcmd (void) { - return endcmd; + return the_settings.endcmd; } /* Set the character used to terminate commands. */ void -set_endcmd (char endcmd_) +settings_set_endcmd ( char endcmd) { - endcmd = endcmd_; + the_settings.endcmd = endcmd; } /* Approximate maximum amount of memory to use for cases, in bytes. */ size_t -get_workspace (void) +settings_get_workspace (void) { - return workspace; + return the_settings.workspace; } /* Approximate maximum number of cases to allocate in-core, given that each case contains VALUE_CNT values. */ size_t -get_workspace_cases (size_t value_cnt) +settings_get_workspace_cases (size_t value_cnt) { size_t case_size = sizeof (union value) * value_cnt + 4 * sizeof (void *); - size_t case_cnt = MAX (get_workspace () / case_size, 4); + size_t case_cnt = MAX (settings_get_workspace () / case_size, 4); return case_cnt; } @@ -395,81 +528,231 @@ get_workspace_cases (size_t value_cnt) bytes. */ void -set_workspace (size_t workspace_) +settings_set_workspace ( size_t workspace) { - workspace = workspace_; + the_settings.workspace = workspace; } /* Default format for variables created by transformations and by DATA LIST {FREE,LIST}. */ const struct fmt_spec * -get_format (void) +settings_get_format (void) { - return &default_format; + return &the_settings.default_format; } /* Set default format for variables created by transformations and by DATA LIST {FREE,LIST}. */ void -set_format (const struct fmt_spec *default_format_) +settings_set_format ( const struct fmt_spec *default_format) { - default_format = *default_format_; + the_settings.default_format = *default_format; } /* Are we in testing mode? (e.g. --testing-mode command line option) */ bool -get_testing_mode (void) +settings_get_testing_mode (void) { - return testing_mode; + return the_settings.testing_mode; } /* Set testing mode. */ void -set_testing_mode (bool testing_mode_) +settings_set_testing_mode ( bool testing_mode) { - testing_mode = testing_mode_; + the_settings.testing_mode = testing_mode; } /* Return the current algorithm setting */ enum behavior_mode -get_algorithm (void) +settings_get_algorithm (void) { - return *algorithm; + return *the_settings.algorithm; } /* Set the algorithm option globally. */ void -set_algorithm (enum behavior_mode mode) +settings_set_algorithm (enum behavior_mode mode) { global_algorithm = mode; } /* Set the algorithm option for this command only */ void -set_cmd_algorithm (enum behavior_mode mode) +settings_set_cmd_algorithm ( enum behavior_mode mode) { - cmd_algorithm = mode; - algorithm = &cmd_algorithm; + the_settings.cmd_algorithm = mode; + the_settings.algorithm = &the_settings.cmd_algorithm; } /* Unset the algorithm option for this command */ void unset_cmd_algorithm (void) { - algorithm = &global_algorithm; + the_settings.algorithm = &global_algorithm; } /* Get the current syntax setting */ enum behavior_mode -get_syntax (void) +settings_get_syntax (void) { - return syntax; + return the_settings.syntax; } /* Set the syntax option */ void -set_syntax (enum behavior_mode mode) +settings_set_syntax ( enum behavior_mode mode) { - syntax = mode; + the_settings.syntax = mode; +} + + + +/* Find the grouping characters in CC_STRING and set CC's + grouping and decimal members appropriately. Returns true if + successful, false otherwise. */ +static bool +find_cc_separators (const char *cc_string, struct fmt_number_style *cc) +{ + const char *sp; + int comma_cnt, dot_cnt; + + /* Count commas and periods. There must be exactly three of + one or the other, except that an apostrophe escapes a + following comma or period. */ + comma_cnt = dot_cnt = 0; + for (sp = cc_string; *sp; sp++) + if (*sp == ',') + comma_cnt++; + else if (*sp == '.') + dot_cnt++; + else if (*sp == '\'' && (sp[1] == '.' || sp[1] == ',' || sp[1] == '\'')) + sp++; + + if ((comma_cnt == 3) == (dot_cnt == 3)) + return false; + + if (comma_cnt == 3) + { + cc->decimal = '.'; + cc->grouping = ','; + } + else + { + cc->decimal = ','; + cc->grouping = '.'; + } + return true; +} + +/* Extracts a token from IN into a newly allocated AFFIX. Tokens + are delimited by GROUPING. The token is truncated to at most + FMT_STYLE_AFFIX_MAX characters. Returns the first character + following the token. */ +static const char * +extract_cc_token (const char *in, int grouping, struct substring *affix) +{ + size_t ofs = 0; + ss_alloc_uninit (affix, FMT_STYLE_AFFIX_MAX); + for (; *in != '\0' && *in != grouping; in++) + { + if (*in == '\'' && in[1] == grouping) + in++; + if (ofs < FMT_STYLE_AFFIX_MAX) + ss_data (*affix)[ofs++] = *in; + } + affix->length = ofs; + + if (*in == grouping) + in++; + return in; +} + + +/* Sets custom currency specifier CC having name CC_NAME ('A' through + 'E') to correspond to the settings in CC_STRING. */ +bool +settings_set_cc (const char *cc_string, enum fmt_type type) +{ + struct fmt_number_style *cc = &the_settings.styles[type]; + + assert (fmt_get_category (type) == FMT_CAT_CUSTOM); + + /* Determine separators. */ + if (!find_cc_separators (cc_string, cc)) + { + msg (SE, _("%s: Custom currency string `%s' does not contain " + "exactly three periods or commas (or it contains both)."), + fmt_name (type), cc_string); + return false; + } + + cc_string = extract_cc_token (cc_string, cc->grouping, &cc->neg_prefix); + cc_string = extract_cc_token (cc_string, cc->grouping, &cc->prefix); + cc_string = extract_cc_token (cc_string, cc->grouping, &cc->suffix); + cc_string = extract_cc_token (cc_string, cc->grouping, &cc->neg_suffix); + + fmt_check_style (cc); + + return true; +} + +/* Returns the decimal point character for TYPE. */ +int +settings_get_decimal_char (enum fmt_type type) +{ + return fmt_get_style (the_settings.styles, type)->decimal; +} + +void +settings_set_decimal_char (char decimal) +{ + fmt_set_decimal (the_settings.styles, decimal); +} + + + +/* Returns the number formatting style associated with the given + format TYPE. */ +const struct fmt_number_style * +settings_get_style (enum fmt_type type) +{ + assert (is_fmt_type (type)); + return &the_settings.styles[type]; +} + + +/* Returns a string of the form "$#,###.##" according to FMT, + which must be of type FMT_DOLLAR. The caller must free the + string. */ +char * +settings_dollar_template (const struct fmt_spec *fmt) +{ + const struct fmt_number_style *styles = the_settings.styles; + struct string str = DS_EMPTY_INITIALIZER; + int c; + const struct fmt_number_style *fns ; + + assert (fmt->type == FMT_DOLLAR); + + fns = fmt_get_style (styles, fmt->type); + + ds_put_char (&str, '$'); + for (c = MAX (fmt->w - fmt->d - 1, 0); c > 0; ) + { + ds_put_char (&str, '#'); + if (--c % 4 == 0 && c > 0) + { + ds_put_char (&str, fns->grouping); + --c; + } + } + if (fmt->d > 0) + { + ds_put_char (&str, fns->decimal); + ds_put_char_multiple (&str, '#', fmt->d); + } + + return ds_cstr (&str); } diff --git a/src/data/settings.h b/src/data/settings.h index 9ef278fc..1838927d 100644 --- a/src/data/settings.h +++ b/src/data/settings.h @@ -19,82 +19,122 @@ #include #include +#include "format.h" + +struct settings; + void settings_init (int *, int *); void settings_done (void); -int get_viewlength (void); -void set_viewlength (int); +enum float_format settings_get_input_float_format (void); +void settings_set_input_float_format ( enum float_format); + +/* Returns the integer format used for IB and PIB input. */ +enum integer_format settings_get_input_integer_format (void); + +/* Sets the integer format used for IB and PIB input to + FORMAT. */ +void settings_set_input_integer_format ( enum integer_format); + + +/* Returns the current output integer format. */ +enum integer_format settings_get_output_integer_format (void); + +/* Sets the output integer format to INTEGER_FORMAT. */ +void settings_set_output_integer_format (enum integer_format integer_format); + +/* Returns the current output float format. */ +enum float_format settings_get_output_float_format (void); + +/* Sets the output float format to FLOAT_FORMAT. */ +void settings_set_output_float_format (enum float_format float_format); -int get_viewwidth (void); -void set_viewwidth (int); -bool get_safer_mode (void); -void set_safer_mode (void); -bool get_echo (void); -void set_echo (bool); -bool get_include (void); -void set_include (bool); +int settings_get_viewlength (void); +void settings_set_viewlength ( int); -int get_epoch (void); -void set_epoch (int); +int settings_get_viewwidth (void); +void settings_set_viewwidth ( int); -bool get_errorbreak (void); -void set_errorbreak (bool); +bool settings_get_safer_mode (void); +void settings_set_safer_mode (void); -bool get_error_routing_to_terminal (void); -void set_error_routing_to_terminal (bool); -bool get_error_routing_to_listing (void); -void set_error_routing_to_listing (bool); +bool settings_get_echo (void); +void settings_set_echo ( bool); +bool settings_get_include (void); +void settings_set_include ( bool); -bool get_scompression (void); -void set_scompression (bool); +int settings_get_epoch (void); +void settings_set_epoch ( int); -bool get_undefined (void); -void set_undefined (bool); -double get_blanks (void); -void set_blanks (double); +bool settings_get_errorbreak (void); +void settings_set_errorbreak ( bool); -int get_mxwarns (void); -void set_mxwarns (int); -int get_mxerrs (void); -void set_mxerrs (int); +bool settings_get_error_routing_to_terminal (void); +void settings_set_error_routing_to_terminal (bool); +bool settings_get_error_routing_to_listing (void); +void settings_set_error_routing_to_listing (bool); -bool get_printback (void); -void set_printback (bool); -bool get_mprint (void); -void set_mprint (bool); +bool settings_get_scompression (void); +void settings_set_scompression (bool); -int get_mxloops (void); -void set_mxloops (int); +bool settings_get_undefined (void); +void settings_set_undefined (bool); +double settings_get_blanks (void); +void settings_set_blanks (double); -bool get_nulline (void); -void set_nulline (bool); +int settings_get_mxwarns (void); +void settings_set_mxwarns ( int); +int settings_get_mxerrs (void); +void settings_set_mxerrs ( int); -char get_endcmd (void); -void set_endcmd (char); +bool settings_get_printback (void); +void settings_set_printback (bool); +bool settings_get_mprint (void); +void settings_set_mprint (bool); -size_t get_workspace (void); -size_t get_workspace_cases (size_t value_cnt); -void set_workspace (size_t); +int settings_get_mxloops (void); +void settings_set_mxloops ( int); -const struct fmt_spec *get_format (void); -void set_format (const struct fmt_spec *); +bool settings_get_nulline (void); +void settings_set_nulline (bool); -bool get_testing_mode (void); -void set_testing_mode (bool); +char settings_get_endcmd (void); +void settings_set_endcmd (char); + +size_t settings_get_workspace (void); +size_t settings_get_workspace_cases (size_t value_cnt); +void settings_set_workspace ( size_t); + +const struct fmt_spec *settings_get_format (void); +void settings_set_format ( const struct fmt_spec *); + +bool settings_get_testing_mode (void); +void settings_set_testing_mode ( bool); enum behavior_mode { ENHANCED, /* Use improved PSPP behavior. */ COMPATIBLE /* Be as compatible as possible. */ }; -enum behavior_mode get_algorithm (void); -void set_algorithm (enum behavior_mode); -enum behavior_mode get_syntax (void); -void set_syntax(enum behavior_mode); -void set_cmd_algorithm (enum behavior_mode); +enum behavior_mode settings_get_algorithm (void); +void settings_set_algorithm (enum behavior_mode); +enum behavior_mode settings_get_syntax (void); +void settings_set_syntax (enum behavior_mode); + +void settings_set_cmd_algorithm (enum behavior_mode); void unset_cmd_algorithm (void); +bool settings_set_cc (const char *cc_string, enum fmt_type type); + +int settings_get_decimal_char (enum fmt_type type); +void settings_set_decimal_char (char decimal); + + +const struct fmt_number_style * settings_get_style (enum fmt_type type); + +char * settings_dollar_template (const struct fmt_spec *fmt); + #endif /* !settings_h */ diff --git a/src/data/sparse-cases.c b/src/data/sparse-cases.c index 0a7b1c5c..1f3fb092 100644 --- a/src/data/sparse-cases.c +++ b/src/data/sparse-cases.c @@ -48,7 +48,7 @@ sparse_cases_create (size_t column_cnt) struct sparse_cases *sc = xmalloc (sizeof *sc); sc->column_cnt = column_cnt; sc->default_columns = NULL; - sc->max_memory_cases = get_workspace_cases (column_cnt); + sc->max_memory_cases = settings_get_workspace_cases (column_cnt); sc->memory = sparse_array_create (sizeof (struct ccase)); sc->disk = NULL; sc->disk_cases = NULL; diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c index 6cbd7557..7804e591 100644 --- a/src/data/sys-file-writer.c +++ b/src/data/sys-file-writer.c @@ -136,7 +136,7 @@ sfm_writer_default_options (void) { struct sfm_write_options opts; opts.create_writeable = true; - opts.compress = get_scompression (); + opts.compress = settings_get_scompression (); opts.version = 3; return opts; } diff --git a/src/language/command.c b/src/language/command.c index 42580166..5dd2a308 100644 --- a/src/language/command.c +++ b/src/language/command.c @@ -209,13 +209,13 @@ do_parse_command (struct lexer *lexer, result = CMD_NOT_IMPLEMENTED; goto finish; } - else if ((command->flags & F_TESTING) && !get_testing_mode ()) + else if ((command->flags & F_TESTING) && !settings_get_testing_mode ()) { msg (SE, _("%s may be used only in testing mode."), command->name); result = CMD_FAILURE; goto finish; } - else if ((command->flags & F_ENHANCED) && get_syntax () != ENHANCED) + else if ((command->flags & F_ENHANCED) && settings_get_syntax () != ENHANCED) { msg (SE, _("%s may be used only in enhanced syntax mode."), command->name); @@ -718,8 +718,8 @@ cmd_complete (const char *prefix, const struct command **cmd) for (; *cmd < commands + command_cnt; (*cmd)++) if (!memcasecmp ((*cmd)->name, prefix, strlen (prefix)) - && (!((*cmd)->flags & F_TESTING) || get_testing_mode ()) - && (!((*cmd)->flags & F_ENHANCED) || get_syntax () == ENHANCED) + && (!((*cmd)->flags & F_TESTING) || settings_get_testing_mode ()) + && (!((*cmd)->flags & F_ENHANCED) || settings_get_syntax () == ENHANCED) && !((*cmd)->flags & F_ABBREV) && ((*cmd)->function != NULL) && in_correct_state (*cmd, completion_state)) @@ -768,7 +768,7 @@ cmd_execute (struct lexer *lexer, struct dataset *ds) int cmd_erase (struct lexer *lexer, struct dataset *ds UNUSED) { - if (get_safer_mode ()) + if (settings_get_safer_mode ()) { msg (SE, _("This command not allowed when the SAFER option is set.")); return CMD_FAILURE; @@ -876,7 +876,7 @@ cmd_host (struct lexer *lexer, struct dataset *ds UNUSED) { int look_ahead; - if (get_safer_mode ()) + if (settings_get_safer_mode ()) { msg (SE, _("This command not allowed when the SAFER option is set.")); return CMD_FAILURE; diff --git a/src/language/control/loop.c b/src/language/control/loop.c index 20cf69e5..ea020a25 100644 --- a/src/language/control/loop.c +++ b/src/language/control/loop.c @@ -180,7 +180,7 @@ close_loop (void *loop_) && loop->index_var == NULL && loop->loop_condition == NULL && loop->end_loop_condition == NULL) - loop->max_pass_count = get_mxloops (); + loop->max_pass_count = settings_get_mxloops (); } /* Parses an IF clause for LOOP or END LOOP and stores the diff --git a/src/language/control/repeat.c b/src/language/control/repeat.c index e518d51e..32847bb4 100644 --- a/src/language/control/repeat.c +++ b/src/language/control/repeat.c @@ -330,7 +330,7 @@ parse_lines (struct lexer *lexer, struct repeat_block *block) &command_ends_after_line); if (recognize_do_repeat (ds_ss (&text))) { - if (get_syntax () == COMPATIBLE) + if (settings_get_syntax () == COMPATIBLE) msg (SE, _("DO REPEAT may not nest in compatibility mode.")); else nesting_level++; @@ -525,8 +525,7 @@ do_repeat_filter (struct getl_interface *block_, /* Strip trailing whitespace, check for & remove terminal dot. */ ds_rtrim (line, ss_cstr (CC_SPACES)); - dot = ds_chomp (line, get_endcmd ()); - + dot = ds_chomp (line, settings_get_endcmd ()); input = ds_ss (line); in_apos = in_quote = false; while ((c = ss_first (input)) != EOF) @@ -549,7 +548,7 @@ do_repeat_filter (struct getl_interface *block_, } } if (dot) - ds_put_char (&output, get_endcmd ()); + ds_put_char (&output, settings_get_endcmd ()); ds_swap (line, &output); ds_destroy (&output); diff --git a/src/language/data-io/data-list.c b/src/language/data-io/data-list.c index 51dbce11..ecb87d4a 100644 --- a/src/language/data-io/data-list.c +++ b/src/language/data-io/data-list.c @@ -424,7 +424,7 @@ parse_free (struct lexer *lexer, struct dictionary *dict, { lex_match (lexer, '*'); input = fmt_for_input (FMT_F, 8, 0); - output = *get_format (); + output = *settings_get_format (); } for (i = 0; i < name_cnt; i++) diff --git a/src/language/data-io/data-parser.c b/src/language/data-io/data-parser.c index 5fb044a5..9a2ea769 100644 --- a/src/language/data-io/data-parser.c +++ b/src/language/data-io/data-parser.c @@ -554,7 +554,7 @@ parse_delimited_no_span (const struct data_parser *parser, { if (!cut_field (parser, reader, &s)) { - if (get_undefined ()) + if (settings_get_undefined ()) msg (SW, _("Missing value(s) for all variables from %s onward. " "These will be filled with the system-missing value " "or blanks, as appropriate."), diff --git a/src/language/data-io/file-handle.q b/src/language/data-io/file-handle.q index af5fa332..9747cb1a 100644 --- a/src/language/data-io/file-handle.q +++ b/src/language/data-io/file-handle.q @@ -210,7 +210,7 @@ fh_parse (struct lexer *lexer, enum fh_referent referent_mask) handle = fh_from_id (lex_tokid (lexer)); if (handle == NULL) { - if (lex_token (lexer) != T_ID || lex_tokid (lexer)[0] != '#' || get_syntax () != ENHANCED) + if (lex_token (lexer) != T_ID || lex_tokid (lexer)[0] != '#' || settings_get_syntax () != ENHANCED) handle = fh_create_file (NULL, ds_cstr (lex_tokstr (lexer)), fh_default_properties ()); else diff --git a/src/language/expressions/parse.c b/src/language/expressions/parse.c index 40b0a7ab..bdce53c5 100644 --- a/src/language/expressions/parse.c +++ b/src/language/expressions/parse.c @@ -801,9 +801,9 @@ parse_sysvar (struct lexer *lexer, struct expression *e) + tm->tm_sec); } else if (lex_match_id (lexer, "$LENGTH")) - return expr_allocate_number (e, get_viewlength ()); + return expr_allocate_number (e, settings_get_viewlength ()); else if (lex_match_id (lexer, "$WIDTH")) - return expr_allocate_number (e, get_viewwidth ()); + return expr_allocate_number (e, settings_get_viewwidth ()); else { msg (SE, _("Unknown system variable %s."), lex_tokid (lexer)); @@ -1260,7 +1260,7 @@ parse_function (struct lexer *lexer, struct expression *e) if (!validate_function_args (f, arg_cnt, min_valid)) goto fail; - if ((f->flags & OPF_EXTENSION) && get_syntax () == COMPATIBLE) + if ((f->flags & OPF_EXTENSION) && settings_get_syntax () == COMPATIBLE) msg (SW, _("%s is a PSPP extension."), f->prototype); if (f->flags & OPF_UNIMPLEMENTED) { diff --git a/src/language/lexer/lexer.c b/src/language/lexer/lexer.c index d1612876..1c9542d7 100644 --- a/src/language/lexer/lexer.c +++ b/src/language/lexer/lexer.c @@ -859,8 +859,8 @@ lex_preprocess_line (struct string *line, { strip_comments (line); ds_rtrim (line, ss_cstr (CC_SPACES)); - *line_ends_command = (ds_chomp (line, get_endcmd ()) - || (ds_is_empty (line) && get_nulline ())); + *line_ends_command = (ds_chomp (line, settings_get_endcmd ()) + || (ds_is_empty (line) && settings_get_nulline ())); *line_starts_command = false; if (syntax == GETL_BATCH) { diff --git a/src/language/lexer/q2c.c b/src/language/lexer/q2c.c index 60a5790f..d14c69d0 100644 --- a/src/language/lexer/q2c.c +++ b/src/language/lexer/q2c.c @@ -1850,16 +1850,16 @@ dump_parser (int persistent) /* Now deal with the /ALGORITHM subcommand implicit to all commands */ - dump(1,"else if ( get_syntax() != COMPATIBLE && lex_match_id(lexer, \"ALGORITHM\"))"); + dump(1,"else if ( settings_get_syntax () != COMPATIBLE && lex_match_id(lexer, \"ALGORITHM\"))"); dump(1,"{"); dump (0, "lex_match (lexer, '=');"); dump(1,"if (lex_match_id(lexer, \"COMPATIBLE\"))"); - dump(0,"set_cmd_algorithm(COMPATIBLE);"); + dump(0,"settings_set_cmd_algorithm (COMPATIBLE);"); outdent(); dump(1,"else if (lex_match_id(lexer, \"ENHANCED\"))"); - dump(0,"set_cmd_algorithm(ENHANCED);"); + dump(0,"settings_set_cmd_algorithm (ENHANCED);"); dump (-1, "}"); outdent (); diff --git a/src/language/stats/flip.c b/src/language/stats/flip.c index 6c49bd37..ccb84dd8 100644 --- a/src/language/stats/flip.c +++ b/src/language/stats/flip.c @@ -362,7 +362,7 @@ flip_file (struct flip_pgm *flip) /* Allocate memory for many cases. */ case_bytes = flip->var_cnt * sizeof *input_buf; - case_capacity = get_workspace () / case_bytes; + case_capacity = settings_get_workspace () / case_bytes; if (case_capacity > flip->case_cnt * 2) case_capacity = flip->case_cnt * 2; if (case_capacity < 2) diff --git a/src/language/stats/frequencies.q b/src/language/stats/frequencies.q index 3857bd85..e7509052 100644 --- a/src/language/stats/frequencies.q +++ b/src/language/stats/frequencies.q @@ -766,7 +766,7 @@ frq_custom_variables (struct lexer *lexer, struct dataset *ds, struct cmd_freque vf->groups = NULL; vf->width = var_get_width (v); vf->print = *var_get_print_format (v); - if (vf->width > MAX_SHORT_STRING && get_algorithm () == COMPATIBLE) + if (vf->width > MAX_SHORT_STRING && settings_get_algorithm () == COMPATIBLE) { enum fmt_type type = var_get_print_format (v)->type; vf->width = MAX_SHORT_STRING; @@ -1257,7 +1257,7 @@ calc_stats (const struct variable *v, double d[frq_n_stats]) double tp; if ( percentiles[i].flag2 ) continue ; - if ( get_algorithm() != COMPATIBLE ) + if ( settings_get_algorithm () != COMPATIBLE ) tp = (ft->valid_cases - 1) * percentiles[i].p; else @@ -1308,7 +1308,7 @@ calc_stats (const struct variable *v, double d[frq_n_stats]) double s; double dummy; - if ( get_algorithm() != COMPATIBLE ) + if ( settings_get_algorithm () != COMPATIBLE ) { s = modf((ft->valid_cases - 1) * percentiles[i].p , &dummy); } diff --git a/src/language/stats/sort-cases.c b/src/language/stats/sort-cases.c index 2435c19a..85acc6c2 100644 --- a/src/language/stats/sort-cases.c +++ b/src/language/stats/sort-cases.c @@ -52,7 +52,7 @@ cmd_sort_cases (struct lexer *lexer, struct dataset *ds) if (ordering == NULL) return CMD_CASCADING_FAILURE; - if (get_testing_mode () && lex_match (lexer, '/')) + if (settings_get_testing_mode () && lex_match (lexer, '/')) { if (!lex_force_match_id (lexer, "BUFFERS") || !lex_match (lexer, '=') || !lex_force_int (lexer)) diff --git a/src/language/syntax-file.c b/src/language/syntax-file.c index 5bd6fafa..a48dba4a 100644 --- a/src/language/syntax-file.c +++ b/src/language/syntax-file.c @@ -110,7 +110,7 @@ read_syntax_file (struct getl_interface *s, while (sfs->ln == 1 && !memcmp (ds_cstr (line), "#!", 2)); /* Echo to listing file, if configured to do so. */ - if (get_echo ()) + if (settings_get_echo ()) tab_output_text (TAB_LEFT | TAB_FIX, ds_cstr (line)); return true; diff --git a/src/language/utilities/permissions.c b/src/language/utilities/permissions.c index 100317bb..fec6b4fc 100644 --- a/src/language/utilities/permissions.c +++ b/src/language/utilities/permissions.c @@ -88,12 +88,12 @@ cmd_permissions (struct lexer *lexer, struct dataset *ds UNUSED) int -change_permissions(const char *file_name, enum PER per) +change_permissions (const char *file_name, enum PER per) { struct stat buf; mode_t mode; - if (get_safer_mode ()) + if (settings_get_safer_mode ()) { msg (SE, _("This command not allowed when the SAFER option is set.")); return CMD_FAILURE; diff --git a/src/language/utilities/set.q b/src/language/utilities/set.q index 2248b85e..e058aa59 100644 --- a/src/language/utilities/set.q +++ b/src/language/utilities/set.q @@ -125,7 +125,6 @@ int tgetnum (const char *); /* (functions) */ -static bool do_cc (const char *cc_string, enum fmt_type); static enum integer_format stc_to_integer_format (int stc); static enum float_format stc_to_float_format (int stc); @@ -141,15 +140,15 @@ cmd_set (struct lexer *lexer, struct dataset *ds) } if (cmd.sbc_cca) - do_cc (cmd.s_cca, FMT_CCA); + settings_set_cc ( cmd.s_cca, FMT_CCA); if (cmd.sbc_ccb) - do_cc (cmd.s_ccb, FMT_CCB); + settings_set_cc ( cmd.s_ccb, FMT_CCB); if (cmd.sbc_ccc) - do_cc (cmd.s_ccc, FMT_CCC); + settings_set_cc ( cmd.s_ccc, FMT_CCC); if (cmd.sbc_ccd) - do_cc (cmd.s_ccd, FMT_CCD); + settings_set_cc ( cmd.s_ccd, FMT_CCD); if (cmd.sbc_cce) - do_cc (cmd.s_cce, FMT_CCE); + settings_set_cc ( cmd.s_cce, FMT_CCE); if (cmd.sbc_prompt) prompt_set (PROMPT_FIRST, cmd.s_prompt); @@ -159,43 +158,44 @@ cmd_set (struct lexer *lexer, struct dataset *ds) prompt_set (PROMPT_DATA, cmd.s_dprompt); if (cmd.sbc_decimal) - fmt_set_decimal (cmd.dec == STC_DOT ? '.' : ','); + settings_set_decimal_char (cmd.dec == STC_DOT ? '.' : ','); + if (cmd.sbc_echo) - set_echo (cmd.echo == STC_ON); + settings_set_echo (cmd.echo == STC_ON); if (cmd.sbc_endcmd) - set_endcmd (cmd.s_endcmd[0]); + settings_set_endcmd (cmd.s_endcmd[0]); if (cmd.sbc_errorbreak) - set_errorbreak (cmd.errbrk == STC_ON); + settings_set_errorbreak (cmd.errbrk == STC_ON); if (cmd.sbc_errors) { bool both = cmd.errors == STC_BOTH || cmd.errors == STC_ON; - set_error_routing_to_terminal (cmd.errors == STC_TERMINAL || both); - set_error_routing_to_listing (cmd.errors == STC_LISTING || both); + settings_set_error_routing_to_terminal (cmd.errors == STC_TERMINAL || both); + settings_set_error_routing_to_listing (cmd.errors == STC_LISTING || both); } if (cmd.sbc_include) - set_include (cmd.inc == STC_ON); + settings_set_include (cmd.inc == STC_ON); if (cmd.sbc_mxerrs) - set_mxerrs (cmd.n_mxerrs[0]); + settings_set_mxerrs (cmd.n_mxerrs[0]); if (cmd.sbc_mxwarns) - set_mxwarns (cmd.n_mxwarns[0]); + settings_set_mxwarns (cmd.n_mxwarns[0]); if (cmd.sbc_nulline) - set_nulline (cmd.null == STC_ON); + settings_set_nulline (cmd.null == STC_ON); if (cmd.sbc_rib) - data_in_set_integer_format (stc_to_integer_format (cmd.rib)); + settings_set_input_integer_format (stc_to_integer_format (cmd.rib)); if (cmd.sbc_rrb) - data_in_set_float_format (stc_to_float_format (cmd.rrb)); + settings_set_input_float_format (stc_to_float_format (cmd.rrb)); if (cmd.sbc_safer) - set_safer_mode (); + settings_set_safer_mode (); if (cmd.sbc_scompression) - set_scompression (cmd.scompress == STC_ON); + settings_set_scompression (cmd.scompress == STC_ON); if (cmd.sbc_undefined) - set_undefined (cmd.undef == STC_WARN); + settings_set_undefined (cmd.undef == STC_WARN); if (cmd.sbc_wib) - data_out_set_integer_format (stc_to_integer_format (cmd.wib)); + settings_set_output_integer_format (stc_to_integer_format (cmd.wib)); if (cmd.sbc_wrb) - data_out_set_float_format (stc_to_float_format (cmd.wrb)); + settings_set_output_float_format (stc_to_float_format (cmd.wrb)); if (cmd.sbc_workspace) - set_workspace (cmd.n_workspace[0] * 1024L); + settings_set_workspace (cmd.n_workspace[0] * 1024L); if (cmd.sbc_block) msg (SW, _("%s is obsolete."), "BLOCK"); @@ -273,92 +273,7 @@ stc_to_float_format (int stc) NOT_REACHED (); } -/* Find the grouping characters in CC_STRING and set CC's - grouping and decimal members appropriately. Returns true if - successful, false otherwise. */ -static bool -find_cc_separators (const char *cc_string, struct fmt_number_style *cc) -{ - const char *sp; - int comma_cnt, dot_cnt; - - /* Count commas and periods. There must be exactly three of - one or the other, except that an apostrophe escapes a - following comma or period. */ - comma_cnt = dot_cnt = 0; - for (sp = cc_string; *sp; sp++) - if (*sp == ',') - comma_cnt++; - else if (*sp == '.') - dot_cnt++; - else if (*sp == '\'' && (sp[1] == '.' || sp[1] == ',' || sp[1] == '\'')) - sp++; - - if ((comma_cnt == 3) == (dot_cnt == 3)) - return false; - if (comma_cnt == 3) - { - cc->decimal = '.'; - cc->grouping = ','; - } - else - { - cc->decimal = ','; - cc->grouping = '.'; - } - return true; -} - -/* Extracts a token from IN into a newly allocated AFFIX. Tokens - are delimited by GROUPING. The token is truncated to at most - FMT_STYLE_AFFIX_MAX characters. Returns the first character - following the token. */ -static const char * -extract_cc_token (const char *in, int grouping, struct substring *affix) -{ - size_t ofs = 0; - ss_alloc_uninit (affix, FMT_STYLE_AFFIX_MAX); - for (; *in != '\0' && *in != grouping; in++) - { - if (*in == '\'' && in[1] == grouping) - in++; - if (ofs < FMT_STYLE_AFFIX_MAX) - ss_data (*affix)[ofs++] = *in; - } - affix->length = ofs; - - if (*in == grouping) - in++; - return in; -} - -/* Sets custom currency specifier CC having name CC_NAME ('A' through - 'E') to correspond to the settings in CC_STRING. */ -static bool -do_cc (const char *cc_string, enum fmt_type type) -{ - struct fmt_number_style *cc = fmt_number_style_create (); - - /* Determine separators. */ - if (!find_cc_separators (cc_string, cc)) - { - fmt_number_style_destroy (cc); - msg (SE, _("%s: Custom currency string `%s' does not contain " - "exactly three periods or commas (or it contains both)."), - fmt_name (type), cc_string); - return false; - } - - cc_string = extract_cc_token (cc_string, cc->grouping, &cc->neg_prefix); - cc_string = extract_cc_token (cc_string, cc->grouping, &cc->prefix); - cc_string = extract_cc_token (cc_string, cc->grouping, &cc->suffix); - cc_string = extract_cc_token (cc_string, cc->grouping, &cc->neg_suffix); - - fmt_set_style (type, cc); - - return true; -} /* Parses the BLANKS subcommand, which controls the value that completely blank fields in numeric data imply. X, Wnd: Syntax is @@ -372,13 +287,13 @@ stc_custom_blanks (struct lexer *lexer, if (lex_match_id (lexer, "SYSMIS")) { lex_get (lexer); - set_blanks (SYSMIS); + settings_set_blanks (SYSMIS); } else { if (!lex_force_num (lexer)) return 0; - set_blanks (lex_number (lexer)); + settings_set_blanks (lex_number (lexer)); lex_get (lexer); } return 1; @@ -393,7 +308,7 @@ stc_custom_epoch (struct lexer *lexer, { lex_match (lexer, '='); if (lex_match_id (lexer, "AUTOMATIC")) - set_epoch (-1); + settings_set_epoch (-1); else if (lex_is_integer (lexer)) { int new_epoch = lex_integer (lexer); @@ -403,7 +318,7 @@ stc_custom_epoch (struct lexer *lexer, msg (SE, _("EPOCH must be 1500 or later.")); return 0; } - set_epoch (new_epoch); + settings_set_epoch (new_epoch); } else { @@ -436,7 +351,7 @@ stc_custom_length (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_se } if (page_length != -1) - set_viewlength (page_length); + settings_set_viewlength (page_length); return 1; } @@ -463,9 +378,9 @@ stc_custom_width (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_set { lex_match (lexer, '='); if (lex_match_id (lexer, "NARROW")) - set_viewwidth (79); + settings_set_viewwidth (79); else if (lex_match_id (lexer, "WIDE")) - set_viewwidth (131); + settings_set_viewwidth (131); else { if (!lex_force_int (lexer)) @@ -475,7 +390,7 @@ stc_custom_width (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_set msg (SE, _("WIDTH must be at least 40.")); return 0; } - set_viewwidth (lex_integer (lexer)); + settings_set_viewwidth (lex_integer (lexer)); lex_get (lexer); } @@ -501,7 +416,7 @@ stc_custom_format (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_se return 0; } - set_format (&fmt); + settings_set_format (&fmt); return 1; } @@ -561,10 +476,10 @@ stc_custom_disk (struct lexer *lexer, struct dataset *ds, struct cmd_set *cmd UN static void show_blanks (const struct dataset *ds UNUSED) { - if (get_blanks () == SYSMIS) + if (settings_get_blanks () == SYSMIS) msg (SN, _("BLANKS is SYSMIS.")); else - msg (SN, _("BLANKS is %g."), get_blanks ()); + msg (SN, _("BLANKS is %g."), settings_get_blanks ()); } @@ -586,7 +501,7 @@ format_cc (struct substring in, char grouping, char *out) static void show_cc (enum fmt_type type) { - const struct fmt_number_style *cc = fmt_get_style (type); + const struct fmt_number_style *cc = settings_get_style (type); char cc_string[FMT_STYLE_AFFIX_MAX * 4 * 2 + 3 + 1]; char *out; @@ -635,20 +550,20 @@ show_cce (const struct dataset *ds UNUSED) static void show_decimals (const struct dataset *ds UNUSED) { - msg (SN, _("DECIMAL is \"%c\"."), fmt_decimal_char (FMT_F)); + msg (SN, _("DECIMAL is \"%c\"."), settings_get_decimal_char (FMT_F)); } static void show_endcmd (const struct dataset *ds UNUSED) { - msg (SN, _("ENDCMD is \"%c\"."), get_endcmd ()); + msg (SN, _("ENDCMD is \"%c\"."), settings_get_endcmd ()); } static void show_errors (const struct dataset *ds UNUSED) { - bool terminal = get_error_routing_to_terminal (); - bool listing = get_error_routing_to_listing (); + bool terminal = settings_get_error_routing_to_terminal (); + bool listing = settings_get_error_routing_to_listing (); msg (SN, _("ERRORS is \"%s\"."), terminal && listing ? "BOTH" : terminal ? "TERMINAL" @@ -660,31 +575,31 @@ static void show_format (const struct dataset *ds UNUSED) { char str[FMT_STRING_LEN_MAX + 1]; - msg (SN, _("FORMAT is %s."), fmt_to_string (get_format (), str)); + msg (SN, _("FORMAT is %s."), fmt_to_string (settings_get_format (), str)); } static void show_length (const struct dataset *ds UNUSED) { - msg (SN, _("LENGTH is %d."), get_viewlength ()); + msg (SN, _("LENGTH is %d."), settings_get_viewlength ()); } static void show_mxerrs (const struct dataset *ds UNUSED) { - msg (SN, _("MXERRS is %d."), get_mxerrs ()); + msg (SN, _("MXERRS is %d."), settings_get_mxerrs ()); } static void show_mxloops (const struct dataset *ds UNUSED) { - msg (SN, _("MXLOOPS is %d."), get_mxloops ()); + msg (SN, _("MXLOOPS is %d."), settings_get_mxloops ()); } static void show_mxwarns (const struct dataset *ds UNUSED) { - msg (SN, _("MXWARNS is %d."), get_mxwarns ()); + msg (SN, _("MXWARNS is %d."), settings_get_mxwarns ()); } /* Outputs that SETTING has the given INTEGER_FORMAT value. */ @@ -750,19 +665,19 @@ show_float_format (const char *setting, enum float_format float_format) static void show_rib (const struct dataset *ds UNUSED) { - show_integer_format ("RIB", data_in_get_integer_format ()); + show_integer_format ("RIB", settings_get_input_integer_format ()); } static void show_rrb (const struct dataset *ds UNUSED) { - show_float_format ("RRB", data_in_get_float_format ()); + show_float_format ("RRB", settings_get_input_float_format ()); } static void show_scompression (const struct dataset *ds UNUSED) { - if (get_scompression ()) + if (settings_get_scompression ()) msg (SN, _("SCOMPRESSION is ON.")); else msg (SN, _("SCOMPRESSION is OFF.")); @@ -771,7 +686,7 @@ show_scompression (const struct dataset *ds UNUSED) static void show_undefined (const struct dataset *ds UNUSED) { - if (get_undefined ()) + if (settings_get_undefined ()) msg (SN, _("UNDEFINED is WARN.")); else msg (SN, _("UNDEFINED is NOWARN.")); @@ -780,7 +695,7 @@ show_undefined (const struct dataset *ds UNUSED) static void show_weight (const struct dataset *ds) { - struct variable *var = dict_get_weight (dataset_dict (ds)); + const struct variable *var = dict_get_weight (dataset_dict (ds)); if (var == NULL) msg (SN, _("WEIGHT is off.")); else @@ -790,19 +705,19 @@ show_weight (const struct dataset *ds) static void show_wib (const struct dataset *ds UNUSED) { - show_integer_format ("WIB", data_out_get_integer_format ()); + show_integer_format ("WIB", settings_get_output_integer_format ()); } static void show_wrb (const struct dataset *ds UNUSED) { - show_float_format ("WRB", data_out_get_float_format ()); + show_float_format ("WRB", settings_get_output_float_format ()); } static void show_width (const struct dataset *ds UNUSED) { - msg (SN, _("WIDTH is %d."), get_viewwidth ()); + msg (SN, _("WIDTH is %d."), settings_get_viewwidth ()); } struct show_sbc diff --git a/src/math/sort.c b/src/math/sort.c index 5e909422..e03ef574 100644 --- a/src/math/sort.c +++ b/src/math/sort.c @@ -208,7 +208,7 @@ pqueue_create (const struct case_ordering *ordering) pq = xmalloc (sizeof *pq); pq->ordering = case_ordering_clone (ordering); pq->record_cap - = get_workspace_cases (case_ordering_get_value_cnt (ordering)); + = settings_get_workspace_cases (case_ordering_get_value_cnt (ordering)); if (pq->record_cap > max_buffers) pq->record_cap = max_buffers; else if (pq->record_cap < min_buffers) diff --git a/src/output/ascii.c b/src/output/ascii.c index ad72e8dc..29d7b76b 100644 --- a/src/output/ascii.c +++ b/src/output/ascii.c @@ -238,9 +238,9 @@ update_page_size (struct outp_driver *this, bool issue_error) int margins = x->top_margin + x->bottom_margin + 1 + (x->headers ? 3 : 0); if (x->auto_width) - this->width = get_viewwidth (); + this->width = settings_get_viewwidth (); if (x->auto_length) - x->page_length = get_viewlength (); + x->page_length = settings_get_viewlength (); this->length = x->page_length - margins; diff --git a/src/output/output.c b/src/output/output.c index 8eccf763..ab91ed6f 100644 --- a/src/output/output.c +++ b/src/output/output.c @@ -210,12 +210,12 @@ find_defn_value (const char *key) return ds_cstr (&d->value); if (!strcmp (key, "viewwidth")) { - sprintf (buf, "%d", get_viewwidth ()); + sprintf (buf, "%d", settings_get_viewwidth ()); return buf; } else if (!strcmp (key, "viewlength")) { - sprintf (buf, "%d", get_viewlength ()); + sprintf (buf, "%d", settings_get_viewlength ()); return buf; } else @@ -462,7 +462,7 @@ outp_done (void) void outp_list_classes (void) { - int width = get_viewwidth(); + int width = settings_get_viewwidth (); struct outp_driver_class_list *c; printf (_("Driver classes:\n\t")); @@ -472,7 +472,7 @@ outp_list_classes (void) if ((int) strlen (c->class->name) + 1 > width) { printf ("\n\t"); - width = get_viewwidth() - 8; + width = settings_get_viewwidth () - 8; } else putc (' ', stdout); diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index bc49a3cb..07557fed 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -88,7 +88,6 @@ initialize (void) glade_init (); gsl_set_error_handler_off (); - fmt_init (); fn_init (); outp_init (); settings_init (&viewer_width, &viewer_length); diff --git a/src/ui/gui/var-type-dialog.c b/src/ui/gui/var-type-dialog.c index bee65de8..8aad3ada 100644 --- a/src/ui/gui/var-type-dialog.c +++ b/src/ui/gui/var-type-dialog.c @@ -467,7 +467,7 @@ var_type_dialog_create (GladeXML *xml) for ( i = 0 ; i < sizeof (dollar_format)/sizeof (dollar_format[0]) ; ++i ) { - char *template = fmt_dollar_template (&dollar_format[i]); + char *template = settings_dollar_template (&dollar_format[i]); gtk_list_store_append (list_store, &iter); gtk_list_store_set (list_store, &iter, 0, template, diff --git a/src/ui/terminal/command-line.c b/src/ui/terminal/command-line.c index 71d42a04..95b22ceb 100644 --- a/src/ui/terminal/command-line.c +++ b/src/ui/terminal/command-line.c @@ -96,9 +96,9 @@ parse_command_line (int argc, char **argv, struct source_stream *ss) /* Compatibility options */ case 'a': if ( 0 == strcmp(optarg,"compatible") ) - set_algorithm(COMPATIBLE); + settings_set_algorithm(COMPATIBLE); else if ( 0 == strcmp(optarg,"enhanced")) - set_algorithm(ENHANCED); + settings_set_algorithm(ENHANCED); else { usage (); @@ -108,9 +108,9 @@ parse_command_line (int argc, char **argv, struct source_stream *ss) case 'x': if ( 0 == strcmp(optarg,"compatible") ) - set_syntax(COMPATIBLE); + settings_set_syntax (COMPATIBLE); else if ( 0 == strcmp(optarg,"enhanced")) - set_syntax(ENHANCED); + settings_set_syntax (ENHANCED); else { usage (); @@ -162,7 +162,7 @@ parse_command_line (int argc, char **argv, struct source_stream *ss) process_statrc = false; break; case 's': - set_safer_mode (); + settings_set_safer_mode (); break; case 'v': verbose_increment_level (); @@ -172,7 +172,7 @@ parse_command_line (int argc, char **argv, struct source_stream *ss) puts (legal); return false; case 'T': - set_testing_mode (true); + settings_set_testing_mode (true); break; case '?': usage (); diff --git a/src/ui/terminal/main.c b/src/ui/terminal/main.c index 2f80cb57..673b88b1 100644 --- a/src/ui/terminal/main.c +++ b/src/ui/terminal/main.c @@ -91,7 +91,6 @@ main (int argc, char **argv) fpu_init (); gsl_set_error_handler_off (); - fmt_init (); outp_init (); fn_init (); fh_init (); @@ -110,7 +109,7 @@ main (int argc, char **argv) if (parse_command_line (argc, argv, the_source_stream)) { msg_ui_init (the_source_stream); - if (!get_testing_mode ()) + if (!settings_get_testing_mode ()) outp_read_devices (); else outp_configure_driver_line ( @@ -210,6 +209,5 @@ clean_up (void) readln_uninitialize (); outp_done (); msg_ui_done (); - fmt_done (); } } diff --git a/src/ui/terminal/msg-ui.c b/src/ui/terminal/msg-ui.c index 98f99c1c..fb0e7557 100644 --- a/src/ui/terminal/msg-ui.c +++ b/src/ui/terminal/msg-ui.c @@ -90,14 +90,14 @@ check_msg_count (struct source_stream *ss) { if (!getl_is_interactive (ss)) { - if (get_errorbreak () && error_count) + if (settings_get_errorbreak () && error_count) msg (MN, _("Terminating execution of syntax file due to error.")); - else if (error_count > get_mxerrs() ) + else if (error_count > settings_get_mxerrs () ) msg (MN, _("Errors (%d) exceeds limit (%d)."), - error_count, get_mxerrs()); - else if (error_count + warning_count > get_mxwarns() ) + error_count, settings_get_mxerrs ()); + else if (error_count + warning_count > settings_get_mxwarns () ) msg (MN, _("Warnings (%d) exceed limit (%d)."), - error_count + warning_count, get_mxwarns() ); + error_count + warning_count, settings_get_mxwarns () ); else return; @@ -175,14 +175,14 @@ handle_msg (const struct msg *m) ds_put_cstr (&string, m->text); - if (msg_file != stdout || get_error_routing_to_terminal ()) + if (msg_file != stdout || settings_get_error_routing_to_terminal ()) dump_message (ds_cstr (&string), - isatty (fileno (msg_file)) ? get_viewwidth () : INT_MAX, 8, + isatty (fileno (msg_file)) ? settings_get_viewwidth () : INT_MAX, 8, write_stream, msg_file); dump_message (ds_cstr (&string), 78, 0, write_journal, NULL); - if (get_error_routing_to_listing ()) + if (settings_get_error_routing_to_listing ()) { /* Disable screen output devices, because the error should already have been reported to the screen with the diff --git a/src/ui/terminal/read-line.c b/src/ui/terminal/read-line.c index 493a3d63..e72f1145 100644 --- a/src/ui/terminal/read-line.c +++ b/src/ui/terminal/read-line.c @@ -92,7 +92,7 @@ readln_uninitialize (void) initialised = false; #if HAVE_READLINE - if (history_file != NULL && false == get_testing_mode() ) + if (history_file != NULL && false == settings_get_testing_mode () ) write_history (history_file); clear_history (); free (history_file);