annotate src/specifier.h @ 260:052205f7dd5f

Added tag r20-5b28 for changeset 11cf20601dec
author cvs
date Mon, 13 Aug 2007 10:23:05 +0200
parents 3d6bfa290dbd
children c5d627a313b1
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
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 116
diff changeset
155 #define DECLARE_SPECIFIER_TYPE(type) \
0
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
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 116
diff changeset
158 #define DEFINE_SPECIFIER_TYPE(type) \
0
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
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 116
diff changeset
161 #define INITIALIZE_SPECIFIER_TYPE(type, obj_name, pred_sym) do { \
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 116
diff changeset
162 type##_specifier_methods = xnew_and_zero (struct specifier_methods); \
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 116
diff changeset
163 type##_specifier_methods->name = obj_name; \
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 116
diff changeset
164 defsymbol (&type##_specifier_methods->predicate_symbol, pred_sym); \
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 116
diff changeset
165 add_entry_to_specifier_type_list (Q##type, type##_specifier_methods); \
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 116
diff changeset
166 } while (0) \
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 #define INITIALIZE_SPECIFIER_TYPE_WITH_DATA(type, obj_name, pred_sym) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 INITIALIZE_SPECIFIER_TYPE (type, obj_name, pred_sym); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 type##_specifier_methods->extra_data_size = \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 sizeof (struct type##_specifier); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 /* Declare that specifier-type TYPE has method M; used in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 initialization routines */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 #define SPECIFIER_HAS_METHOD(type, m) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (type##_specifier_methods->m##_method = type##_##m)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 /***** Macros for accessing specifier types *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 #define SPECIFIER_TYPE_P(sp, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ((sp)->methods == type##_specifier_methods)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 #ifdef ERROR_CHECK_TYPECHECK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 MAC_DECLARE_EXTERN (struct Lisp_Specifier *, MTspecifier_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 # define SPECIFIER_TYPE_DATA(sp, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 MAC_BEGIN \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 MAC_DECLARE (struct Lisp_Specifier *, MTspecifier_data, sp) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 assert (SPECIFIER_TYPE_P (MTspecifier_data, type)) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 MAC_SEP \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (struct type##_specifier *) MTspecifier_data->data \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 MAC_END
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 # define SPECIFIER_TYPE_DATA(sp, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ((struct type##_specifier *) (sp)->data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 /* #### Need to create ERROR_CHECKING versions of these. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 #define XSPECIFIER_TYPE(x, type) XSPECIFIER (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 #define XSETSPECIFIER_TYPE(x, p, type) XSETSPECIFIER (x, p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 #define SPECIFIER_TYPEP(x, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 #define CHECK_SPECIFIER_TYPE(x, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 CHECK_SPECIFIER (x); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 if (!(SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 type))) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 dead_wrong_type_argument \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (type##_specifier_methods->predicate_symbol, x); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 #define CONCHECK_SPECIFIER_TYPE(x, type) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 do { \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 CONCHECK_SPECIFIER (x); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 if (!(SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 type))) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 x = wrong_type_argument \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (type##_specifier_methods->predicate_symbol, x); \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 } while (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 /***** Miscellaneous structures *****/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 enum spec_locale_type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 LOCALE_GLOBAL,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 LOCALE_DEVICE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 LOCALE_FRAME,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 LOCALE_WINDOW,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 LOCALE_BUFFER
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 enum spec_add_meth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 SPEC_PREPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 SPEC_APPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 SPEC_REMOVE_TAG_SET_PREPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 SPEC_REMOVE_TAG_SET_APPEND,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 SPEC_REMOVE_LOCALE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 SPEC_REMOVE_LOCALE_TYPE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 SPEC_REMOVE_ALL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 struct specifier_caching
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 int offset_into_struct_window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 void (*value_changed_in_window) (Lisp_Object specifier, struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 Lisp_Object oldval);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 int offset_into_struct_frame;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 void (*value_changed_in_frame) (Lisp_Object specifier, struct frame *f,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 Lisp_Object oldval);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 extern Lisp_Object decode_locale (Lisp_Object locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 extern Lisp_Object decode_locale_list (Lisp_Object locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 extern Lisp_Object decode_domain (Lisp_Object domain);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 extern enum spec_add_meth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 decode_how_to_add_specification (Lisp_Object how_to_add);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 extern Lisp_Object decode_specifier_tag_set (Lisp_Object tag_set);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 extern void add_entry_to_specifier_type_list (Lisp_Object symbol,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 struct specifier_methods *meths);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 extern void set_specifier_caching (Lisp_Object specifier,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 int struct_window_offset,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 void (*value_changed_in_window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (Lisp_Object specifier, struct window *w,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 Lisp_Object oldval),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 int struct_frame_offset,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 void (*value_changed_in_frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (Lisp_Object specifier, struct frame *f,
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 extern void set_specifier_fallback (Lisp_Object specifier,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 Lisp_Object fallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 extern void recompute_all_cached_specifiers_in_window (struct window *w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 extern void recompute_all_cached_specifiers_in_frame (struct frame *f);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 extern void cleanup_specifiers (void);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 extern void prune_specifiers (int (*obj_marked_p) (Lisp_Object));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 extern void setup_device_initial_specifier_tags (struct device *d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 void kill_specifier_buffer_locals (Lisp_Object buffer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 DECLARE_SPECIFIER_TYPE (generic);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 #define XGENERIC_SPECIFIER(x) XSPECIFIER_TYPE (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 #define XSETGENERIC_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 #define GENERIC_SPECIFIERP(x) SPECIFIER_TYPEP (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 #define CHECK_GENERIC_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 #define CONCHECK_GENERIC_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, generic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 DECLARE_SPECIFIER_TYPE (integer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 #define XINTEGER_SPECIFIER(x) XSPECIFIER_TYPE (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 #define XSETINTEGER_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 #define INTEGER_SPECIFIERP(x) SPECIFIER_TYPEP (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 #define CHECK_INTEGER_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 #define CONCHECK_INTEGER_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, integer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 DECLARE_SPECIFIER_TYPE (natnum);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 #define XNATNUM_SPECIFIER(x) XSPECIFIER_TYPE (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 #define XSETNATNUM_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 #define NATNUM_SPECIFIERP(x) SPECIFIER_TYPEP (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 #define CHECK_NATNUM_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 #define CONCHECK_NATNUM_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, natnum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 DECLARE_SPECIFIER_TYPE (boolean);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 #define XBOOLEAN_SPECIFIER(x) XSPECIFIER_TYPE (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 #define XSETBOOLEAN_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 #define BOOLEAN_SPECIFIERP(x) SPECIFIER_TYPEP (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 #define CHECK_BOOLEAN_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 #define CONCHECK_BOOLEAN_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, boolean)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
310 DECLARE_SPECIFIER_TYPE (display_table);
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
311 #define XDISPLAYTABLE_SPECIFIER(x) XSPECIFIER_TYPE (x, display_table)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
312 #define XSETDISPLAYTABLE_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, display_table)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
313 #define DISPLAYTABLE_SPECIFIERP(x) SPECIFIER_TYPEP (x, display_table)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
314 #define CHECK_DISPLAYTABLE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, display_table)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
315 #define CONCHECK_DISPLAYTABLE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, display_table)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 0
diff changeset
316
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 #endif /* _XEMACS_SPECIFIER_H_ */