Added abstract factory to create casefiles. Updated procedures to use
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 22 Dec 2006 11:12:14 +0000 (11:12 +0000)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 22 Dec 2006 11:12:14 +0000 (11:12 +0000)
it.

28 files changed:
po/de.po
po/pspp.pot
src/data/ChangeLog
src/data/automake.mk
src/data/case-sink.c
src/data/case-sink.h
src/data/casefile-factory.h [new file with mode: 0644]
src/data/fastfile-factory.c [new file with mode: 0644]
src/data/fastfile-factory.h [new file with mode: 0644]
src/data/procedure.c
src/data/procedure.h
src/data/storage-stream.c
src/language/data-io/get.c
src/language/expressions/evaluate.c
src/language/stats/aggregate.c
src/language/stats/flip.c
src/language/stats/rank.q
src/math/sort.c
src/math/sort.h
src/ui/gui/automake.mk
src/ui/gui/flexifile-factory.c [new file with mode: 0644]
src/ui/gui/flexifile-factory.h [new file with mode: 0644]
src/ui/gui/psppire-case-file.c
src/ui/gui/psppire-case-file.h
src/ui/gui/psppire-data-store.c
src/ui/gui/psppire.c
src/ui/terminal/automake.mk
src/ui/terminal/main.c

index 32d73620ecb02af75cead0cf2268f2c84d20ebb6..6c937bf2c13c0d4a278acd1843359b1131b416b2 100644 (file)
--- 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"
 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 <john@darrington.wattle.id.au>\n"
 "Language-Team: German <pspp-dev@gnu.org>\n"
 "PO-Revision-Date: 2006-05-26 17:49+0800\n"
 "Last-Translator: John Darrington <john@darrington.wattle.id.au>\n"
 "Language-Team: German <pspp-dev@gnu.org>\n"
@@ -938,6 +938,10 @@ msgstr ""
 msgid "This command may not follow ELSE in DO IF...END IF."
 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\"."
 #: 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 ""
 
 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 "
 #, 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
 msgstr ""
 
 #: src/language/dictionary/missing-values.c:58
-#: src/language/stats/aggregate.c:479
+#: src/language/stats/aggregate.c:484
 msgid "expecting `('"
 msgstr ""
 
 msgid "expecting `('"
 msgstr ""
 
@@ -1885,7 +1889,7 @@ msgstr ""
 msgid "Unknown identifier %s."
 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 ""
 
 msgid "expecting `)'"
 msgstr ""
 
@@ -2171,40 +2175,40 @@ msgid ""
 "has no effect.  Output data will be sorted the same way as the input data."
 msgstr ""
 
 "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 ""
 
 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 "
 #, 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 ""
 
 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 ""
 
 #, 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 ""
 
 msgid "Binomial Test"
 msgstr ""
 
-#: src/language/stats/binomial.c:203
+#: src/language/stats/binomial.c:202
 msgid "Group1"
 msgstr ""
 
 msgid "Group1"
 msgstr ""
 
-#: src/language/stats/binomial.c:206
+#: src/language/stats/binomial.c:205
 msgid "Group2"
 msgstr ""
 
 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
 #: 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 ""
 
 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/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/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/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 ""
 
 msgid "Observed Prop."
 msgstr ""
 
-#: src/language/stats/binomial.c:257
+#: src/language/stats/binomial.c:256
 msgid "Test Prop."
 msgstr ""
 
 msgid "Test Prop."
 msgstr ""
 
-#: src/language/stats/binomial.c:260
+#: src/language/stats/binomial.c:259
 #, c-format
 msgid "Exact Sig. (%d-tailed)"
 msgstr ""
 
 #, 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 ""
 
 #, 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 ""
 
 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 ""
 
 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/regression.q:313
 msgid "Residual"
 msgstr ""
 
-#: src/language/stats/chisquare.c:256
+#: src/language/stats/chisquare.c:255
 msgid "Frequencies"
 msgstr ""
 
 msgid "Frequencies"
 msgstr ""
 
