Rewrite expression code.
[pspp-builds.git] / src / var.h
index 46a0efc5fc0a061d83f315ec9f6cacb93741efa9..fadda24954622742a7a5c5fec3ace0d6e3bd29bd 100644 (file)
--- a/src/var.h
+++ b/src/var.h
 #include "format.h"
 #include "val.h"
 
-/* Frequency tables. */
-
-/* Frequency table entry. */
-struct freq
-  {
-    union value v;             /* The value. */
-    double c;                  /* The number of occurrences of the value. */
-  };
-
-/* Types of frequency tables. */
-enum
-  {
-    FRQM_GENERAL,
-    FRQM_INTEGER
-  };
-
-/* Entire frequency table. */
-struct freq_tab
-  {
-    int mode;                  /* FRQM_GENERAL or FRQM_INTEGER. */
-
-    /* General mode. */
-    struct hsh_table *data;    /* Undifferentiated data. */
-
-    /* Integer mode. */
-    double *vector;            /* Frequencies proper. */
-    int min, max;              /* The boundaries of the table. */
-    double out_of_range;       /* Sum of weights of out-of-range values. */
-    double sysmis;             /* Sum of weights of SYSMIS values. */
-
-    /* All modes. */
-    struct freq *valid;         /* Valid freqs. */
-    int n_valid;               /* Number of total freqs. */
-
-    struct freq *missing;      /* Missing freqs. */
-    int n_missing;             /* Number of missing freqs. */
-
-    /* Statistics. */
-    double total_cases;                /* Sum of weights of all cases. */
-    double valid_cases;                /* Sum of weights of valid cases. */
-  };
-\f
 /* Script variables. */
 
 /* Variable type. */
@@ -95,10 +53,12 @@ enum
     MISSING_COUNT
   };
 
+#define MAX_VAR_NAME_LEN 8
+
 /* A variable's dictionary entry.  */
 struct variable
   {
-    char name[9];              /* As a string. */
+    char name[MAX_VAR_NAME_LEN + 1]; /* As a string. */
     int index;                 /* Index into its dictionary's var[]. */
     int type;                   /* NUMERIC or ALPHA. */
 
@@ -124,8 +84,10 @@ struct variable
     void (*aux_dtor) (struct variable *);
   };
 
-int compare_variables (const void *, const void *, void *);
-unsigned hash_variable (const void *, void *);
+int compare_var_names (const void *, const void *, void *);
+unsigned hash_var_name (const void *, void *);
+int compare_var_ptr_names (const void *, const void *, void *);
+unsigned hash_var_ptr_name (const void *, void *);
 
 void *var_attach_aux (struct variable *,
                       void *aux, void (*aux_dtor) (struct variable *));
@@ -238,6 +200,7 @@ size_t var_set_get_cnt (const struct var_set *vs);
 struct variable *var_set_get_var (const struct var_set *vs, size_t idx);
 struct variable *var_set_lookup_var (const struct var_set *vs,
                                      const char *name);
+int var_set_lookup_var_idx (const struct var_set *vs, const char *name);
 void var_set_destroy (struct var_set *vs);
 \f
 /* Variable parsers. */