63ec88cb8e24e687a1cb55aa2af263797f78047e
[pspp] / src / data / vardict.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 1997-9, 2000, 2009 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef DATA_VARDICT_H
18 #define DATA_VARDICT_H 1
19
20 /* Interface between dictionary and variable code.
21    This header file should only be included by variable.c and
22    dictionary.c. */
23
24 struct dictionary ;
25
26 /* Dictionary data associated with variable. */
27 struct vardict_info
28   {
29     int dict_index;     /* Dictionary index containing the variable. */
30     int case_index;     /* Index into case of variable data. */
31     struct dictionary *dict;  /* The dictionary containing the variable */
32   };
33
34 /* Called by dictionary code, defined in variable.c. */
35 struct vardict_info *var_get_vardict (const struct variable *);
36 void var_set_vardict (struct variable *, struct vardict_info *);
37 bool var_has_vardict (const struct variable *);
38 void var_clear_vardict (struct variable *);
39
40 /* Called by variable.c, defined in dictionary.c. */
41 void dict_var_changed (const struct variable *v);
42 void dict_var_resized (const struct variable *v, int old_width);
43 void dict_var_display_width_changed (const struct variable *v);
44
45 static inline int
46 vardict_get_dict_index (const struct vardict_info *vardict)
47 {
48   return vardict->dict_index;
49 }
50
51 static inline int
52 vardict_get_case_index (const struct vardict_info *vardict)
53 {
54   return vardict->case_index;
55 }
56
57 static inline struct dictionary *
58 vardict_get_dictionary (const struct vardict_info *vardict)
59 {
60   return vardict->dict;
61 }
62
63 #endif /* data/vardict.h */