-#: src/language/stats/chisquare.c:310
+#: src/language/stats/chisquare.c:309
 msgid "Test Statistics"
 msgstr ""
 
 msgid "Test Statistics"
 msgstr ""
 
-#: src/language/stats/chisquare.c:324
+#: src/language/stats/chisquare.c:323
 msgid "Chi-Square"
 msgstr ""
 
 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/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 ""
 
 msgid "Asymp. Sig."
 msgstr ""
 
@@ -2600,7 +2604,7 @@ msgid "%s Dependent"
 msgstr ""
 
 #: src/language/stats/descriptives.c:106 src/language/stats/examine.q:1528
 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
 #: 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
 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/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 ""
 #: src/language/stats/oneway.q:405
 msgid "Maximum"
 msgstr ""
@@ -2765,7 +2769,7 @@ msgstr ""
 msgid "Median"
 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
 #: 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
 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 ""
 
 msgid "Percentiles"
 msgstr ""
 
@@ -2834,51 +2838,51 @@ msgstr ""
 msgid "Could not create temporary file for FLIP."
 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 msgid "Unexpected end of file reading FLIP temporary file."
 msgstr ""
 
@@ -2999,19 +3003,19 @@ msgid ""
 "match the number following (%d)."
 msgstr ""
 
 "match the number following (%d)."
 msgstr ""
 
-#: src/language/stats/npar-summary.c:111
+#: src/language/stats/npar-summary.c:110
 msgid "Descriptive Statistics"
 msgstr ""
 
 msgid "Descriptive Statistics"
 msgstr ""
 
-#: src/language/stats/npar-summary.c:148
+#: src/language/stats/npar-summary.c:147
 msgid "25th"
 msgstr ""
 
 msgid "25th"
 msgstr ""
 
-#: src/language/stats/npar-summary.c:151
+#: src/language/stats/npar-summary.c:150
 msgid "50th (Median)"
 msgstr ""
 
 msgid "50th (Median)"
 msgstr ""
 
-#: src/language/stats/npar-summary.c:154
+#: src/language/stats/npar-summary.c:153
 msgid "75th"
 msgstr ""
 
 msgid "75th"
 msgstr ""
 
@@ -3677,7 +3681,7 @@ msgstr ""
 msgid "Empirical with averaging"
 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 "
 #, 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"
 
 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!"
 
 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 ""
 
 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
 #: 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 ""
 
 "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."
 msgid ""
 "Stopping syntax file processing here to avoid a cascade of dependent command "
 "failures."
index 651a3d853a563ef4e34e24d6d9e882f4005436d8..660b3259fb43f22793e6d238be1b7b9ece6ce5fb 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
 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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -933,6 +933,10 @@ msgstr ""
 msgid "This command may not follow ELSE in DO IF...END IF."
 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\"."
 #: 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 ""
 
 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 "
 #, 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
 msgstr ""
 
 #: src/language/dictionary/missing-values.c:58
-#: src/language/stats/aggregate.c:479
+#: src/language/stats/aggregate.c:484
 msgid "expecting `('"
 msgstr ""
 
 msgid "expecting `('"
 msgstr ""
 
@@ -1880,7 +1884,7 @@ msgstr ""
 msgid "Unknown identifier %s."
 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 ""
 
 msgid "expecting `)'"
 msgstr ""
 
@@ -2166,40 +2170,40 @@ msgid ""
 "has no effect.  Output data will be sorted the same way as the input data."
 msgstr ""
 
 "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 ""
 
 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 "
 #, 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 ""
 
 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 ""
 
 #, 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 ""
 
 msgid "Binomial Test"
 msgstr ""
 
-#: src/language/stats/binomial.c:203
+#: src/language/stats/binomial.c:202
 msgid "Group1"
 msgstr ""
 
 msgid "Group1"
 msgstr ""
 
