annotate src/specifier.h @ 22:8fc7fe29b841 r19-15b94

Import from CVS: tag r19-15b94
author cvs
date Mon, 13 Aug 2007 08:50:29 +0200
parents 376386a54a3c
children 9f59509498e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Generic specifier list implementation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Ben Wing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 #ifndef _XEMACS_SPECIFIER_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #define _XEMACS_SPECIFIER_H_
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 struct specifier_methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 CONST char *name;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 Lisp_Object predicate_symbol;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 /* Implementation specific methods: */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 /* #### Document me */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 /* Create method */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 void (*create_method) (Lisp_Object specifier);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 /* Mark method */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 void (*mark_method) (Lisp_Object specifier, void (*markobj) (Lisp_Object));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 /* Equal method */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 int (*equal_method) (Lisp_Object sp1, Lisp_Object sp2, int depth);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 /* Hash method */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 unsigned long (*hash_method) (Lisp_Object specifier, int depth);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 /* Validate method: Given an instantiator, verify that it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 valid for this specifier type. If not, signal an error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 If this functions is not present, all instantiators are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 considered valid. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 void (*validate_method) (Lisp_Object instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 /* Validate-matchspec method: Given a matchspec, verify that it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 valid for this specifier type. If not, signal an error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 If this functions is not present, *no* matchspecs are considered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 valid. Note that this differs from validate_method(). */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 void (*validate_matchspec_method) (Lisp_Object matchspec);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 /* Instantiate method */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 Lisp_Object (*instantiate_method) (Lisp_Object specifier,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 Lisp_Object matchspec,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 Lisp_Object domain,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 /* always an integer, but encapsulated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 as a Lisp_Object so it can be called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 from call_with_suspended_errors() */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 Lisp_Object depth);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 /* Going-to-add method: Called when an instantiator is about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 to be added to a specifier. This function can specify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 that different instantiators should be used instead by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 returning an inst-list (possibly containing zero elements).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 If the instantiator is fine as-is, return Qt. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 instantiator has been copied with copy-tree, so feel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 free to reuse parts of it to create a new instantiator.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 The tag-set, however, is not copied and is not canonicalized
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (that will be done on the result of this function).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 Lisp_Object (*going_to_add_method) (Lisp_Object specifier,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 Lisp_Object locale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 Lisp_Object tag_set,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 Lisp_Object instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 /* After-change method */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 void (*after_change_method) (Lisp_Object specifier,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 Lisp_Object locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 int extra_data_size;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 struct Lisp_Specifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 struct lcrecord_header header;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 struct specifier_methods *methods;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 /* we keep a chained list of all current specifiers, for GC cleanup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 purposes. Do NOT mark through this, or specifiers will never
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 be GC'd. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 Lisp_Object next_specifier;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 /* This is a straight list of instantiators. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 Lisp_Object global_specs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 /* These are all assoc lists where the key is type of object the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 list represents (buffer, window, etc.) and the associated list is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 the actual list of instantiators. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 Lisp_Object device_specs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 Lisp_Object frame_specs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 /* window_specs is actually a key-assoc weak list. See specifier.c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 for an explanation of why (it boils down to the fact that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 dead windows can become live again through window configurations).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 Lisp_Object window_specs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 Lisp_Object buffer_specs;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 struct specifier_caching *caching;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 Lisp_Object fallback;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 /* type-specific extra data attached to a specifier */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 char data[1];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 DECLARE_LRECORD (specifier, struct Lisp_Specifier);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 #define XSPECIFIER(x) XRECORD (x, specifier, struct Lisp_Specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 #define XSETSPECIFIER(x, p) XSETRECORD (x, p, specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 #define SPECIFIERP(x) RECORDP (x, specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 #define GC_SPECIFIERP(x) GC_RECORDP (x, specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 #define CHECK_SPECIFIER(x) CHECK_RECORD (x, specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 #define CONCHECK_SPECIFIER(x) CONCHECK_RECORD (x, specifier)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 /***** Calling a specifier method *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 #define RAW_SPECMETH(sp, m) ((sp)->methods->m##_method)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 #define HAS_SPECMETH_P(sp, m) (!!RAW_SPECMETH (sp, m))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 #define SPECMETH(sp, m, args) (((sp)->methods->m##_method) args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 /* Call a void-returning specifier method, if it exists */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 #define MAYBE_SPECMETH(sp, m, args) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 struct Lisp_Specifier *_maybe_specmeth_sp = (sp); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 if (HAS_SPECMETH_P (_maybe_specmeth_sp, m)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 SPECMETH (_maybe_specmeth_sp, m, args); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 MAC_DECLARE_EXTERN (struct Lisp_Specifier *, MTspecmeth_or_given)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 /* Call a specifier method, if it exists; otherwise return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 the specified value */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 #define SPECMETH_OR_GIVEN(sp, m, args, given) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 MAC_BEGIN \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 MAC_DECLARE (struct Lisp_Specifier *, MTspecmeth_or_given, sp) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 HAS_SPECMETH_P (MTspecmeth_or_given, m) ? \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 SPECMETH (MTspecmeth_or_given, m, args) : (given) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 MAC_END
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 /***** Defining new specifier types *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 #define DECLARE_SPECIFIER_TYPE(type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 extern struct specifier_methods * type##_specifier_methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 #define DEFINE_SPECIFIER_TYPE(type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 struct specifier_methods * type##_specifier_methods
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 #define INITIALIZE_SPECIFIER_TYPE(type, obj_name, pred_sym) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 type##_specifier_methods = \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 malloc_type_and_zero (struct specifier_methods); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 type##_specifier_methods->name = obj_name; \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 defsymbol (&type##_specifier_methods->predicate_symbol, \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 pred_sym); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 add_entry_to_specifier_type_list (Q##type, \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 type##_specifier_methods); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 } while (0) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 #define INITIALIZE_SPECIFIER_TYPE_WITH_DATA(type, obj_name, pred_sym) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 INITIALIZE_SPECIFIER_TYPE (type, obj_name, pred_sym); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 type##_specifier_methods->extra_data_size = \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 sizeof (struct type##_specifier); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 /* Declare that specifier-type TYPE has method M; used in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 initialization routines */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 #define SPECIFIER_HAS_METHOD(type, m) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (type##_specifier_methods->m##_method = type##_##m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 /***** Macros for accessing specifier types *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 #define SPECIFIER_TYPE_P(sp, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ((sp)->methods == type##_specifier_methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 #ifdef ERROR_CHECK_TYPECHECK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 MAC_DECLARE_EXTERN (struct Lisp_Specifier *, MTspecifier_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 # define SPECIFIER_TYPE_DATA(sp, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 MAC_BEGIN \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 MAC_DECLARE (struct Lisp_Specifier *, MTspecifier_data, sp) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 assert (SPECIFIER_TYPE_P (MTspecifier_data, type)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 MAC_SEP \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (struct type##_specifier *) MTspecifier_data->data \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 MAC_END
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 # define SPECIFIER_TYPE_DATA(sp, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ((struct type##_specifier *) (sp)->data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 /* #### Need to create ERROR_CHECKING versions of these. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 #define XSPECIFIER_TYPE(x, type) XSPECIFIER (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 #define XSETSPECIFIER_TYPE(x, p, type) XSETSPECIFIER (x, p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 #define SPECIFIER_TYPEP(x, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 #define CHECK_SPECIFIER_TYPE(x, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 CHECK_SPECIFIER (x); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 if (!(SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 type))) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 dead_wrong_type_argument \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (type##_specifier_methods->predicate_symbol, x); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 #define CONCHECK_SPECIFIER_TYPE(x, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 CONCHECK_SPECIFIER (x); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 if (!(SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 type))) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 x = wrong_type_argument \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (type##_specifier_methods->predicate_symbol, x); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 /***** Miscellaneous structures *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 enum spec_locale_type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 LOCALE_GLOBAL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 LOCALE_DEVICE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 LOCALE_FRAME,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 LOCALE_WINDOW,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 LOCALE_BUFFER
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 enum spec_add_meth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 SPEC_PREPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 SPEC_APPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 SPEC_REMOVE_TAG_SET_PREPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 SPEC_REMOVE_TAG_SET_APPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 SPEC_REMOVE_LOCALE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 SPEC_REMOVE_LOCALE_TYPE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 SPEC_REMOVE_ALL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 struct specifier_caching
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 int offset_into_struct_window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 void (*value_changed_in_window) (Lisp_Object specifier, struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 Lisp_Object oldval);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 int offset_into_struct_frame;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 void (*value_changed_in_frame) (Lisp_Object specifier, struct frame *f,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 Lisp_Object oldval);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 extern Lisp_Object decode_locale (Lisp_Object locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 extern Lisp_Object decode_locale_list (Lisp_Object locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 extern Lisp_Object decode_domain (Lisp_Object domain);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 extern enum spec_add_meth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 decode_how_to_add_specification (Lisp_Object how_to_add);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 extern Lisp_Object decode_specifier_tag_set (Lisp_Object tag_set);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 extern void add_entry_to_specifier_type_list (Lisp_Object symbol,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 struct specifier_methods *meths);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 extern void set_specifier_caching (Lisp_Object specifier,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 int struct_window_offset,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 void (*value_changed_in_window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (Lisp_Object specifier, struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 Lisp_Object oldval),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 int struct_frame_offset,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 void (*value_changed_in_frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (Lisp_Object specifier, struct frame *f,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 Lisp_Object oldval));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 extern void set_specifier_fallback (Lisp_Object specifier,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 Lisp_Object fallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 extern void recompute_all_cached_specifiers_in_window (struct window *w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 extern void recompute_all_cached_specifiers_in_frame (struct frame *f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 extern void cleanup_specifiers (void);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 extern void prune_specifiers (int (*obj_marked_p) (Lisp_Object));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 extern void setup_device_initial_specifier_tags (struct device *d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 void kill_specifier_buffer_locals (Lisp_Object buffer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 DECLARE_SPECIFIER_TYPE (generic);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 #define XGENERIC_SPECIFIER(x) XSPECIFIER_TYPE (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 #define XSETGENERIC_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 #define GENERIC_SPECIFIERP(x) SPECIFIER_TYPEP (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 #define CHECK_GENERIC_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 #define CONCHECK_GENERIC_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 DECLARE_SPECIFIER_TYPE (integer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 #define XINTEGER_SPECIFIER(x) XSPECIFIER_TYPE (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 #define XSETINTEGER_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 #define INTEGER_SPECIFIERP(x) SPECIFIER_TYPEP (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 #define CHECK_INTEGER_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 #define CONCHECK_INTEGER_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 DECLARE_SPECIFIER_TYPE (natnum);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 #define XNATNUM_SPECIFIER(x) XSPECIFIER_TYPE (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 #define XSETNATNUM_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 #define NATNUM_SPECIFIERP(x) SPECIFIER_TYPEP (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 #define CHECK_NATNUM_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 #define CONCHECK_NATNUM_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 DECLARE_SPECIFIER_TYPE (boolean);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 #define XBOOLEAN_SPECIFIER(x) XSPECIFIER_TYPE (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 #define XSETBOOLEAN_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 #define BOOLEAN_SPECIFIERP(x) SPECIFIER_TYPEP (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 #define CHECK_BOOLEAN_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 #define CONCHECK_BOOLEAN_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 #endif /* _XEMACS_SPECIFIER_H_ */