On Thu, Sep 11, 2008 at 09:40:10AM -0700, Ben Pfaff wrote:
OK. Do you want to propose it? You are more familiar with your
proposed use case than I am.My proposed patch is attached. J' -- PGP Public key ID: 1024D/2DE827B3 fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://pgp.mit.edu or any PGP keyserver for public key.
diff --git a/po/en_GB.po b/po/en_GB.po
index 4cef93a..b6911c9 100644
--- a/po/en_GB.po
+++ b/po/en_GB.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PSPP 0.4.3\n"
"Report-Msgid-Bugs-To: [EMAIL PROTECTED]"
-"POT-Creation-Date: 2008-09-13 07:24+0800\n"
+"POT-Creation-Date: 2008-09-13 08:26+0800\n"
"PO-Revision-Date: 2007-09-15 08:29+0800\n"
"Last-Translator: John Darrington <[EMAIL PROTECTED]>\n"
"Language-Team: John Darrington <[EMAIL PROTECTED]>\n"
@@ -976,28 +976,28 @@ msgstr ""
msgid "An I/O error occurred writing system file \"%s\"."
msgstr ""
-#: src/data/variable.c:209
+#: src/data/variable.c:225
#, c-format
msgid ""
"Character `%c' (in %s) may not appear as the first character in a variable "
"name."
msgstr ""
-#: src/data/variable.c:221
+#: src/data/variable.c:237
#, c-format
msgid "Character `%c' (in %s) may not appear in a variable name."
msgstr ""
-#: src/data/variable.c:249
+#: src/data/variable.c:265
msgid "Variable name cannot be empty string."
msgstr ""
-#: src/data/variable.c:255
+#: src/data/variable.c:271
#, c-format
msgid "Variable name %s exceeds %d-character limit."
msgstr ""
-#: src/data/variable.c:263
+#: src/data/variable.c:279
#, c-format
msgid "`%s' may not be used as a variable name because it is a reserved word."
msgstr ""
diff --git a/src/data/variable.c b/src/data/variable.c
index a455e40..e39692a 100644
--- a/src/data/variable.c
+++ b/src/data/variable.c
@@ -142,6 +142,23 @@ var_clone (const struct variable *old_var)
return new_var;
}
+/* Create a variable to be used for internal calculations only */
+struct variable *
+var_create_internal (int case_idx)
+{
+ struct variable *v = var_create ("$internal", 0);
+
+ struct vardict_info vdi;
+
+ vdi.dict = NULL;
+ vdi.dict_index = 0;
+ vdi.case_index = case_idx;
+
+ var_set_vardict (v, &vdi);
+
+ return v;
+}
+
/* Destroys variable V.
V must not belong to a dictionary. If it does, use
dict_delete_var instead. */
@@ -150,7 +167,11 @@ var_destroy (struct variable *v)
{
if (v != NULL)
{
- assert (!var_has_vardict (v));
+ if (var_has_vardict (v))
+ {
+ const struct vardict_info *vdi = var_get_vardict (v);
+ assert (vdi->dict == NULL);
+ }
cat_stored_values_destroy (v->obs_vals);
var_clear_short_names (v);
var_clear_aux (v);
diff --git a/src/data/variable.h b/src/data/variable.h
index c7f86aa..d2820d3 100644
--- a/src/data/variable.h
+++ b/src/data/variable.h
@@ -32,6 +32,8 @@ union value;
struct variable *var_create (const char *name, int width);
struct variable *var_clone (const struct variable *);
void var_destroy (struct variable *);
+struct variable *var_create_internal (int case_idx);
+
/* Variable names. */
#define VAR_NAME_LEN 64 /* Maximum length of variable name, in bytes. */
signature.asc
Description: Digital signature
_______________________________________________ pspp-dev mailing list [email protected] http://lists.gnu.org/mailman/listinfo/pspp-dev