-#: src/language/stats/binomial.c:206
+#: src/language/stats/binomial.c:205
 msgid "Group2"
 msgstr ""
 
 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
 #: 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 ""
 
 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/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/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/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 ""
 
 msgid "Observed Prop."
 msgstr ""
 
-#: src/language/stats/binomial.c:257
+#: src/language/stats/binomial.c:256
 msgid "Test Prop."
 msgstr ""
 
 msgid "Test Prop."
 msgstr ""
 
-#: src/language/stats/binomial.c:260
+#: src/language/stats/binomial.c:259
 #, c-format
 msgid "Exact Sig. (%d-tailed)"
 msgstr ""
 
 #, 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 ""
 
 #, 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 ""
 
 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 ""
 
 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/regression.q:313
 msgid "Residual"
 msgstr ""
 
-#: src/language/stats/chisquare.c:256
+#: src/language/stats/chisquare.c:255
 msgid "Frequencies"
 msgstr ""
 
 msgid "Frequencies"
 msgstr ""
 
-#: src/language/stats/chisquare.c:310
+#: src/language/stats/chisquare.c:309
 msgid "Test Statistics"
 msgstr ""
 
 msgid "Test Statistics"
 msgstr ""
 
-#: src/language/stats/chisquare.c:324
+#: src/language/stats/chisquare.c:323
 msgid "Chi-Square"
 msgstr ""
 
 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/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 ""
 
 msgid "Asymp. Sig."
 msgstr ""
 
@@ -2595,7 +2599,7 @@ msgid "%s Dependent"
 msgstr ""
 
 #: src/language/stats/descriptives.c:106 src/language/stats/examine.q:1528
 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
 #: 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
 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/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 ""
 #: src/language/stats/oneway.q:405
 msgid "Maximum"
 msgstr ""
@@ -2760,7 +2764,7 @@ msgstr ""
 msgid "Median"
 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
 #: 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
 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 ""
 
 msgid "Percentiles"
 msgstr ""
 
@@ -2829,51 +2833,51 @@ msgstr ""
 msgid "Could not create temporary file for FLIP."
 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 #, 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 ""
 
 msgid "Unexpected end of file reading FLIP temporary file."
 msgstr ""
 
@@ -2994,19 +2998,19 @@ msgid ""
 "match the number following (%d)."
 msgstr ""
 
 "match the number following (%d)."
 msgstr ""
 
-#: src/language/stats/npar-summary.c:111
+#: src/language/stats/npar-summary.c:110
 msgid "Descriptive Statistics"
 msgstr ""
 
 msgid "Descriptive Statistics"
 msgstr ""
 
-#: src/language/stats/npar-summary.c:148
+#: src/language/stats/npar-summary.c:147
 msgid "25th"
 msgstr ""
 
 msgid "25th"
 msgstr ""
 
-#: src/language/stats/npar-summary.c:151
+#: src/language/stats/npar-summary.c:150
 msgid "50th (Median)"
 msgstr ""
 
 msgid "50th (Median)"
 msgstr ""
 
-#: src/language/stats/npar-summary.c:154
+#: src/language/stats/npar-summary.c:153
 msgid "75th"
 msgstr ""
 
 msgid "75th"
 msgstr ""
 
@@ -3672,7 +3676,7 @@ msgstr ""
 msgid "Empirical with averaging"
 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 "
 #, 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 ""
 
 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 ""
 
 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 ""
 
 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
 #: 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 ""
 
 "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."
 msgid ""
 "Stopping syntax file processing here to avoid a cascade of dependent command "
 "failures."
index d324da4e59ceb98a96516421a5ede9733c26c39e..352b063e4516d66befd4816d276203b92ae6c917 100644 (file)
@@ -1,3 +1,10 @@
+Fri Dec 22 20:08:38 WST 2006 John Darrington <john@darrington.wattle.id.au>
+
+       * 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  <blp@gnu.org>
 
        Make it possible to pull cases from the active file with a
 Sat Dec 16 22:05:18 2006  Ben Pfaff  <blp@gnu.org>
 
        Make it possible to pull cases from the active file with a
