20 |
#if !var_h |
#if !var_h |
21 |
#define var_h 1 |
#define var_h 1 |
22 |
|
|
23 |
|
|
24 |
#include <stddef.h> |
#include <stddef.h> |
25 |
|
#include "config.h" |
26 |
#include "bool.h" |
#include "bool.h" |
27 |
#include "format.h" |
#include "format.h" |
28 |
#include "val.h" |
#include "val.h" |
29 |
|
|
30 |
|
|
31 |
|
|
32 |
/* Script variables. */ |
/* Script variables. */ |
33 |
|
|
34 |
/* Variable type. */ |
/* Variable type. */ |
58 |
MISSING_COUNT |
MISSING_COUNT |
59 |
}; |
}; |
60 |
|
|
|
#define MAX_VAR_NAME_LEN 8 |
|
61 |
|
|
62 |
/* A variable's dictionary entry. */ |
/* A variable's dictionary entry. */ |
63 |
struct variable |
struct variable |
64 |
{ |
{ |
65 |
char name[MAX_VAR_NAME_LEN + 1]; /* As a string. */ |
char name[SHORT_NAME_LEN + 1]; /* As a string. */ |
66 |
|
char *longname; /* Pointer to entry in dictionary's table */ |
67 |
int index; /* Index into its dictionary's var[]. */ |
int index; /* Index into its dictionary's var[]. */ |
68 |
int type; /* NUMERIC or ALPHA. */ |
int type; /* NUMERIC or ALPHA. */ |
69 |
|
|
84 |
struct val_labs *val_labs; /* Value labels. */ |
struct val_labs *val_labs; /* Value labels. */ |
85 |
char *label; /* Variable label. */ |
char *label; /* Variable label. */ |
86 |
|
|
87 |
|
|
88 |
|
/* GUI display parameters */ |
89 |
|
enum measure measure; /* Nominal ordinal or continuous */ |
90 |
|
int display_width; /* Width of data editor column */ |
91 |
|
enum alignment alignment; /* Alignment of data in gui */ |
92 |
|
|
93 |
/* Per-command info. */ |
/* Per-command info. */ |
94 |
void *aux; |
void *aux; |
95 |
void (*aux_dtor) (struct variable *); |
void (*aux_dtor) (struct variable *); |
96 |
}; |
}; |
97 |
|
|
98 |
|
|
99 |
|
/* A tuple containing short names and longnames */ |
100 |
|
struct name_table_entry |
101 |
|
{ |
102 |
|
char *longname; |
103 |
|
char *name; |
104 |
|
}; |
105 |
|
|
106 |
bool var_is_valid_name (const char *, bool issue_error); |
bool var_is_valid_name (const char *, bool issue_error); |
107 |
int compare_var_names (const void *, const void *, void *); |
int compare_var_names (const void *, const void *, void *); |
108 |
unsigned hash_var_name (const void *, void *); |
unsigned hash_var_name (const void *, void *); |
109 |
|
|
110 |
|
|
111 |
|
unsigned hash_long_name (const void *e_, void *aux UNUSED) ; |
112 |
|
int compare_long_names(const void *a_, const void *b_, void *aux); |
113 |
|
|
114 |
|
|
115 |
int compare_var_ptr_names (const void *, const void *, void *); |
int compare_var_ptr_names (const void *, const void *, void *); |
116 |
unsigned hash_var_ptr_name (const void *, void *); |
unsigned hash_var_ptr_name (const void *, void *); |
117 |
|
|
136 |
struct vector |
struct vector |
137 |
{ |
{ |
138 |
int idx; /* Index for dict_get_vector(). */ |
int idx; /* Index for dict_get_vector(). */ |
139 |
char name[9]; /* Name. */ |
char name[SHORT_NAME_LEN + 1]; /* Name. */ |
140 |
struct variable **var; /* Vector of variables. */ |
struct variable **var; /* Vector of variables. */ |
141 |
int cnt; /* Number of variables. */ |
int cnt; /* Number of variables. */ |
142 |
}; |
}; |