annotate src/data.c @ 161:28f395d8dc7a r20-3b7

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