index a2e7b3c7c927d4f1055fd45f76fbd8a22c4de5d3..f623b1f70772e2d016a4e7409089302f98038f55 100644 (file)
@@ -20,6 +20,8 @@ src_data_libdata_a_SOURCES = \
        src/data/casefile-private.h \
        src/data/fastfile.c \
        src/data/fastfile.h \
        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 \
        src/data/case.h \
        src/data/category.c \
        src/data/category.h \
index 999834c72aa4dde5f5964085f4fe0ee57527f138..d7be3fa681c6c3f24c7da8159e29fcdee6f90c28 100644 (file)
    class CLASS and auxiliary data AUX. */
 struct case_sink *
 create_case_sink (const struct case_sink_class *class,
    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;
                   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;
 }
 
   return sink;
 }
 
index 087c0601edd385fc613b52743a1c4f71b1c95ef7..ec2cfd21414ff0a291256e53d89aa24702230db5 100644 (file)
@@ -30,6 +30,8 @@ struct case_sink
   {
     const struct case_sink_class *class;        /* Class. */
     void *aux;          /* Auxiliary data. */
   {
     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. */
   };
 
     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;
 
 
 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 case_sink *create_case_sink (const struct case_sink_class *,
                                     const struct dictionary *,
+                                   struct casefile_factory *,
                                     void *);
 void free_case_sink (struct case_sink *);
 
                                     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 (file)
index 0000000..cc7423e
--- /dev/null
@@ -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 (file)
index 0000000..7820f65
--- /dev/null
@@ -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 <stdlib.h>
+#include <libpspp/alloc.h>
+#include <libpspp/compiler.h>
+#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 (file)
index 0000000..74ebe9a
--- /dev/null
@@ -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 <data/casefile-factory.h>
+
+struct casefile_factory * fastfile_factory_create (void);
+void fastfile_factory_destroy (struct casefile_factory *);
+
+#endif
index baba8fa7cefb20f049b09484d2de162f50b51694..8aec2c9fe05092d1beded5ca2bddafbc12048e1d 100644 (file)
 #include <libpspp/str.h>
 
 struct dataset {
 #include <libpspp/str.h>
 
 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),
   /* 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;
 
   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;
 
   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; 
     }
       if (!proc_read (ds, &c))
         break; 
     }
-  
   ds->ok = free_case_source (ds->proc_source) && ds->ok;
   ds->proc_source = NULL;
 
   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)
 
   /* 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);
 
   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 = 
 
       /* 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;
     }
 
   return casefile_append (aux->casefile, c) && ok;
@@ -834,10 +844,11 @@ proc_cancel_all_transformations (struct dataset *ds)
 \f
 /* Initializes procedure handling. */
 struct dataset *
 \f
 /* Initializes procedure handling. */
 struct dataset *
-create_dataset (void)
+create_dataset (struct casefile_factory *fact)
 {
   struct dataset *ds = xzalloc (sizeof(*ds));
   ds->dict = dict_create ();
 {
   struct dataset *ds = xzalloc (sizeof(*ds));
   ds->dict = dict_create ();
+  ds->cf_factory = fact;
   proc_cancel_all_transformations (ds);
   return ds;
 }
   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;
+}
+
index 3b501df90b8cb96b1675e508fae662de5eba5c85..4e8fa91024ff3c0c57686dbf07a99ffd0336e765 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdbool.h>
 
 #include <data/transformations.h>
 #include <stdbool.h>
 
 #include <data/transformations.h>
+#include <data/casefile-factory.h>
 #include <libpspp/compiler.h>
 
 struct ccase;
 #include <libpspp/compiler.h>
 
 struct ccase;
@@ -57,9 +58,11 @@ bool proc_cancel_temporary_transformations (struct dataset *ds);
 \f
 /* Procedures. */
 
 \f
 /* Procedures. */
 
-struct dataset * create_dataset (void);
+struct dataset * create_dataset (struct casefile_factory *);
 void destroy_dataset (struct dataset *);
 
 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);
 
 void proc_set_source (struct dataset *ds, struct case_source *);
 bool proc_has_source (const struct dataset *ds);
 
