From: John Darrington Date: Fri, 22 Dec 2006 11:12:14 +0000 (+0000) Subject: Added abstract factory to create casefiles. Updated procedures to use X-Git-Tag: v0.6.0~619 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=687adf53eae434e88a47bb3409f946f3a26115a4;p=pspp-builds.git Added abstract factory to create casefiles. Updated procedures to use it. --- diff --git a/po/de.po b/po/de.po index 32d73620..6c937bf2 100644 --- a/po/de.po +++ b/po/de.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: PSPP 0.4.2\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2006-12-20 18:53+0900\n" +"POT-Creation-Date: 2006-12-21 09:13+0900\n" "PO-Revision-Date: 2006-05-26 17:49+0800\n" "Last-Translator: John Darrington \n" "Language-Team: German \n" @@ -938,6 +938,10 @@ msgstr "" msgid "This command may not follow ELSE in DO IF...END IF." msgstr "" +#: src/language/control/loop.c:214 +msgid "Only one index clause may be specified." +msgstr "" + #: src/language/control/repeat.c:170 #, c-format msgid "Dummy variable name \"%s\" hides dictionary variable \"%s\"." @@ -1246,7 +1250,7 @@ msgstr "" msgid "IN variable name %s duplicates an existing variable name." msgstr "" -#: src/language/data-io/get.c:1479 +#: src/language/data-io/get.c:1484 #, c-format msgid "" "Variable %s in file %s (%s) has different type or width from the same " @@ -1403,7 +1407,7 @@ msgid "`)' expected after output format." msgstr "" #: src/language/dictionary/missing-values.c:58 -#: src/language/stats/aggregate.c:479 +#: src/language/stats/aggregate.c:484 msgid "expecting `('" msgstr "" @@ -1885,7 +1889,7 @@ msgstr "" msgid "Unknown identifier %s." msgstr "" -#: src/language/expressions/parse.c:886 src/language/stats/aggregate.c:537 +#: src/language/expressions/parse.c:886 src/language/stats/aggregate.c:542 msgid "expecting `)'" msgstr "" @@ -2171,40 +2175,40 @@ msgid "" "has no effect. Output data will be sorted the same way as the input data." msgstr "" -#: src/language/stats/aggregate.c:444 +#: src/language/stats/aggregate.c:449 msgid "expecting aggregation function" msgstr "" -#: src/language/stats/aggregate.c:462 +#: src/language/stats/aggregate.c:467 #, c-format msgid "Unknown aggregation function %s." msgstr "" -#: src/language/stats/aggregate.c:518 +#: src/language/stats/aggregate.c:523 #, c-format msgid "Missing argument %d to %s." msgstr "" -#: src/language/stats/aggregate.c:527 +#: src/language/stats/aggregate.c:532 #, c-format msgid "Arguments to %s must be of same type as source variables." msgstr "" -#: src/language/stats/aggregate.c:549 +#: src/language/stats/aggregate.c:554 #, c-format msgid "" "Number of source variables (%u) does not match number of target variables (%" "u)." msgstr "" -#: src/language/stats/aggregate.c:565 +#: src/language/stats/aggregate.c:570 #, c-format msgid "" "The value arguments passed to the %s function are out-of-order. They will " "be treated as if they had been specified in the correct order." msgstr "" -#: src/language/stats/aggregate.c:635 +#: src/language/stats/aggregate.c:640 #, c-format msgid "" "Variable name %s is not unique within the aggregate file dictionary, which " @@ -2226,25 +2230,25 @@ msgstr "" msgid "Duplicate variable name %s among target variables." msgstr "" -#: src/language/stats/binomial.c:139 +#: src/language/stats/binomial.c:138 #, c-format msgid "Variable %s is not dichotomous" msgstr "" -#: src/language/stats/binomial.c:185 +#: src/language/stats/binomial.c:184 msgid "Binomial Test" msgstr "" -#: src/language/stats/binomial.c:203 +#: src/language/stats/binomial.c:202 msgid "Group1" msgstr "" -#: src/language/stats/binomial.c:206 +#: src/language/stats/binomial.c:205 msgid "Group2" msgstr "" -#: src/language/stats/binomial.c:209 src/language/stats/chisquare.c:237 -#: src/language/stats/chisquare.c:297 src/language/stats/crosstabs.q:821 +#: src/language/stats/binomial.c:208 src/language/stats/chisquare.c:236 +#: src/language/stats/chisquare.c:296 src/language/stats/crosstabs.q:821 #: src/language/stats/crosstabs.q:1021 src/language/stats/crosstabs.q:1744 #: src/language/stats/examine.q:912 src/language/stats/frequencies.q:1220 #: src/language/stats/oneway.q:306 src/language/stats/oneway.q:470 @@ -2252,72 +2256,72 @@ msgstr "" msgid "Total" msgstr "" -#: src/language/stats/binomial.c:254 src/language/stats/chisquare.c:260 +#: src/language/stats/binomial.c:253 src/language/stats/chisquare.c:259 #: src/language/stats/crosstabs.q:1139 src/language/stats/crosstabs.q:1180 msgid "Category" msgstr "" -#: src/language/stats/binomial.c:255 src/language/stats/crosstabs.q:831 +#: src/language/stats/binomial.c:254 src/language/stats/crosstabs.q:831 #: src/language/stats/examine.q:988 src/language/stats/frequencies.q:1516 -#: src/language/stats/npar-summary.c:125 src/language/stats/oneway.q:391 +#: src/language/stats/npar-summary.c:124 src/language/stats/oneway.q:391 #: src/language/stats/t-test.q:681 src/language/stats/t-test.q:704 #: src/language/stats/t-test.q:830 src/language/stats/t-test.q:1367 msgid "N" msgstr "" -#: src/language/stats/binomial.c:256 +#: src/language/stats/binomial.c:255 msgid "Observed Prop." msgstr "" -#: src/language/stats/binomial.c:257 +#: src/language/stats/binomial.c:256 msgid "Test Prop." msgstr "" -#: src/language/stats/binomial.c:260 +#: src/language/stats/binomial.c:259 #, c-format msgid "Exact Sig. (%d-tailed)" msgstr "" -#: src/language/stats/chisquare.c:209 +#: src/language/stats/chisquare.c:208 #, c-format msgid "" "CHISQUARE test specified %d expected values, but %d distinct values were " "encountered in variable %s." msgstr "" -#: src/language/stats/chisquare.c:221 src/language/stats/chisquare.c:261 +#: src/language/stats/chisquare.c:220 src/language/stats/chisquare.c:260 msgid "Observed N" msgstr "" -#: src/language/stats/chisquare.c:222 src/language/stats/chisquare.c:262 +#: src/language/stats/chisquare.c:221 src/language/stats/chisquare.c:261 msgid "Expected N" msgstr "" -#: src/language/stats/chisquare.c:223 src/language/stats/chisquare.c:263 +#: src/language/stats/chisquare.c:222 src/language/stats/chisquare.c:262 #: src/language/stats/regression.q:313 msgid "Residual" msgstr "" -#: src/language/stats/chisquare.c:256 +#: src/language/stats/chisquare.c:255 msgid "Frequencies" msgstr "" -#: src/language/stats/chisquare.c:310 +#: src/language/stats/chisquare.c:309 msgid "Test Statistics" msgstr "" -#: src/language/stats/chisquare.c:324 +#: src/language/stats/chisquare.c:323 msgid "Chi-Square" msgstr "" -#: src/language/stats/chisquare.c:325 src/language/stats/crosstabs.q:1115 +#: src/language/stats/chisquare.c:324 src/language/stats/crosstabs.q:1115 #: src/language/stats/oneway.q:279 src/language/stats/oneway.q:680 #: src/language/stats/regression.q:307 src/language/stats/t-test.q:981 #: src/language/stats/t-test.q:1173 src/language/stats/t-test.q:1266 msgid "df" msgstr "" -#: src/language/stats/chisquare.c:326 +#: src/language/stats/chisquare.c:325 msgid "Asymp. Sig." msgstr "" @@ -2600,7 +2604,7 @@ msgid "%s Dependent" msgstr "" #: src/language/stats/descriptives.c:106 src/language/stats/examine.q:1528 -#: src/language/stats/frequencies.q:125 src/language/stats/npar-summary.c:128 +#: src/language/stats/frequencies.q:125 src/language/stats/npar-summary.c:127 #: src/language/stats/oneway.q:392 src/language/stats/t-test.q:682 #: src/language/stats/t-test.q:705 src/language/stats/t-test.q:829 #: src/language/stats/t-test.q:1167 @@ -2644,13 +2648,13 @@ msgid "Range" msgstr "" #: src/language/stats/descriptives.c:115 src/language/stats/examine.q:1633 -#: src/language/stats/frequencies.q:136 src/language/stats/npar-summary.c:134 +#: src/language/stats/frequencies.q:136 src/language/stats/npar-summary.c:133 #: src/language/stats/oneway.q:404 msgid "Minimum" msgstr "" #: src/language/stats/descriptives.c:116 src/language/stats/examine.q:1644 -#: src/language/stats/frequencies.q:137 src/language/stats/npar-summary.c:137 +#: src/language/stats/frequencies.q:137 src/language/stats/npar-summary.c:136 #: src/language/stats/oneway.q:405 msgid "Maximum" msgstr "" @@ -2765,7 +2769,7 @@ msgstr "" msgid "Median" msgstr "" -#: src/language/stats/examine.q:1620 src/language/stats/npar-summary.c:131 +#: src/language/stats/examine.q:1620 src/language/stats/npar-summary.c:130 #: src/language/stats/oneway.q:393 src/language/stats/t-test.q:683 #: src/language/stats/t-test.q:706 src/language/stats/t-test.q:831 #: src/language/stats/t-test.q:1168 @@ -2808,7 +2812,7 @@ msgid "Dev from Normal" msgstr "" #: src/language/stats/examine.q:2014 src/language/stats/examine.q:2036 -#: src/language/stats/frequencies.q:1528 src/language/stats/npar-summary.c:144 +#: src/language/stats/frequencies.q:1528 src/language/stats/npar-summary.c:143 msgid "Percentiles" msgstr "" @@ -2834,51 +2838,51 @@ msgstr "" msgid "Could not create temporary file for FLIP." msgstr "" -#: src/language/stats/flip.c:313 src/language/stats/flip.c:382 +#: src/language/stats/flip.c:313 src/language/stats/flip.c:385 #, c-format msgid "Error writing FLIP file: %s." msgstr "" -#: src/language/stats/flip.c:429 +#: src/language/stats/flip.c:432 #, c-format msgid "Error rewinding FLIP file: %s." msgstr "" -#: src/language/stats/flip.c:436 +#: src/language/stats/flip.c:439 msgid "Error creating FLIP source file." msgstr "" -#: src/language/stats/flip.c:448 +#: src/language/stats/flip.c:451 #, c-format msgid "Error reading FLIP file: %s." msgstr "" -#: src/language/stats/flip.c:472 +#: src/language/stats/flip.c:475 #, c-format msgid "Error seeking FLIP source file: %s." msgstr "" -#: src/language/stats/flip.c:480 +#: src/language/stats/flip.c:483 #, c-format msgid "Error writing FLIP source file: %s." msgstr "" -#: src/language/stats/flip.c:491 +#: src/language/stats/flip.c:494 #, c-format msgid "Error closing FLIP source file: %s." msgstr "" -#: src/language/stats/flip.c:499 +#: src/language/stats/flip.c:502 #, c-format msgid "Error rewinding FLIP source file: %s." msgstr "" -#: src/language/stats/flip.c:545 +#: src/language/stats/flip.c:548 #, c-format msgid "Error reading FLIP temporary file: %s." msgstr "" -#: src/language/stats/flip.c:548 +#: src/language/stats/flip.c:551 msgid "Unexpected end of file reading FLIP temporary file." msgstr "" @@ -2999,19 +3003,19 @@ msgid "" "match the number following (%d)." msgstr "" -#: src/language/stats/npar-summary.c:111 +#: src/language/stats/npar-summary.c:110 msgid "Descriptive Statistics" msgstr "" -#: src/language/stats/npar-summary.c:148 +#: src/language/stats/npar-summary.c:147 msgid "25th" msgstr "" -#: src/language/stats/npar-summary.c:151 +#: src/language/stats/npar-summary.c:150 msgid "50th (Median)" msgstr "" -#: src/language/stats/npar-summary.c:154 +#: src/language/stats/npar-summary.c:153 msgid "75th" msgstr "" @@ -3677,7 +3681,7 @@ msgstr "" msgid "Empirical with averaging" msgstr "" -#: src/math/sort.c:438 +#: src/math/sort.c:467 #, c-format msgid "" "Out of memory. Could not allocate room for minimum of %d cases of %d bytes " @@ -4145,15 +4149,15 @@ msgstr "Unpassend Wert für Variable" msgid "Incorrect range specification" msgstr "Falshe Spannweitebeschreibung" -#: src/ui/gui/psppire.c:74 +#: src/ui/gui/psppire.c:76 msgid "Sorry. The help system hasn't yet been implemented." msgstr "Es gibt noch nicht kein Helpsysteme. Schade!" -#: src/ui/gui/psppire-data-store.c:724 +#: src/ui/gui/psppire-data-store.c:721 msgid "var" msgstr "" -#: src/ui/gui/psppire-data-store.c:805 src/ui/gui/psppire-var-store.c:551 +#: src/ui/gui/psppire-data-store.c:802 src/ui/gui/psppire-var-store.c:551 #: src/ui/gui/psppire-var-store.c:561 src/ui/gui/psppire-var-store.c:571 #: src/ui/gui/psppire-var-store.c:769 #, c-format @@ -4617,7 +4621,7 @@ msgid "" "Report bugs to <%s>.\n" msgstr "" -#: src/ui/terminal/main.c:125 +#: src/ui/terminal/main.c:129 msgid "" "Stopping syntax file processing here to avoid a cascade of dependent command " "failures." diff --git a/po/pspp.pot b/po/pspp.pot index 651a3d85..660b3259 100644 --- a/po/pspp.pot +++ b/po/pspp.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2006-12-20 18:53+0900\n" +"POT-Creation-Date: 2006-12-21 09:13+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -933,6 +933,10 @@ msgstr "" msgid "This command may not follow ELSE in DO IF...END IF." msgstr "" +#: src/language/control/loop.c:214 +msgid "Only one index clause may be specified." +msgstr "" + #: src/language/control/repeat.c:170 #, c-format msgid "Dummy variable name \"%s\" hides dictionary variable \"%s\"." @@ -1241,7 +1245,7 @@ msgstr "" msgid "IN variable name %s duplicates an existing variable name." msgstr "" -#: src/language/data-io/get.c:1479 +#: src/language/data-io/get.c:1484 #, c-format msgid "" "Variable %s in file %s (%s) has different type or width from the same " @@ -1398,7 +1402,7 @@ msgid "`)' expected after output format." msgstr "" #: src/language/dictionary/missing-values.c:58 -#: src/language/stats/aggregate.c:479 +#: src/language/stats/aggregate.c:484 msgid "expecting `('" msgstr "" @@ -1880,7 +1884,7 @@ msgstr "" msgid "Unknown identifier %s." msgstr "" -#: src/language/expressions/parse.c:886 src/language/stats/aggregate.c:537 +#: src/language/expressions/parse.c:886 src/language/stats/aggregate.c:542 msgid "expecting `)'" msgstr "" @@ -2166,40 +2170,40 @@ msgid "" "has no effect. Output data will be sorted the same way as the input data." msgstr "" -#: src/language/stats/aggregate.c:444 +#: src/language/stats/aggregate.c:449 msgid "expecting aggregation function" msgstr "" -#: src/language/stats/aggregate.c:462 +#: src/language/stats/aggregate.c:467 #, c-format msgid "Unknown aggregation function %s." msgstr "" -#: src/language/stats/aggregate.c:518 +#: src/language/stats/aggregate.c:523 #, c-format msgid "Missing argument %d to %s." msgstr "" -#: src/language/stats/aggregate.c:527 +#: src/language/stats/aggregate.c:532 #, c-format msgid "Arguments to %s must be of same type as source variables." msgstr "" -#: src/language/stats/aggregate.c:549 +#: src/language/stats/aggregate.c:554 #, c-format msgid "" "Number of source variables (%u) does not match number of target variables (%" "u)." msgstr "" -#: src/language/stats/aggregate.c:565 +#: src/language/stats/aggregate.c:570 #, c-format msgid "" "The value arguments passed to the %s function are out-of-order. They will " "be treated as if they had been specified in the correct order." msgstr "" -#: src/language/stats/aggregate.c:635 +#: src/language/stats/aggregate.c:640 #, c-format msgid "" "Variable name %s is not unique within the aggregate file dictionary, which " @@ -2221,25 +2225,25 @@ msgstr "" msgid "Duplicate variable name %s among target variables." msgstr "" -#: src/language/stats/binomial.c:139 +#: src/language/stats/binomial.c:138 #, c-format msgid "Variable %s is not dichotomous" msgstr "" -#: src/language/stats/binomial.c:185 +#: src/language/stats/binomial.c:184 msgid "Binomial Test" msgstr "" -#: src/language/stats/binomial.c:203 +#: src/language/stats/binomial.c:202 msgid "Group1" msgstr "" -#: src/language/stats/binomial.c:206 +#: src/language/stats/binomial.c:205 msgid "Group2" msgstr "" -#: src/language/stats/binomial.c:209 src/language/stats/chisquare.c:237 -#: src/language/stats/chisquare.c:297 src/language/stats/crosstabs.q:821 +#: src/language/stats/binomial.c:208 src/language/stats/chisquare.c:236 +#: src/language/stats/chisquare.c:296 src/language/stats/crosstabs.q:821 #: src/language/stats/crosstabs.q:1021 src/language/stats/crosstabs.q:1744 #: src/language/stats/examine.q:912 src/language/stats/frequencies.q:1220 #: src/language/stats/oneway.q:306 src/language/stats/oneway.q:470 @@ -2247,72 +2251,72 @@ msgstr "" msgid "Total" msgstr "" -#: src/language/stats/binomial.c:254 src/language/stats/chisquare.c:260 +#: src/language/stats/binomial.c:253 src/language/stats/chisquare.c:259 #: src/language/stats/crosstabs.q:1139 src/language/stats/crosstabs.q:1180 msgid "Category" msgstr "" -#: src/language/stats/binomial.c:255 src/language/stats/crosstabs.q:831 +#: src/language/stats/binomial.c:254 src/language/stats/crosstabs.q:831 #: src/language/stats/examine.q:988 src/language/stats/frequencies.q:1516 -#: src/language/stats/npar-summary.c:125 src/language/stats/oneway.q:391 +#: src/language/stats/npar-summary.c:124 src/language/stats/oneway.q:391 #: src/language/stats/t-test.q:681 src/language/stats/t-test.q:704 #: src/language/stats/t-test.q:830 src/language/stats/t-test.q:1367 msgid "N" msgstr "" -#: src/language/stats/binomial.c:256 +#: src/language/stats/binomial.c:255 msgid "Observed Prop." msgstr "" -#: src/language/stats/binomial.c:257 +#: src/language/stats/binomial.c:256 msgid "Test Prop." msgstr "" -#: src/language/stats/binomial.c:260 +#: src/language/stats/binomial.c:259 #, c-format msgid "Exact Sig. (%d-tailed)" msgstr "" -#: src/language/stats/chisquare.c:209 +#: src/language/stats/chisquare.c:208 #, c-format msgid "" "CHISQUARE test specified %d expected values, but %d distinct values were " "encountered in variable %s." msgstr "" -#: src/language/stats/chisquare.c:221 src/language/stats/chisquare.c:261 +#: src/language/stats/chisquare.c:220 src/language/stats/chisquare.c:260 msgid "Observed N" msgstr "" -#: src/language/stats/chisquare.c:222 src/language/stats/chisquare.c:262 +#: src/language/stats/chisquare.c:221 src/language/stats/chisquare.c:261 msgid "Expected N" msgstr "" -#: src/language/stats/chisquare.c:223 src/language/stats/chisquare.c:263 +#: src/language/stats/chisquare.c:222 src/language/stats/chisquare.c:262 #: src/language/stats/regression.q:313 msgid "Residual" msgstr "" -#: src/language/stats/chisquare.c:256 +#: src/language/stats/chisquare.c:255 msgid "Frequencies" msgstr "" -#: src/language/stats/chisquare.c:310 +#: src/language/stats/chisquare.c:309 msgid "Test Statistics" msgstr "" -#: src/language/stats/chisquare.c:324 +#: src/language/stats/chisquare.c:323 msgid "Chi-Square" msgstr "" -#: src/language/stats/chisquare.c:325 src/language/stats/crosstabs.q:1115 +#: src/language/stats/chisquare.c:324 src/language/stats/crosstabs.q:1115 #: src/language/stats/oneway.q:279 src/language/stats/oneway.q:680 #: src/language/stats/regression.q:307 src/language/stats/t-test.q:981 #: src/language/stats/t-test.q:1173 src/language/stats/t-test.q:1266 msgid "df" msgstr "" -#: src/language/stats/chisquare.c:326 +#: src/language/stats/chisquare.c:325 msgid "Asymp. Sig." msgstr "" @@ -2595,7 +2599,7 @@ msgid "%s Dependent" msgstr "" #: src/language/stats/descriptives.c:106 src/language/stats/examine.q:1528 -#: src/language/stats/frequencies.q:125 src/language/stats/npar-summary.c:128 +#: src/language/stats/frequencies.q:125 src/language/stats/npar-summary.c:127 #: src/language/stats/oneway.q:392 src/language/stats/t-test.q:682 #: src/language/stats/t-test.q:705 src/language/stats/t-test.q:829 #: src/language/stats/t-test.q:1167 @@ -2639,13 +2643,13 @@ msgid "Range" msgstr "" #: src/language/stats/descriptives.c:115 src/language/stats/examine.q:1633 -#: src/language/stats/frequencies.q:136 src/language/stats/npar-summary.c:134 +#: src/language/stats/frequencies.q:136 src/language/stats/npar-summary.c:133 #: src/language/stats/oneway.q:404 msgid "Minimum" msgstr "" #: src/language/stats/descriptives.c:116 src/language/stats/examine.q:1644 -#: src/language/stats/frequencies.q:137 src/language/stats/npar-summary.c:137 +#: src/language/stats/frequencies.q:137 src/language/stats/npar-summary.c:136 #: src/language/stats/oneway.q:405 msgid "Maximum" msgstr "" @@ -2760,7 +2764,7 @@ msgstr "" msgid "Median" msgstr "" -#: src/language/stats/examine.q:1620 src/language/stats/npar-summary.c:131 +#: src/language/stats/examine.q:1620 src/language/stats/npar-summary.c:130 #: src/language/stats/oneway.q:393 src/language/stats/t-test.q:683 #: src/language/stats/t-test.q:706 src/language/stats/t-test.q:831 #: src/language/stats/t-test.q:1168 @@ -2803,7 +2807,7 @@ msgid "Dev from Normal" msgstr "" #: src/language/stats/examine.q:2014 src/language/stats/examine.q:2036 -#: src/language/stats/frequencies.q:1528 src/language/stats/npar-summary.c:144 +#: src/language/stats/frequencies.q:1528 src/language/stats/npar-summary.c:143 msgid "Percentiles" msgstr "" @@ -2829,51 +2833,51 @@ msgstr "" msgid "Could not create temporary file for FLIP." msgstr "" -#: src/language/stats/flip.c:313 src/language/stats/flip.c:382 +#: src/language/stats/flip.c:313 src/language/stats/flip.c:385 #, c-format msgid "Error writing FLIP file: %s." msgstr "" -#: src/language/stats/flip.c:429 +#: src/language/stats/flip.c:432 #, c-format msgid "Error rewinding FLIP file: %s." msgstr "" -#: src/language/stats/flip.c:436 +#: src/language/stats/flip.c:439 msgid "Error creating FLIP source file." msgstr "" -#: src/language/stats/flip.c:448 +#: src/language/stats/flip.c:451 #, c-format msgid "Error reading FLIP file: %s." msgstr "" -#: src/language/stats/flip.c:472 +#: src/language/stats/flip.c:475 #, c-format msgid "Error seeking FLIP source file: %s." msgstr "" -#: src/language/stats/flip.c:480 +#: src/language/stats/flip.c:483 #, c-format msgid "Error writing FLIP source file: %s." msgstr "" -#: src/language/stats/flip.c:491 +#: src/language/stats/flip.c:494 #, c-format msgid "Error closing FLIP source file: %s." msgstr "" -#: src/language/stats/flip.c:499 +#: src/language/stats/flip.c:502 #, c-format msgid "Error rewinding FLIP source file: %s." msgstr "" -#: src/language/stats/flip.c:545 +#: src/language/stats/flip.c:548 #, c-format msgid "Error reading FLIP temporary file: %s." msgstr "" -#: src/language/stats/flip.c:548 +#: src/language/stats/flip.c:551 msgid "Unexpected end of file reading FLIP temporary file." msgstr "" @@ -2994,19 +2998,19 @@ msgid "" "match the number following (%d)." msgstr "" -#: src/language/stats/npar-summary.c:111 +#: src/language/stats/npar-summary.c:110 msgid "Descriptive Statistics" msgstr "" -#: src/language/stats/npar-summary.c:148 +#: src/language/stats/npar-summary.c:147 msgid "25th" msgstr "" -#: src/language/stats/npar-summary.c:151 +#: src/language/stats/npar-summary.c:150 msgid "50th (Median)" msgstr "" -#: src/language/stats/npar-summary.c:154 +#: src/language/stats/npar-summary.c:153 msgid "75th" msgstr "" @@ -3672,7 +3676,7 @@ msgstr "" msgid "Empirical with averaging" msgstr "" -#: src/math/sort.c:438 +#: src/math/sort.c:467 #, c-format msgid "" "Out of memory. Could not allocate room for minimum of %d cases of %d bytes " @@ -4140,15 +4144,15 @@ msgstr "" msgid "Incorrect range specification" msgstr "" -#: src/ui/gui/psppire.c:74 +#: src/ui/gui/psppire.c:76 msgid "Sorry. The help system hasn't yet been implemented." msgstr "" -#: src/ui/gui/psppire-data-store.c:724 +#: src/ui/gui/psppire-data-store.c:721 msgid "var" msgstr "" -#: src/ui/gui/psppire-data-store.c:805 src/ui/gui/psppire-var-store.c:551 +#: src/ui/gui/psppire-data-store.c:802 src/ui/gui/psppire-var-store.c:551 #: src/ui/gui/psppire-var-store.c:561 src/ui/gui/psppire-var-store.c:571 #: src/ui/gui/psppire-var-store.c:769 #, c-format @@ -4601,7 +4605,7 @@ msgid "" "Report bugs to <%s>.\n" msgstr "" -#: src/ui/terminal/main.c:125 +#: src/ui/terminal/main.c:129 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 d324da4e..352b063e 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,10 @@ +Fri Dec 22 20:08:38 WST 2006 John Darrington + + * casefile-factory.h fastfile-factory.c fastfile-factory.h: New files. + + * case-sink.c case-sink.h procedure.c procedure.h + storage-stream.c: Now uses the factory. + Sat Dec 16 22:05:18 2006 Ben Pfaff Make it possible to pull cases from the active file with a diff --git a/src/data/automake.mk b/src/data/automake.mk index a2e7b3c7..f623b1f7 100644 --- a/src/data/automake.mk +++ b/src/data/automake.mk @@ -20,6 +20,8 @@ src_data_libdata_a_SOURCES = \ src/data/casefile-private.h \ src/data/fastfile.c \ src/data/fastfile.h \ + src/data/fastfile-factory.h \ + src/data/fastfile-factory.c \ src/data/case.h \ src/data/category.c \ src/data/category.h \ diff --git a/src/data/case-sink.c b/src/data/case-sink.c index 999834c7..d7be3fa6 100644 --- a/src/data/case-sink.c +++ b/src/data/case-sink.c @@ -30,13 +30,14 @@ class CLASS and auxiliary data AUX. */ struct case_sink * create_case_sink (const struct case_sink_class *class, - const struct dictionary *dict, + const struct dictionary *dict, struct casefile_factory *f, void *aux) { struct case_sink *sink = xmalloc (sizeof *sink); sink->class = class; sink->value_cnt = dict_get_compacted_value_cnt (dict); sink->aux = aux; + sink->factory = f; return sink; } diff --git a/src/data/case-sink.h b/src/data/case-sink.h index 087c0601..ec2cfd21 100644 --- a/src/data/case-sink.h +++ b/src/data/case-sink.h @@ -30,6 +30,8 @@ struct case_sink { const struct case_sink_class *class; /* Class. */ void *aux; /* Auxiliary data. */ + struct casefile_factory *factory ; /* Factory used to create + the destination */ size_t value_cnt; /* Number of `union value's in case. */ }; @@ -56,8 +58,10 @@ struct case_sink_class extern const struct case_sink_class null_sink_class; +struct casefile_factory ; struct case_sink *create_case_sink (const struct case_sink_class *, const struct dictionary *, + struct casefile_factory *, void *); void free_case_sink (struct case_sink *); diff --git a/src/data/casefile-factory.h b/src/data/casefile-factory.h new file mode 100644 index 00000000..cc7423e9 --- /dev/null +++ b/src/data/casefile-factory.h @@ -0,0 +1,28 @@ +/* PSPP - computes sample statistics. + Copyright (C) 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#ifndef CASEFILE_FACTORY_H +#define CASEFILE_FACTORY_H + +struct casefile_factory +{ + struct casefile * (*create_casefile) (struct casefile_factory *, size_t); +}; + +#endif + diff --git a/src/data/fastfile-factory.c b/src/data/fastfile-factory.c new file mode 100644 index 00000000..7820f651 --- /dev/null +++ b/src/data/fastfile-factory.c @@ -0,0 +1,54 @@ +/* PSPP - computes sample statistics. + Copyright (C) 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#include +#include +#include +#include "fastfile-factory.h" +#include "fastfile.h" + + +struct fastfile_factory + { + struct casefile_factory parent; + }; + + +static struct casefile * +produce_fastfile(struct casefile_factory *this UNUSED, size_t value_cnt) +{ + return fastfile_create (value_cnt); +} + + +struct casefile_factory * +fastfile_factory_create (void) +{ + struct fastfile_factory *fact = xzalloc (sizeof (*fact)); + + fact->parent.create_casefile = produce_fastfile; + + return (struct casefile_factory *) fact; +} + + +void +fastfile_factory_destroy (struct casefile_factory *factory) +{ + free (factory); +} diff --git a/src/data/fastfile-factory.h b/src/data/fastfile-factory.h new file mode 100644 index 00000000..74ebe9a9 --- /dev/null +++ b/src/data/fastfile-factory.h @@ -0,0 +1,28 @@ +/* PSPP - computes sample statistics. + Copyright (C) 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#ifndef FASTFILE_FACTORY_H +#define FASTFILE_FACTORY_H + + +#include + +struct casefile_factory * fastfile_factory_create (void); +void fastfile_factory_destroy (struct casefile_factory *); + +#endif diff --git a/src/data/procedure.c b/src/data/procedure.c index baba8fa7..8aec2c9f 100644 --- a/src/data/procedure.c +++ b/src/data/procedure.c @@ -39,6 +39,10 @@ #include struct dataset { + + /* An abstract factory which creates casefiles */ + struct casefile_factory *cf_factory; + /* Cases are read from proc_source, pass through permanent_trns_chain (which transforms them into the format described by permanent_dict), @@ -182,7 +186,10 @@ multipass_procedure (struct dataset *ds, casefile_func *proc_func, void *aux) struct multipass_aux_data aux_data; bool ok; - aux_data.casefile = fastfile_create (dict_get_next_value_idx (ds->dict)); + aux_data.casefile = + ds->cf_factory->create_casefile (ds->cf_factory, + dict_get_next_value_idx (ds->dict)); + aux_data.proc_func = proc_func; aux_data.aux = aux; @@ -322,7 +329,6 @@ proc_close (struct dataset *ds) if (!proc_read (ds, &c)) break; } - ds->ok = free_case_source (ds->proc_source) && ds->ok; ds->proc_source = NULL; @@ -388,7 +394,10 @@ open_active_file (struct dataset *ds) /* Prepare sink. */ if (ds->proc_sink == NULL) - ds->proc_sink = create_case_sink (&storage_sink_class, ds->permanent_dict, NULL); + ds->proc_sink = create_case_sink (&storage_sink_class, + ds->permanent_dict, + ds->cf_factory, + NULL); if (ds->proc_sink->class->open != NULL) ds->proc_sink->class->open (ds->proc_sink); @@ -662,7 +671,8 @@ multipass_split_case_func (const struct ccase *c, void *aux_, const struct datas /* Start a new casefile. */ aux->casefile = - fastfile_create (dict_get_next_value_idx (ds->dict)); + ds->cf_factory->create_casefile (ds->cf_factory, + dict_get_next_value_idx (ds->dict)); } return casefile_append (aux->casefile, c) && ok; @@ -834,10 +844,11 @@ proc_cancel_all_transformations (struct dataset *ds) /* Initializes procedure handling. */ struct dataset * -create_dataset (void) +create_dataset (struct casefile_factory *fact) { struct dataset *ds = xzalloc (sizeof(*ds)); ds->dict = dict_create (); + ds->cf_factory = fact; proc_cancel_all_transformations (ds); return ds; } @@ -998,3 +1009,9 @@ dataset_set_n_lag (struct dataset *ds, int n_lag) } +struct casefile_factory * +dataset_get_casefile_factory (const struct dataset *ds) +{ + return ds->cf_factory; +} + diff --git a/src/data/procedure.h b/src/data/procedure.h index 3b501df9..4e8fa910 100644 --- a/src/data/procedure.h +++ b/src/data/procedure.h @@ -23,6 +23,7 @@ #include #include +#include #include struct ccase; @@ -57,9 +58,11 @@ bool proc_cancel_temporary_transformations (struct dataset *ds); /* Procedures. */ -struct dataset * create_dataset (void); +struct dataset * create_dataset (struct casefile_factory *); void destroy_dataset (struct dataset *); +struct casefile_factory *dataset_get_casefile_factory (const struct dataset *); + void proc_set_source (struct dataset *ds, struct case_source *); bool proc_has_source (const struct dataset *ds); diff --git a/src/data/storage-stream.c b/src/data/storage-stream.c index a003e7be..4ff939cd 100644 --- a/src/data/storage-stream.c +++ b/src/data/storage-stream.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "xalloc.h" @@ -53,7 +53,8 @@ storage_sink_open (struct case_sink *sink) struct storage_sink_info *info; sink->aux = info = xmalloc (sizeof *info); - info->casefile = fastfile_create (sink->value_cnt); + info->casefile = sink->factory->create_casefile (sink->factory, + sink->value_cnt); } /* Writes case C to the storage sink SINK. diff --git a/src/language/data-io/get.c b/src/language/data-io/get.c index 8b03ec95..edd1512c 100644 --- a/src/language/data-io/get.c +++ b/src/language/data-io/get.c @@ -1111,14 +1111,19 @@ cmd_match_files (struct lexer *lexer, struct dataset *ds) if (used_active_file) { proc_set_sink (ds, create_case_sink (&null_sink_class, - dataset_dict (ds), NULL)); + dataset_dict (ds), + dataset_get_casefile_factory (ds), + NULL)); proc_open (ds); } else discard_variables (ds); dict_compact_values (mtf.dict); - mtf.output = fastfile_create (dict_get_next_value_idx (mtf.dict)); + mtf.output = dataset_get_casefile_factory (ds)->create_casefile + (dataset_get_casefile_factory (ds), + dict_get_next_value_idx (mtf.dict)); + mtf.seq_nums = xcalloc (dict_get_var_cnt (mtf.dict), sizeof *mtf.seq_nums); case_create (&mtf.mtf_case, dict_get_next_value_idx (mtf.dict)); diff --git a/src/language/expressions/evaluate.c b/src/language/expressions/evaluate.c index aeb374ce..32f96610 100644 --- a/src/language/expressions/evaluate.c +++ b/src/language/expressions/evaluate.c @@ -158,7 +158,7 @@ cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED) if ( ds == NULL ) { - ds = create_dataset (); + ds = create_dataset (NULL); d = dataset_dict (ds); } diff --git a/src/language/stats/aggregate.c b/src/language/stats/aggregate.c index 79d90fdd..7d1c7a7a 100644 --- a/src/language/stats/aggregate.c +++ b/src/language/stats/aggregate.c @@ -278,11 +278,15 @@ cmd_aggregate (struct lexer *lexer, struct dataset *ds) goto error; } - agr.sink = create_case_sink (&storage_sink_class, agr.dict, NULL); + agr.sink = create_case_sink (&storage_sink_class, agr.dict, + dataset_get_casefile_factory (ds), + NULL); if (agr.sink->class->open != NULL) agr.sink->class->open (agr.sink); proc_set_sink (ds, - create_case_sink (&null_sink_class, dict, NULL)); + create_case_sink (&null_sink_class, dict, + dataset_get_casefile_factory (ds), + NULL)); proc_open (ds); while (proc_read (ds, &c)) if (aggregate_single_case (&agr, c, &agr.agr_case)) @@ -293,6 +297,7 @@ cmd_aggregate (struct lexer *lexer, struct dataset *ds) } if (!proc_close (ds)) goto error; + if (agr.case_cnt > 0) { dump_aggregate_info (&agr, &agr.agr_case); diff --git a/src/language/stats/flip.c b/src/language/stats/flip.c index 594596c0..c3f2439f 100644 --- a/src/language/stats/flip.c +++ b/src/language/stats/flip.c @@ -83,7 +83,7 @@ struct flip_pgm }; static void destroy_flip_pgm (struct flip_pgm *); -static struct case_sink *flip_sink_create (struct dictionary *d, struct flip_pgm *); +static struct case_sink *flip_sink_create (struct dataset *ds, struct flip_pgm *); static struct case_source *flip_source_create (struct flip_pgm *); static bool flip_file (struct flip_pgm *); static int build_dictionary (struct dictionary *, struct flip_pgm *); @@ -158,7 +158,7 @@ cmd_flip (struct lexer *lexer, struct dataset *ds) /* Read the active file into a flip_sink. */ flip->case_cnt = 0; proc_make_temporary_transformations_permanent (ds); - sink = flip_sink_create (dict, flip); + sink = flip_sink_create (ds, flip); if (sink == NULL) goto error; proc_set_sink (ds, sink); @@ -289,7 +289,7 @@ build_dictionary (struct dictionary *dict, struct flip_pgm *flip) /* Creates a flip sink based on FLIP. */ static struct case_sink * -flip_sink_create (struct dictionary *dict, struct flip_pgm *flip) +flip_sink_create (struct dataset *ds, struct flip_pgm *flip) { size_t i; @@ -316,7 +316,10 @@ flip_sink_create (struct dictionary *dict, struct flip_pgm *flip) flip->case_cnt = 1; - return create_case_sink (&flip_sink_class, dict, flip); + return create_case_sink (&flip_sink_class, + dataset_dict (ds), + dataset_get_casefile_factory (ds), + flip); } /* Writes case C to the FLIP sink. diff --git a/src/language/stats/rank.q b/src/language/stats/rank.q index 882d04eb..894d2769 100644 --- a/src/language/stats/rank.q +++ b/src/language/stats/rank.q @@ -275,7 +275,7 @@ rank_cmd (struct dataset *ds, const struct sort_criteria *sc, reader = casefile_get_destructive_reader (cf) ; criteria.crits[criteria.crit_cnt - 1] = sc->crits[i]; assert ( sc->crits[i].fv == var_get_case_index (src_vars[i]) ); - sorted_cf = sort_execute (reader, &criteria); + sorted_cf = sort_execute (reader, &criteria, NULL); casefile_destroy (cf); out = rank_sorted_casefile (sorted_cf, &criteria, diff --git a/src/math/sort.c b/src/math/sort.c index 7c2539aa..d3e4446d 100644 --- a/src/math/sort.c +++ b/src/math/sort.c @@ -1,5 +1,5 @@ /* PSPP - computes sample statistics. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include #include @@ -55,9 +57,13 @@ bool allow_internal_sort = true; static int compare_record (const struct ccase *, const struct ccase *, const struct sort_criteria *); static struct casefile *do_internal_sort (struct casereader *, - const struct sort_criteria *); + const struct sort_criteria *, + struct casefile_factory * + ); static struct casefile *do_external_sort (struct casereader *, - const struct sort_criteria *); + const struct sort_criteria *, + struct casefile_factory * + ); /* Sorts the active file in-place according to CRITERIA. @@ -73,7 +79,8 @@ sort_active_file_in_place (struct dataset *ds, return false; in = proc_capture_output (ds); - out = sort_execute (casefile_get_destructive_reader (in), criteria); + out = sort_execute (casefile_get_destructive_reader (in), criteria, + dataset_get_casefile_factory (ds)); if (out == NULL) return false; @@ -86,6 +93,7 @@ struct sort_to_casefile_cb_data { const struct sort_criteria *criteria; struct casefile *output; + struct casefile_factory *factory ; }; /* Sorts casefile CF according to the criteria in CB_DATA. */ @@ -93,7 +101,10 @@ static bool sort_to_casefile_callback (const struct casefile *cf, void *cb_data_) { struct sort_to_casefile_cb_data *cb_data = cb_data_; - cb_data->output = sort_execute (casefile_get_reader (cf, NULL), cb_data->criteria); + cb_data->output = sort_execute (casefile_get_reader (cf, NULL), + cb_data->criteria, + cb_data->factory + ); return cb_data->output != NULL; } @@ -110,6 +121,7 @@ sort_active_file_to_casefile (struct dataset *ds, cb_data.criteria = criteria; cb_data.output = NULL; + cb_data.factory = dataset_get_casefile_factory (ds); if (!multipass_procedure (ds, sort_to_casefile_callback, &cb_data)) { casefile_destroy (cb_data.output); @@ -121,14 +133,27 @@ sort_active_file_to_casefile (struct dataset *ds, /* Reads all the cases from READER, which is destroyed. Sorts the cases according to CRITERIA. Returns the sorted cases in - a newly created casefile. */ + a newly created casefile, which will be created by FACTORY. + If FACTORY is NULL, then a local fastfile_factory will be used. +*/ struct casefile * -sort_execute (struct casereader *reader, const struct sort_criteria *criteria) +sort_execute (struct casereader *reader, + const struct sort_criteria *criteria, + struct casefile_factory *factory + ) { - struct casefile *output = do_internal_sort (reader, criteria); + struct casefile_factory *local_factory = NULL; + struct casefile *output ; + if ( factory == NULL ) + factory = local_factory = fastfile_factory_create (); + + output = do_internal_sort (reader, criteria, factory); if (output == NULL) - output = do_external_sort (reader, criteria); + output = do_external_sort (reader, criteria, factory); casereader_destroy (reader); + + fastfile_factory_destroy (local_factory); + return output; } @@ -145,7 +170,8 @@ static int compare_indexed_cases (const void *, const void *, const void *); casefile for the data. Otherwise, return a null pointer. */ static struct casefile * do_internal_sort (struct casereader *reader, - const struct sort_criteria *criteria) + const struct sort_criteria *criteria, + struct casefile_factory *factory) { const struct casefile *src; struct casefile *dst; @@ -159,7 +185,7 @@ do_internal_sort (struct casereader *reader, return NULL; case_cnt = casefile_get_case_cnt (src); - dst = fastfile_create (casefile_get_value_cnt (src)); + dst = factory->create_casefile (factory, casefile_get_value_cnt (src)); if (case_cnt != 0) { struct indexed_case *cases = nmalloc (sizeof *cases, case_cnt); @@ -225,6 +251,7 @@ struct external_sort size_t value_cnt; /* Size of data in `union value's. */ struct casefile **runs; /* Array of initial runs. */ size_t run_cnt, run_cap; /* Number of runs, allocated capacity. */ + struct casefile_factory *factory; /* Factory used to create the result */ }; /* Prototypes for helper functions. */ @@ -238,7 +265,9 @@ static void destroy_external_sort (struct external_sort *); pattern that assures stability. */ static struct casefile * do_external_sort (struct casereader *reader, - const struct sort_criteria *criteria) + const struct sort_criteria *criteria, + struct casefile_factory *factory + ) { struct external_sort *xsrt; @@ -251,6 +280,7 @@ do_external_sort (struct casereader *reader, xsrt->run_cap = 512; xsrt->run_cnt = 0; xsrt->runs = xnmalloc (xsrt->run_cap, sizeof *xsrt->runs); + xsrt->factory = factory; if (write_runs (xsrt, reader)) { struct casefile *output = merge (xsrt); @@ -508,6 +538,9 @@ start_run (struct initial_run_state *irs) { irs->run++; irs->case_cnt = 0; + + /* This casefile is internal to the sort, so don't use the factory + to create it. */ irs->casefile = fastfile_create (irs->xsrt->value_cnt); casefile_to_disk (irs->casefile); case_nullify (&irs->last_output); @@ -673,7 +706,7 @@ merge_once (struct external_sort *xsrt, } /* Create output file. */ - output = fastfile_create (xsrt->value_cnt); + output = xsrt->factory->create_casefile (xsrt->factory, xsrt->value_cnt); casefile_to_disk (output); /* Merge. */ diff --git a/src/math/sort.h b/src/math/sort.h index cd74c122..c6f86e9f 100644 --- a/src/math/sort.h +++ b/src/math/sort.h @@ -25,6 +25,7 @@ struct casereader; struct dictionary; struct variable; +struct casefile_factory; extern int min_buffers ; extern int max_buffers ; @@ -57,7 +58,9 @@ struct sort_criteria void sort_destroy_criteria (struct sort_criteria *); struct casefile *sort_execute (struct casereader *, - const struct sort_criteria *); + const struct sort_criteria *, + struct casefile_factory * + ); struct dataset ; bool sort_active_file_in_place (struct dataset *ds, diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk index 53738069..ac5f7ed9 100644 --- a/src/ui/gui/automake.mk +++ b/src/ui/gui/automake.mk @@ -44,6 +44,8 @@ src_ui_gui_psppire_SOURCES = \ src/ui/gui/customentry.h \ src/ui/gui/data-sheet.c \ src/ui/gui/data-sheet.h \ + src/ui/gui/flexifile-factory.h \ + src/ui/gui/flexifile-factory.c \ src/ui/gui/message-dialog.c \ src/ui/gui/message-dialog.h \ src/ui/gui/psppire.c \ diff --git a/src/ui/gui/flexifile-factory.c b/src/ui/gui/flexifile-factory.c new file mode 100644 index 00000000..453253c9 --- /dev/null +++ b/src/ui/gui/flexifile-factory.c @@ -0,0 +1,57 @@ +/* PSPP - computes sample statistics. + Copyright (C) 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#include +#include +#include +#include "flexifile-factory.h" +#include +#include + + +struct flexifile_factory + { + struct casefile_factory parent; + }; + + +static struct casefile * +produce_flexifile(struct casefile_factory *this UNUSED, size_t value_cnt) +{ + struct casefile *ff = flexifile_create (value_cnt); + + return ff; +} + + +struct casefile_factory * +flexifile_factory_create (void) +{ + struct flexifile_factory *fact = xzalloc (sizeof (*fact)); + + fact->parent.create_casefile = produce_flexifile; + + return (struct casefile_factory *) fact; +} + + +void +flexifile_factory_destroy (struct casefile_factory *factory) +{ + free (factory); +} diff --git a/src/ui/gui/flexifile-factory.h b/src/ui/gui/flexifile-factory.h new file mode 100644 index 00000000..eecb901c --- /dev/null +++ b/src/ui/gui/flexifile-factory.h @@ -0,0 +1,28 @@ +/* PSPP - computes sample statistics. + Copyright (C) 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#ifndef FLEXIFILE_FACTORY_H +#define FLEXIFILE_FACTORY_H + + +struct casefile_factory ; + +struct casefile_factory * flexifile_factory_create (void); +void flexifile_factory_destroy (struct casefile_factory *); + +#endif diff --git a/src/ui/gui/psppire-case-file.c b/src/ui/gui/psppire-case-file.c index e43ab107..cd9c2ba6 100644 --- a/src/ui/gui/psppire-case-file.c +++ b/src/ui/gui/psppire-case-file.c @@ -28,6 +28,7 @@ #include #include +#include "flexifile-factory.h" #include #include #include @@ -144,6 +145,7 @@ psppire_case_file_init (PsppireCaseFile *cf) cf->flexifile = 0; } + /** * psppire_case_file_new: * @returns: a new #PsppireCaseFile object @@ -161,6 +163,23 @@ psppire_case_file_new (gint val_cnt) } +/** + * psppire_case_file_new_from_flexifile: + * @returns: a new #PsppireCaseFile object + * + * Creates a new #PsppireCaseFile from an existing flexifile + */ +PsppireCaseFile* +psppire_case_file_new_from_flexifile (struct flexifile *ff) +{ + PsppireCaseFile *cf = g_object_new (G_TYPE_PSPPIRE_CASE_FILE, NULL); + + cf->flexifile = (struct casefile *) ff; + + return cf; +} + + gboolean psppire_case_file_delete_cases(PsppireCaseFile *cf, gint n_cases, gint first) { @@ -247,7 +266,6 @@ psppire_case_file_get_value(const PsppireCaseFile *cf, gint casenum, gint idx) flexifile_get_case(FLEXIFILE(cf->flexifile), casenum, &c); v = case_data_idx(&c, idx); - case_destroy(&c); return v; @@ -321,28 +339,25 @@ psppire_case_file_data_in(PsppireCaseFile *cf, gint casenum, gint idx, void psppire_case_file_sort(PsppireCaseFile *cf, const struct sort_criteria *sc) { - struct ccase cc; gint c; - struct casefile *cfile; - struct casereader *reader = casefile_get_reader (cf->flexifile, NULL); - const int value_cnt = casefile_get_value_cnt(cf->flexifile); - cfile = sort_execute(reader, sc); + struct casereader *reader = casefile_get_reader (cf->flexifile, NULL); + struct casefile *cfile; - casefile_destroy(cf->flexifile); + struct casefile_factory *factory = flexifile_factory_create (); - /* Copy casefile into flexifile */ + cfile = sort_execute(reader, sc, factory); - reader = casefile_get_destructive_reader(cfile); - cf->flexifile = flexifile_create(value_cnt); - while(casereader_read(reader, &cc)) - casefile_append(cf->flexifile, &cc); + casefile_destroy(cf->flexifile); + cf->flexifile = cfile; /* FIXME: Need to have a signal to change a range of cases, instead of calling a signal many times */ for ( c = 0 ; c < casefile_get_case_cnt(cf->flexifile) ; ++c ) g_signal_emit(cf, signal[CASE_CHANGED], 0, c); + + flexifile_factory_destroy (factory); } @@ -357,6 +372,7 @@ psppire_case_file_insert_values (PsppireCaseFile *cf, if ( ! cf->flexifile ) { cf->flexifile = flexifile_create(n_values); + return TRUE; } diff --git a/src/ui/gui/psppire-case-file.h b/src/ui/gui/psppire-case-file.h index eed3bb6e..e2b8252c 100644 --- a/src/ui/gui/psppire-case-file.h +++ b/src/ui/gui/psppire-case-file.h @@ -48,7 +48,8 @@ typedef struct _PsppireCaseFile PsppireCaseFile; typedef struct _PsppireCaseFileClass PsppireCaseFileClass; struct ccase; -struct casefilefile; +struct flexifile; +struct casefile; struct _PsppireCaseFile { @@ -68,9 +69,8 @@ struct _PsppireCaseFileClass GType psppire_case_file_get_type (void); PsppireCaseFile *psppire_case_file_new (gint var_cnt); +PsppireCaseFile* psppire_case_file_new_from_flexifile (struct flexifile *ff); -gboolean psppire_case_file_append_case(PsppireCaseFile *cf, - struct ccase *c); gboolean psppire_case_file_insert_case(PsppireCaseFile *cf, struct ccase *c, gint row); diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index c761c237..c0bebecc 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -366,9 +366,6 @@ void psppire_data_store_set_dictionary(PsppireDataStore *data_store, PsppireDict *dict) { gint var_cnt = psppire_dict_get_next_value_idx(dict); -#if 0 - if ( data_store->dict ) g_object_unref(data_store->dict); -#endif data_store->dict = dict; diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index 36142245..ed4c790b 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -22,6 +22,7 @@ #include #include + #include #include #include @@ -44,6 +45,7 @@ #include "data-sheet.h" #include "var-sheet.h" #include "message-dialog.h" +#include "flexifile-factory.h" GladeXML *xml; @@ -88,6 +90,7 @@ struct dataset * the_dataset = NULL; int main(int argc, char *argv[]) { + struct casefile_factory *factory; GtkWidget *data_editor ; GtkSheet *var_sheet ; @@ -125,13 +128,14 @@ main(int argc, char *argv[]) fmt_init(); settings_init(); fh_init (); + factory = flexifile_factory_create (); the_source_stream = create_source_stream ( fn_getenv_default ("STAT_INCLUDE_PATH", include_path) ); the_lexer = lex_create (the_source_stream); - the_dataset = create_dataset (); + the_dataset = create_dataset (factory); message_dialog_init (the_source_stream); diff --git a/src/ui/terminal/automake.mk b/src/ui/terminal/automake.mk index 20821b49..ef56b7e9 100644 --- a/src/ui/terminal/automake.mk +++ b/src/ui/terminal/automake.mk @@ -18,12 +18,12 @@ src_ui_terminal_pspp_SOURCES = src_ui_terminal_pspp_LDADD = \ src/ui/terminal/libui.a \ - src/ui/libuicommon.a \ src/language/liblanguage.a \ src/output/charts/libcharts.a \ src/output/liboutput.a \ src/math/libpspp_math.a \ src/math/linreg/libpspp_linreg.a \ + src/ui/libuicommon.a \ lib/linreg/liblinreg.a \ lib/gsl-extras/libgsl-extras.a \ src/data/libdata.a \ diff --git a/src/ui/terminal/main.c b/src/ui/terminal/main.c index 7e1f5c99..9712fb8b 100644 --- a/src/ui/terminal/main.c +++ b/src/ui/terminal/main.c @@ -27,7 +27,7 @@ #include "progname.h" #include "read-line.h" - +#include #include #include #include @@ -82,6 +82,7 @@ static struct source_stream *the_source_stream ; int main (int argc, char **argv) { + struct casefile_factory *factory; signal (SIGABRT, bug_handler); signal (SIGSEGV, bug_handler); signal (SIGFPE, bug_handler); @@ -104,7 +105,10 @@ main (int argc, char **argv) readln_initialize (); settings_init (); random_init (); - the_dataset = create_dataset (); + + factory = fastfile_factory_create (); + + the_dataset = create_dataset (factory); if (parse_command_line (argc, argv, the_source_stream)) {