0
|
1 /* Primitive operations on Lisp data types for XEmacs Lisp interpreter.
|
|
2 Copyright (C) 1985, 1986, 1988, 1992, 1993, 1994, 1995
|
|
3 Free Software Foundation, Inc.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Mule 2.0, FSF 19.30. Some of FSF's data.c is in
|
|
23 XEmacs' symbols.c. */
|
|
24
|
|
25 /* This file has been Mule-ized. */
|
|
26
|
|
27 #include <config.h>
|
|
28 #include "lisp.h"
|
|
29
|
|
30 #include "buffer.h"
|
|
31 #include "bytecode.h"
|
|
32
|
|
33 #include "syssignal.h"
|
|
34 #ifdef LISP_FLOAT_TYPE
|
|
35 /* Need to define a differentiating symbol -- see sysfloat.h */
|
|
36 # define THIS_FILENAME data_c
|
|
37 # include "sysfloat.h"
|
|
38 #endif /* LISP_FLOAT_TYPE */
|
|
39
|
|
40 Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound;
|
|
41 Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
|
|
42 Lisp_Object Qsignal, Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range;
|
|
43 Lisp_Object Qvoid_variable, Qcyclic_variable_indirection;
|
|
44 Lisp_Object Qvoid_function, Qcyclic_function_indirection;
|
|
45 Lisp_Object Qsetting_constant, Qinvalid_read_syntax;
|
|
46 Lisp_Object Qmalformed_list, Qmalformed_property_list;
|
|
47 Lisp_Object Qcircular_list, Qcircular_property_list;
|
|
48 Lisp_Object Qinvalid_function, Qwrong_number_of_arguments, Qno_catch;
|
|
49 Lisp_Object Qio_error, Qend_of_file;
|
|
50 Lisp_Object Qarith_error, Qrange_error, Qdomain_error;
|
|
51 Lisp_Object Qsingularity_error, Qoverflow_error, Qunderflow_error;
|
|
52 Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;
|
|
53 Lisp_Object Qintegerp, Qnatnump, Qsymbolp, Qkeywordp, Qlistp, Qconsp, Qsubrp;
|
|
54 Lisp_Object Qcharacterp, Qstringp, Qarrayp, Qsequencep, Qbufferp;
|
|
55 Lisp_Object Qcompiled_functionp;
|
|
56 Lisp_Object Qchar_or_string_p, Qmarkerp, Qinteger_or_marker_p, Qvectorp;
|
|
57 Lisp_Object Qinteger_or_char_p, Qinteger_char_or_marker_p;
|
|
58 Lisp_Object Qbit_vectorp, Qbitp;
|
|
59
|
|
60 /* Qstring, Qinteger, Qsymbol, Qvector defined in general.c */
|
|
61 Lisp_Object Qcons, Qkeyword;
|
|
62
|
|
63 Lisp_Object Qcdr;
|
|
64
|
|
65 Lisp_Object Qignore;
|
|
66
|
|
67 #ifdef LISP_FLOAT_TYPE
|
|
68 Lisp_Object Qfloatp;
|
|
69 #endif
|
|
70 Lisp_Object Qnumberp, Qnumber_or_marker_p, Qnumber_char_or_marker_p;
|
|
71
|
|
72 Lisp_Object Qweak_listp;
|
|
73
|
|
74 Lisp_Object
|
|
75 wrong_type_argument (Lisp_Object predicate, Lisp_Object value)
|
|
76 {
|
|
77 /* This function can GC */
|
|
78 REGISTER Lisp_Object tem;
|
|
79 do
|
|
80 {
|
|
81 #ifdef MOCKLISP_SUPPORT
|
|
82 if (!EQ (Vmocklisp_arguments, Qt))
|
|
83 {
|
|
84 if (STRINGP (value) &&
|
|
85 (EQ (predicate, Qintegerp) ||
|
|
86 EQ (predicate, Qinteger_or_marker_p) ||
|
|
87 EQ (predicate, Qinteger_char_or_marker_p)))
|
|
88 return Fstring_to_number (value);
|
|
89 if (INTP (value) && EQ (predicate, Qstringp))
|
|
90 return Fnumber_to_string (value);
|
|
91 if (CHARP (value) && EQ (predicate, Qstringp))
|
|
92 return Fchar_to_string (value);
|
|
93 }
|
16
|
94 #endif /* MOCKLISP_SUPPORT */
|
0
|
95 value = Fsignal (Qwrong_type_argument, list2 (predicate, value));
|
|
96 tem = call1 (predicate, value);
|
|
97 }
|
|
98 while (NILP (tem));
|
|
99 return value;
|
|
100 }
|
|
101
|
|
102 DOESNT_RETURN
|
|
103 dead_wrong_type_argument (Lisp_Object predicate, Lisp_Object value)
|
|
104 {
|
|
105 signal_error (Qwrong_type_argument, list2 (predicate, value));
|
|
106 }
|
|
107
|
|
108 DEFUN ("wrong-type-argument", Fwrong_type_argument, Swrong_type_argument,
|
|
109 2, 2, 0 /*
|
|
110 Signal an error until the correct type value is given by the user.
|
|
111 This function loops, signalling a continuable `wrong-type-argument' error
|
|
112 with PREDICATE and VALUE as the data associated with the error and then
|
|
113 calling PREDICATE on the returned value, until the value gotten satisfies
|
|
114 PREDICATE. At that point, the gotten value is returned.
|
|
115 */ )
|
|
116 (predicate, value)
|
|
117 Lisp_Object predicate, value;
|
|
118 {
|
|
119 return wrong_type_argument (predicate, value);
|
|
120 }
|
|
121
|
|
122 DOESNT_RETURN
|
|
123 pure_write_error (void)
|
|
124 {
|
|
125 error ("Attempt to modify read-only object");
|
|
126 }
|
|
127
|
|
128 DOESNT_RETURN
|
|
129 args_out_of_range (Lisp_Object a1, Lisp_Object a2)
|
|
130 {
|
|
131 signal_error (Qargs_out_of_range, list2 (a1, a2));
|
|
132 }
|
|
133
|
|
134 DOESNT_RETURN
|
|
135 args_out_of_range_3 (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3)
|
|
136 {
|
|
137 signal_error (Qargs_out_of_range, list3 (a1, a2, a3));
|
|
138 }
|
|
139
|
|
140 void
|
|
141 check_int_range (int val, int min, int max)
|
|
142 {
|
|
143 if (val < min || val > max)
|
|
144 args_out_of_range_3 (make_int (val), make_int (min),
|
|
145 make_int (max));
|
|
146 }
|
|
147
|
|
148 #ifndef make_int
|
|
149 Lisp_Object
|
|
150 make_int (EMACS_INT num)
|
|
151 {
|
|
152 Lisp_Object val;
|
|
153 /* Don't use XSETINT here -- it's defined in terms of make_int (). */
|
|
154 XSETOBJ (val, Lisp_Int, num);
|
|
155 return val;
|
|
156 }
|
|
157 #endif /* ! defined (make_int) */
|
|
158
|
|
159 /* On some machines, XINT needs a temporary location.
|
|
160 Here it is, in case it is needed. */
|
|
161
|
|
162 EMACS_INT sign_extend_temp;
|
|
163
|
|
164 /* On a few machines, XINT can only be done by calling this. */
|
|
165 /* XEmacs: only used by m/convex.h */
|
|
166 int sign_extend_lisp_int (EMACS_INT num);
|
|
167 int
|
|
168 sign_extend_lisp_int (EMACS_INT num)
|
|
169 {
|
|
170 if (num & (1L << (VALBITS - 1)))
|
|
171 return num | ((-1L) << VALBITS);
|
|
172 else
|
|
173 return num & ((1L << VALBITS) - 1);
|
|
174 }
|
|
175
|
|
176 /* characters do not need to sign extend so there's no need for special
|
|
177 futzing like with ints. */
|
|
178 Lisp_Object
|
|
179 make_char (Emchar num)
|
|
180 {
|
16
|
181 Lisp_Object val;
|
|
182 val = make_int (num);
|
|
183 return val;
|
0
|
184 }
|
|
185
|
|
186 /* Data type predicates */
|
|
187
|
|
188 DEFUN ("eq", Feq, Seq, 2, 2, 0 /*
|
|
189 T if the two args are the same Lisp object.
|
|
190 */ )
|
|
191 (obj1, obj2)
|
|
192 Lisp_Object obj1, obj2;
|
|
193 {
|
16
|
194 return EQ (obj1, obj2) ? Qt : Qnil;
|
0
|
195 }
|
|
196
|
|
197 DEFUN ("null", Fnull, Snull, 1, 1, 0 /*
|
|
198 T if OBJECT is nil.
|
|
199 */ )
|
|
200 (object)
|
|
201 Lisp_Object object;
|
|
202 {
|
16
|
203 return NILP (object) ? Qt : Qnil;
|
0
|
204 }
|
|
205
|
|
206 DEFUN ("consp", Fconsp, Sconsp, 1, 1, 0 /*
|
|
207 T if OBJECT is a cons cell.
|
|
208 */ )
|
|
209 (object)
|
|
210 Lisp_Object object;
|
|
211 {
|
16
|
212 return CONSP (object) ? Qt : Qnil;
|
0
|
213 }
|
|
214
|
|
215 DEFUN ("atom", Fatom, Satom, 1, 1, 0 /*
|
|
216 T if OBJECT is not a cons cell. This includes nil.
|
|
217 */ )
|
|
218 (object)
|
|
219 Lisp_Object object;
|
|
220 {
|
16
|
221 return CONSP (object) ? Qnil : Qt;
|
0
|
222 }
|
|
223
|
|
224 DEFUN ("listp", Flistp, Slistp, 1, 1, 0 /*
|
|
225 T if OBJECT is a list. This includes nil.
|
|
226 */ )
|
|
227 (object)
|
|
228 Lisp_Object object;
|
|
229 {
|
16
|
230 return (CONSP (object) || NILP (object)) ? Qt : Qnil;
|
0
|
231 }
|
|
232
|
|
233 DEFUN ("nlistp", Fnlistp, Snlistp, 1, 1, 0 /*
|
|
234 T if OBJECT is not a list. Lists include nil.
|
|
235 */ )
|
|
236 (object)
|
|
237 Lisp_Object object;
|
|
238 {
|
16
|
239 return (CONSP (object) || NILP (object)) ? Qnil : Qt;
|
0
|
240 }
|
|
241
|
|
242 DEFUN ("symbolp", Fsymbolp, Ssymbolp, 1, 1, 0 /*
|
|
243 T if OBJECT is a symbol.
|
|
244 */ )
|
|
245 (object)
|
|
246 Lisp_Object object;
|
|
247 {
|
16
|
248 return SYMBOLP (object) ? Qt : Qnil;
|
0
|
249 }
|
|
250
|
|
251 DEFUN ("keywordp", Fkeywordp, Skeywordp, 1, 1, 0 /*
|
|
252 T if OBJECT is a keyword.
|
|
253 */ )
|
|
254 (object)
|
|
255 Lisp_Object object;
|
|
256 {
|
16
|
257 return KEYWORDP (object) ? Qt : Qnil;
|
0
|
258 }
|
|
259
|
|
260 DEFUN ("vectorp", Fvectorp, Svectorp, 1, 1, 0 /*
|
|
261 T if OBJECT is a vector.
|
|
262 */ )
|
|
263 (object)
|
|
264 Lisp_Object object;
|
|
265 {
|
16
|
266 return VECTORP (object) ? Qt : Qnil;
|
0
|
267 }
|
|
268
|
|
269 DEFUN ("bit-vector-p", Fbit_vector_p, Sbit_vector_p, 1, 1, 0 /*
|
|
270 T if OBJECT is a bit vector.
|
|
271 */ )
|
|
272 (object)
|
|
273 Lisp_Object object;
|
|
274 {
|
16
|
275 return BIT_VECTORP (object) ? Qt : Qnil;
|
0
|
276 }
|
|
277
|
|
278 DEFUN ("stringp", Fstringp, Sstringp, 1, 1, 0 /*
|
|
279 T if OBJECT is a string.
|
|
280 */ )
|
|
281 (object)
|
|
282 Lisp_Object object;
|
|
283 {
|
16
|
284 return STRINGP (object) ? Qt : Qnil;
|
0
|
285 }
|
|
286
|
|
287 DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0 /*
|
|
288 T if OBJECT is an array (string, vector, or bit vector).
|
|
289 */ )
|
|
290 (object)
|
|
291 Lisp_Object object;
|
|
292 {
|
16
|
293 return (VECTORP (object) ||
|
|
294 STRINGP (object) ||
|
|
295 BIT_VECTORP (object))
|
|
296 ? Qt : Qnil;
|
0
|
297 }
|
|
298
|
|
299 DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0 /*
|
|
300 T if OBJECT is a sequence (list or array).
|
|
301 */ )
|
|
302 (object)
|
|
303 Lisp_Object object;
|
|
304 {
|
16
|
305 return (CONSP (object) ||
|
|
306 NILP (object) ||
|
|
307 VECTORP (object) ||
|
|
308 STRINGP (object) ||
|
|
309 BIT_VECTORP (object))
|
|
310 ? Qt : Qnil;
|
0
|
311 }
|
|
312
|
|
313 DEFUN ("markerp", Fmarkerp, Smarkerp, 1, 1, 0 /*
|
|
314 T if OBJECT is a marker (editor pointer).
|
|
315 */ )
|
|
316 (object)
|
|
317 Lisp_Object object;
|
|
318 {
|
16
|
319 return MARKERP (object) ? Qt : Qnil;
|
0
|
320 }
|
|
321
|
|
322 DEFUN ("subrp", Fsubrp, Ssubrp, 1, 1, 0 /*
|
|
323 T if OBJECT is a built-in function.
|
|
324 */ )
|
|
325 (object)
|
|
326 Lisp_Object object;
|
|
327 {
|
16
|
328 return SUBRP (object) ? Qt : Qnil;
|
0
|
329 }
|
|
330
|
|
331 DEFUN ("subr-min-args", Fsubr_min_args, Ssubr_min_args, 1, 1, 0 /*
|
|
332 Return minimum number of args built-in function SUBR may be called with.
|
|
333 */ )
|
|
334 (subr)
|
|
335 Lisp_Object subr;
|
|
336 {
|
|
337 CHECK_SUBR (subr);
|
|
338 return make_int (XSUBR (subr)->min_args);
|
|
339 }
|
|
340
|
|
341 DEFUN ("subr-max-args", Fsubr_max_args, Ssubr_max_args, 1, 1, 0 /*
|
|
342 Return maximum number of args built-in function SUBR may be called with,
|
16
|
343 or nil if it takes an arbitrary number of arguments or is a special form.
|
0
|
344 */ )
|
|
345 (subr)
|
|
346 Lisp_Object subr;
|
|
347 {
|
|
348 int nargs;
|
|
349 CHECK_SUBR (subr);
|
|
350 nargs = XSUBR (subr)->max_args;
|
|
351 if (nargs == MANY || nargs == UNEVALLED)
|
|
352 return Qnil;
|
|
353 else
|
|
354 return make_int (nargs);
|
|
355 }
|
|
356
|
|
357 DEFUN ("compiled-function-p", Fcompiled_function_p, Scompiled_function_p, 1, 1, 0 /*
|
|
358 t if OBJECT is a byte-compiled function object.
|
|
359 */ )
|
|
360 (object)
|
|
361 Lisp_Object object;
|
|
362 {
|
16
|
363 return COMPILED_FUNCTIONP (object) ? Qt : Qnil;
|
0
|
364 }
|
|
365
|
|
366
|
|
367 DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 1, 0 /*
|
|
368 t if OBJECT is a character.
|
|
369 A character is an integer that can be inserted into a buffer with
|
|
370 `insert-char'. All integers are considered valid characters and are
|
|
371 modded with 256 to get the actual character to use.
|
|
372 */ )
|
|
373 (object)
|
|
374 Lisp_Object object;
|
|
375 {
|
16
|
376 return CHARP (object) ? Qt : Qnil;
|
0
|
377 }
|
|
378
|
|
379 DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0 /*
|
|
380 t if OBJECT is a character or a string.
|
|
381 */ )
|
|
382 (object)
|
|
383 Lisp_Object object;
|
|
384 {
|
16
|
385 return CHAR_OR_CHAR_INTP (object) || STRINGP (object) ? Qt : Qnil;
|
0
|
386 }
|
|
387
|
|
388 DEFUN ("integerp", Fintegerp, Sintegerp, 1, 1, 0 /*
|
|
389 t if OBJECT is an integer.
|
|
390 */ )
|
|
391 (object)
|
|
392 Lisp_Object object;
|
|
393 {
|
16
|
394 return INTP (object) ? Qt : Qnil;
|
0
|
395 }
|
|
396
|
|
397 DEFUN ("integer-or-marker-p", Finteger_or_marker_p, Sinteger_or_marker_p,
|
|
398 1, 1, 0 /*
|
|
399 t if OBJECT is an integer or a marker (editor pointer).
|
|
400 */ )
|
|
401 (object)
|
|
402 Lisp_Object object;
|
|
403 {
|
16
|
404 return INTP (object) || MARKERP (object) ? Qt : Qnil;
|
0
|
405 }
|
|
406
|
|
407 DEFUN ("natnump", Fnatnump, Snatnump, 1, 1, 0 /*
|
|
408 t if OBJECT is a nonnegative integer.
|
|
409 */ )
|
|
410 (object)
|
|
411 Lisp_Object object;
|
|
412 {
|
16
|
413 return NATNUMP (object) ? Qt : Qnil;
|
0
|
414 }
|
|
415
|
|
416 DEFUN ("bitp", Fbitp, Sbitp, 1, 1, 0 /*
|
|
417 t if OBJECT is a bit (0 or 1).
|
|
418 */ )
|
|
419 (object)
|
|
420 Lisp_Object object;
|
|
421 {
|
16
|
422 return BITP (object) ? Qt : Qnil;
|
0
|
423 }
|
|
424
|
|
425 DEFUN ("numberp", Fnumberp, Snumberp, 1, 1, 0 /*
|
|
426 t if OBJECT is a number (floating point or integer).
|
|
427 */ )
|
|
428 (object)
|
|
429 Lisp_Object object;
|
|
430 {
|
16
|
431 return INT_OR_FLOATP (object) ? Qt : Qnil;
|
0
|
432 }
|
|
433
|
|
434 DEFUN ("number-or-marker-p", Fnumber_or_marker_p, Snumber_or_marker_p, 1, 1, 0 /*
|
|
435 t if OBJECT is a number or a marker.
|
|
436 */ )
|
|
437 (object)
|
|
438 Lisp_Object object;
|
|
439 {
|
16
|
440 return INT_OR_FLOATP (object) || MARKERP (object) ? Qt : Qnil;
|
0
|
441 }
|
|
442
|
|
443 #ifdef LISP_FLOAT_TYPE
|
|
444 DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0 /*
|
|
445 t if OBJECT is a floating point number.
|
|
446 */ )
|
|
447 (object)
|
|
448 Lisp_Object object;
|
|
449 {
|
16
|
450 return FLOATP (object) ? Qt : Qnil;
|
0
|
451 }
|
|
452 #endif /* LISP_FLOAT_TYPE */
|
|
453
|
|
454 DEFUN ("type-of", Ftype_of, Stype_of, 1, 1, 0 /*
|
|
455 Return a symbol representing the type of OBJECT.
|
|
456 */ )
|
|
457 (object)
|
|
458 Lisp_Object object;
|
|
459 {
|
16
|
460 if (CONSP (object)) return Qcons;
|
|
461 if (SYMBOLP (object)) return Qsymbol;
|
|
462 if (KEYWORDP (object)) return Qkeyword;
|
|
463 if (INTP (object)) return Qinteger;
|
|
464 if (STRINGP (object)) return Qstring;
|
|
465 if (VECTORP (object)) return Qvector;
|
|
466
|
0
|
467 assert (LRECORDP (object));
|
|
468 return intern (XRECORD_LHEADER (object)->implementation->name);
|
|
469 }
|
|
470
|
|
471
|
|
472 /* Extract and set components of lists */
|
|
473
|
|
474 DEFUN ("car", Fcar, Scar, 1, 1, 0 /*
|
|
475 Return the car of LIST. If arg is nil, return nil.
|
|
476 Error if arg is not nil and not a cons cell. See also `car-safe'.
|
|
477 */ )
|
|
478 (list)
|
|
479 Lisp_Object list;
|
|
480 {
|
|
481 while (1)
|
|
482 {
|
|
483 if (CONSP (list))
|
|
484 return XCAR (list);
|
|
485 else if (NILP (list))
|
|
486 return Qnil;
|
|
487 else
|
|
488 list = wrong_type_argument (Qconsp, list);
|
|
489 }
|
|
490 }
|
|
491
|
|
492 DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0 /*
|
|
493 Return the car of OBJECT if it is a cons cell, or else nil.
|
|
494 */ )
|
|
495 (object)
|
|
496 Lisp_Object object;
|
|
497 {
|
16
|
498 return CONSP (object) ? XCAR (object) : Qnil;
|
0
|
499 }
|
|
500
|
|
501 DEFUN ("cdr", Fcdr, Scdr, 1, 1, 0 /*
|
|
502 Return the cdr of LIST. If arg is nil, return nil.
|
|
503 Error if arg is not nil and not a cons cell. See also `cdr-safe'.
|
|
504 */ )
|
|
505 (list)
|
|
506 Lisp_Object list;
|
|
507 {
|
|
508 while (1)
|
|
509 {
|
|
510 if (CONSP (list))
|
|
511 return XCDR (list);
|
|
512 else if (NILP (list))
|
|
513 return Qnil;
|
|
514 else
|
|
515 list = wrong_type_argument (Qconsp, list);
|
|
516 }
|
|
517 }
|
|
518
|
|
519 DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0 /*
|
|
520 Return the cdr of OBJECT if it is a cons cell, or else nil.
|
|
521 */ )
|
|
522 (object)
|
|
523 Lisp_Object object;
|
|
524 {
|
16
|
525 return CONSP (object) ? XCDR (object) : Qnil;
|
0
|
526 }
|
|
527
|
|
528 DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0 /*
|
|
529 Set the car of CONSCELL to be NEWCAR. Returns NEWCAR.
|
|
530 */ )
|
|
531 (conscell, newcar)
|
|
532 Lisp_Object conscell, newcar;
|
|
533 {
|
|
534 if (!CONSP (conscell))
|
|
535 conscell = wrong_type_argument (Qconsp, conscell);
|
|
536
|
|
537 CHECK_IMPURE (conscell);
|
|
538 XCAR (conscell) = newcar;
|
|
539 return newcar;
|
|
540 }
|
|
541
|
|
542 DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0 /*
|
|
543 Set the cdr of CONSCELL to be NEWCDR. Returns NEWCDR.
|
|
544 */ )
|
|
545 (conscell, newcdr)
|
|
546 Lisp_Object conscell, newcdr;
|
|
547 {
|
|
548 if (!CONSP (conscell))
|
|
549 conscell = wrong_type_argument (Qconsp, conscell);
|
|
550
|
|
551 CHECK_IMPURE (conscell);
|
|
552 XCDR (conscell) = newcdr;
|
|
553 return newcdr;
|
|
554 }
|
|
555
|
|
556 /* Find the function at the end of a chain of symbol function indirections. */
|
|
557
|
|
558 /* If OBJECT is a symbol, find the end of its function chain and
|
|
559 return the value found there. If OBJECT is not a symbol, just
|
|
560 return it. If there is a cycle in the function chain, signal a
|
|
561 cyclic-function-indirection error.
|
|
562
|
|
563 This is like Findirect_function, except that it doesn't signal an
|
|
564 error if the chain ends up unbound. */
|
|
565 Lisp_Object
|
|
566 indirect_function (Lisp_Object object, int errorp)
|
|
567 {
|
|
568 Lisp_Object tortoise = object;
|
16
|
569 Lisp_Object hare = object;
|
0
|
570
|
|
571 for (;;)
|
|
572 {
|
|
573 if (!SYMBOLP (hare) || UNBOUNDP (hare))
|
|
574 break;
|
|
575 hare = XSYMBOL (hare)->function;
|
|
576 if (!SYMBOLP (hare) || UNBOUNDP (hare))
|
|
577 break;
|
|
578 hare = XSYMBOL (hare)->function;
|
|
579
|
|
580 tortoise = XSYMBOL (tortoise)->function;
|
|
581
|
|
582 if (EQ (hare, tortoise))
|
|
583 return (Fsignal (Qcyclic_function_indirection, list1 (object)));
|
|
584 }
|
|
585
|
|
586 if (UNBOUNDP (hare) && errorp)
|
|
587 return Fsignal (Qvoid_function, list1 (object));
|
|
588 return hare;
|
|
589 }
|
|
590
|
|
591 DEFUN ("indirect-function", Findirect_function, Sindirect_function, 1, 1, 0 /*
|
|
592 Return the function at the end of OBJECT's function chain.
|
|
593 If OBJECT is a symbol, follow all function indirections and return
|
|
594 the final function binding.
|
|
595 If OBJECT is not a symbol, just return it.
|
|
596 Signal a void-function error if the final symbol is unbound.
|
|
597 Signal a cyclic-function-indirection error if there is a loop in the
|
|
598 function chain of symbols.
|
|
599 */ )
|
|
600 (object)
|
|
601 Lisp_Object object;
|
|
602 {
|
|
603 return indirect_function (object, 1);
|
|
604 }
|
|
605
|
|
606 /* Extract and set vector and string elements */
|
|
607
|
|
608 DEFUN ("aref", Faref, Saref, 2, 2, 0 /*
|
|
609 Return the element of ARRAY at index INDEX.
|
|
610 ARRAY may be a vector, bit vector, string, or byte-code object.
|
|
611 IDX starts at 0.
|
|
612 */ )
|
|
613 (array, idx)
|
|
614 Lisp_Object array;
|
|
615 Lisp_Object idx;
|
|
616 {
|
|
617 int idxval;
|
|
618
|
|
619 retry:
|
|
620 CHECK_INT_COERCE_CHAR (idx); /* yuck! */
|
|
621 idxval = XINT (idx);
|
|
622 if (idxval < 0)
|
|
623 {
|
|
624 lose:
|
|
625 args_out_of_range (array, idx);
|
|
626 }
|
|
627 if (VECTORP (array))
|
|
628 {
|
|
629 if (idxval >= vector_length (XVECTOR (array))) goto lose;
|
|
630 return vector_data (XVECTOR (array))[idxval];
|
|
631 }
|
|
632 else if (BIT_VECTORP (array))
|
|
633 {
|
|
634 if (idxval >= bit_vector_length (XBIT_VECTOR (array))) goto lose;
|
|
635 return make_int (bit_vector_bit (XBIT_VECTOR (array), idxval));
|
|
636 }
|
|
637 else if (STRINGP (array))
|
|
638 {
|
|
639 if (idxval >= string_char_length (XSTRING (array))) goto lose;
|
|
640 return (make_char (string_char (XSTRING (array), idxval)));
|
|
641 }
|
|
642 #ifdef LOSING_BYTECODE
|
|
643 else if (COMPILED_FUNCTIONP (array))
|
|
644 {
|
|
645 /* Weird, gross compatibility kludge */
|
|
646 return (Felt (array, idx));
|
|
647 }
|
|
648 #endif
|
|
649 else
|
|
650 {
|
|
651 check_losing_bytecode ("aref", array);
|
|
652 array = wrong_type_argument (Qarrayp, array);
|
|
653 goto retry;
|
|
654 }
|
|
655 }
|
|
656
|
|
657 DEFUN ("aset", Faset, Saset, 3, 3, 0 /*
|
|
658 Store into the element of ARRAY at index IDX the value NEWVAL.
|
|
659 ARRAY may be a vector, bit vector, or string. IDX starts at 0.
|
|
660 */ )
|
|
661 (array, idx, newval)
|
|
662 Lisp_Object array;
|
|
663 Lisp_Object idx, newval;
|
|
664 {
|
|
665 int idxval;
|
|
666
|
|
667 CHECK_INT_COERCE_CHAR (idx); /* yuck! */
|
|
668 if (!VECTORP (array) && !BIT_VECTORP (array) && !STRINGP (array))
|
|
669 array = wrong_type_argument (Qarrayp, array);
|
|
670
|
|
671 idxval = XINT (idx);
|
|
672 if (idxval < 0)
|
|
673 {
|
|
674 lose:
|
|
675 args_out_of_range (array, idx);
|
|
676 }
|
|
677 CHECK_IMPURE (array);
|
|
678
|
|
679 if (VECTORP (array))
|
|
680 {
|
|
681 if (idxval >= vector_length (XVECTOR (array))) goto lose;
|
|
682 vector_data (XVECTOR (array))[idxval] = newval;
|
|
683 }
|
|
684 else if (BIT_VECTORP (array))
|
|
685 {
|
|
686 if (idxval >= bit_vector_length (XBIT_VECTOR (array))) goto lose;
|
|
687 CHECK_BIT (newval);
|
|
688 set_bit_vector_bit (XBIT_VECTOR (array), idxval, !ZEROP (newval));
|
|
689 }
|
|
690 else /* string */
|
|
691 {
|
|
692 CHECK_CHAR_COERCE_INT (newval);
|
|
693 if (idxval >= string_char_length (XSTRING (array))) goto lose;
|
|
694 set_string_char (XSTRING (array), idxval, XCHAR (newval));
|
|
695 bump_string_modiff (array);
|
|
696 }
|
|
697
|
|
698 return newval;
|
|
699 }
|
|
700
|
|
701
|
|
702 /**********************************************************************/
|
|
703 /* Compiled-function objects */
|
|
704 /**********************************************************************/
|
|
705
|
|
706 /* The compiled_function->doc_and_interactive slot uses the minimal
|
|
707 number of conses, based on compiled_function->flags; it may take
|
|
708 any of the following forms:
|
|
709
|
|
710 doc
|
|
711 interactive
|
|
712 domain
|
|
713 (doc . interactive)
|
|
714 (doc . domain)
|
|
715 (interactive . domain)
|
|
716 (doc . (interactive . domain))
|
|
717 */
|
|
718
|
|
719 /* Caller must check flags.interactivep first */
|
|
720 Lisp_Object
|
|
721 compiled_function_interactive (struct Lisp_Compiled_Function *b)
|
|
722 {
|
|
723 assert (b->flags.interactivep);
|
|
724 if (b->flags.documentationp && b->flags.domainp)
|
|
725 return (XCAR (XCDR (b->doc_and_interactive)));
|
|
726 else if (b->flags.documentationp)
|
|
727 return (XCDR (b->doc_and_interactive));
|
|
728 else if (b->flags.domainp)
|
|
729 return (XCAR (b->doc_and_interactive));
|
|
730
|
|
731 /* if all else fails... */
|
|
732 return (b->doc_and_interactive);
|
|
733 }
|
|
734
|
|
735 /* Caller need not check flags.documentationp first */
|
|
736 Lisp_Object
|
|
737 compiled_function_documentation (struct Lisp_Compiled_Function *b)
|
|
738 {
|
|
739 if (! b->flags.documentationp)
|
|
740 return Qnil;
|
|
741 else if (b->flags.interactivep && b->flags.domainp)
|
|
742 return (XCAR (b->doc_and_interactive));
|
|
743 else if (b->flags.interactivep)
|
|
744 return (XCAR (b->doc_and_interactive));
|
|
745 else if (b->flags.domainp)
|
|
746 return (XCAR (b->doc_and_interactive));
|
|
747 else
|
|
748 return (b->doc_and_interactive);
|
|
749 }
|
|
750
|
|
751 /* Caller need not check flags.domainp first */
|
|
752 Lisp_Object
|
|
753 compiled_function_domain (struct Lisp_Compiled_Function *b)
|
|
754 {
|
|
755 if (! b->flags.domainp)
|
|
756 return Qnil;
|
|
757 else if (b->flags.documentationp && b->flags.interactivep)
|
|
758 return (XCDR (XCDR (b->doc_and_interactive)));
|
|
759 else if (b->flags.documentationp)
|
|
760 return (XCDR (b->doc_and_interactive));
|
|
761 else if (b->flags.interactivep)
|
|
762 return (XCDR (b->doc_and_interactive));
|
|
763 else
|
|
764 return (b->doc_and_interactive);
|
|
765 }
|
|
766
|
|
767 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
|
|
768
|
|
769 Lisp_Object
|
|
770 compiled_function_annotation (struct Lisp_Compiled_Function *b)
|
|
771 {
|
|
772 return b->annotated;
|
|
773 }
|
|
774
|
|
775 #endif
|
|
776
|
|
777 /* used only by Snarf-documentation; there must be doc already. */
|
|
778 void
|
|
779 set_compiled_function_documentation (struct Lisp_Compiled_Function *b,
|
|
780 Lisp_Object new)
|
|
781 {
|
|
782 assert (b->flags.documentationp);
|
|
783 assert (INTP (new) || STRINGP (new));
|
|
784
|
|
785 if (b->flags.interactivep && b->flags.domainp)
|
|
786 XCAR (b->doc_and_interactive) = new;
|
|
787 else if (b->flags.interactivep)
|
|
788 XCAR (b->doc_and_interactive) = new;
|
|
789 else if (b->flags.domainp)
|
|
790 XCAR (b->doc_and_interactive) = new;
|
|
791 else
|
|
792 b->doc_and_interactive = new;
|
|
793 }
|
|
794
|
|
795 DEFUN ("compiled-function-instructions", Fcompiled_function_instructions,
|
|
796 Scompiled_function_instructions, 1, 1, 0 /*
|
|
797 Return the byte-opcode string of the compiled-function object.
|
|
798 */ )
|
|
799 (function)
|
|
800 Lisp_Object function;
|
|
801 {
|
|
802 CHECK_COMPILED_FUNCTION (function);
|
|
803 return (XCOMPILED_FUNCTION (function)->bytecodes);
|
|
804 }
|
|
805
|
|
806 DEFUN ("compiled-function-constants", Fcompiled_function_constants,
|
|
807 Scompiled_function_constants, 1, 1, 0 /*
|
|
808 Return the constants vector of the compiled-function object.
|
|
809 */ )
|
|
810 (function)
|
|
811 Lisp_Object function;
|
|
812 {
|
|
813 CHECK_COMPILED_FUNCTION (function);
|
|
814 return (XCOMPILED_FUNCTION (function)->constants);
|
|
815 }
|
|
816
|
|
817 DEFUN ("compiled-function-stack-depth", Fcompiled_function_stack_depth,
|
|
818 Scompiled_function_stack_depth, 1, 1, 0 /*
|
|
819 Return the max stack depth of the compiled-function object.
|
|
820 */ )
|
|
821 (function)
|
|
822 Lisp_Object function;
|
|
823 {
|
|
824 CHECK_COMPILED_FUNCTION (function);
|
|
825 return (make_int (XCOMPILED_FUNCTION (function)->maxdepth));
|
|
826 }
|
|
827
|
|
828 DEFUN ("compiled-function-arglist", Fcompiled_function_arglist,
|
|
829 Scompiled_function_arglist, 1, 1, 0 /*
|
|
830 Return the argument list of the compiled-function object.
|
|
831 */ )
|
|
832 (function)
|
|
833 Lisp_Object function;
|
|
834 {
|
|
835 CHECK_COMPILED_FUNCTION (function);
|
|
836 return (XCOMPILED_FUNCTION (function)->arglist);
|
|
837 }
|
|
838
|
|
839 DEFUN ("compiled-function-interactive", Fcompiled_function_interactive,
|
|
840 Scompiled_function_interactive, 1, 1, 0 /*
|
|
841 Return the interactive spec of the compiled-function object, or nil.
|
|
842 If non-nil, the return value will be a list whose first element is
|
|
843 `interactive' and whose second element is the interactive spec.
|
|
844 */ )
|
|
845 (function)
|
|
846 Lisp_Object function;
|
|
847 {
|
|
848 CHECK_COMPILED_FUNCTION (function);
|
|
849 if (!XCOMPILED_FUNCTION (function)->flags.interactivep)
|
|
850 return Qnil;
|
|
851 return (list2 (Qinteractive,
|
|
852 compiled_function_interactive
|
|
853 (XCOMPILED_FUNCTION (function))));
|
|
854 }
|
|
855
|
|
856 DEFUN ("compiled-function-doc-string", Fcompiled_function_doc_string,
|
|
857 Scompiled_function_doc_string, 1, 1, 0 /*
|
|
858 Return the doc string of the compiled-function object, if available.
|
|
859 */ )
|
|
860 (function)
|
|
861 Lisp_Object function;
|
|
862 {
|
|
863 CHECK_COMPILED_FUNCTION (function);
|
|
864 if (!XCOMPILED_FUNCTION (function)->flags.interactivep)
|
|
865 return Qnil;
|
|
866 return (list2 (Qinteractive,
|
|
867 compiled_function_interactive
|
|
868 (XCOMPILED_FUNCTION (function))));
|
|
869 }
|
|
870
|
|
871 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
|
|
872
|
|
873 DEFUN ("compiled-function-annotation", Fcompiled_function_annotation,
|
|
874 Scompiled_function_annotation, 1, 1, 0 /*
|
|
875 Return the annotation of the compiled-function object, or nil.
|
|
876 The annotation is a piece of information indicating where this
|
|
877 compiled-function object came from. Generally this will be
|
|
878 a symbol naming a function; or a string naming a file, if the
|
|
879 compiled-function object was not defined in a function; or nil,
|
|
880 if the compiled-function object was not created as a result of
|
|
881 a `load'.
|
|
882 */ )
|
|
883 (function)
|
|
884 Lisp_Object function;
|
|
885 {
|
|
886 CHECK_COMPILED_FUNCTION (function);
|
|
887 return (compiled_function_annotation (XCOMPILED_FUNCTION (function)));
|
|
888 }
|
|
889
|
|
890 #endif /* COMPILED_FUNCTION_ANNOTATION_HACK */
|
|
891
|
|
892 DEFUN ("compiled-function-domain", Fcompiled_function_domain,
|
|
893 Scompiled_function_domain, 1, 1, 0 /*
|
|
894 Return the domain of the compiled-function object, or nil.
|
|
895 This is only meaningful if I18N3 was enabled when emacs was compiled.
|
|
896 */ )
|
|
897 (function)
|
|
898 Lisp_Object function;
|
|
899 {
|
|
900 CHECK_COMPILED_FUNCTION (function);
|
|
901 if (!XCOMPILED_FUNCTION (function)->flags.domainp)
|
|
902 return Qnil;
|
|
903 return (compiled_function_domain (XCOMPILED_FUNCTION (function)));
|
|
904 }
|
|
905
|
|
906
|
|
907 /**********************************************************************/
|
|
908 /* Arithmetic functions */
|
|
909 /**********************************************************************/
|
|
910
|
|
911 enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal };
|
|
912
|
|
913 static Lisp_Object
|
16
|
914 arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
|
0
|
915 {
|
|
916 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (num1);
|
|
917 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (num2);
|
|
918
|
|
919 #ifdef LISP_FLOAT_TYPE
|
|
920 if (FLOATP (num1) || FLOATP (num2))
|
|
921 {
|
16
|
922 double f1 = (FLOATP (num1)) ? float_data (XFLOAT (num1)) : XINT (num1);
|
|
923 double f2 = (FLOATP (num2)) ? float_data (XFLOAT (num2)) : XINT (num2);
|
0
|
924
|
|
925 switch (comparison)
|
16
|
926 {
|
|
927 case equal: return f1 == f2 ? Qt : Qnil;
|
|
928 case notequal: return f1 != f2 ? Qt : Qnil;
|
|
929 case less: return f1 < f2 ? Qt : Qnil;
|
|
930 case less_or_equal: return f1 <= f2 ? Qt : Qnil;
|
|
931 case grtr: return f1 > f2 ? Qt : Qnil;
|
|
932 case grtr_or_equal: return f1 >= f2 ? Qt : Qnil;
|
|
933 }
|
0
|
934 }
|
|
935 #endif /* LISP_FLOAT_TYPE */
|
16
|
936
|
|
937 switch (comparison)
|
0
|
938 {
|
16
|
939 case equal: return XINT (num1) == XINT (num2) ? Qt : Qnil;
|
|
940 case notequal: return XINT (num1) != XINT (num2) ? Qt : Qnil;
|
|
941 case less: return XINT (num1) < XINT (num2) ? Qt : Qnil;
|
|
942 case less_or_equal: return XINT (num1) <= XINT (num2) ? Qt : Qnil;
|
|
943 case grtr: return XINT (num1) > XINT (num2) ? Qt : Qnil;
|
|
944 case grtr_or_equal: return XINT (num1) >= XINT (num2) ? Qt : Qnil;
|
|
945 }
|
0
|
946
|
|
947 abort ();
|
|
948 return Qnil; /* suppress compiler warning */
|
|
949 }
|
|
950
|
|
951 DEFUN ("=", Feqlsign, Seqlsign, 2, 2, 0 /*
|
|
952 T if two args, both numbers or markers, are equal.
|
|
953 */ )
|
|
954 (num1, num2)
|
|
955 Lisp_Object num1, num2;
|
|
956 {
|
|
957 return arithcompare (num1, num2, equal);
|
|
958 }
|
|
959
|
|
960 DEFUN ("<", Flss, Slss, 2, 2, 0 /*
|
16
|
961 T if first arg is less than second arg.
|
|
962 Both must be numbers or markers.
|
0
|
963 */ )
|
|
964 (num1, num2)
|
|
965 Lisp_Object num1, num2;
|
|
966 {
|
|
967 return arithcompare (num1, num2, less);
|
|
968 }
|
|
969
|
|
970 DEFUN (">", Fgtr, Sgtr, 2, 2, 0 /*
|
16
|
971 T if first arg is greater than second arg.
|
|
972 Both must be numbers or markers.
|
0
|
973 */ )
|
|
974 (num1, num2)
|
|
975 Lisp_Object num1, num2;
|
|
976 {
|
|
977 return arithcompare (num1, num2, grtr);
|
|
978 }
|
|
979
|
|
980 DEFUN ("<=", Fleq, Sleq, 2, 2, 0 /*
|
|
981 T if first arg is less than or equal to second arg.
|
|
982 Both must be numbers or markers.
|
|
983 */ )
|
|
984 (num1, num2)
|
|
985 Lisp_Object num1, num2;
|
|
986 {
|
|
987 return arithcompare (num1, num2, less_or_equal);
|
|
988 }
|
|
989
|
|
990 DEFUN (">=", Fgeq, Sgeq, 2, 2, 0 /*
|
|
991 T if first arg is greater than or equal to second arg.
|
|
992 Both must be numbers or markers.
|
|
993 */ )
|
|
994 (num1, num2)
|
|
995 Lisp_Object num1, num2;
|
|
996 {
|
|
997 return arithcompare (num1, num2, grtr_or_equal);
|
|
998 }
|
|
999
|
|
1000 DEFUN ("/=", Fneq, Sneq, 2, 2, 0 /*
|
16
|
1001 T if first arg is not equal to second arg.
|
|
1002 Both must be numbers or markers.
|
0
|
1003 */ )
|
|
1004 (num1, num2)
|
|
1005 Lisp_Object num1, num2;
|
|
1006 {
|
|
1007 return arithcompare (num1, num2, notequal);
|
|
1008 }
|
|
1009
|
|
1010 DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0 /*
|
|
1011 T if NUMBER is zero.
|
|
1012 */ )
|
|
1013 (number)
|
|
1014 Lisp_Object number;
|
|
1015 {
|
|
1016 CHECK_INT_OR_FLOAT (number);
|
|
1017
|
|
1018 #ifdef LISP_FLOAT_TYPE
|
|
1019 if (FLOATP (number))
|
16
|
1020 return (float_data (XFLOAT (number)) == 0.0) ? Qt : Qnil;
|
0
|
1021 #endif /* LISP_FLOAT_TYPE */
|
|
1022
|
16
|
1023 return (XINT (number) == 0) ? Qt : Qnil;
|
0
|
1024 }
|
|
1025
|
|
1026 /* Convert between a 32-bit value and a cons of two 16-bit values.
|
|
1027 This is used to pass 32-bit integers to and from the user.
|
|
1028 Use time_to_lisp() and lisp_to_time() for time values.
|
|
1029
|
|
1030 If you're thinking of using this to store a pointer into a Lisp Object
|
|
1031 for internal purposes (such as when calling record_unwind_protect()),
|
|
1032 try using make_opaque_ptr()/get_opaque_ptr() instead. */
|
|
1033 Lisp_Object
|
|
1034 word_to_lisp (unsigned int item)
|
|
1035 {
|
|
1036 return Fcons (make_int (item >> 16), make_int (item & 0xffff));
|
|
1037 }
|
|
1038
|
|
1039 unsigned int
|
|
1040 lisp_to_word (Lisp_Object item)
|
|
1041 {
|
|
1042 if (INTP (item))
|
|
1043 return XINT (item);
|
|
1044 else
|
|
1045 {
|
|
1046 Lisp_Object top = Fcar (item);
|
|
1047 Lisp_Object bot = Fcdr (item);
|
|
1048 CHECK_INT (top);
|
|
1049 CHECK_INT (bot);
|
|
1050 return (XINT (top) << 16) | (XINT (bot) & 0xffff);
|
|
1051 }
|
|
1052 }
|
|
1053
|
|
1054
|
|
1055 DEFUN ("number-to-string", Fnumber_to_string, Snumber_to_string, 1, 1, 0 /*
|
|
1056 Convert NUM to a string by printing it in decimal.
|
|
1057 Uses a minus sign if negative.
|
|
1058 NUM may be an integer or a floating point number.
|
|
1059 */ )
|
|
1060 (num)
|
|
1061 Lisp_Object num;
|
|
1062 {
|
|
1063 char buffer[VALBITS];
|
|
1064
|
|
1065 CHECK_INT_OR_FLOAT (num);
|
|
1066
|
|
1067 #ifdef LISP_FLOAT_TYPE
|
|
1068 if (FLOATP (num))
|
|
1069 {
|
|
1070 char pigbuf[350]; /* see comments in float_to_string */
|
|
1071
|
|
1072 float_to_string (pigbuf, float_data (XFLOAT (num)));
|
|
1073 return build_string (pigbuf);
|
|
1074 }
|
|
1075 #endif /* LISP_FLOAT_TYPE */
|
|
1076
|
|
1077 if (sizeof (int) == sizeof (EMACS_INT))
|
|
1078 sprintf (buffer, "%d", XINT (num));
|
|
1079 else if (sizeof (long) == sizeof (EMACS_INT))
|
|
1080 sprintf (buffer, "%ld", (long) XINT (num));
|
|
1081 else
|
|
1082 abort ();
|
|
1083 return build_string (buffer);
|
|
1084 }
|
|
1085
|
|
1086 DEFUN ("string-to-number", Fstring_to_number, Sstring_to_number, 1, 1, 0 /*
|
|
1087 Convert STRING to a number by parsing it as a decimal number.
|
|
1088 This parses both integers and floating point numbers.
|
|
1089 It ignores leading spaces and tabs.
|
|
1090 */ )
|
|
1091 (string)
|
|
1092 Lisp_Object string;
|
|
1093 {
|
|
1094 Lisp_Object value;
|
|
1095 char *p;
|
|
1096 CHECK_STRING (string);
|
|
1097
|
16
|
1098 p = (char *) XSTRING_DATA (string);
|
0
|
1099 /* Skip any whitespace at the front of the number. Some versions of
|
|
1100 atoi do this anyway, so we might as well make Emacs lisp consistent. */
|
|
1101 while (*p == ' ' || *p == '\t')
|
|
1102 p++;
|
|
1103
|
|
1104 #ifdef LISP_FLOAT_TYPE
|
|
1105 if (isfloat_string (p))
|
|
1106 return make_float (atof (p));
|
|
1107 #endif /* LISP_FLOAT_TYPE */
|
|
1108
|
|
1109 if (sizeof (int) == sizeof (EMACS_INT))
|
|
1110 XSETINT (value, atoi (p));
|
|
1111 else if (sizeof (long) == sizeof (EMACS_INT))
|
|
1112 XSETINT (value, atol (p));
|
|
1113 else
|
|
1114 abort ();
|
|
1115 return value;
|
|
1116 }
|
|
1117
|
|
1118 enum arithop
|
|
1119 { Aadd, Asub, Amult, Adiv, Alogand, Alogior, Alogxor, Amax, Amin };
|
|
1120
|
|
1121 #ifdef LISP_FLOAT_TYPE
|
|
1122 static Lisp_Object
|
|
1123 float_arith_driver (double accum, int argnum, enum arithop code, int nargs,
|
|
1124 Lisp_Object *args)
|
|
1125 {
|
|
1126 REGISTER Lisp_Object val;
|
|
1127 double next;
|
|
1128
|
|
1129 for (; argnum < nargs; argnum++)
|
|
1130 {
|
16
|
1131 /* using args[argnum] as argument to CHECK_INT_OR_FLOAT_... */
|
|
1132 val = args[argnum];
|
0
|
1133 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (val);
|
|
1134
|
|
1135 if (FLOATP (val))
|
|
1136 {
|
|
1137 next = float_data (XFLOAT (val));
|
|
1138 }
|
|
1139 else
|
|
1140 {
|
|
1141 args[argnum] = val; /* runs into a compiler bug. */
|
|
1142 next = XINT (args[argnum]);
|
|
1143 }
|
|
1144 switch (code)
|
|
1145 {
|
|
1146 case Aadd:
|
|
1147 accum += next;
|
|
1148 break;
|
|
1149 case Asub:
|
|
1150 if (!argnum && nargs != 1)
|
|
1151 next = - next;
|
|
1152 accum -= next;
|
|
1153 break;
|
|
1154 case Amult:
|
|
1155 accum *= next;
|
|
1156 break;
|
|
1157 case Adiv:
|
|
1158 if (!argnum)
|
|
1159 accum = next;
|
|
1160 else
|
|
1161 {
|
|
1162 if (next == 0)
|
|
1163 Fsignal (Qarith_error, Qnil);
|
|
1164 accum /= next;
|
|
1165 }
|
|
1166 break;
|
|
1167 case Alogand:
|
|
1168 case Alogior:
|
|
1169 case Alogxor:
|
|
1170 return wrong_type_argument (Qinteger_or_marker_p, val);
|
|
1171 case Amax:
|
|
1172 if (!argnum || isnan (next) || next > accum)
|
|
1173 accum = next;
|
|
1174 break;
|
|
1175 case Amin:
|
|
1176 if (!argnum || isnan (next) || next < accum)
|
|
1177 accum = next;
|
|
1178 break;
|
|
1179 }
|
|
1180 }
|
|
1181
|
|
1182 return make_float (accum);
|
|
1183 }
|
|
1184 #endif /* LISP_FLOAT_TYPE */
|
|
1185
|
16
|
1186 static Lisp_Object
|
|
1187 arith_driver (enum arithop code, int nargs, Lisp_Object *args)
|
|
1188 {
|
|
1189 Lisp_Object val;
|
|
1190 REGISTER int argnum;
|
|
1191 REGISTER EMACS_INT accum = 0;
|
|
1192 REGISTER EMACS_INT next;
|
|
1193
|
|
1194 switch (code)
|
|
1195 {
|
|
1196 case Alogior:
|
|
1197 case Alogxor:
|
|
1198 case Aadd:
|
|
1199 case Asub:
|
|
1200 accum = 0; break;
|
|
1201 case Amult:
|
|
1202 accum = 1; break;
|
|
1203 case Alogand:
|
|
1204 accum = -1; break;
|
|
1205 case Adiv:
|
|
1206 case Amax:
|
|
1207 case Amin:
|
|
1208 accum = 0; break;
|
|
1209 default:
|
|
1210 abort ();
|
|
1211 }
|
|
1212
|
|
1213 for (argnum = 0; argnum < nargs; argnum++)
|
|
1214 {
|
|
1215 /* using args[argnum] as argument to CHECK_INT_OR_FLOAT_... */
|
|
1216 val = args[argnum];
|
|
1217 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (val);
|
|
1218
|
|
1219 #ifdef LISP_FLOAT_TYPE
|
|
1220 if (FLOATP (val)) /* time to do serious math */
|
|
1221 return (float_arith_driver ((double) accum, argnum, code,
|
|
1222 nargs, args));
|
|
1223 #endif /* LISP_FLOAT_TYPE */
|
|
1224 args[argnum] = val; /* runs into a compiler bug. */
|
|
1225 next = XINT (args[argnum]);
|
|
1226 switch (code)
|
|
1227 {
|
|
1228 case Aadd: accum += next; break;
|
|
1229 case Asub:
|
|
1230 if (!argnum && nargs != 1)
|
|
1231 next = - next;
|
|
1232 accum -= next;
|
|
1233 break;
|
|
1234 case Amult: accum *= next; break;
|
|
1235 case Adiv:
|
|
1236 if (!argnum) accum = next;
|
|
1237 else
|
|
1238 {
|
|
1239 if (next == 0)
|
|
1240 Fsignal (Qarith_error, Qnil);
|
|
1241 accum /= next;
|
|
1242 }
|
|
1243 break;
|
|
1244 case Alogand: accum &= next; break;
|
|
1245 case Alogior: accum |= next; break;
|
|
1246 case Alogxor: accum ^= next; break;
|
|
1247 case Amax: if (!argnum || next > accum) accum = next; break;
|
|
1248 case Amin: if (!argnum || next < accum) accum = next; break;
|
|
1249 }
|
|
1250 }
|
|
1251
|
|
1252 XSETINT (val, accum);
|
|
1253 return val;
|
|
1254 }
|
|
1255
|
0
|
1256 DEFUN ("+", Fplus, Splus, 0, MANY, 0 /*
|
16
|
1257 Return sum of any number of arguments.
|
|
1258 The arguments should all be numbers or markers.
|
0
|
1259 */ )
|
|
1260 (nargs, args)
|
|
1261 int nargs;
|
|
1262 Lisp_Object *args;
|
|
1263 {
|
|
1264 return arith_driver (Aadd, nargs, args);
|
|
1265 }
|
|
1266
|
|
1267 DEFUN ("-", Fminus, Sminus, 0, MANY, 0 /*
|
|
1268 Negate number or subtract numbers or markers.
|
|
1269 With one arg, negates it. With more than one arg,
|
|
1270 subtracts all but the first from the first.
|
|
1271 */ )
|
|
1272 (nargs, args)
|
|
1273 int nargs;
|
|
1274 Lisp_Object *args;
|
|
1275 {
|
|
1276 return arith_driver (Asub, nargs, args);
|
|
1277 }
|
|
1278
|
|
1279 DEFUN ("*", Ftimes, Stimes, 0, MANY, 0 /*
|
16
|
1280 Return product of any number of arguments.
|
|
1281 The arguments should all be numbers or markers.
|
0
|
1282 */ )
|
|
1283 (nargs, args)
|
|
1284 int nargs;
|
|
1285 Lisp_Object *args;
|
|
1286 {
|
|
1287 return arith_driver (Amult, nargs, args);
|
|
1288 }
|
|
1289
|
|
1290 DEFUN ("/", Fquo, Squo, 2, MANY, 0 /*
|
|
1291 Return first argument divided by all the remaining arguments.
|
|
1292 The arguments must be numbers or markers.
|
|
1293 */ )
|
|
1294 (nargs, args)
|
|
1295 int nargs;
|
|
1296 Lisp_Object *args;
|
|
1297 {
|
|
1298 return arith_driver (Adiv, nargs, args);
|
|
1299 }
|
|
1300
|
|
1301 DEFUN ("%", Frem, Srem, 2, 2, 0 /*
|
|
1302 Return remainder of first arg divided by second.
|
|
1303 Both must be integers or markers.
|
|
1304 */ )
|
|
1305 (num1, num2)
|
|
1306 Lisp_Object num1, num2;
|
|
1307 {
|
|
1308 CHECK_INT_COERCE_CHAR_OR_MARKER (num1);
|
|
1309 CHECK_INT_COERCE_CHAR_OR_MARKER (num2);
|
|
1310
|
|
1311 if (ZEROP (num2))
|
|
1312 Fsignal (Qarith_error, Qnil);
|
|
1313
|
|
1314 return (make_int (XINT (num1) % XINT (num2)));
|
|
1315 }
|
|
1316
|
|
1317 /* Note, ANSI *requires* the presence of the fmod() library routine.
|
|
1318 If your system doesn't have it, complain to your vendor, because
|
|
1319 that is a bug. */
|
|
1320
|
|
1321 #ifndef HAVE_FMOD
|
|
1322 double
|
|
1323 fmod (double f1, double f2)
|
|
1324 {
|
|
1325 if (f2 < 0.0)
|
|
1326 f2 = -f2;
|
|
1327 return (f1 - f2 * floor (f1/f2));
|
|
1328 }
|
|
1329 #endif /* ! HAVE_FMOD */
|
|
1330
|
|
1331
|
|
1332 DEFUN ("mod", Fmod, Smod, 2, 2, 0 /*
|
|
1333 Return X modulo Y.
|
|
1334 The result falls between zero (inclusive) and Y (exclusive).
|
|
1335 Both X and Y must be numbers or markers.
|
|
1336 If either argument is a float, a float will be returned.
|
|
1337 */ )
|
|
1338 (x, y)
|
|
1339 Lisp_Object x, y;
|
|
1340 {
|
|
1341 EMACS_INT i1, i2;
|
|
1342
|
|
1343 #ifdef LISP_FLOAT_TYPE
|
|
1344 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (x);
|
|
1345 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (y);
|
|
1346
|
|
1347 if (FLOATP (x) || FLOATP (y))
|
|
1348 {
|
|
1349 double f1, f2;
|
|
1350
|
|
1351 f1 = ((FLOATP (x)) ? float_data (XFLOAT (x)) : XINT (x));
|
|
1352 f2 = ((FLOATP (y)) ? float_data (XFLOAT (y)) : XINT (y));
|
|
1353 if (f2 == 0)
|
|
1354 Fsignal (Qarith_error, Qnil);
|
|
1355
|
|
1356 f1 = fmod (f1, f2);
|
|
1357
|
|
1358 /* If the "remainder" comes out with the wrong sign, fix it. */
|
|
1359 if (f2 < 0 ? f1 > 0 : f1 < 0)
|
|
1360 f1 += f2;
|
|
1361 return (make_float (f1));
|
|
1362 }
|
|
1363 #else /* not LISP_FLOAT_TYPE */
|
|
1364 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (x);
|
|
1365 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (y);
|
|
1366 #endif /* not LISP_FLOAT_TYPE */
|
|
1367
|
|
1368 i1 = XINT (x);
|
|
1369 i2 = XINT (y);
|
|
1370
|
|
1371 if (i2 == 0)
|
|
1372 Fsignal (Qarith_error, Qnil);
|
|
1373
|
|
1374 i1 %= i2;
|
|
1375
|
|
1376 /* If the "remainder" comes out with the wrong sign, fix it. */
|
|
1377 if (i2 < 0 ? i1 > 0 : i1 < 0)
|
|
1378 i1 += i2;
|
|
1379
|
|
1380 return (make_int (i1));
|
|
1381 }
|
|
1382
|
|
1383
|
|
1384 DEFUN ("max", Fmax, Smax, 1, MANY, 0 /*
|
16
|
1385 Return largest of all the arguments.
|
|
1386 All arguments must be numbers or markers.
|
0
|
1387 The value is always a number; markers are converted to numbers.
|
|
1388 */ )
|
|
1389 (nargs, args)
|
|
1390 int nargs;
|
|
1391 Lisp_Object *args;
|
|
1392 {
|
|
1393 return arith_driver (Amax, nargs, args);
|
|
1394 }
|
|
1395
|
|
1396 DEFUN ("min", Fmin, Smin, 1, MANY, 0 /*
|
16
|
1397 Return smallest of all the arguments.
|
|
1398 All arguments must be numbers or markers.
|
0
|
1399 The value is always a number; markers are converted to numbers.
|
|
1400 */ )
|
|
1401 (nargs, args)
|
|
1402 int nargs;
|
|
1403 Lisp_Object *args;
|
|
1404 {
|
|
1405 return arith_driver (Amin, nargs, args);
|
|
1406 }
|
|
1407
|
|
1408 DEFUN ("logand", Flogand, Slogand, 0, MANY, 0 /*
|
|
1409 Return bitwise-and of all the arguments.
|
|
1410 Arguments may be integers, or markers converted to integers.
|
|
1411 */ )
|
|
1412 (nargs, args)
|
|
1413 int nargs;
|
|
1414 Lisp_Object *args;
|
|
1415 {
|
|
1416 return arith_driver (Alogand, nargs, args);
|
|
1417 }
|
|
1418
|
|
1419 DEFUN ("logior", Flogior, Slogior, 0, MANY, 0 /*
|
|
1420 Return bitwise-or of all the arguments.
|
|
1421 Arguments may be integers, or markers converted to integers.
|
|
1422 */ )
|
|
1423 (nargs, args)
|
|
1424 int nargs;
|
|
1425 Lisp_Object *args;
|
|
1426 {
|
|
1427 return arith_driver (Alogior, nargs, args);
|
|
1428 }
|
|
1429
|
|
1430 DEFUN ("logxor", Flogxor, Slogxor, 0, MANY, 0 /*
|
|
1431 Return bitwise-exclusive-or of all the arguments.
|
|
1432 Arguments may be integers, or markers converted to integers.
|
|
1433 */ )
|
|
1434 (nargs, args)
|
|
1435 int nargs;
|
|
1436 Lisp_Object *args;
|
|
1437 {
|
|
1438 return arith_driver (Alogxor, nargs, args);
|
|
1439 }
|
|
1440
|
|
1441 DEFUN ("ash", Fash, Sash, 2, 2, 0 /*
|
|
1442 Return VALUE with its bits shifted left by COUNT.
|
|
1443 If COUNT is negative, shifting is actually to the right.
|
|
1444 In this case, the sign bit is duplicated.
|
|
1445 */ )
|
|
1446 (value, count)
|
|
1447 Lisp_Object value, count;
|
|
1448 {
|
|
1449 CHECK_INT_COERCE_CHAR (value);
|
|
1450 CHECK_INT (count);
|
|
1451
|
16
|
1452 return make_int (XINT (count) > 0 ?
|
|
1453 XINT (value) << XINT (count) :
|
|
1454 XINT (value) >> -XINT (count));
|
0
|
1455 }
|
|
1456
|
|
1457 DEFUN ("lsh", Flsh, Slsh, 2, 2, 0 /*
|
|
1458 Return VALUE with its bits shifted left by COUNT.
|
|
1459 If COUNT is negative, shifting is actually to the right.
|
|
1460 In this case, zeros are shifted in on the left.
|
|
1461 */ )
|
|
1462 (value, count)
|
|
1463 Lisp_Object value, count;
|
|
1464 {
|
|
1465 Lisp_Object val;
|
|
1466
|
|
1467 CHECK_INT_COERCE_CHAR (value);
|
|
1468 CHECK_INT (count);
|
|
1469
|
|
1470 if (XINT (count) > 0)
|
|
1471 XSETINT (val, (EMACS_UINT) XUINT (value) << XINT (count));
|
|
1472 else
|
|
1473 XSETINT (val, (EMACS_UINT) XUINT (value) >> -XINT (count));
|
|
1474 return val;
|
|
1475 }
|
|
1476
|
|
1477 DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0 /*
|
|
1478 Return NUMBER plus one. NUMBER may be a number or a marker.
|
|
1479 Markers are converted to integers.
|
|
1480 */ )
|
|
1481 (number)
|
|
1482 Lisp_Object number;
|
|
1483 {
|
|
1484 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (number);
|
|
1485
|
|
1486 #ifdef LISP_FLOAT_TYPE
|
|
1487 if (FLOATP (number))
|
|
1488 return (make_float (1.0 + float_data (XFLOAT (number))));
|
|
1489 #endif /* LISP_FLOAT_TYPE */
|
|
1490
|
|
1491 return (make_int (XINT (number) + 1));
|
|
1492 }
|
|
1493
|
|
1494 DEFUN ("1-", Fsub1, Ssub1, 1, 1, 0 /*
|
|
1495 Return NUMBER minus one. NUMBER may be a number or a marker.
|
|
1496 Markers are converted to integers.
|
|
1497 */ )
|
|
1498 (number)
|
|
1499 Lisp_Object number;
|
|
1500 {
|
|
1501 CHECK_INT_OR_FLOAT_COERCE_CHAR_OR_MARKER (number);
|
|
1502
|
|
1503 #ifdef LISP_FLOAT_TYPE
|
|
1504 if (FLOATP (number))
|
|
1505 return (make_float (-1.0 + (float_data (XFLOAT (number)))));
|
|
1506 #endif /* LISP_FLOAT_TYPE */
|
|
1507
|
|
1508 return (make_int (XINT (number) - 1));
|
|
1509 }
|
|
1510
|
|
1511 DEFUN ("lognot", Flognot, Slognot, 1, 1, 0 /*
|
|
1512 Return the bitwise complement of NUMBER. NUMBER must be an integer.
|
|
1513 */ )
|
|
1514 (number)
|
|
1515 Lisp_Object number;
|
|
1516 {
|
|
1517 CHECK_INT (number);
|
|
1518 return (make_int (~XINT (number)));
|
|
1519 }
|
|
1520
|
|
1521
|
|
1522 /************************************************************************/
|
|
1523 /* weak lists */
|
|
1524 /************************************************************************/
|
|
1525
|
|
1526 /* A weak list is like a normal list except that elements automatically
|
|
1527 disappear when no longer in use, i.e. when no longer GC-protected.
|
|
1528 The basic idea is that we don't mark the elements during GC, but
|
|
1529 wait for them to be marked elsewhere. If they're not marked, we
|
|
1530 remove them. This is analogous to weak hashtables; see the explanation
|
|
1531 there for more info. */
|
|
1532
|
|
1533 static Lisp_Object mark_weak_list (Lisp_Object, void (*) (Lisp_Object));
|
|
1534 static void print_weak_list (Lisp_Object, Lisp_Object, int);
|
|
1535 static int weak_list_equal (Lisp_Object, Lisp_Object, int depth);
|
|
1536 static unsigned long weak_list_hash (Lisp_Object obj, int depth);
|
|
1537 DEFINE_LRECORD_IMPLEMENTATION ("weak-list", weak_list,
|
|
1538 mark_weak_list, print_weak_list,
|
|
1539 0, weak_list_equal, weak_list_hash,
|
|
1540 struct weak_list);
|
|
1541
|
|
1542 static Lisp_Object Vall_weak_lists; /* Gemarke es nicht!!! */
|
|
1543
|
|
1544 static Lisp_Object encode_weak_list_type (enum weak_list_type type);
|
|
1545
|
|
1546 static Lisp_Object
|
|
1547 mark_weak_list (Lisp_Object obj, void (*markobj) (Lisp_Object))
|
|
1548 {
|
|
1549 return Qnil; /* nichts ist gemarkt */
|
|
1550 }
|
|
1551
|
|
1552 static void
|
|
1553 print_weak_list (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
|
|
1554 {
|
|
1555 if (print_readably)
|
|
1556 error ("printing unreadable object #<weak-list>");
|
|
1557
|
|
1558 write_c_string ("#<weak-list ", printcharfun);
|
|
1559 print_internal (encode_weak_list_type (XWEAK_LIST (obj)->type),
|
|
1560 printcharfun, 0);
|
|
1561 write_c_string (" ", printcharfun);
|
|
1562 print_internal (XWEAK_LIST (obj)->list, printcharfun, escapeflag);
|
|
1563 write_c_string (">", printcharfun);
|
|
1564 }
|
|
1565
|
|
1566 static int
|
|
1567 weak_list_equal (Lisp_Object o1, Lisp_Object o2, int depth)
|
|
1568 {
|
|
1569 struct weak_list *w1 = XWEAK_LIST (o1);
|
|
1570 struct weak_list *w2 = XWEAK_LIST (o2);
|
|
1571
|
16
|
1572 return (w1->type != w2->type &&
|
|
1573 internal_equal (w1->list, w2->list, depth + 1));
|
0
|
1574 }
|
|
1575
|
|
1576 static unsigned long
|
|
1577 weak_list_hash (Lisp_Object obj, int depth)
|
|
1578 {
|
|
1579 struct weak_list *w = XWEAK_LIST (obj);
|
|
1580
|
|
1581 return HASH2 ((unsigned long) w->type,
|
|
1582 internal_hash (w->list, depth + 1));
|
|
1583 }
|
|
1584
|
|
1585 Lisp_Object
|
|
1586 make_weak_list (enum weak_list_type type)
|
|
1587 {
|
|
1588 Lisp_Object result = Qnil;
|
|
1589
|
|
1590 struct weak_list *wl =
|
|
1591 alloc_lcrecord (sizeof (struct weak_list), lrecord_weak_list);
|
|
1592 wl->list = Qnil;
|
|
1593 wl->type = type;
|
|
1594 XSETWEAK_LIST (result, wl);
|
|
1595 wl->next_weak = Vall_weak_lists;
|
|
1596 Vall_weak_lists = result;
|
|
1597 return result;
|
|
1598 }
|
|
1599
|
|
1600 /*
|
|
1601 -- we do not mark the list elements (either the elements themselves
|
|
1602 or the cons cells that hold them) in the normal marking phase.
|
|
1603 -- at the end of marking, we go through all weak lists that are
|
|
1604 marked, and mark the cons cells that hold all marked
|
|
1605 objects, and possibly parts of the objects themselves.
|
|
1606 (See alloc.c, "after-mark".)
|
|
1607 -- after that, we prune away all the cons cells that are not marked.
|
|
1608
|
|
1609 WARNING WARNING WARNING WARNING WARNING:
|
|
1610
|
|
1611 The code in the following two functions is *unbelievably* tricky.
|
|
1612 Don't mess with it. You'll be sorry.
|
|
1613
|
|
1614 Linked lists just majorly suck, d'ya know?
|
|
1615 */
|
|
1616
|
|
1617 int
|
|
1618 finish_marking_weak_lists (int (*obj_marked_p) (Lisp_Object),
|
|
1619 void (*markobj) (Lisp_Object))
|
|
1620 {
|
|
1621 Lisp_Object rest;
|
|
1622 int did_mark = 0;
|
|
1623
|
|
1624 for (rest = Vall_weak_lists;
|
|
1625 !GC_NILP (rest);
|
|
1626 rest = XWEAK_LIST (rest)->next_weak)
|
|
1627 {
|
|
1628 Lisp_Object rest2;
|
|
1629 enum weak_list_type type = XWEAK_LIST (rest)->type;
|
|
1630
|
|
1631 if (! ((*obj_marked_p) (rest)))
|
|
1632 /* The weak list is probably garbage. Ignore it. */
|
|
1633 continue;
|
|
1634
|
|
1635 for (rest2 = XWEAK_LIST (rest)->list;
|
|
1636 /* We need to be trickier since we're inside of GC;
|
|
1637 use CONSP instead of !NILP in case of user-visible
|
|
1638 imperfect lists */
|
|
1639 GC_CONSP (rest2);
|
|
1640 rest2 = XCDR (rest2))
|
|
1641 {
|
|
1642 Lisp_Object elem;
|
|
1643 /* If the element is "marked" (meaning depends on the type
|
|
1644 of weak list), we need to mark the cons containing the
|
|
1645 element, and maybe the element itself (if only some part
|
|
1646 was already marked). */
|
|
1647 int need_to_mark_cons = 0;
|
|
1648 int need_to_mark_elem = 0;
|
|
1649
|
|
1650 /* If a cons is already marked, then its car is already marked
|
|
1651 (either because of an external pointer or because of
|
|
1652 a previous call to this function), and likewise for all
|
|
1653 the rest of the elements in the list, so we can stop now. */
|
|
1654 if ((*obj_marked_p) (rest2))
|
|
1655 break;
|
|
1656
|
|
1657 elem = XCAR (rest2);
|
|
1658
|
|
1659 switch (type)
|
|
1660 {
|
|
1661 case WEAK_LIST_SIMPLE:
|
|
1662 if ((*obj_marked_p) (elem))
|
|
1663 need_to_mark_cons = 1;
|
|
1664 break;
|
|
1665
|
|
1666 case WEAK_LIST_ASSOC:
|
|
1667 if (!GC_CONSP (elem))
|
|
1668 {
|
|
1669 /* just leave bogus elements there */
|
|
1670 need_to_mark_cons = 1;
|
|
1671 need_to_mark_elem = 1;
|
|
1672 }
|
|
1673 else if ((*obj_marked_p) (XCAR (elem)) &&
|
|
1674 (*obj_marked_p) (XCDR (elem)))
|
|
1675 {
|
|
1676 need_to_mark_cons = 1;
|
|
1677 /* We still need to mark elem, because it's
|
|
1678 probably not marked. */
|
|
1679 need_to_mark_elem = 1;
|
|
1680 }
|
|
1681 break;
|
|
1682
|
|
1683 case WEAK_LIST_KEY_ASSOC:
|
|
1684 if (!GC_CONSP (elem))
|
|
1685 {
|
|
1686 /* just leave bogus elements there */
|
|
1687 need_to_mark_cons = 1;
|
|
1688 need_to_mark_elem = 1;
|
|
1689 }
|
|
1690 else if ((*obj_marked_p) (XCAR (elem)))
|
|
1691 {
|
|
1692 need_to_mark_cons = 1;
|
|
1693 /* We still need to mark elem and XCDR (elem);
|
|
1694 marking elem does both */
|
|
1695 need_to_mark_elem = 1;
|
|
1696 }
|
|
1697 break;
|
|
1698
|
|
1699 case WEAK_LIST_VALUE_ASSOC:
|
|
1700 if (!GC_CONSP (elem))
|
|
1701 {
|
|
1702 /* just leave bogus elements there */
|
|
1703 need_to_mark_cons = 1;
|
|
1704 need_to_mark_elem = 1;
|
|
1705 }
|
|
1706 else if ((*obj_marked_p) (XCDR (elem)))
|
|
1707 {
|
|
1708 need_to_mark_cons = 1;
|
|
1709 /* We still need to mark elem and XCAR (elem);
|
|
1710 marking elem does both */
|
|
1711 need_to_mark_elem = 1;
|
|
1712 }
|
|
1713 break;
|
|
1714
|
|
1715 default:
|
|
1716 abort ();
|
|
1717 }
|
|
1718
|
|
1719 if (need_to_mark_elem && ! (*obj_marked_p) (elem))
|
|
1720 {
|
|
1721 (*markobj) (elem);
|
|
1722 did_mark = 1;
|
|
1723 }
|
|
1724
|
|
1725 /* We also need to mark the cons that holds the elem or
|
|
1726 assoc-pair. We do *not* want to call (markobj) here
|
|
1727 because that will mark the entire list; we just want to
|
|
1728 mark the cons itself.
|
|
1729 */
|
|
1730 if (need_to_mark_cons)
|
|
1731 {
|
|
1732 struct Lisp_Cons *ptr = XCONS (rest2);
|
|
1733 if (!CONS_MARKED_P (ptr))
|
|
1734 {
|
|
1735 MARK_CONS (ptr);
|
|
1736 did_mark = 1;
|
|
1737 }
|
|
1738 }
|
|
1739 }
|
|
1740
|
|
1741 /* In case of imperfect list, need to mark the final cons
|
|
1742 because we're not removing it */
|
|
1743 if (!GC_NILP (rest2) && ! (obj_marked_p) (rest2))
|
|
1744 {
|
|
1745 (markobj) (rest2);
|
|
1746 did_mark = 1;
|
|
1747 }
|
|
1748 }
|
|
1749
|
|
1750 return did_mark;
|
|
1751 }
|
|
1752
|
|
1753 void
|
|
1754 prune_weak_lists (int (*obj_marked_p) (Lisp_Object))
|
|
1755 {
|
|
1756 Lisp_Object rest, prev = Qnil;
|
|
1757
|
|
1758 for (rest = Vall_weak_lists;
|
|
1759 !GC_NILP (rest);
|
|
1760 rest = XWEAK_LIST (rest)->next_weak)
|
|
1761 {
|
|
1762 if (! ((*obj_marked_p) (rest)))
|
|
1763 {
|
|
1764 /* This weak list itself is garbage. Remove it from the list. */
|
|
1765 if (GC_NILP (prev))
|
|
1766 Vall_weak_lists = XWEAK_LIST (rest)->next_weak;
|
|
1767 else
|
|
1768 XWEAK_LIST (prev)->next_weak =
|
|
1769 XWEAK_LIST (rest)->next_weak;
|
|
1770 }
|
|
1771 else
|
|
1772 {
|
|
1773 Lisp_Object rest2, prev2 = Qnil;
|
|
1774 Lisp_Object tortoise;
|
|
1775 int go_tortoise = 0;
|
|
1776
|
|
1777 for (rest2 = XWEAK_LIST (rest)->list, tortoise = rest2;
|
|
1778 /* We need to be trickier since we're inside of GC;
|
|
1779 use CONSP instead of !NILP in case of user-visible
|
|
1780 imperfect lists */
|
|
1781 GC_CONSP (rest2);)
|
|
1782 {
|
|
1783 /* It suffices to check the cons for marking,
|
|
1784 regardless of the type of weak list:
|
|
1785
|
|
1786 -- if the cons is pointed to somewhere else,
|
|
1787 then it should stay around and will be marked.
|
|
1788 -- otherwise, if it should stay around, it will
|
|
1789 have been marked in finish_marking_weak_lists().
|
|
1790 -- otherwise, it's not marked and should disappear.
|
|
1791 */
|
|
1792 if (!(*obj_marked_p) (rest2))
|
|
1793 {
|
|
1794 /* bye bye :-( */
|
|
1795 if (GC_NILP (prev2))
|
|
1796 XWEAK_LIST (rest)->list = XCDR (rest2);
|
|
1797 else
|
|
1798 XCDR (prev2) = XCDR (rest2);
|
|
1799 rest2 = XCDR (rest2);
|
|
1800 /* Ouch. Circularity checking is even trickier
|
|
1801 than I thought. When we cut out a link
|
|
1802 like this, we can't advance the turtle or
|
|
1803 it'll catch up to us. Imagine that we're
|
|
1804 standing on floor tiles and moving forward --
|
|
1805 what we just did here is as if the floor
|
|
1806 tile under us just disappeared and all the
|
|
1807 ones ahead of us slid one tile towards us.
|
|
1808 In other words, we didn't move at all;
|
|
1809 if the tortoise was one step behind us
|
|
1810 previously, it still is, and therefore
|
|
1811 it must not move. */
|
|
1812 }
|
|
1813 else
|
|
1814 {
|
|
1815 prev2 = rest2;
|
|
1816
|
|
1817 /* Implementing circularity checking is trickier here
|
|
1818 than in other places because we have to guarantee
|
|
1819 that we've processed all elements before exiting
|
|
1820 due to a circularity. (In most places, an error
|
|
1821 is issued upon encountering a circularity, so it
|
|
1822 doesn't really matter if all elements are processed.)
|
|
1823 The idea is that we process along with the hare
|
|
1824 rather than the tortoise. If at any point in
|
|
1825 our forward process we encounter the tortoise,
|
|
1826 we must have already visited the spot, so we exit.
|
|
1827 (If we process with the tortoise, we can fail to
|
|
1828 process cases where a cons points to itself, or
|
|
1829 where cons A points to cons B, which points to
|
|
1830 cons A.) */
|
|
1831
|
|
1832 rest2 = XCDR (rest2);
|
|
1833 if (go_tortoise)
|
|
1834 tortoise = XCDR (tortoise);
|
|
1835 go_tortoise = !go_tortoise;
|
|
1836 if (GC_EQ (rest2, tortoise))
|
|
1837 break;
|
|
1838 }
|
|
1839 }
|
|
1840
|
|
1841 prev = rest;
|
|
1842 }
|
|
1843 }
|
|
1844 }
|
|
1845
|
|
1846 static enum weak_list_type
|
|
1847 decode_weak_list_type (Lisp_Object symbol)
|
|
1848 {
|
|
1849 CHECK_SYMBOL (symbol);
|
16
|
1850 if (EQ (symbol, Qsimple)) return WEAK_LIST_SIMPLE;
|
|
1851 if (EQ (symbol, Qassoc)) return WEAK_LIST_ASSOC;
|
|
1852 if (EQ (symbol, Qkey_assoc)) return WEAK_LIST_KEY_ASSOC;
|
|
1853 if (EQ (symbol, Qvalue_assoc)) return WEAK_LIST_VALUE_ASSOC;
|
0
|
1854
|
|
1855 signal_simple_error ("Invalid weak list type", symbol);
|
|
1856 return WEAK_LIST_SIMPLE; /* not reached */
|
|
1857 }
|
|
1858
|
|
1859 static Lisp_Object
|
|
1860 encode_weak_list_type (enum weak_list_type type)
|
|
1861 {
|
|
1862 switch (type)
|
|
1863 {
|
16
|
1864 case WEAK_LIST_SIMPLE: return Qsimple;
|
|
1865 case WEAK_LIST_ASSOC: return Qassoc;
|
|
1866 case WEAK_LIST_KEY_ASSOC: return Qkey_assoc;
|
|
1867 case WEAK_LIST_VALUE_ASSOC: return Qvalue_assoc;
|
0
|
1868 default:
|
|
1869 abort ();
|
|
1870 }
|
|
1871
|
16
|
1872 return Qnil; /* not reached */
|
0
|
1873 }
|
|
1874
|
|
1875 DEFUN ("weak-list-p", Fweak_list_p, Sweak_list_p, 1, 1, 0 /*
|
|
1876 Return non-nil if OBJECT is a weak list.
|
|
1877 */ )
|
|
1878 (object)
|
|
1879 Lisp_Object object;
|
|
1880 {
|
|
1881 return WEAK_LISTP (object) ? Qt : Qnil;
|
|
1882 }
|
|
1883
|
|
1884 DEFUN ("make-weak-list", Fmake_weak_list, Smake_weak_list, 0, 1, 0 /*
|
|
1885 Create a new weak list.
|
|
1886 A weak list object is an object that contains a list. This list behaves
|
|
1887 like any other list except that its elements do not count towards
|
|
1888 garbage collection -- if the only pointer to an object in inside a weak
|
|
1889 list (other than pointers in similar objects such as weak hash tables),
|
|
1890 the object is garbage collected and automatically removed from the list.
|
|
1891 This is used internally, for example, to manage the list holding the
|
|
1892 children of an extent -- an extent that is unused but has a parent will
|
|
1893 still be reclaimed, and will automatically be removed from its parent's
|
|
1894 list of children.
|
|
1895
|
|
1896 Optional argument TYPE specifies the type of the weak list, and defaults
|
|
1897 to `simple'. Recognized types are
|
|
1898
|
|
1899 `simple' Objects in the list disappear if not pointed to.
|
|
1900 `assoc' Objects in the list disappear if they are conses
|
|
1901 and either the car or the cdr of the cons is not
|
|
1902 pointed to.
|
|
1903 `key-assoc' Objects in the list disappear if they are conses
|
|
1904 and the car is not pointed to.
|
|
1905 `value-assoc' Objects in the list disappear if they are conses
|
|
1906 and the cdr is not pointed to.
|
|
1907 */ )
|
|
1908 (type)
|
|
1909 Lisp_Object type;
|
|
1910 {
|
|
1911 if (NILP (type))
|
|
1912 type = Qsimple;
|
|
1913
|
|
1914 return make_weak_list (decode_weak_list_type (type));
|
|
1915 }
|
|
1916
|
|
1917 DEFUN ("weak-list-type", Fweak_list_type, Sweak_list_type, 1, 1, 0 /*
|
|
1918 Return the type of the given weak-list object.
|
|
1919 */ )
|
|
1920 (weak)
|
|
1921 Lisp_Object weak;
|
|
1922 {
|
|
1923 CHECK_WEAK_LIST (weak);
|
|
1924 return encode_weak_list_type (XWEAK_LIST (weak)->type);
|
|
1925 }
|
|
1926
|
|
1927 DEFUN ("weak-list-list", Fweak_list_list, Sweak_list_list, 1, 1, 0 /*
|
|
1928 Return the list contained in a weak-list object.
|
|
1929 */ )
|
|
1930 (weak)
|
|
1931 Lisp_Object weak;
|
|
1932 {
|
|
1933 CHECK_WEAK_LIST (weak);
|
|
1934 return XWEAK_LIST_LIST (weak);
|
|
1935 }
|
|
1936
|
|
1937 DEFUN ("set-weak-list-list", Fset_weak_list_list, Sset_weak_list_list,
|
|
1938 2, 2, 0 /*
|
|
1939 Change the list contained in a weak-list object.
|
|
1940 */ )
|
|
1941 (weak, new_list)
|
|
1942 Lisp_Object weak, new_list;
|
|
1943 {
|
|
1944 CHECK_WEAK_LIST (weak);
|
|
1945 XWEAK_LIST_LIST (weak) = new_list;
|
|
1946 return new_list;
|
|
1947 }
|
|
1948
|
|
1949
|
|
1950 /************************************************************************/
|
|
1951 /* initialization */
|
|
1952 /************************************************************************/
|
|
1953
|
|
1954 static SIGTYPE
|
|
1955 arith_error (int signo)
|
|
1956 {
|
|
1957 EMACS_REESTABLISH_SIGNAL (signo, arith_error);
|
|
1958 EMACS_UNBLOCK_SIGNAL (signo);
|
|
1959 signal_error (Qarith_error, Qnil);
|
|
1960 }
|
|
1961
|
|
1962 void
|
|
1963 init_data_very_early (void)
|
|
1964 {
|
|
1965 /* Don't do this if just dumping out.
|
|
1966 We don't want to call `signal' in this case
|
|
1967 so that we don't have trouble with dumping
|
|
1968 signal-delivering routines in an inconsistent state. */
|
|
1969 #ifndef CANNOT_DUMP
|
|
1970 if (!initialized)
|
|
1971 return;
|
|
1972 #endif /* CANNOT_DUMP */
|
|
1973 signal (SIGFPE, arith_error);
|
|
1974 #ifdef uts
|
|
1975 signal (SIGEMT, arith_error);
|
|
1976 #endif /* uts */
|
|
1977 }
|
|
1978
|
|
1979 void
|
|
1980 init_errors_once_early (void)
|
|
1981 {
|
|
1982 defsymbol (&Qerror_conditions, "error-conditions");
|
|
1983 defsymbol (&Qerror_message, "error-message");
|
|
1984
|
|
1985 /* We declare the errors here because some other deferrors depend
|
|
1986 on some of the errors below. */
|
|
1987
|
|
1988 /* ERROR is used as a signaler for random errors for which nothing
|
|
1989 else is right */
|
|
1990
|
|
1991 deferror (&Qerror, "error", "error", Qnil);
|
|
1992 deferror (&Qquit, "quit", "Quit", Qnil);
|
|
1993
|
|
1994 deferror (&Qwrong_type_argument, "wrong-type-argument",
|
|
1995 "Wrong type argument", Qerror);
|
|
1996 deferror (&Qargs_out_of_range, "args-out-of-range", "Args out of range",
|
|
1997 Qerror);
|
|
1998 deferror (&Qvoid_function, "void-function",
|
|
1999 "Symbol's function definition is void", Qerror);
|
|
2000 deferror (&Qcyclic_function_indirection, "cyclic-function-indirection",
|
|
2001 "Symbol's chain of function indirections contains a loop", Qerror);
|
|
2002 deferror (&Qvoid_variable, "void-variable",
|
|
2003 "Symbol's value as variable is void", Qerror);
|
|
2004 deferror (&Qcyclic_variable_indirection, "cyclic-variable-indirection",
|
|
2005 "Symbol's chain of variable indirections contains a loop", Qerror);
|
|
2006 deferror (&Qsetting_constant, "setting-constant",
|
|
2007 "Attempt to set a constant symbol", Qerror);
|
|
2008 deferror (&Qinvalid_read_syntax, "invalid-read-syntax",
|
|
2009 "Invalid read syntax", Qerror);
|
|
2010 deferror (&Qmalformed_list, "malformed-list",
|
|
2011 "Malformed list", Qerror);
|
|
2012 deferror (&Qmalformed_property_list, "malformed-property-list",
|
|
2013 "Malformed property list", Qerror);
|
|
2014 deferror (&Qcircular_list, "circular-list",
|
|
2015 "Circular list", Qerror);
|
|
2016 deferror (&Qcircular_property_list, "circular-property-list",
|
|
2017 "Circular property list", Qerror);
|
|
2018 deferror (&Qinvalid_function, "invalid-function", "Invalid function",
|
|
2019 Qerror);
|
|
2020 deferror (&Qwrong_number_of_arguments, "wrong-number-of-arguments",
|
|
2021 "Wrong number of arguments", Qerror);
|
|
2022 deferror (&Qno_catch, "no-catch", "No catch for tag",
|
|
2023 Qerror);
|
|
2024 deferror (&Qbeginning_of_buffer, "beginning-of-buffer",
|
|
2025 "Beginning of buffer", Qerror);
|
|
2026 deferror (&Qend_of_buffer, "end-of-buffer", "End of buffer", Qerror);
|
|
2027 deferror (&Qbuffer_read_only, "buffer-read-only", "Buffer is read-only",
|
|
2028 Qerror);
|
|
2029
|
|
2030 deferror (&Qio_error, "io-error", "IO Error", Qerror);
|
|
2031 deferror (&Qend_of_file, "end-of-file", "End of stream", Qio_error);
|
|
2032
|
|
2033 deferror (&Qarith_error, "arith-error", "Arithmetic error", Qerror);
|
|
2034 deferror (&Qrange_error, "range-error", "Arithmetic range error",
|
|
2035 Qarith_error);
|
|
2036 deferror (&Qdomain_error, "domain-error", "Arithmetic domain error",
|
|
2037 Qarith_error);
|
|
2038 deferror (&Qsingularity_error, "singularity-error",
|
|
2039 "Arithmetic singularity error", Qdomain_error);
|
|
2040 deferror (&Qoverflow_error, "overflow-error",
|
|
2041 "Arithmetic overflow error", Qdomain_error);
|
|
2042 deferror (&Qunderflow_error, "underflow-error",
|
|
2043 "Arithmetic underflow error", Qdomain_error);
|
|
2044 }
|
|
2045
|
|
2046 void
|
|
2047 syms_of_data (void)
|
|
2048 {
|
|
2049 defsymbol (&Qcons, "cons");
|
|
2050 defsymbol (&Qkeyword, "keyword");
|
|
2051 /* Qstring, Qinteger, Qsymbol, Qvector defined in general.c */
|
|
2052
|
|
2053 defsymbol (&Qquote, "quote");
|
|
2054 defsymbol (&Qlambda, "lambda");
|
|
2055 defsymbol (&Qsignal, "signal");
|
|
2056 defsymbol (&Qtop_level, "top-level");
|
|
2057 defsymbol (&Qignore, "ignore");
|
|
2058
|
|
2059 defsymbol (&Qlistp, "listp");
|
|
2060 defsymbol (&Qconsp, "consp");
|
|
2061 defsymbol (&Qsubrp, "subrp");
|
|
2062 defsymbol (&Qsymbolp, "symbolp");
|
|
2063 defsymbol (&Qkeywordp, "keywordp");
|
|
2064 defsymbol (&Qintegerp, "integerp");
|
|
2065 defsymbol (&Qcharacterp, "characterp");
|
|
2066 defsymbol (&Qnatnump, "natnump");
|
|
2067 defsymbol (&Qstringp, "stringp");
|
|
2068 defsymbol (&Qarrayp, "arrayp");
|
|
2069 defsymbol (&Qsequencep, "sequencep");
|
|
2070 defsymbol (&Qbufferp, "bufferp");
|
|
2071 defsymbol (&Qbitp, "bitp");
|
|
2072 defsymbol (&Qbit_vectorp, "bit-vector-p");
|
|
2073 defsymbol (&Qvectorp, "vectorp");
|
|
2074 defsymbol (&Qcompiled_functionp, "compiled-function-p");
|
|
2075 defsymbol (&Qchar_or_string_p, "char-or-string-p");
|
|
2076 defsymbol (&Qmarkerp, "markerp");
|
|
2077 defsymbol (&Qinteger_or_marker_p, "integer-or-marker-p");
|
|
2078 /* HACK for 19.x only. */
|
|
2079 defsymbol (&Qinteger_char_or_marker_p, "integer-or-marker-p");
|
|
2080
|
|
2081 #ifdef LISP_FLOAT_TYPE
|
|
2082 defsymbol (&Qfloatp, "floatp");
|
|
2083 #endif /* LISP_FLOAT_TYPE */
|
|
2084 defsymbol (&Qnumberp, "numberp");
|
|
2085 defsymbol (&Qnumber_or_marker_p, "number-or-marker-p");
|
|
2086 /* HACK for 19.x only. */
|
|
2087 defsymbol (&Qnumber_char_or_marker_p, "number-or-marker-p");
|
|
2088
|
|
2089 defsymbol (&Qcdr, "cdr");
|
|
2090
|
|
2091 defsymbol (&Qweak_listp, "weak-list-p");
|
|
2092
|
|
2093 defsubr (&Swrong_type_argument);
|
|
2094
|
|
2095 defsubr (&Seq);
|
|
2096 defsubr (&Snull);
|
|
2097 defsubr (&Slistp);
|
|
2098 defsubr (&Snlistp);
|
|
2099 defsubr (&Sconsp);
|
|
2100 defsubr (&Satom);
|
|
2101 defsubr (&Schar_or_string_p);
|
|
2102 defsubr (&Scharacterp);
|
|
2103 defsubr (&Sintegerp);
|
|
2104 defsubr (&Sinteger_or_marker_p);
|
|
2105 defsubr (&Snumberp);
|
|
2106 defsubr (&Snumber_or_marker_p);
|
|
2107 #ifdef LISP_FLOAT_TYPE
|
|
2108 defsubr (&Sfloatp);
|
|
2109 #endif /* LISP_FLOAT_TYPE */
|
|
2110 defsubr (&Snatnump);
|
|
2111 defsubr (&Ssymbolp);
|
|
2112 defsubr (&Skeywordp);
|
|
2113 defsubr (&Sstringp);
|
|
2114 defsubr (&Svectorp);
|
|
2115 defsubr (&Sbitp);
|
|
2116 defsubr (&Sbit_vector_p);
|
|
2117 defsubr (&Sarrayp);
|
|
2118 defsubr (&Ssequencep);
|
|
2119 defsubr (&Smarkerp);
|
|
2120 defsubr (&Ssubrp);
|
|
2121 defsubr (&Ssubr_min_args);
|
|
2122 defsubr (&Ssubr_max_args);
|
|
2123 defsubr (&Scompiled_function_p);
|
|
2124 defsubr (&Stype_of);
|
|
2125 defsubr (&Scar);
|
|
2126 defsubr (&Scdr);
|
|
2127 defsubr (&Scar_safe);
|
|
2128 defsubr (&Scdr_safe);
|
|
2129 defsubr (&Ssetcar);
|
|
2130 defsubr (&Ssetcdr);
|
|
2131 defsubr (&Sindirect_function);
|
|
2132 defsubr (&Saref);
|
|
2133 defsubr (&Saset);
|
|
2134
|
|
2135 defsubr (&Scompiled_function_instructions);
|
|
2136 defsubr (&Scompiled_function_constants);
|
|
2137 defsubr (&Scompiled_function_stack_depth);
|
|
2138 defsubr (&Scompiled_function_arglist);
|
|
2139 defsubr (&Scompiled_function_interactive);
|
|
2140 defsubr (&Scompiled_function_doc_string);
|
|
2141 defsubr (&Scompiled_function_domain);
|
|
2142 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
|
|
2143 defsubr (&Scompiled_function_annotation);
|
|
2144 #endif
|
|
2145
|
|
2146 defsubr (&Snumber_to_string);
|
|
2147 defsubr (&Sstring_to_number);
|
|
2148 defsubr (&Seqlsign);
|
|
2149 defsubr (&Slss);
|
|
2150 defsubr (&Sgtr);
|
|
2151 defsubr (&Sleq);
|
|
2152 defsubr (&Sgeq);
|
|
2153 defsubr (&Sneq);
|
|
2154 defsubr (&Szerop);
|
|
2155 defsubr (&Splus);
|
|
2156 defsubr (&Sminus);
|
|
2157 defsubr (&Stimes);
|
|
2158 defsubr (&Squo);
|
|
2159 defsubr (&Srem);
|
|
2160 defsubr (&Smod);
|
|
2161 defsubr (&Smax);
|
|
2162 defsubr (&Smin);
|
|
2163 defsubr (&Slogand);
|
|
2164 defsubr (&Slogior);
|
|
2165 defsubr (&Slogxor);
|
|
2166 defsubr (&Slsh);
|
|
2167 defsubr (&Sash);
|
|
2168 defsubr (&Sadd1);
|
|
2169 defsubr (&Ssub1);
|
|
2170 defsubr (&Slognot);
|
|
2171
|
|
2172 defsubr (&Sweak_list_p);
|
|
2173 defsubr (&Smake_weak_list);
|
|
2174 defsubr (&Sweak_list_type);
|
|
2175 defsubr (&Sweak_list_list);
|
|
2176 defsubr (&Sset_weak_list_list);
|
|
2177 }
|
|
2178
|
|
2179 void
|
|
2180 vars_of_data (void)
|
|
2181 {
|
|
2182 /* This must not be staticpro'd */
|
|
2183 Vall_weak_lists = Qnil;
|
|
2184 }
|