index a003e7bebab38d0c583c706a35996a62c2cec8ff..4ff939cd02a1559ebdcaafeb8b51738ffc9a8973 100644 (file)
@@ -27,7 +27,7 @@
 #include <data/case-source.h>
 #include <data/case.h>
 #include <data/casefile.h> 
 #include <data/case-source.h>
 #include <data/case.h>
 #include <data/casefile.h> 
-#include <data/fastfile.h> 
+#include <data/casefile-factory.h>
 
 #include "xalloc.h"
 
 
 #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);
   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.
 }
 
 /* Writes case C to the storage sink SINK.
index 8b03ec95f809322e88edff3a47bd1a0d6ba7465f..edd1512ca8daf3880291838337f256fa52d1758e 100644 (file)
@@ -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, 
   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);
       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));
 
   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));
 
index aeb374ced57d63a2bc52020257a70eab617a50f2..32f966109d2a2ea27c80554d86d6b4a7c15fbcbd 100644 (file)
@@ -158,7 +158,7 @@ cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED)
 
          if  ( ds == NULL )
            {
 
          if  ( ds == NULL )
            {
-             ds = create_dataset ();
+             ds = create_dataset (NULL);
              d = dataset_dict (ds);
            }
 
              d = dataset_dict (ds);
            }
 
index 79d90fdd9d9fb58b6e18e0cd9c5de7a539705417..7d1c7a7a72cb245c751601b711af76463477d825 100644 (file)
@@ -278,11 +278,15 @@ cmd_aggregate (struct lexer *lexer, struct dataset *ds)
             goto error;
         }
 
             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, 
       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)) 
       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 (!proc_close (ds))
         goto error;
+
       if (agr.case_cnt > 0) 
         {
           dump_aggregate_info (&agr, &agr.agr_case);
       if (agr.case_cnt > 0) 
         {
           dump_aggregate_info (&agr, &agr.agr_case);
index 594596c07550143938ae22e5ed443fe632bcb3da..c3f2439fe9ac0dc9968fd4eddcd45913d9ea65f2 100644 (file)
@@ -83,7 +83,7 @@ struct flip_pgm
   };
 
 static void destroy_flip_pgm (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 *);
 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);
   /* 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);
   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 *
      
 /* 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;
 
 {
   size_t i;
 
@@ -316,7 +316,10 @@ flip_sink_create (struct dictionary *dict, struct flip_pgm *flip)
 
   flip->case_cnt = 1;
 
 
   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.
 }
 
 /* Writes case C to the FLIP sink.
index 882d04eba857c6d1fd20435d12a98abc1ff8f343..894d2769b68d8125636992cfb5f5570830806743 100644 (file)
@@ -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]) );
       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,
       casefile_destroy (cf);
 
       out = rank_sorted_casefile (sorted_cf, &criteria,
index 7c2539aa9f573f90276682fbd987e703273eb1a0..d3e4446d075bc8be8a92cd003c62649e83b021f6 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - computes sample statistics.
 /* 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
 
    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 <data/case.h>
 #include <data/casefile.h>
 #include <data/fastfile.h>
 #include <data/case.h>
 #include <data/casefile.h>
 #include <data/fastfile.h>
+#include <data/casefile-factory.h>
+#include <data/fastfile-factory.h>
 #include <data/procedure.h>
 #include <data/settings.h>
 #include <data/variable.h>
 #include <data/procedure.h>
 #include <data/settings.h>
 #include <data/variable.h>
@@ -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 *,
 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 *,
 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.
 
 
 /* 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);
     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;
 
   if (out == NULL) 
     return false;
 
@@ -86,6 +93,7 @@ struct sort_to_casefile_cb_data
   {
     const struct sort_criteria *criteria;
     struct casefile *output;
   {
     const struct sort_criteria *criteria;
     struct casefile *output;
+    struct casefile_factory *factory ;
   };
 
 /* Sorts casefile CF according to the criteria in CB_DATA. */
   };
 
 /* 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_;
 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;
 }
 
   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.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);
   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
 
 /* 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 *
 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)
   if (output == NULL)
-    output = do_external_sort (reader, criteria);
+    output = do_external_sort (reader, criteria, factory);
   casereader_destroy (reader);
   casereader_destroy (reader);
+
+  fastfile_factory_destroy (local_factory);
+
   return output;
 }
 \f
   return output;
 }
 \f
@@ -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,
    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;
 {
   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);
     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);
   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. */
     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. */
   };
 
 /* 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,
    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;
 
 {
   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->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);
   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;
 {
   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); 
   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. */
     }
 
   /* Create output file. */
