data source is replaced.
msgstr ""
"Project-Id-Version: PSPP 0.4.2\n"
"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2006-12-28 20:05+0900\n"
+"POT-Creation-Date: 2006-12-29 15:57+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"
msgid "Month number %f is not between 1 and 12."
msgstr ""
-#: src/data/dictionary.c:709
+#: src/data/dictionary.c:721
msgid ""
"At least one case in the data file had a weight value that was user-missing, "
"system-missing, zero, or negative. These case(s) were ignored."
msgstr ""
-#: src/data/dictionary.c:1189
+#: src/data/dictionary.c:1201
msgid "Variable suffix too large."
msgstr ""
msgstr ""
#: src/data/format.c:310 src/data/por-file-reader.c:489
-#: src/data/sys-file-reader.c:602 src/ui/gui/data-editor.glade:1247
+#: src/data/sys-file-reader.c:602 src/ui/gui/data-editor.glade:1558
#: src/ui/gui/psppire-var-store.c:482
msgid "String"
msgstr "Zeichenkette"
#: src/data/format.c:310 src/data/por-file-reader.c:489
-#: src/data/sys-file-reader.c:602 src/ui/gui/data-editor.glade:1108
+#: src/data/sys-file-reader.c:602 src/ui/gui/data-editor.glade:1419
#: src/ui/gui/psppire-var-store.c:475
msgid "Numeric"
msgstr "Nummer"
"bad box: (%d+%d=%d,%d+%d=%d)-(%d+%d=%d,%d+%d=%d) in table size (%d,%d)\n"
msgstr ""
-#: src/ui/gui/customentry.c:337 src/ui/gui/psppire-status-bar.c:252
+#: src/ui/gui/customentry.c:337
msgid "Style of bevel around the custom entry button"
msgstr ""
-#: src/ui/gui/data-editor.c:369 src/ui/gui/data-editor.glade:531
+#: src/ui/gui/data-editor.c:368 src/ui/gui/data-editor.glade:531
msgid "Open"
msgstr "Öffen"
-#: src/ui/gui/data-editor.c:377
+#: src/ui/gui/data-editor.c:376
msgid "System Files (*.sav)"
msgstr "Systemedatein (*.sav)"
-#: src/ui/gui/data-editor.c:383
+#: src/ui/gui/data-editor.c:382
msgid "Portable Files (*.por) "
msgstr "Tragbardatein (*.por)"
-#: src/ui/gui/data-editor.c:389 src/ui/gui/syntax-editor.c:140
-#: src/ui/gui/syntax-editor.c:541
+#: src/ui/gui/data-editor.c:388 src/ui/gui/syntax-editor.c:140
+#: src/ui/gui/syntax-editor.c:538
msgid "All Files"
msgstr "Alle Datei"
-#: src/ui/gui/data-editor.c:467
+#: src/ui/gui/data-editor.c:466
msgid "Font Selection"
msgstr "Schriftwahlung"
msgstr "Glitten"
#: src/ui/gui/data-editor.glade:278 src/ui/gui/data-editor.glade:831
-#: src/ui/gui/data-editor.glade:1682 src/ui/gui/data-editor.glade:1959
+#: src/ui/gui/data-editor.glade:1993 src/ui/gui/data-editor.glade:2270
msgid "Value Labels"
msgstr "Werten"
msgstr "_Stecken"
#: src/ui/gui/data-editor.glade:343 src/ui/gui/data-editor.glade:638
-#: src/ui/gui/data-editor.glade:2524
+#: src/ui/gui/data-editor.glade:2835
msgid "Go To Case"
msgstr ""
-#: src/ui/gui/data-editor.glade:372 src/ui/gui/data-editor.glade:2635
+#: src/ui/gui/data-editor.glade:372 src/ui/gui/data-editor.glade:2946
msgid "Sort Cases"
msgstr ""
msgid "Variable View"
msgstr "Variableansicht"
-#: src/ui/gui/data-editor.glade:1075
+#: src/ui/gui/data-editor.glade:1079
+msgid "Information Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1126
+msgid "Processor Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1169
+msgid "OMS Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1212
+msgid "Case Counter Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1255
+msgid "Filter Use Status Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1298
+msgid "Weight Status Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1341
+#, fuzzy
+msgid "Split File Status Area"
+msgstr "Alle Datei"
+
+#: src/ui/gui/data-editor.glade:1386
msgid "Variable Type"
msgstr "Variableansicht"
-#: src/ui/gui/data-editor.glade:1127 src/ui/gui/psppire-var-store.c:476
+#: src/ui/gui/data-editor.glade:1438 src/ui/gui/psppire-var-store.c:476
msgid "Comma"
msgstr "Komma"
-#: src/ui/gui/data-editor.glade:1147 src/ui/gui/psppire-var-store.c:477
+#: src/ui/gui/data-editor.glade:1458 src/ui/gui/psppire-var-store.c:477
msgid "Dot"
msgstr "Punkt"
-#: src/ui/gui/data-editor.glade:1167
+#: src/ui/gui/data-editor.glade:1478
msgid "Scientific notation"
msgstr "Wissenschaftlichnotation"
-#: src/ui/gui/data-editor.glade:1187 src/ui/gui/psppire-var-store.c:479
+#: src/ui/gui/data-editor.glade:1498 src/ui/gui/psppire-var-store.c:479
msgid "Date"
msgstr "Datum"
-#: src/ui/gui/data-editor.glade:1207 src/ui/gui/psppire-var-store.c:480
+#: src/ui/gui/data-editor.glade:1518 src/ui/gui/psppire-var-store.c:480
msgid "Dollar"
msgstr "Euro"
-#: src/ui/gui/data-editor.glade:1227
+#: src/ui/gui/data-editor.glade:1538
msgid "Custom currency"
msgstr "Spezialwährung"
-#: src/ui/gui/data-editor.glade:1372
+#: src/ui/gui/data-editor.glade:1683
msgid "positive"
msgstr "positiv"
-#: src/ui/gui/data-editor.glade:1397
+#: src/ui/gui/data-editor.glade:1708
msgid "negative"
msgstr "negativ"
-#: src/ui/gui/data-editor.glade:1426
+#: src/ui/gui/data-editor.glade:1737
msgid "Sample"
msgstr "Muster"
-#: src/ui/gui/data-editor.glade:1504
+#: src/ui/gui/data-editor.glade:1815
msgid "Decimal Places:"
msgstr "Dezimalstellen:"
-#: src/ui/gui/data-editor.glade:1581
+#: src/ui/gui/data-editor.glade:1892
msgid "Width:"
msgstr "Große:"
-#: src/ui/gui/data-editor.glade:1800
+#: src/ui/gui/data-editor.glade:2111
msgid "Value:"
msgstr "Werte:"
-#: src/ui/gui/data-editor.glade:1828
+#: src/ui/gui/data-editor.glade:2139
msgid "Value Label:"
msgstr "Kennsatz:"
-#: src/ui/gui/data-editor.glade:2044
+#: src/ui/gui/data-editor.glade:2355
msgid "Missing Values"
msgstr "Lösewerten"
-#: src/ui/gui/data-editor.glade:2130
+#: src/ui/gui/data-editor.glade:2441
msgid "_No missing values"
msgstr "_Kein Lösewerten"
-#: src/ui/gui/data-editor.glade:2155
+#: src/ui/gui/data-editor.glade:2466
msgid "_Discrete missing values"
msgstr "_Diskret Lösewerten"
-#: src/ui/gui/data-editor.glade:2284
+#: src/ui/gui/data-editor.glade:2595
msgid "_Range plus one optional discrete missing value"
msgstr "Wertebereich und ein optional Lösewert"
-#: src/ui/gui/data-editor.glade:2321
+#: src/ui/gui/data-editor.glade:2632
msgid "_Low:"
msgstr "_Tief:"
-#: src/ui/gui/data-editor.glade:2380
+#: src/ui/gui/data-editor.glade:2691
msgid "_High:"
msgstr "_Hoch:"
-#: src/ui/gui/data-editor.glade:2454
+#: src/ui/gui/data-editor.glade:2765
msgid "Di_screte value:"
msgstr "Di_skretwerte"
-#: src/ui/gui/data-editor.glade:2580
+#: src/ui/gui/data-editor.glade:2891
msgid "Case Number:"
msgstr ""
-#: src/ui/gui/data-editor.glade:2752 src/ui/gui/sort-cases-dialog.c:279
+#: src/ui/gui/data-editor.glade:3063 src/ui/gui/sort-cases-dialog.c:279
msgid "Ascending"
msgstr ""
-#: src/ui/gui/data-editor.glade:2771 src/ui/gui/sort-cases-dialog.c:281
+#: src/ui/gui/data-editor.glade:3082 src/ui/gui/sort-cases-dialog.c:281
msgid "Descending"
msgstr ""
-#: src/ui/gui/data-editor.glade:2792
+#: src/ui/gui/data-editor.glade:3103
msgid "Sort Order"
msgstr ""
-#: src/ui/gui/data-editor.glade:2829
+#: src/ui/gui/data-editor.glade:3140
msgid "Sort by:"
msgstr ""
msgid "Incorrect range specification"
msgstr "Falshe Spannweitebeschreibung"
-#: src/ui/gui/psppire-data-store.c:745
+#: src/ui/gui/psppire-data-store.c:743
msgid "var"
msgstr ""
-#: src/ui/gui/psppire-data-store.c:826 src/ui/gui/psppire-var-store.c:552
+#: src/ui/gui/psppire-data-store.c:824 src/ui/gui/psppire-var-store.c:552
#: src/ui/gui/psppire-var-store.c:562 src/ui/gui/psppire-var-store.c:572
#: src/ui/gui/psppire-var-store.c:770
#, c-format
msgid "Save Syntax"
msgstr "Speichern unter"
-#: src/ui/gui/syntax-editor.c:134 src/ui/gui/syntax-editor.c:535
+#: src/ui/gui/syntax-editor.c:134 src/ui/gui/syntax-editor.c:532
#, fuzzy
msgid "Syntax Files (*.sps) "
msgstr "Systemedatein (*.sav)"
-#: src/ui/gui/syntax-editor.c:527
+#: src/ui/gui/syntax-editor.c:524
msgid "Open Syntax"
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2006-12-28 20:05+0900\n"
+"POT-Creation-Date: 2006-12-29 15:57+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"
msgid "Month number %f is not between 1 and 12."
msgstr ""
-#: src/data/dictionary.c:709
+#: src/data/dictionary.c:721
msgid ""
"At least one case in the data file had a weight value that was user-missing, "
"system-missing, zero, or negative. These case(s) were ignored."
msgstr ""
-#: src/data/dictionary.c:1189
+#: src/data/dictionary.c:1201
msgid "Variable suffix too large."
msgstr ""
msgstr ""
#: src/data/format.c:310 src/data/por-file-reader.c:489
-#: src/data/sys-file-reader.c:602 src/ui/gui/data-editor.glade:1247
+#: src/data/sys-file-reader.c:602 src/ui/gui/data-editor.glade:1558
#: src/ui/gui/psppire-var-store.c:482
msgid "String"
msgstr ""
#: src/data/format.c:310 src/data/por-file-reader.c:489
-#: src/data/sys-file-reader.c:602 src/ui/gui/data-editor.glade:1108
+#: src/data/sys-file-reader.c:602 src/ui/gui/data-editor.glade:1419
#: src/ui/gui/psppire-var-store.c:475
msgid "Numeric"
msgstr ""
"bad box: (%d+%d=%d,%d+%d=%d)-(%d+%d=%d,%d+%d=%d) in table size (%d,%d)\n"
msgstr ""
-#: src/ui/gui/customentry.c:337 src/ui/gui/psppire-status-bar.c:252
+#: src/ui/gui/customentry.c:337
msgid "Style of bevel around the custom entry button"
msgstr ""
-#: src/ui/gui/data-editor.c:369 src/ui/gui/data-editor.glade:531
+#: src/ui/gui/data-editor.c:368 src/ui/gui/data-editor.glade:531
msgid "Open"
msgstr ""
-#: src/ui/gui/data-editor.c:377
+#: src/ui/gui/data-editor.c:376
msgid "System Files (*.sav)"
msgstr ""
-#: src/ui/gui/data-editor.c:383
+#: src/ui/gui/data-editor.c:382
msgid "Portable Files (*.por) "
msgstr ""
-#: src/ui/gui/data-editor.c:389 src/ui/gui/syntax-editor.c:140
-#: src/ui/gui/syntax-editor.c:541
+#: src/ui/gui/data-editor.c:388 src/ui/gui/syntax-editor.c:140
+#: src/ui/gui/syntax-editor.c:538
msgid "All Files"
msgstr ""
-#: src/ui/gui/data-editor.c:467
+#: src/ui/gui/data-editor.c:466
msgid "Font Selection"
msgstr ""
msgstr ""
#: src/ui/gui/data-editor.glade:278 src/ui/gui/data-editor.glade:831
-#: src/ui/gui/data-editor.glade:1682 src/ui/gui/data-editor.glade:1959
+#: src/ui/gui/data-editor.glade:1993 src/ui/gui/data-editor.glade:2270
msgid "Value Labels"
msgstr ""
msgstr ""
#: src/ui/gui/data-editor.glade:343 src/ui/gui/data-editor.glade:638
-#: src/ui/gui/data-editor.glade:2524
+#: src/ui/gui/data-editor.glade:2835
msgid "Go To Case"
msgstr ""
-#: src/ui/gui/data-editor.glade:372 src/ui/gui/data-editor.glade:2635
+#: src/ui/gui/data-editor.glade:372 src/ui/gui/data-editor.glade:2946
msgid "Sort Cases"
msgstr ""
msgid "Variable View"
msgstr ""
-#: src/ui/gui/data-editor.glade:1075
+#: src/ui/gui/data-editor.glade:1079
+msgid "Information Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1126
+msgid "Processor Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1169
+msgid "OMS Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1212
+msgid "Case Counter Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1255
+msgid "Filter Use Status Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1298
+msgid "Weight Status Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1341
+msgid "Split File Status Area"
+msgstr ""
+
+#: src/ui/gui/data-editor.glade:1386
msgid "Variable Type"
msgstr ""
-#: src/ui/gui/data-editor.glade:1127 src/ui/gui/psppire-var-store.c:476
+#: src/ui/gui/data-editor.glade:1438 src/ui/gui/psppire-var-store.c:476
msgid "Comma"
msgstr ""
-#: src/ui/gui/data-editor.glade:1147 src/ui/gui/psppire-var-store.c:477
+#: src/ui/gui/data-editor.glade:1458 src/ui/gui/psppire-var-store.c:477
msgid "Dot"
msgstr ""
-#: src/ui/gui/data-editor.glade:1167
+#: src/ui/gui/data-editor.glade:1478
msgid "Scientific notation"
msgstr ""
-#: src/ui/gui/data-editor.glade:1187 src/ui/gui/psppire-var-store.c:479
+#: src/ui/gui/data-editor.glade:1498 src/ui/gui/psppire-var-store.c:479
msgid "Date"
msgstr ""
-#: src/ui/gui/data-editor.glade:1207 src/ui/gui/psppire-var-store.c:480
+#: src/ui/gui/data-editor.glade:1518 src/ui/gui/psppire-var-store.c:480
msgid "Dollar"
msgstr ""
-#: src/ui/gui/data-editor.glade:1227
+#: src/ui/gui/data-editor.glade:1538
msgid "Custom currency"
msgstr ""
-#: src/ui/gui/data-editor.glade:1372
+#: src/ui/gui/data-editor.glade:1683
msgid "positive"
msgstr ""
-#: src/ui/gui/data-editor.glade:1397
+#: src/ui/gui/data-editor.glade:1708
msgid "negative"
msgstr ""
-#: src/ui/gui/data-editor.glade:1426
+#: src/ui/gui/data-editor.glade:1737
msgid "Sample"
msgstr ""
-#: src/ui/gui/data-editor.glade:1504
+#: src/ui/gui/data-editor.glade:1815
msgid "Decimal Places:"
msgstr ""
-#: src/ui/gui/data-editor.glade:1581
+#: src/ui/gui/data-editor.glade:1892
msgid "Width:"
msgstr ""
-#: src/ui/gui/data-editor.glade:1800
+#: src/ui/gui/data-editor.glade:2111
msgid "Value:"
msgstr ""
-#: src/ui/gui/data-editor.glade:1828
+#: src/ui/gui/data-editor.glade:2139
msgid "Value Label:"
msgstr ""
-#: src/ui/gui/data-editor.glade:2044
+#: src/ui/gui/data-editor.glade:2355
msgid "Missing Values"
msgstr ""
-#: src/ui/gui/data-editor.glade:2130
+#: src/ui/gui/data-editor.glade:2441
msgid "_No missing values"
msgstr ""
-#: src/ui/gui/data-editor.glade:2155
+#: src/ui/gui/data-editor.glade:2466
msgid "_Discrete missing values"
msgstr ""
-#: src/ui/gui/data-editor.glade:2284
+#: src/ui/gui/data-editor.glade:2595
msgid "_Range plus one optional discrete missing value"
msgstr ""
-#: src/ui/gui/data-editor.glade:2321
+#: src/ui/gui/data-editor.glade:2632
msgid "_Low:"
msgstr ""
-#: src/ui/gui/data-editor.glade:2380
+#: src/ui/gui/data-editor.glade:2691
msgid "_High:"
msgstr ""
-#: src/ui/gui/data-editor.glade:2454
+#: src/ui/gui/data-editor.glade:2765
msgid "Di_screte value:"
msgstr ""
-#: src/ui/gui/data-editor.glade:2580
+#: src/ui/gui/data-editor.glade:2891
msgid "Case Number:"
msgstr ""
-#: src/ui/gui/data-editor.glade:2752 src/ui/gui/sort-cases-dialog.c:279
+#: src/ui/gui/data-editor.glade:3063 src/ui/gui/sort-cases-dialog.c:279
msgid "Ascending"
msgstr ""
-#: src/ui/gui/data-editor.glade:2771 src/ui/gui/sort-cases-dialog.c:281
+#: src/ui/gui/data-editor.glade:3082 src/ui/gui/sort-cases-dialog.c:281
msgid "Descending"
msgstr ""
-#: src/ui/gui/data-editor.glade:2792
+#: src/ui/gui/data-editor.glade:3103
msgid "Sort Order"
msgstr ""
-#: src/ui/gui/data-editor.glade:2829
+#: src/ui/gui/data-editor.glade:3140
msgid "Sort by:"
msgstr ""
msgid "Incorrect range specification"
msgstr ""
-#: src/ui/gui/psppire-data-store.c:745
+#: src/ui/gui/psppire-data-store.c:743
msgid "var"
msgstr ""
-#: src/ui/gui/psppire-data-store.c:826 src/ui/gui/psppire-var-store.c:552
+#: src/ui/gui/psppire-data-store.c:824 src/ui/gui/psppire-var-store.c:552
#: src/ui/gui/psppire-var-store.c:562 src/ui/gui/psppire-var-store.c:572
#: src/ui/gui/psppire-var-store.c:770
#, c-format
msgid "Save Syntax"
msgstr ""
-#: src/ui/gui/syntax-editor.c:134 src/ui/gui/syntax-editor.c:535
+#: src/ui/gui/syntax-editor.c:134 src/ui/gui/syntax-editor.c:532
msgid "Syntax Files (*.sps) "
msgstr ""
-#: src/ui/gui/syntax-editor.c:527
+#: src/ui/gui/syntax-editor.c:524
msgid "Open Syntax"
msgstr ""
+Mon Jan 1 10:36:26 WST 2007 John Darrington <john@darrington.wattle.id.au>
+
+ * dictionary.c dictionary.h : Added replace_source and replace_dict
+ callbacks, and functions to deal with them.
+
Fri Dec 22 13:56:08 2006 Ben Pfaff <blp@gnu.org>
Simplify missing value handling.
}
+/* Shallow copy the callbacks from SRC to DEST */
+void
+dict_copy_callbacks (struct dictionary *dest,
+ const struct dictionary *src)
+{
+ dest->callbacks = src->callbacks;
+ dest->cb_data = src->cb_data;
+}
+
/* Creates and returns a new dictionary. */
struct dictionary *
dict_create (void)
for (i = 0; i < d->var_cnt; i++)
{
+ if (d->callbacks && d->callbacks->var_deleted )
+ d->callbacks->var_deleted (d, i, d->cb_data);
+
var_clear_vardict (d->var[i]);
var_destroy (d->var[i]);
}
struct dictionary *dict_clone (const struct dictionary *);
void dict_set_callbacks (struct dictionary *, const struct dict_callbacks *,
void *);
+void dict_copy_callbacks (struct dictionary *, const struct dictionary *);
+
void dict_clear (struct dictionary *);
void dict_clear_aux (struct dictionary *);
/* An abstract factory which creates casefiles */
struct casefile_factory *cf_factory;
+ /* Callback which occurs when a procedure provides a new source for
+ the dataset */
+ replace_source_callback *replace_source ;
+
+ /* Callback which occurs whenever the DICT is replaced by a new one */
+ replace_dictionary_callback *replace_dict;
+
/* Cases are read from proc_source,
pass through permanent_trns_chain (which transforms them into
the format described by permanent_dict),
start the next case from step 1.
2. Write case to replacement active file.
-
+
3. Execute temporary transformations. If these drop the case,
start the next case from step 1.
-
+
4. Pass case to PROC_FUNC, passing AUX as auxiliary data.
Returns true if successful, false if an I/O error occurred. */
\f
/* Multipass procedure. */
-struct multipass_aux_data
+struct multipass_aux_data
{
struct casefile *casefile;
-
+
bool (*proc_func) (const struct casefile *, void *aux);
void *aux;
};
/* Case processing function for multipass_procedure(). */
static bool
-multipass_case_func (const struct ccase *c, void *aux_data_, const struct dataset *ds UNUSED)
+multipass_case_func (const struct ccase *c, void *aux_data_, const struct dataset *ds UNUSED)
{
struct multipass_aux_data *aux_data = aux_data_;
return casefile_append (aux_data->casefile, c);
/* End-of-file function for multipass_procedure(). */
static bool
-multipass_end_func (void *aux_data_, const struct dataset *ds UNUSED)
+multipass_end_func (void *aux_data_, const struct dataset *ds UNUSED)
{
struct multipass_aux_data *aux_data = aux_data_;
return (aux_data->proc_func == NULL
The entire active file is passed to PROC_FUNC, with the given
AUX as auxiliary data, as a unit. */
bool
-multipass_procedure (struct dataset *ds, casefile_func *proc_func, void *aux)
+multipass_procedure (struct dataset *ds, casefile_func *proc_func, void *aux)
{
struct multipass_aux_data aux_data;
bool ok;
return ok;
}
\f
+
/* Procedure implementation. */
/* Executes a procedure.
static bool
internal_procedure (struct dataset *ds, case_func *proc,
end_func *end,
- void *aux)
+ void *aux)
{
struct ccase *c;
bool ok = true;
-
+
proc_open (ds);
while (ok && proc_read (ds, &c))
if (proc != NULL)
ok = proc (c, aux, ds) && ok;
if (end != NULL)
ok = end (aux, ds) && ok;
- return proc_close (ds) && ok;
+
+ if ( proc_close (ds) && ok )
+ {
+ if ( ds->replace_source )
+ ds->replace_source (ds->proc_source);
+
+ return true;
+ }
+
+ return false;
}
/* Opens dataset DS for reading cases with proc_read.
Return false at end of file or if a read error occurs. In
this case a null pointer is stored in *C. */
bool
-proc_read (struct dataset *ds, struct ccase **c)
+proc_read (struct dataset *ds, struct ccase **c)
{
enum trns_result retval = TRNS_DROP_CASE;
assert (ds->is_open);
*c = NULL;
- for (;;)
+ for (;;)
{
size_t case_nr;
&ds->trns_case, &case_nr);
if (retval != TRNS_CONTINUE)
continue;
-
+
/* Write case to LAG queue. */
if (ds->n_lag)
lag_case (ds, &ds->trns_case);
/* Write case to replacement active file. */
ds->cases_written++;
- if (ds->proc_sink->class->write != NULL)
+ if (ds->proc_sink->class->write != NULL)
{
- if (ds->compactor != NULL)
+ if (ds->compactor != NULL)
{
dict_compactor_compact (ds->compactor, &ds->sink_case,
&ds->trns_case);
else
ds->proc_sink->class->write (ds->proc_sink, &ds->trns_case);
}
-
+
/* Execute temporary transformations. */
- if (ds->temporary_trns_chain != NULL)
+ if (ds->temporary_trns_chain != NULL)
{
retval = trns_chain_execute (ds->temporary_trns_chain, TRNS_CONTINUE,
&ds->trns_case, &ds->cases_written);
}
*c = &ds->trns_case;
- return true;
+ return true;
}
}
If DS has not been opened, returns true without doing
anything else. */
bool
-proc_close (struct dataset *ds)
+proc_close (struct dataset *ds)
{
if (!ds->is_open)
return true;
/* Drain any remaining cases. */
- while (ds->ok)
+ while (ds->ok)
{
struct ccase *c;
if (!proc_read (ds, &c))
- break;
+ break;
}
ds->ok = free_case_source (ds->proc_source) && ds->ok;
ds->proc_source = NULL;
/* Updates last_proc_invocation. */
static void
-update_last_proc_invocation (struct dataset *ds)
+update_last_proc_invocation (struct dataset *ds)
{
ds->last_proc_invocation = time (NULL);
}
size_t i;
case_create (trns_case, dict_get_next_value_idx (dict));
- for (i = 0; i < var_cnt; i++)
+ for (i = 0; i < var_cnt; i++)
{
struct variable *v = dict_get_var (dict, i);
union value *value = case_data_rw (trns_case, v);
ds->permanent_dict = ds->dict;
/* Figure out whether to compact. */
- ds->compactor =
+ ds->compactor =
(dict_compacting_would_shrink (ds->permanent_dict)
? dict_make_compactor (ds->permanent_dict)
: NULL);
if (ds->n_lag > 0)
{
int i;
-
+
ds->lag_count = 0;
ds->lag_head = 0;
ds->lag_queue = xnmalloc (ds->n_lag, sizeof *ds->lag_queue);
{
size_t var_cnt = dict_get_var_cnt (ds->dict);
size_t i;
-
- for (i = 0; i < var_cnt; i++)
+
+ for (i = 0; i < var_cnt; i++)
{
struct variable *v = dict_get_var (ds->dict, i);
- if (!var_get_leave (v))
+ if (!var_get_leave (v))
{
if (var_is_numeric (v))
- case_data_rw (c, v)->f = SYSMIS;
+ case_data_rw (c, v)->f = SYSMIS;
else
memset (case_data_rw (c, v)->s, ' ', var_get_width (v));
- }
+ }
}
}
if (ds->n_lag > 0)
{
int i;
-
+
for (i = 0; i < ds->n_lag; i++)
case_destroy (&ds->lag_queue[i]);
free (ds->lag_queue);
ds->n_lag = 0;
}
-
+
/* Dictionary from before TEMPORARY becomes permanent. */
proc_cancel_temporary_transformations (ds);
/* Finish compacting. */
- if (ds->compactor != NULL)
+ if (ds->compactor != NULL)
{
dict_compactor_destroy (ds->compactor);
dict_compact_values (ds->dict);
ds->compactor = NULL;
}
-
+
/* Old data sink becomes new data source. */
if (ds->proc_sink->class->make_source != NULL)
ds->proc_source = ds->proc_sink->class->make_source (ds->proc_sink);
/* Procedure that separates the data into SPLIT FILE groups. */
/* Represents auxiliary data for handling SPLIT FILE. */
-struct split_aux_data
+struct split_aux_data
{
struct dataset *dataset; /* The dataset */
struct ccase prev_case; /* Data in previous case. */
/* Callback functions. */
- begin_func *begin;
+ begin_func *begin;
case_func *proc;
end_func *end;
void *func_aux;
passed to each of the functions as auxiliary data.
If the active file is empty, none of BEGIN_FUNC, PROC_FUNC,
- and END_FUNC will be called at all.
+ and END_FUNC will be called at all.
If SPLIT FILE is not in effect, then there is one break group
(if the active file is nonempty), and BEGIN_FUNC and END_FUNC
will be called once.
-
+
Returns true if successful, false if an I/O error occurred. */
bool
procedure_with_splits (struct dataset *ds,
- begin_func begin,
+ begin_func begin,
case_func *proc,
end_func *end,
- void *func_aux)
+ void *func_aux)
{
struct split_aux_data split_aux;
bool ok;
/* Case callback used by procedure_with_splits(). */
static bool
-split_procedure_case_func (const struct ccase *c, void *split_aux_, const struct dataset *ds)
+split_procedure_case_func (const struct ccase *c, void *split_aux_, const struct dataset *ds)
{
struct split_aux_data *split_aux = split_aux_;
/* End-of-file callback used by procedure_with_splits(). */
static bool
-split_procedure_end_func (void *split_aux_, const struct dataset *ds)
+split_procedure_end_func (void *split_aux_, const struct dataset *ds)
{
struct split_aux_data *split_aux = split_aux_;
/* Compares the SPLIT FILE variables in cases A and B and returns
nonzero only if they differ. */
static int
-equal_splits (const struct ccase *a, const struct ccase *b,
- const struct dataset *ds)
+equal_splits (const struct ccase *a, const struct ccase *b,
+ const struct dataset *ds)
{
return case_compare (a, b,
dict_get_split_vars (ds->dict),
/* Represents auxiliary data for handling SPLIT FILE in a
multipass procedure. */
-struct multipass_split_aux_data
+struct multipass_split_aux_data
{
struct dataset *dataset; /* The dataset of the split */
struct ccase prev_case; /* Data in previous case. */
struct casefile *casefile; /* Accumulates data for a split. */
- split_func *split; /* Function to call with the accumulated
+ split_func *split; /* Function to call with the accumulated
data. */
- void *func_aux; /* Auxiliary data. */
+ void *func_aux; /* Auxiliary data. */
};
static bool multipass_split_case_func (const struct ccase *c, void *aux_, const struct dataset *);
/* Returns true if successful, false if an I/O error occurred. */
bool
-multipass_procedure_with_splits (struct dataset *ds,
+multipass_procedure_with_splits (struct dataset *ds,
split_func *split,
void *func_aux)
{
ok = multipass_split_output (aux, ds);
/* Start a new casefile. */
- aux->casefile =
+ aux->casefile =
ds->cf_factory->create_casefile (ds->cf_factory,
dict_get_next_value_idx (ds->dict));
}
multipass_split_output (struct multipass_split_aux_data *aux, const struct dataset *ds)
{
bool ok;
-
+
assert (aux->casefile != NULL);
ok = aux->split (&aux->prev_case, aux->casefile, aux->func_aux, ds);
casefile_destroy (aux->casefile);
fh_set_default_handle (NULL);
ds->n_lag = 0;
-
+
free_case_source (ds->proc_source);
ds->proc_source = NULL;
+ if ( ds->replace_source )
+ ds->replace_source (ds->proc_source);
+
proc_cancel_all_transformations (ds);
}
and clears the permanent transformations.
For use by INPUT PROGRAM. */
struct trns_chain *
-proc_capture_transformations (struct dataset *ds)
+proc_capture_transformations (struct dataset *ds)
{
struct trns_chain *chain;
-
+
assert (ds->temporary_trns_chain == NULL);
chain = ds->permanent_trns_chain;
ds->cur_trns_chain = ds->permanent_trns_chain = trns_chain_create ();
FINALIZE will be called.
The functions are passed AUX as auxiliary data. */
void
-add_transformation_with_finalizer (struct dataset *ds,
+add_transformation_with_finalizer (struct dataset *ds,
trns_finalize_func *finalize,
trns_proc_func *proc,
trns_free_func *free, void *aux)
This value can be returned by a transformation procedure
function to indicate a "jump" to that transformation. */
size_t
-next_transformation (const struct dataset *ds)
+next_transformation (const struct dataset *ds)
{
return trns_chain_next (ds->cur_trns_chain);
}
a temporary transformation, false if it will add a permanent
transformation. */
bool
-proc_in_temporary_transformations (const struct dataset *ds)
+proc_in_temporary_transformations (const struct dataset *ds)
{
return ds->temporary_trns_chain != NULL;
}
Further calls to add_transformation() will add temporary
transformations. */
void
-proc_start_temporary_transformations (struct dataset *ds)
+proc_start_temporary_transformations (struct dataset *ds)
{
if (!proc_in_temporary_transformations (ds))
{
permanent.
Returns true if anything changed, false otherwise. */
bool
-proc_make_temporary_transformations_permanent (struct dataset *ds)
+proc_make_temporary_transformations_permanent (struct dataset *ds)
{
- if (proc_in_temporary_transformations (ds))
+ if (proc_in_temporary_transformations (ds))
{
trns_chain_finalize (ds->temporary_trns_chain);
trns_chain_splice (ds->permanent_trns_chain, ds->temporary_trns_chain);
transformations will be permanent.
Returns true if anything changed, false otherwise. */
bool
-proc_cancel_temporary_transformations (struct dataset *ds)
+proc_cancel_temporary_transformations (struct dataset *ds)
{
- if (proc_in_temporary_transformations (ds))
+ if (proc_in_temporary_transformations (ds))
{
dict_destroy (ds->dict);
ds->dict = ds->permanent_dict;
\f
/* Initializes procedure handling. */
struct dataset *
-create_dataset (struct casefile_factory *fact)
+create_dataset (struct casefile_factory *fact,
+ replace_source_callback *rps,
+ replace_dictionary_callback *rds
+ )
{
struct dataset *ds = xzalloc (sizeof(*ds));
ds->dict = dict_create ();
ds->cf_factory = fact;
+ ds->replace_source = rps;
+ ds->replace_dict = rds;
proc_cancel_all_transformations (ds);
return ds;
}
/* Sets SINK as the destination for procedure output from the
next procedure. */
void
-proc_set_sink (struct dataset *ds, struct case_sink *sink)
+proc_set_sink (struct dataset *ds, struct case_sink *sink)
{
assert (ds->proc_sink == NULL);
ds->proc_sink = sink;
/* Sets SOURCE as the source for procedure input for the next
procedure. */
void
-proc_set_source (struct dataset *ds, struct case_source *source)
+proc_set_source (struct dataset *ds, struct case_source *source)
{
assert (ds->proc_source == NULL);
ds->proc_source = source;
/* Returns true if a source for the next procedure has been
configured, false otherwise. */
bool
-proc_has_source (const struct dataset *ds)
+proc_has_source (const struct dataset *ds)
{
return ds->proc_source != NULL;
}
The returned casefile is owned by the caller; it will not be
automatically used for the next procedure's input. */
struct casefile *
-proc_capture_output (struct dataset *ds)
+proc_capture_output (struct dataset *ds)
{
struct casefile *casefile;
/* Adds a transformation that limits the number of cases that may
pass through, if DS->DICT has a case limit. */
static void
-add_case_limit_trns (struct dataset *ds)
+add_case_limit_trns (struct dataset *ds)
{
size_t case_limit = dict_get_case_limit (ds->dict);
if (case_limit != 0)
*CASES_REMAINING. */
static int
case_limit_trns_proc (void *cases_remaining_,
- struct ccase *c UNUSED, casenumber case_nr UNUSED)
+ struct ccase *c UNUSED, casenumber case_nr UNUSED)
{
size_t *cases_remaining = cases_remaining_;
- if (*cases_remaining > 0)
+ if (*cases_remaining > 0)
{
(*cases_remaining)--;
return TRNS_CONTINUE;
/* Frees the data associated with a case limit transformation. */
static bool
-case_limit_trns_free (void *cases_remaining_)
+case_limit_trns_free (void *cases_remaining_)
{
size_t *cases_remaining = cases_remaining_;
free (cases_remaining);
/* Adds a temporary transformation to filter data according to
the variable specified on FILTER, if any. */
static void
-add_filter_trns (struct dataset *ds)
+add_filter_trns (struct dataset *ds)
{
struct variable *filter_var = dict_get_filter (ds->dict);
- if (filter_var != NULL)
+ if (filter_var != NULL)
{
proc_start_temporary_transformations (ds);
add_transformation (ds, filter_trns_proc, NULL, filter_var);
/* FILTER transformation. */
static int
filter_trns_proc (void *filter_var_,
- struct ccase *c UNUSED, casenumber case_nr UNUSED)
-
+ struct ccase *c UNUSED, casenumber case_nr UNUSED)
+
{
struct variable *filter_var = filter_var_;
double f = case_num (c, filter_var);
}
-void
+void
dataset_set_dict (struct dataset *ds, struct dictionary *dict)
{
+ dict_copy_callbacks (dict, ds->dict);
ds->dict = dict;
+
+ if ( ds->replace_dict )
+ ds->replace_dict (dict);
}
-int
+int
dataset_n_lag (const struct dataset *ds)
{
return ds->n_lag;
}
-void
+void
dataset_set_n_lag (struct dataset *ds, int n_lag)
{
ds->n_lag = n_lag;
\f
/* Procedures. */
-struct dataset * create_dataset (struct casefile_factory *);
+struct dictionary ;
+typedef void replace_source_callback (struct case_source *);
+typedef void replace_dictionary_callback (struct dictionary *);
+
+
+struct dataset * create_dataset (struct casefile_factory *fact,
+ replace_source_callback *,
+ replace_dictionary_callback *
+ );
+
void destroy_dataset (struct dataset *);
struct casefile_factory *dataset_get_casefile_factory (const struct dataset *);
if ( ds == NULL )
{
- ds = create_dataset (NULL);
+ ds = create_dataset (NULL, NULL, NULL);
d = dataset_dict (ds);
}
+Mon Jan 1 10:37:07 WST 2007 John Darrington <john@darrington.wattle.id.au>
+
+ * psppire-case-file.c psppire-case-file.h: Changed the backend
+ semantics. An object is now created without any backend. A new function ( psppire_case_file_replace_flexifile ) sets the backend to use.
+
+ * psppire-data-store.c : Updated callers accordingly.
+
+ * psppire-dict.c psppire-dict.h : New function
+ (psppire_dict_replace_dictionary) .
+
+ * psppire.c : Updated to use new dataset replace_{source, dictionary}
+ callbacks.
+
+ * syntax-editor.c : parses in state CMD_STATE_DATA unless there are
+ no variables in the dictionary.
+
Mon Dec 25 12:38:24 WST 2006 John Darrington <john@darrington.wattle.id.au>
* data-editor.c data-editor.glade: Enabled deleting of variables from
* Creates a new #PsppireCaseFile.
*/
PsppireCaseFile*
-psppire_case_file_new (gint val_cnt)
+psppire_case_file_new (void)
{
PsppireCaseFile *cf = g_object_new (G_TYPE_PSPPIRE_CASE_FILE, NULL);
- cf->flexifile = flexifile_create (val_cnt);
-
return cf;
}
-/**
- * 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)
+void
+psppire_case_file_replace_flexifile (PsppireCaseFile *cf, 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)
{
/* -- PsppireCaseFile --- */
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);
-
+PsppireCaseFile *psppire_case_file_new (void);
gboolean psppire_case_file_insert_case (PsppireCaseFile *cf, struct ccase *c, gint row);
gboolean psppire_case_file_get_case (const PsppireCaseFile *cf, gint casenum,
struct ccase *c);
+void psppire_case_file_replace_flexifile (PsppireCaseFile *,
+ struct flexifile *);
+
+
G_END_DECLS
void
psppire_data_store_set_dictionary (PsppireDataStore *data_store, PsppireDict *dict)
{
- gint var_cnt = psppire_dict_get_next_value_idx (dict);
-
data_store->dict = dict;
if ( data_store->case_file)
data_store->case_file = 0;
}
- data_store->case_file = psppire_case_file_new (var_cnt);
+ data_store->case_file = psppire_case_file_new ();
g_signal_connect (data_store->case_file, "cases-deleted",
G_CALLBACK (delete_cases_callback),
iface->get_button_label = geometry_get_row_button_label;
}
+
}
+void
+psppire_dict_replace_dictionary (PsppireDict *dict, struct dictionary *d)
+{
+ dict->dict = d;
+}
+
+
/* Returns a valid name for a new variable in DICT.
The return value is statically allocated */
static gchar *
return dict_lookup_var (d->dict, name);
}
-
/* Clears the contents of D */
void
psppire_dict_clear (PsppireDict *d)
g_return_if_fail (d->dict);
{
- const gint n_vars = dict_get_var_cnt (d->dict);
-
dict_clear (d->dict);
}
}
-
/* Return true is NAME would be a valid name of a variable to add to the
dictionary. False otherwise.
If REPORT is true, then invalid names will be reported as such as errors
void psppire_dict_rename_var (PsppireDict *dict, struct variable *v,
const gchar *text);
+void psppire_dict_replace_dictionary (PsppireDict *, struct dictionary *);
+
G_END_DECLS
#include <libpspp/copyleft.h>
#include <data/file-handle-def.h>
#include <data/format.h>
+#include <data/storage-stream.h>
#include <data/settings.h>
#include <data/file-name.h>
#include <data/procedure.h>
#include <libpspp/getl.h>
#include <language/lexer/lexer.h>
+#include <ui/flexifile.h>
#include <getopt.h>
#include <gtk/gtk.h>
struct source_stream *the_source_stream ;
struct dataset * the_dataset = NULL;
+static void
+replace_dictionary (struct dictionary *d)
+{
+ psppire_dict_replace_dictionary (the_data_store->dict,
+ d);
+}
+
+
+static void
+replace_flexifile (struct case_source *s)
+{
+ if ( NULL == s )
+ psppire_case_file_replace_flexifile (the_data_store->case_file,
+ (struct flexifile *) flexifile_create (0));
+ else
+ psppire_case_file_replace_flexifile (the_data_store->case_file,
+ (struct flexifile *)
+ storage_source_get_casefile (s));
+}
+
int
main (int argc, char *argv[])
fn_getenv_default ("STAT_INCLUDE_PATH", include_path)
);
- the_dataset = create_dataset (factory);
+ the_dataset = create_dataset (factory,
+ replace_flexifile,
+ replace_dictionary);
message_dialog_init (the_source_stream);
- dictionary =
- psppire_dict_new_from_dict (
- dataset_dict (the_dataset)
- );
+ dictionary = psppire_dict_new_from_dict (
+ dataset_dict (the_dataset)
+ );
bind_textdomain_codeset (PACKAGE, "UTF-8");
the_data_store = psppire_data_store_new (dictionary);
+ proc_set_source (the_dataset,
+ storage_source_create (the_data_store->case_file->flexifile)
+ );
+
create_icon_factory ();
new_data_window (NULL, NULL);
#include "window-manager.h"
+#include <data/dictionary.h>
#include <language/lexer/lexer.h>
#include <language/command.h>
#include <data/procedure.h>
execute_syntax (const struct syntax_editor *se, GtkTextIter start,
GtkTextIter stop)
{
+ g_return_if_fail (proc_has_source (the_dataset));
+
getl_append_source (the_source_stream,
create_syntax_editor_source (se, start, stop));
for (;;)
{
+ const struct dictionary *dict = dataset_dict (the_dataset);
int result = cmd_parse (se->lexer, the_dataset,
- proc_has_source (the_dataset)
- ? CMD_STATE_DATA : CMD_STATE_INITIAL);
-
+ dict_get_var_cnt (dict) > 0 ?
+ CMD_STATE_DATA : CMD_STATE_INITIAL);
if (result == CMD_EOF || result == CMD_FINISH)
break;
}
factory = fastfile_factory_create ();
- the_dataset = create_dataset (factory);
+ the_dataset = create_dataset (factory, NULL, NULL);
if (parse_command_line (argc, argv, the_source_stream))
{