-  output = fastfile_create (xsrt->value_cnt);
+  output = xsrt->factory->create_casefile (xsrt->factory, xsrt->value_cnt);
   casefile_to_disk (output);
 
   /* Merge. */
   casefile_to_disk (output);
 
   /* Merge. */
index cd74c122c63911554ad09c11d60b176c8263f42a..c6f86e9f4d39990a851b0b02c8a34fbfd164a4a6 100644 (file)
@@ -25,6 +25,7 @@
 struct casereader;
 struct dictionary;
 struct variable;
 struct casereader;
 struct dictionary;
 struct variable;
+struct casefile_factory;
 
 extern int min_buffers ;
 extern int max_buffers ;
 
 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 *,
 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, 
 
 struct dataset ;
 bool sort_active_file_in_place (struct dataset *ds, 
index 53738069d6227591fd2320c34b3558b4d86a9ab1..ac5f7ed96d4813ae32ccb4cdbbf56c97bcce3e50 100644 (file)
@@ -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/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 \
        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 (file)
index 0000000..453253c
--- /dev/null
@@ -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 <stdlib.h>
+#include <libpspp/alloc.h>
+#include <libpspp/compiler.h>
+#include "flexifile-factory.h"
+#include <ui/flexifile.h>
+#include <data/casefile-factory.h>
+
+
+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 (file)
index 0000000..eecb901
--- /dev/null
@@ -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
index e43ab107b1bf7690dbcba75ecb2a2d98e8cae3a3..cd9c2ba66058040c6f7f09f092df3bed10427a62 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <data/case.h>
 #include <ui/flexifile.h>
 
 #include <data/case.h>
 #include <ui/flexifile.h>
+#include "flexifile-factory.h"
 #include <data/casefile.h>
 #include <data/data-in.h>
 #include <math/sort.h>
 #include <data/casefile.h>
 #include <data/data-in.h>
 #include <math/sort.h>
@@ -144,6 +145,7 @@ psppire_case_file_init (PsppireCaseFile *cf)
   cf->flexifile = 0;
 }
 
   cf->flexifile = 0;
 }
 
+
 /**
  * psppire_case_file_new:
  * @returns: a new #PsppireCaseFile object
 /**
  * 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)
 {
 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);
   flexifile_get_case(FLEXIFILE(cf->flexifile), casenum, &c);
 
   v = case_data_idx(&c, idx);
-
   case_destroy(&c);
 
   return v;
   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)
 {
 void
 psppire_case_file_sort(PsppireCaseFile *cf, const struct sort_criteria *sc)
 {
-  struct ccase cc;
   gint c;
   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);
 
   /* 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);
   if ( ! cf->flexifile ) 
     {
       cf->flexifile = flexifile_create(n_values);
+
       return TRUE;
     }
 
       return TRUE;
     }
 
index eed3bb6e9dae293816cd5dc72b16907b288347c1..e2b8252c289c16d43dd6b7a3ff645987678b9eda 100644 (file)
@@ -48,7 +48,8 @@ typedef struct _PsppireCaseFile          PsppireCaseFile;
 typedef struct _PsppireCaseFileClass PsppireCaseFileClass;
 
 struct ccase;
 typedef struct _PsppireCaseFileClass PsppireCaseFileClass;
 
 struct ccase;
-struct casefilefile;
+struct flexifile;
+struct casefile;
 
 struct _PsppireCaseFile
 {
 
 struct _PsppireCaseFile
 {
@@ -68,9 +69,8 @@ struct _PsppireCaseFileClass
 GType          psppire_case_file_get_type (void);
 
 PsppireCaseFile *psppire_case_file_new (gint var_cnt);
 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);
 
 
 gboolean psppire_case_file_insert_case(PsppireCaseFile *cf, struct ccase *c, gint row);
 
index c761c237edc3422726d8c4e48c6697f4c3817abd..c0bebeccb03f3b7126b90a94e43d8e4d9f7d3c0c 100644 (file)
@@ -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);
 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;
 
 
   data_store->dict = dict;
 
index 3614224510472520d8a315ea3a9db17c9e718904..ed4c790b95a38797dbbe8e730ffa9cfa1c9b0fe4 100644 (file)
@@ -22,6 +22,7 @@
 #include <assert.h>
 #include <libintl.h>
 
 #include <assert.h>
 #include <libintl.h>
 
+
 #include <libpspp/version.h>
 #include <libpspp/copyleft.h>
 #include <data/file-handle-def.h>
 #include <libpspp/version.h>
 #include <libpspp/copyleft.h>
 #include <data/file-handle-def.h>
@@ -44,6 +45,7 @@
 #include "data-sheet.h"
 #include "var-sheet.h"
 #include "message-dialog.h"
 #include "data-sheet.h"
 #include "var-sheet.h"
 #include "message-dialog.h"
+#include "flexifile-factory.h"
 
 GladeXML *xml;
 
 
 GladeXML *xml;
 
@@ -88,6 +90,7 @@ struct dataset * the_dataset = NULL;
 int 
 main(int argc, char *argv[]) 
 {
 int 
 main(int argc, char *argv[]) 
 {
+  struct casefile_factory *factory;
 
   GtkWidget *data_editor ;
   GtkSheet *var_sheet ; 
 
   GtkWidget *data_editor ;
   GtkSheet *var_sheet ; 
@@ -125,13 +128,14 @@ main(int argc, char *argv[])
   fmt_init();
   settings_init();
   fh_init ();
   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_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);
 
 
   message_dialog_init (the_source_stream);
 
index 20821b494a5a9b727ef465abaa51edfb73c371ec..ef56b7e97f65c005be03065a11eeb74bd8e87583 100644 (file)
@@ -18,12 +18,12 @@ src_ui_terminal_pspp_SOURCES =
 
 src_ui_terminal_pspp_LDADD =                                   \
        src/ui/terminal/libui.a \
 
 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/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 \
        lib/linreg/liblinreg.a  \
        lib/gsl-extras/libgsl-extras.a  \
        src/data/libdata.a \
index 7e1f5c99f98fc80bf367c7c20b8f668aafbfb86c..9712fb8be5a80945bbaa2038cab25b9517471a75 100644 (file)
@@ -27,7 +27,7 @@
 #include "progname.h"
 #include "read-line.h"
 
 #include "progname.h"
 #include "read-line.h"
 
-
+#include <data/fastfile-factory.h>
 #include <data/dictionary.h>
 #include <data/file-handle-def.h>
 #include <libpspp/getl.h>
 #include <data/dictionary.h>
 #include <data/file-handle-def.h>
 #include <libpspp/getl.h>
@@ -82,6 +82,7 @@ static struct source_stream *the_source_stream ;
 int
 main (int argc, char **argv)
 {
 int
 main (int argc, char **argv)
 {
+  struct casefile_factory *factory;
   signal (SIGABRT, bug_handler);
   signal (SIGSEGV, bug_handler);
   signal (SIGFPE, bug_handler);
   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 ();
   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))
     {
 
   if (parse_command_line (argc, argv, the_source_stream))
     {