Mercurial > emacs
annotate src/data.c @ 16947:a6957ab8c977
Spelling corrections.
Removed a couple of redundant entries.
author | Noah Friedman <friedman@splode.com> |
---|---|
date | Tue, 28 Jan 1997 18:38:51 +0000 |
parents | d6cd00b2e214 |
children | b1c4fbf1aee1 |
rev | line source |
---|---|
298 | 1 /* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter. |
10457
2ab3bd0288a9
Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents:
10290
diff
changeset
|
2 Copyright (C) 1985, 86, 88, 93, 94, 95 Free Software Foundation, Inc. |
298 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
12244 | 8 the Free Software Foundation; either version 2, or (at your option) |
298 | 9 any later version. |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14096
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14096
diff
changeset
|
19 Boston, MA 02111-1307, USA. */ |
298 | 20 |
21 | |
22 #include <signal.h> | |
23 | |
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4508
diff
changeset
|
24 #include <config.h> |
298 | 25 #include "lisp.h" |
336 | 26 #include "puresize.h" |
298 | 27 |
28 #ifndef standalone | |
29 #include "buffer.h" | |
11341 | 30 #include "keyboard.h" |
298 | 31 #endif |
32 | |
552 | 33 #include "syssignal.h" |
348 | 34 |
298 | 35 #ifdef LISP_FLOAT_TYPE |
4860
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
36 |
2781
fde05936aebb
* lread.c, data.c: If STDC_HEADERS is #defined, include <stdlib.h>
Jim Blandy <jimb@redhat.com>
parents:
2647
diff
changeset
|
37 #ifdef STDC_HEADERS |
16787
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
38 #include <float.h> |
2781
fde05936aebb
* lread.c, data.c: If STDC_HEADERS is #defined, include <stdlib.h>
Jim Blandy <jimb@redhat.com>
parents:
2647
diff
changeset
|
39 #include <stdlib.h> |
fde05936aebb
* lread.c, data.c: If STDC_HEADERS is #defined, include <stdlib.h>
Jim Blandy <jimb@redhat.com>
parents:
2647
diff
changeset
|
40 #endif |
4860
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
41 |
16787
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
42 /* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */ |
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
43 #ifndef IEEE_FLOATING_POINT |
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
44 #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ |
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
45 && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128) |
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
46 #define IEEE_FLOATING_POINT 1 |
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
47 #else |
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
48 #define IEEE_FLOATING_POINT 0 |
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
49 #endif |
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
50 #endif |
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
51 |
4860
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
52 /* Work around a problem that happens because math.h on hpux 7 |
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
53 defines two static variables--which, in Emacs, are not really static, |
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
54 because `static' is defined as nothing. The problem is that they are |
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
55 here, in floatfns.c, and in lread.c. |
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
56 These macros prevent the name conflict. */ |
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
57 #if defined (HPUX) && !defined (HPUX8) |
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
58 #define _MAXLDBL data_c_maxldbl |
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
59 #define _NMAXLDBL data_c_nmaxldbl |
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
60 #endif |
ff23fe23f58c
[hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents:
4780
diff
changeset
|
61 |
298 | 62 #include <math.h> |
63 #endif /* LISP_FLOAT_TYPE */ | |
64 | |
4780
64cdff1c8ad1
Add declaration for atof if not predefined.
Brian Fox <bfox@gnu.org>
parents:
4696
diff
changeset
|
65 #if !defined (atof) |
64cdff1c8ad1
Add declaration for atof if not predefined.
Brian Fox <bfox@gnu.org>
parents:
4696
diff
changeset
|
66 extern double atof (); |
64cdff1c8ad1
Add declaration for atof if not predefined.
Brian Fox <bfox@gnu.org>
parents:
4696
diff
changeset
|
67 #endif /* !atof */ |
64cdff1c8ad1
Add declaration for atof if not predefined.
Brian Fox <bfox@gnu.org>
parents:
4696
diff
changeset
|
68 |
298 | 69 Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound; |
70 Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; | |
71 Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range; | |
648 | 72 Lisp_Object Qvoid_variable, Qvoid_function, Qcyclic_function_indirection; |
298 | 73 Lisp_Object Qsetting_constant, Qinvalid_read_syntax; |
74 Lisp_Object Qinvalid_function, Qwrong_number_of_arguments, Qno_catch; | |
4036 | 75 Lisp_Object Qend_of_file, Qarith_error, Qmark_inactive; |
298 | 76 Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only; |
6459
30fabcc03f0c
(Qwholenump): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6448
diff
changeset
|
77 Lisp_Object Qintegerp, Qnatnump, Qwholenump, Qsymbolp, Qlistp, Qconsp; |
298 | 78 Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp; |
79 Lisp_Object Qchar_or_string_p, Qmarkerp, Qinteger_or_marker_p, Qvectorp; | |
1293 | 80 Lisp_Object Qbuffer_or_string_p; |
298 | 81 Lisp_Object Qboundp, Qfboundp; |
13200
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
82 Lisp_Object Qchar_table_p, Qvector_or_char_table_p; |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
83 |
298 | 84 Lisp_Object Qcdr; |
8448
b6335ce87e16
(Fdefine_function, Fdefalias): Handle advice as in Ffset.
Richard M. Stallman <rms@gnu.org>
parents:
8415
diff
changeset
|
85 Lisp_Object Qad_advice_info, Qad_activate; |
298 | 86 |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
87 Lisp_Object Qrange_error, Qdomain_error, Qsingularity_error; |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
88 Lisp_Object Qoverflow_error, Qunderflow_error; |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
89 |
298 | 90 #ifdef LISP_FLOAT_TYPE |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
91 Lisp_Object Qfloatp; |
298 | 92 Lisp_Object Qnumberp, Qnumber_or_marker_p; |
93 #endif | |
94 | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
95 static Lisp_Object Qinteger, Qsymbol, Qstring, Qcons, Qmarker, Qoverlay; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
96 static Lisp_Object Qfloat, Qwindow_configuration, Qprocess, Qwindow; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
97 static Lisp_Object Qcompiled_function, Qbuffer, Qframe, Qvector; |
13715
89ffc133f813
(Ftype_of): Return `char-table' and `bool-vector' for
Karl Heuer <kwzh@gnu.org>
parents:
13593
diff
changeset
|
98 static Lisp_Object Qchar_table, Qbool_vector; |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
99 |
298 | 100 static Lisp_Object swap_in_symval_forwarding (); |
101 | |
102 Lisp_Object | |
103 wrong_type_argument (predicate, value) | |
104 register Lisp_Object predicate, value; | |
105 { | |
106 register Lisp_Object tem; | |
107 do | |
108 { | |
109 if (!EQ (Vmocklisp_arguments, Qt)) | |
110 { | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
111 if (STRINGP (value) && |
298 | 112 (EQ (predicate, Qintegerp) || EQ (predicate, Qinteger_or_marker_p))) |
1914
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
113 return Fstring_to_number (value); |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
114 if (INTEGERP (value) && EQ (predicate, Qstringp)) |
2429
96b55f2f19cd
Rename int-to-string to number-to-string, since it can handle
Jim Blandy <jimb@redhat.com>
parents:
2092
diff
changeset
|
115 return Fnumber_to_string (value); |
298 | 116 } |
10245
f0637b2f1671
(wrong_type_argument): Abort if VALUE is invalid Lisp object.
Richard M. Stallman <rms@gnu.org>
parents:
9966
diff
changeset
|
117 |
f0637b2f1671
(wrong_type_argument): Abort if VALUE is invalid Lisp object.
Richard M. Stallman <rms@gnu.org>
parents:
9966
diff
changeset
|
118 /* If VALUE is not even a valid Lisp object, abort here |
f0637b2f1671
(wrong_type_argument): Abort if VALUE is invalid Lisp object.
Richard M. Stallman <rms@gnu.org>
parents:
9966
diff
changeset
|
119 where we can get a backtrace showing where it came from. */ |
10248
8b95a9a6d466
(wrong_type_argument): Use Lisp_Type_Limit.
Richard M. Stallman <rms@gnu.org>
parents:
10245
diff
changeset
|
120 if ((unsigned int) XGCTYPE (value) >= Lisp_Type_Limit) |
10245
f0637b2f1671
(wrong_type_argument): Abort if VALUE is invalid Lisp object.
Richard M. Stallman <rms@gnu.org>
parents:
9966
diff
changeset
|
121 abort (); |
f0637b2f1671
(wrong_type_argument): Abort if VALUE is invalid Lisp object.
Richard M. Stallman <rms@gnu.org>
parents:
9966
diff
changeset
|
122 |
298 | 123 value = Fsignal (Qwrong_type_argument, Fcons (predicate, Fcons (value, Qnil))); |
124 tem = call1 (predicate, value); | |
125 } | |
490 | 126 while (NILP (tem)); |
298 | 127 return value; |
128 } | |
129 | |
130 pure_write_error () | |
131 { | |
132 error ("Attempt to modify read-only object"); | |
133 } | |
134 | |
135 void | |
136 args_out_of_range (a1, a2) | |
137 Lisp_Object a1, a2; | |
138 { | |
139 while (1) | |
140 Fsignal (Qargs_out_of_range, Fcons (a1, Fcons (a2, Qnil))); | |
141 } | |
142 | |
143 void | |
144 args_out_of_range_3 (a1, a2, a3) | |
145 Lisp_Object a1, a2, a3; | |
146 { | |
147 while (1) | |
148 Fsignal (Qargs_out_of_range, Fcons (a1, Fcons (a2, Fcons (a3, Qnil)))); | |
149 } | |
150 | |
151 /* On some machines, XINT needs a temporary location. | |
152 Here it is, in case it is needed. */ | |
153 | |
154 int sign_extend_temp; | |
155 | |
156 /* On a few machines, XINT can only be done by calling this. */ | |
157 | |
158 int | |
159 sign_extend_lisp_int (num) | |
8820
f68749766ed1
(sign_extend_lisp_int): Use EMACS_INT.
Richard M. Stallman <rms@gnu.org>
parents:
8798
diff
changeset
|
160 EMACS_INT num; |
298 | 161 { |
8820
f68749766ed1
(sign_extend_lisp_int): Use EMACS_INT.
Richard M. Stallman <rms@gnu.org>
parents:
8798
diff
changeset
|
162 if (num & (((EMACS_INT) 1) << (VALBITS - 1))) |
f68749766ed1
(sign_extend_lisp_int): Use EMACS_INT.
Richard M. Stallman <rms@gnu.org>
parents:
8798
diff
changeset
|
163 return num | (((EMACS_INT) (-1)) << VALBITS); |
298 | 164 else |
8820
f68749766ed1
(sign_extend_lisp_int): Use EMACS_INT.
Richard M. Stallman <rms@gnu.org>
parents:
8798
diff
changeset
|
165 return num & ((((EMACS_INT) 1) << VALBITS) - 1); |
298 | 166 } |
167 | |
168 /* Data type predicates */ | |
169 | |
170 DEFUN ("eq", Feq, Seq, 2, 2, 0, | |
171 "T if the two args are the same Lisp object.") | |
172 (obj1, obj2) | |
173 Lisp_Object obj1, obj2; | |
174 { | |
175 if (EQ (obj1, obj2)) | |
176 return Qt; | |
177 return Qnil; | |
178 } | |
179 | |
180 DEFUN ("null", Fnull, Snull, 1, 1, 0, "T if OBJECT is nil.") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
181 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
182 Lisp_Object object; |
298 | 183 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
184 if (NILP (object)) |
298 | 185 return Qt; |
186 return Qnil; | |
187 } | |
188 | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
189 DEFUN ("type-of", Ftype_of, Stype_of, 1, 1, 0, |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
190 "Return a symbol representing the type of OBJECT.\n\ |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
191 The symbol returned names the object's basic type;\n\ |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
192 for example, (type-of 1) returns `integer'.") |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
193 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
194 Lisp_Object object; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
195 { |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
196 switch (XGCTYPE (object)) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
197 { |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
198 case Lisp_Int: |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
199 return Qinteger; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
200 |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
201 case Lisp_Symbol: |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
202 return Qsymbol; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
203 |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
204 case Lisp_String: |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
205 return Qstring; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
206 |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
207 case Lisp_Cons: |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
208 return Qcons; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
209 |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
210 case Lisp_Misc: |
11239
38aef18e8e3d
(Ftype_of, do_symval_forwarding, store_symval_forwarding)
Richard M. Stallman <rms@gnu.org>
parents:
11219
diff
changeset
|
211 switch (XMISCTYPE (object)) |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
212 { |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
213 case Lisp_Misc_Marker: |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
214 return Qmarker; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
215 case Lisp_Misc_Overlay: |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
216 return Qoverlay; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
217 case Lisp_Misc_Float: |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
218 return Qfloat; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
219 } |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
220 abort (); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
221 |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
222 case Lisp_Vectorlike: |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
223 if (GC_WINDOW_CONFIGURATIONP (object)) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
224 return Qwindow_configuration; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
225 if (GC_PROCESSP (object)) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
226 return Qprocess; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
227 if (GC_WINDOWP (object)) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
228 return Qwindow; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
229 if (GC_SUBRP (object)) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
230 return Qsubr; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
231 if (GC_COMPILEDP (object)) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
232 return Qcompiled_function; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
233 if (GC_BUFFERP (object)) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
234 return Qbuffer; |
13715
89ffc133f813
(Ftype_of): Return `char-table' and `bool-vector' for
Karl Heuer <kwzh@gnu.org>
parents:
13593
diff
changeset
|
235 if (GC_CHAR_TABLE_P (object)) |
89ffc133f813
(Ftype_of): Return `char-table' and `bool-vector' for
Karl Heuer <kwzh@gnu.org>
parents:
13593
diff
changeset
|
236 return Qchar_table; |
89ffc133f813
(Ftype_of): Return `char-table' and `bool-vector' for
Karl Heuer <kwzh@gnu.org>
parents:
13593
diff
changeset
|
237 if (GC_BOOL_VECTOR_P (object)) |
89ffc133f813
(Ftype_of): Return `char-table' and `bool-vector' for
Karl Heuer <kwzh@gnu.org>
parents:
13593
diff
changeset
|
238 return Qbool_vector; |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
239 if (GC_FRAMEP (object)) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
240 return Qframe; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
241 return Qvector; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
242 |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
243 #ifdef LISP_FLOAT_TYPE |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
244 case Lisp_Float: |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
245 return Qfloat; |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
246 #endif |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
247 |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
248 default: |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
249 abort (); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
250 } |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
251 } |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
252 |
298 | 253 DEFUN ("consp", Fconsp, Sconsp, 1, 1, 0, "T if OBJECT is a cons cell.") |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
254 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
255 Lisp_Object object; |
298 | 256 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
257 if (CONSP (object)) |
298 | 258 return Qt; |
259 return Qnil; | |
260 } | |
261 | |
262 DEFUN ("atom", Fatom, Satom, 1, 1, 0, "T if OBJECT is not a cons cell. This includes nil.") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
263 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
264 Lisp_Object object; |
298 | 265 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
266 if (CONSP (object)) |
298 | 267 return Qnil; |
268 return Qt; | |
269 } | |
270 | |
271 DEFUN ("listp", Flistp, Slistp, 1, 1, 0, "T if OBJECT is a list. This includes nil.") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
272 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
273 Lisp_Object object; |
298 | 274 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
275 if (CONSP (object) || NILP (object)) |
298 | 276 return Qt; |
277 return Qnil; | |
278 } | |
279 | |
280 DEFUN ("nlistp", Fnlistp, Snlistp, 1, 1, 0, "T if OBJECT is not a list. Lists include nil.") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
281 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
282 Lisp_Object object; |
298 | 283 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
284 if (CONSP (object) || NILP (object)) |
298 | 285 return Qnil; |
286 return Qt; | |
287 } | |
288 | |
289 DEFUN ("symbolp", Fsymbolp, Ssymbolp, 1, 1, 0, "T if OBJECT is a symbol.") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
290 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
291 Lisp_Object object; |
298 | 292 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
293 if (SYMBOLP (object)) |
298 | 294 return Qt; |
295 return Qnil; | |
296 } | |
297 | |
298 DEFUN ("vectorp", Fvectorp, Svectorp, 1, 1, 0, "T if OBJECT is a vector.") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
299 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
300 Lisp_Object object; |
298 | 301 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
302 if (VECTORP (object)) |
298 | 303 return Qt; |
304 return Qnil; | |
305 } | |
306 | |
307 DEFUN ("stringp", Fstringp, Sstringp, 1, 1, 0, "T if OBJECT is a string.") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
308 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
309 Lisp_Object object; |
298 | 310 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
311 if (STRINGP (object)) |
298 | 312 return Qt; |
313 return Qnil; | |
314 } | |
315 | |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
316 DEFUN ("char-table-p", Fchar_table_p, Schar_table_p, 1, 1, 0, "T if OBJECT is a char-table.") |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
317 (object) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
318 Lisp_Object object; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
319 { |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
320 if (CHAR_TABLE_P (object)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
321 return Qt; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
322 return Qnil; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
323 } |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
324 |
13200
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
325 DEFUN ("vector-or-char-table-p", Fvector_or_char_table_p, |
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
326 Svector_or_char_table_p, 1, 1, 0, |
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
327 "T if OBJECT is a char-table or vector.") |
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
328 (object) |
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
329 Lisp_Object object; |
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
330 { |
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
331 if (VECTORP (object) || CHAR_TABLE_P (object)) |
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
332 return Qt; |
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
333 return Qnil; |
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
334 } |
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
335 |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
336 DEFUN ("bool-vector-p", Fbool_vector_p, Sbool_vector_p, 1, 1, 0, "T if OBJECT is a bool-vector.") |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
337 (object) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
338 Lisp_Object object; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
339 { |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
340 if (BOOL_VECTOR_P (object)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
341 return Qt; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
342 return Qnil; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
343 } |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
344 |
298 | 345 DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0, "T if OBJECT is an array (string or vector).") |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
346 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
347 Lisp_Object object; |
298 | 348 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
349 if (VECTORP (object) || STRINGP (object)) |
298 | 350 return Qt; |
351 return Qnil; | |
352 } | |
353 | |
354 DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0, | |
355 "T if OBJECT is a sequence (list or array).") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
356 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
357 register Lisp_Object object; |
298 | 358 { |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
359 if (CONSP (object) || NILP (object) || VECTORP (object) || STRINGP (object) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
360 || CHAR_TABLE_P (object) || BOOL_VECTOR_P (object)) |
298 | 361 return Qt; |
362 return Qnil; | |
363 } | |
364 | |
365 DEFUN ("bufferp", Fbufferp, Sbufferp, 1, 1, 0, "T if OBJECT is an editor buffer.") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
366 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
367 Lisp_Object object; |
298 | 368 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
369 if (BUFFERP (object)) |
298 | 370 return Qt; |
371 return Qnil; | |
372 } | |
373 | |
374 DEFUN ("markerp", Fmarkerp, Smarkerp, 1, 1, 0, "T if OBJECT is a marker (editor pointer).") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
375 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
376 Lisp_Object object; |
298 | 377 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
378 if (MARKERP (object)) |
298 | 379 return Qt; |
380 return Qnil; | |
381 } | |
382 | |
383 DEFUN ("subrp", Fsubrp, Ssubrp, 1, 1, 0, "T if OBJECT is a built-in function.") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
384 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
385 Lisp_Object object; |
298 | 386 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
387 if (SUBRP (object)) |
298 | 388 return Qt; |
389 return Qnil; | |
390 } | |
391 | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1648
diff
changeset
|
392 DEFUN ("byte-code-function-p", Fbyte_code_function_p, Sbyte_code_function_p, |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1648
diff
changeset
|
393 1, 1, 0, "T if OBJECT is a byte-compiled function object.") |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
394 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
395 Lisp_Object object; |
298 | 396 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
397 if (COMPILEDP (object)) |
298 | 398 return Qt; |
399 return Qnil; | |
400 } | |
401 | |
6385
e81e7c424e8a
(Fchar_or_string_p, Fintegerp, Fnatnump): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
6201
diff
changeset
|
402 DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0, |
e81e7c424e8a
(Fchar_or_string_p, Fintegerp, Fnatnump): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
6201
diff
changeset
|
403 "T if OBJECT is a character (an integer) or a string.") |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
404 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
405 register Lisp_Object object; |
298 | 406 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
407 if (INTEGERP (object) || STRINGP (object)) |
298 | 408 return Qt; |
409 return Qnil; | |
410 } | |
411 | |
6385
e81e7c424e8a
(Fchar_or_string_p, Fintegerp, Fnatnump): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
6201
diff
changeset
|
412 DEFUN ("integerp", Fintegerp, Sintegerp, 1, 1, 0, "T if OBJECT is an integer.") |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
413 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
414 Lisp_Object object; |
298 | 415 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
416 if (INTEGERP (object)) |
298 | 417 return Qt; |
418 return Qnil; | |
419 } | |
420 | |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
421 DEFUN ("integer-or-marker-p", Finteger_or_marker_p, Sinteger_or_marker_p, 1, 1, 0, |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
422 "T if OBJECT is an integer or a marker (editor pointer).") |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
423 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
424 register Lisp_Object object; |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
425 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
426 if (MARKERP (object) || INTEGERP (object)) |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
427 return Qt; |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
428 return Qnil; |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
429 } |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
430 |
6385
e81e7c424e8a
(Fchar_or_string_p, Fintegerp, Fnatnump): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
6201
diff
changeset
|
431 DEFUN ("natnump", Fnatnump, Snatnump, 1, 1, 0, |
e81e7c424e8a
(Fchar_or_string_p, Fintegerp, Fnatnump): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
6201
diff
changeset
|
432 "T if OBJECT is a nonnegative integer.") |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
433 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
434 Lisp_Object object; |
298 | 435 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
436 if (NATNUMP (object)) |
298 | 437 return Qt; |
438 return Qnil; | |
439 } | |
440 | |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
441 DEFUN ("numberp", Fnumberp, Snumberp, 1, 1, 0, |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
442 "T if OBJECT is a number (floating point or integer).") |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
443 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
444 Lisp_Object object; |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
445 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
446 if (NUMBERP (object)) |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
447 return Qt; |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1648
diff
changeset
|
448 else |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1648
diff
changeset
|
449 return Qnil; |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
450 } |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
451 |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
452 DEFUN ("number-or-marker-p", Fnumber_or_marker_p, |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
453 Snumber_or_marker_p, 1, 1, 0, |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
454 "T if OBJECT is a number or a marker.") |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
455 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
456 Lisp_Object object; |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
457 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
458 if (NUMBERP (object) || MARKERP (object)) |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
459 return Qt; |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
460 return Qnil; |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
461 } |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
462 |
298 | 463 #ifdef LISP_FLOAT_TYPE |
464 DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0, | |
465 "T if OBJECT is a floating point number.") | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
466 (object) |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
467 Lisp_Object object; |
298 | 468 { |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
469 if (FLOATP (object)) |
298 | 470 return Qt; |
471 return Qnil; | |
472 } | |
473 #endif /* LISP_FLOAT_TYPE */ | |
474 | |
475 /* Extract and set components of lists */ | |
476 | |
477 DEFUN ("car", Fcar, Scar, 1, 1, 0, | |
11219
e9702b711640
Doc fixes to match declared args.
Simon Marshall <simon@gnu.org>
parents:
11155
diff
changeset
|
478 "Return the car of LIST. If arg is nil, return nil.\n\ |
298 | 479 Error if arg is not nil and not a cons cell. See also `car-safe'.") |
480 (list) | |
481 register Lisp_Object list; | |
482 { | |
483 while (1) | |
484 { | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
485 if (CONSP (list)) |
298 | 486 return XCONS (list)->car; |
487 else if (EQ (list, Qnil)) | |
488 return Qnil; | |
489 else | |
490 list = wrong_type_argument (Qlistp, list); | |
491 } | |
492 } | |
493 | |
494 DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0, | |
495 "Return the car of OBJECT if it is a cons cell, or else nil.") | |
496 (object) | |
497 Lisp_Object object; | |
498 { | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
499 if (CONSP (object)) |
298 | 500 return XCONS (object)->car; |
501 else | |
502 return Qnil; | |
503 } | |
504 | |
505 DEFUN ("cdr", Fcdr, Scdr, 1, 1, 0, | |
11219
e9702b711640
Doc fixes to match declared args.
Simon Marshall <simon@gnu.org>
parents:
11155
diff
changeset
|
506 "Return the cdr of LIST. If arg is nil, return nil.\n\ |
298 | 507 Error if arg is not nil and not a cons cell. See also `cdr-safe'.") |
508 | |
509 (list) | |
510 register Lisp_Object list; | |
511 { | |
512 while (1) | |
513 { | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
514 if (CONSP (list)) |
298 | 515 return XCONS (list)->cdr; |
516 else if (EQ (list, Qnil)) | |
517 return Qnil; | |
518 else | |
519 list = wrong_type_argument (Qlistp, list); | |
520 } | |
521 } | |
522 | |
523 DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0, | |
8798
e10362de8eba
(Fcdr_safe): Delete extraneous blank in docstring.
Karl Heuer <kwzh@gnu.org>
parents:
8448
diff
changeset
|
524 "Return the cdr of OBJECT if it is a cons cell, or else nil.") |
298 | 525 (object) |
526 Lisp_Object object; | |
527 { | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
528 if (CONSP (object)) |
298 | 529 return XCONS (object)->cdr; |
530 else | |
531 return Qnil; | |
532 } | |
533 | |
534 DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0, | |
11219
e9702b711640
Doc fixes to match declared args.
Simon Marshall <simon@gnu.org>
parents:
11155
diff
changeset
|
535 "Set the car of CELL to be NEWCAR. Returns NEWCAR.") |
298 | 536 (cell, newcar) |
537 register Lisp_Object cell, newcar; | |
538 { | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
539 if (!CONSP (cell)) |
298 | 540 cell = wrong_type_argument (Qconsp, cell); |
541 | |
542 CHECK_IMPURE (cell); | |
543 XCONS (cell)->car = newcar; | |
544 return newcar; | |
545 } | |
546 | |
547 DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0, | |
11219
e9702b711640
Doc fixes to match declared args.
Simon Marshall <simon@gnu.org>
parents:
11155
diff
changeset
|
548 "Set the cdr of CELL to be NEWCDR. Returns NEWCDR.") |
298 | 549 (cell, newcdr) |
550 register Lisp_Object cell, newcdr; | |
551 { | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
552 if (!CONSP (cell)) |
298 | 553 cell = wrong_type_argument (Qconsp, cell); |
554 | |
555 CHECK_IMPURE (cell); | |
556 XCONS (cell)->cdr = newcdr; | |
557 return newcdr; | |
558 } | |
559 | |
560 /* Extract and set components of symbols */ | |
561 | |
562 DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, "T if SYMBOL's value is not void.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
563 (symbol) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
564 register Lisp_Object symbol; |
298 | 565 { |
566 Lisp_Object valcontents; | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
567 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
568 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
569 valcontents = XSYMBOL (symbol)->value; |
298 | 570 |
9889 | 571 if (BUFFER_LOCAL_VALUEP (valcontents) |
572 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
573 valcontents = swap_in_symval_forwarding (symbol, valcontents); |
298 | 574 |
9369
379c7b900689
(Fboundp, Ffboundp, find_symbol_value, Fset, Fdefault_boundp, Fdefault_value):
Karl Heuer <kwzh@gnu.org>
parents:
9366
diff
changeset
|
575 return (EQ (valcontents, Qunbound) ? Qnil : Qt); |
298 | 576 } |
577 | |
578 DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, "T if SYMBOL's function definition is not void.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
579 (symbol) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
580 register Lisp_Object symbol; |
298 | 581 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
582 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
583 return (EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt); |
298 | 584 } |
585 | |
586 DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, "Make SYMBOL's value be void.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
587 (symbol) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
588 register Lisp_Object symbol; |
298 | 589 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
590 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
591 if (NILP (symbol) || EQ (symbol, Qt)) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
592 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
593 Fset (symbol, Qunbound); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
594 return symbol; |
298 | 595 } |
596 | |
597 DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, "Make SYMBOL's function definition be void.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
598 (symbol) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
599 register Lisp_Object symbol; |
298 | 600 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
601 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
602 if (NILP (symbol) || EQ (symbol, Qt)) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
603 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
604 XSYMBOL (symbol)->function = Qunbound; |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
605 return symbol; |
298 | 606 } |
607 | |
608 DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0, | |
609 "Return SYMBOL's function definition. Error if that is void.") | |
648 | 610 (symbol) |
611 register Lisp_Object symbol; | |
298 | 612 { |
648 | 613 CHECK_SYMBOL (symbol, 0); |
614 if (EQ (XSYMBOL (symbol)->function, Qunbound)) | |
615 return Fsignal (Qvoid_function, Fcons (symbol, Qnil)); | |
616 return XSYMBOL (symbol)->function; | |
298 | 617 } |
618 | |
619 DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, "Return SYMBOL's property list.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
620 (symbol) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
621 register Lisp_Object symbol; |
298 | 622 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
623 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
624 return XSYMBOL (symbol)->plist; |
298 | 625 } |
626 | |
627 DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0, "Return SYMBOL's name, a string.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
628 (symbol) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
629 register Lisp_Object symbol; |
298 | 630 { |
631 register Lisp_Object name; | |
632 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
633 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
634 XSETSTRING (name, XSYMBOL (symbol)->name); |
298 | 635 return name; |
636 } | |
637 | |
638 DEFUN ("fset", Ffset, Sfset, 2, 2, 0, | |
16754
6ca8ed287a53
(Ffset): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16434
diff
changeset
|
639 "Set SYMBOL's function definition to DEFINITION, and return DEFINITION.") |
6ca8ed287a53
(Ffset): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16434
diff
changeset
|
640 (symbol, definition) |
6ca8ed287a53
(Ffset): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16434
diff
changeset
|
641 register Lisp_Object symbol, definition; |
298 | 642 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
643 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
644 if (NILP (symbol) || EQ (symbol, Qt)) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
645 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
646 if (!NILP (Vautoload_queue) && !EQ (XSYMBOL (symbol)->function, Qunbound)) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
647 Vautoload_queue = Fcons (Fcons (symbol, XSYMBOL (symbol)->function), |
298 | 648 Vautoload_queue); |
16754
6ca8ed287a53
(Ffset): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16434
diff
changeset
|
649 XSYMBOL (symbol)->function = definition; |
8401
1eee41c8120c
(syms_of_data): Set up Qadvice_info, Qactivate_advice.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
650 /* Handle automatic advice activation */ |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
651 if (CONSP (XSYMBOL (symbol)->plist) && !NILP (Fget (symbol, Qad_advice_info))) |
8401
1eee41c8120c
(syms_of_data): Set up Qadvice_info, Qactivate_advice.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
652 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
653 call2 (Qad_activate, symbol, Qnil); |
16754
6ca8ed287a53
(Ffset): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16434
diff
changeset
|
654 definition = XSYMBOL (symbol)->function; |
8401
1eee41c8120c
(syms_of_data): Set up Qadvice_info, Qactivate_advice.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
655 } |
16754
6ca8ed287a53
(Ffset): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16434
diff
changeset
|
656 return definition; |
298 | 657 } |
658 | |
2565
c1a1557bffde
(Fdefine_function): Changed name back to Fdefalias, so we get things
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2548
diff
changeset
|
659 DEFUN ("defalias", Fdefalias, Sdefalias, 2, 2, 0, |
16756
71113ba79b1b
(Fdefalias): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16754
diff
changeset
|
660 "Set SYMBOL's function definition to DEFINITION, and return DEFINITION.\n\ |
2548
b66eeded6afc
(Fdefine_function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2515
diff
changeset
|
661 Associates the function with the current load file, if any.") |
16756
71113ba79b1b
(Fdefalias): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16754
diff
changeset
|
662 (symbol, definition) |
71113ba79b1b
(Fdefalias): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16754
diff
changeset
|
663 register Lisp_Object symbol, definition; |
2548
b66eeded6afc
(Fdefine_function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2515
diff
changeset
|
664 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
665 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
666 if (!NILP (Vautoload_queue) && !EQ (XSYMBOL (symbol)->function, Qunbound)) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
667 Vautoload_queue = Fcons (Fcons (symbol, XSYMBOL (symbol)->function), |
2548
b66eeded6afc
(Fdefine_function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2515
diff
changeset
|
668 Vautoload_queue); |
16756
71113ba79b1b
(Fdefalias): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16754
diff
changeset
|
669 XSYMBOL (symbol)->function = definition; |
8448
b6335ce87e16
(Fdefine_function, Fdefalias): Handle advice as in Ffset.
Richard M. Stallman <rms@gnu.org>
parents:
8415
diff
changeset
|
670 /* Handle automatic advice activation */ |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
671 if (CONSP (XSYMBOL (symbol)->plist) && !NILP (Fget (symbol, Qad_advice_info))) |
8448
b6335ce87e16
(Fdefine_function, Fdefalias): Handle advice as in Ffset.
Richard M. Stallman <rms@gnu.org>
parents:
8415
diff
changeset
|
672 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
673 call2 (Qad_activate, symbol, Qnil); |
16756
71113ba79b1b
(Fdefalias): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16754
diff
changeset
|
674 definition = XSYMBOL (symbol)->function; |
8448
b6335ce87e16
(Fdefine_function, Fdefalias): Handle advice as in Ffset.
Richard M. Stallman <rms@gnu.org>
parents:
8415
diff
changeset
|
675 } |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
676 LOADHIST_ATTACH (symbol); |
16756
71113ba79b1b
(Fdefalias): Change argument name and doc string.
Richard M. Stallman <rms@gnu.org>
parents:
16754
diff
changeset
|
677 return definition; |
2548
b66eeded6afc
(Fdefine_function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2515
diff
changeset
|
678 } |
b66eeded6afc
(Fdefine_function): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2515
diff
changeset
|
679 |
298 | 680 DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0, |
681 "Set SYMBOL's property list to NEWVAL, and return NEWVAL.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
682 (symbol, newplist) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
683 register Lisp_Object symbol, newplist; |
298 | 684 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
685 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
686 XSYMBOL (symbol)->plist = newplist; |
298 | 687 return newplist; |
688 } | |
648 | 689 |
298 | 690 |
691 /* Getting and setting values of symbols */ | |
692 | |
693 /* Given the raw contents of a symbol value cell, | |
694 return the Lisp value of the symbol. | |
695 This does not handle buffer-local variables; use | |
696 swap_in_symval_forwarding for that. */ | |
697 | |
698 Lisp_Object | |
699 do_symval_forwarding (valcontents) | |
700 register Lisp_Object valcontents; | |
701 { | |
702 register Lisp_Object val; | |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
703 int offset; |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
704 if (MISCP (valcontents)) |
11239
38aef18e8e3d
(Ftype_of, do_symval_forwarding, store_symval_forwarding)
Richard M. Stallman <rms@gnu.org>
parents:
11219
diff
changeset
|
705 switch (XMISCTYPE (valcontents)) |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
706 { |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
707 case Lisp_Misc_Intfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
708 XSETINT (val, *XINTFWD (valcontents)->intvar); |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
709 return val; |
298 | 710 |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
711 case Lisp_Misc_Boolfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
712 return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil); |
298 | 713 |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
714 case Lisp_Misc_Objfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
715 return *XOBJFWD (valcontents)->objvar; |
298 | 716 |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
717 case Lisp_Misc_Buffer_Objfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
718 offset = XBUFFER_OBJFWD (valcontents)->offset; |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
719 return *(Lisp_Object *)(offset + (char *)current_buffer); |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
720 |
11019
48bf6677dab3
(find_symbol_value): current_perdisplay now is never null.
Karl Heuer <kwzh@gnu.org>
parents:
11002
diff
changeset
|
721 case Lisp_Misc_Kboard_Objfwd: |
48bf6677dab3
(find_symbol_value): current_perdisplay now is never null.
Karl Heuer <kwzh@gnu.org>
parents:
11002
diff
changeset
|
722 offset = XKBOARD_OBJFWD (valcontents)->offset; |
48bf6677dab3
(find_symbol_value): current_perdisplay now is never null.
Karl Heuer <kwzh@gnu.org>
parents:
11002
diff
changeset
|
723 return *(Lisp_Object *)(offset + (char *)current_kboard); |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
724 } |
298 | 725 return valcontents; |
726 } | |
727 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
728 /* Store NEWVAL into SYMBOL, where VALCONTENTS is found in the value cell |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
729 of SYMBOL. If SYMBOL is buffer-local, VALCONTENTS should be the |
298 | 730 buffer-independent contents of the value cell: forwarded just one |
731 step past the buffer-localness. */ | |
732 | |
733 void | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
734 store_symval_forwarding (symbol, valcontents, newval) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
735 Lisp_Object symbol; |
298 | 736 register Lisp_Object valcontents, newval; |
737 { | |
10457
2ab3bd0288a9
Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents:
10290
diff
changeset
|
738 switch (SWITCH_ENUM_CAST (XTYPE (valcontents))) |
298 | 739 { |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
740 case Lisp_Misc: |
11239
38aef18e8e3d
(Ftype_of, do_symval_forwarding, store_symval_forwarding)
Richard M. Stallman <rms@gnu.org>
parents:
11219
diff
changeset
|
741 switch (XMISCTYPE (valcontents)) |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
742 { |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
743 case Lisp_Misc_Intfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
744 CHECK_NUMBER (newval, 1); |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
745 *XINTFWD (valcontents)->intvar = XINT (newval); |
11701
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
746 if (*XINTFWD (valcontents)->intvar != XINT (newval)) |
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
747 error ("Value out of range for variable `%s'", |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
748 XSYMBOL (symbol)->name->data); |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
749 break; |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
750 |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
751 case Lisp_Misc_Boolfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
752 *XBOOLFWD (valcontents)->boolvar = NILP (newval) ? 0 : 1; |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
753 break; |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
754 |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
755 case Lisp_Misc_Objfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
756 *XOBJFWD (valcontents)->objvar = newval; |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
757 break; |
298 | 758 |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
759 case Lisp_Misc_Buffer_Objfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
760 { |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
761 int offset = XBUFFER_OBJFWD (valcontents)->offset; |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
762 Lisp_Object type; |
298 | 763 |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
764 type = *(Lisp_Object *)(offset + (char *)&buffer_local_types); |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
765 if (! NILP (type) && ! NILP (newval) |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
766 && XTYPE (newval) != XINT (type)) |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
767 buffer_slot_type_mismatch (offset); |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
768 |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
769 *(Lisp_Object *)(offset + (char *)current_buffer) = newval; |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
770 } |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
771 break; |
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
772 |
11019
48bf6677dab3
(find_symbol_value): current_perdisplay now is never null.
Karl Heuer <kwzh@gnu.org>
parents:
11002
diff
changeset
|
773 case Lisp_Misc_Kboard_Objfwd: |
48bf6677dab3
(find_symbol_value): current_perdisplay now is never null.
Karl Heuer <kwzh@gnu.org>
parents:
11002
diff
changeset
|
774 (*(Lisp_Object *)((char *)current_kboard |
48bf6677dab3
(find_symbol_value): current_perdisplay now is never null.
Karl Heuer <kwzh@gnu.org>
parents:
11002
diff
changeset
|
775 + XKBOARD_OBJFWD (valcontents)->offset)) |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
776 = newval; |
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
777 break; |
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
778 |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
779 default: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
780 goto def; |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
781 } |
298 | 782 break; |
783 | |
784 default: | |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
785 def: |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
786 valcontents = XSYMBOL (symbol)->value; |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
787 if (BUFFER_LOCAL_VALUEP (valcontents) |
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
788 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
789 XBUFFER_LOCAL_VALUE (valcontents)->car = newval; |
298 | 790 else |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
791 XSYMBOL (symbol)->value = newval; |
298 | 792 } |
793 } | |
794 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
795 /* Set up the buffer-local symbol SYMBOL for validity in the current |
298 | 796 buffer. VALCONTENTS is the contents of its value cell. |
797 Return the value forwarded one step past the buffer-local indicator. */ | |
798 | |
799 static Lisp_Object | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
800 swap_in_symval_forwarding (symbol, valcontents) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
801 Lisp_Object symbol, valcontents; |
298 | 802 { |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
803 /* valcontents is a pointer to a struct resembling the cons |
298 | 804 (REALVALUE BUFFER CURRENT-ALIST-ELEMENT . DEFAULT-VALUE)). |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
805 |
298 | 806 CURRENT-ALIST-ELEMENT is a pointer to an element of BUFFER's |
1263
3790dfbefb30
* data.c (swap_in_symval_forwarding): Formatting tweaked.
Jim Blandy <jimb@redhat.com>
parents:
1253
diff
changeset
|
807 local_var_alist, that being the element whose car is this |
3790dfbefb30
* data.c (swap_in_symval_forwarding): Formatting tweaked.
Jim Blandy <jimb@redhat.com>
parents:
1253
diff
changeset
|
808 variable. Or it can be a pointer to the |
3790dfbefb30
* data.c (swap_in_symval_forwarding): Formatting tweaked.
Jim Blandy <jimb@redhat.com>
parents:
1253
diff
changeset
|
809 (CURRENT-ALIST-ELEMENT . DEFAULT-VALUE), if BUFFER does not have |
3790dfbefb30
* data.c (swap_in_symval_forwarding): Formatting tweaked.
Jim Blandy <jimb@redhat.com>
parents:
1253
diff
changeset
|
810 an element in its alist for this variable. |
3790dfbefb30
* data.c (swap_in_symval_forwarding): Formatting tweaked.
Jim Blandy <jimb@redhat.com>
parents:
1253
diff
changeset
|
811 |
3790dfbefb30
* data.c (swap_in_symval_forwarding): Formatting tweaked.
Jim Blandy <jimb@redhat.com>
parents:
1253
diff
changeset
|
812 If the current buffer is not BUFFER, we store the current |
3790dfbefb30
* data.c (swap_in_symval_forwarding): Formatting tweaked.
Jim Blandy <jimb@redhat.com>
parents:
1253
diff
changeset
|
813 REALVALUE value into CURRENT-ALIST-ELEMENT, then find the |
3790dfbefb30
* data.c (swap_in_symval_forwarding): Formatting tweaked.
Jim Blandy <jimb@redhat.com>
parents:
1253
diff
changeset
|
814 appropriate alist element for the buffer now current and set up |
3790dfbefb30
* data.c (swap_in_symval_forwarding): Formatting tweaked.
Jim Blandy <jimb@redhat.com>
parents:
1253
diff
changeset
|
815 CURRENT-ALIST-ELEMENT. Then we set REALVALUE out of that |
3790dfbefb30
* data.c (swap_in_symval_forwarding): Formatting tweaked.
Jim Blandy <jimb@redhat.com>
parents:
1253
diff
changeset
|
816 element, and store into BUFFER. |
3790dfbefb30
* data.c (swap_in_symval_forwarding): Formatting tweaked.
Jim Blandy <jimb@redhat.com>
parents:
1253
diff
changeset
|
817 |
298 | 818 Note that REALVALUE can be a forwarding pointer. */ |
819 | |
820 register Lisp_Object tem1; | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
821 tem1 = XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->car; |
298 | 822 |
490 | 823 if (NILP (tem1) || current_buffer != XBUFFER (tem1)) |
298 | 824 { |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
825 tem1 = XCONS (XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr)->car; |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
826 Fsetcdr (tem1, |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
827 do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->car)); |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
828 tem1 = assq_no_quit (symbol, current_buffer->local_var_alist); |
490 | 829 if (NILP (tem1)) |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
830 tem1 = XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr; |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
831 XCONS (XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr)->car = tem1; |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
832 XSETBUFFER (XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->car, |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
833 current_buffer); |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
834 store_symval_forwarding (symbol, XBUFFER_LOCAL_VALUE (valcontents)->car, |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
835 Fcdr (tem1)); |
298 | 836 } |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
837 return XBUFFER_LOCAL_VALUE (valcontents)->car; |
298 | 838 } |
839 | |
514 | 840 /* Find the value of a symbol, returning Qunbound if it's not bound. |
841 This is helpful for code which just wants to get a variable's value | |
14036 | 842 if it has one, without signaling an error. |
514 | 843 Note that it must not be possible to quit |
844 within this function. Great care is required for this. */ | |
298 | 845 |
514 | 846 Lisp_Object |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
847 find_symbol_value (symbol) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
848 Lisp_Object symbol; |
298 | 849 { |
850 register Lisp_Object valcontents, tem1; | |
851 register Lisp_Object val; | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
852 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
853 valcontents = XSYMBOL (symbol)->value; |
298 | 854 |
9889 | 855 if (BUFFER_LOCAL_VALUEP (valcontents) |
856 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
857 valcontents = swap_in_symval_forwarding (symbol, valcontents); |
9878
8a68b5794c91
(Fboundp, find_symbol_value): Use type test macros instead of checking XTYPE
Karl Heuer <kwzh@gnu.org>
parents:
9465
diff
changeset
|
858 |
8a68b5794c91
(Fboundp, find_symbol_value): Use type test macros instead of checking XTYPE
Karl Heuer <kwzh@gnu.org>
parents:
9465
diff
changeset
|
859 if (MISCP (valcontents)) |
298 | 860 { |
11239
38aef18e8e3d
(Ftype_of, do_symval_forwarding, store_symval_forwarding)
Richard M. Stallman <rms@gnu.org>
parents:
11219
diff
changeset
|
861 switch (XMISCTYPE (valcontents)) |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
862 { |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
863 case Lisp_Misc_Intfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
864 XSETINT (val, *XINTFWD (valcontents)->intvar); |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
865 return val; |
298 | 866 |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
867 case Lisp_Misc_Boolfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
868 return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil); |
298 | 869 |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
870 case Lisp_Misc_Objfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
871 return *XOBJFWD (valcontents)->objvar; |
298 | 872 |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
873 case Lisp_Misc_Buffer_Objfwd: |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
874 return *(Lisp_Object *)(XBUFFER_OBJFWD (valcontents)->offset |
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
875 + (char *)current_buffer); |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
876 |
11019
48bf6677dab3
(find_symbol_value): current_perdisplay now is never null.
Karl Heuer <kwzh@gnu.org>
parents:
11002
diff
changeset
|
877 case Lisp_Misc_Kboard_Objfwd: |
48bf6677dab3
(find_symbol_value): current_perdisplay now is never null.
Karl Heuer <kwzh@gnu.org>
parents:
11002
diff
changeset
|
878 return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset |
48bf6677dab3
(find_symbol_value): current_perdisplay now is never null.
Karl Heuer <kwzh@gnu.org>
parents:
11002
diff
changeset
|
879 + (char *)current_kboard); |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
880 } |
298 | 881 } |
882 | |
883 return valcontents; | |
884 } | |
885 | |
514 | 886 DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0, |
887 "Return SYMBOL's value. Error if that is void.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
888 (symbol) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
889 Lisp_Object symbol; |
514 | 890 { |
6497
89ff61b53cee
(store_symval_forwarding, Fsymbol_value): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6459
diff
changeset
|
891 Lisp_Object val; |
514 | 892 |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
893 val = find_symbol_value (symbol); |
514 | 894 if (EQ (val, Qunbound)) |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
895 return Fsignal (Qvoid_variable, Fcons (symbol, Qnil)); |
514 | 896 else |
897 return val; | |
898 } | |
899 | |
298 | 900 DEFUN ("set", Fset, Sset, 2, 2, 0, |
901 "Set SYMBOL's value to NEWVAL, and return NEWVAL.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
902 (symbol, newval) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
903 register Lisp_Object symbol, newval; |
298 | 904 { |
16931
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
905 return set_internal (symbol, newval, 0); |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
906 } |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
907 |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
908 /* Stpre the value NEWVAL into SYMBOL. |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
909 If BINDFLAG is zero, then if this symbol is supposed to become |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
910 local in every buffer where it is set, then we make it local. |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
911 If BINDFLAG is nonzero, we don't do that. */ |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
912 |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
913 Lisp_Object |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
914 set_internal (symbol, newval, bindflag) |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
915 register Lisp_Object symbol, newval; |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
916 int bindflag; |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
917 { |
9369
379c7b900689
(Fboundp, Ffboundp, find_symbol_value, Fset, Fdefault_boundp, Fdefault_value):
Karl Heuer <kwzh@gnu.org>
parents:
9366
diff
changeset
|
918 int voide = EQ (newval, Qunbound); |
298 | 919 |
920 register Lisp_Object valcontents, tem1, current_alist_element; | |
921 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
922 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
923 if (NILP (symbol) || EQ (symbol, Qt)) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
924 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
925 valcontents = XSYMBOL (symbol)->value; |
298 | 926 |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
927 if (BUFFER_OBJFWDP (valcontents)) |
298 | 928 { |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
929 register int idx = XBUFFER_OBJFWD (valcontents)->offset; |
9364
0bba3bd707c7
(Fset, default_value, Fset_default, Fkill_local_variable): Access
Karl Heuer <kwzh@gnu.org>
parents:
9301
diff
changeset
|
930 register int mask = XINT (*((Lisp_Object *) |
0bba3bd707c7
(Fset, default_value, Fset_default, Fkill_local_variable): Access
Karl Heuer <kwzh@gnu.org>
parents:
9301
diff
changeset
|
931 (idx + (char *)&buffer_local_flags))); |
298 | 932 if (mask > 0) |
933 current_buffer->local_var_flags |= mask; | |
934 } | |
935 | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
936 else if (BUFFER_LOCAL_VALUEP (valcontents) |
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
937 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
298 | 938 { |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
939 /* valcontents is actually a pointer to a struct resembling a cons, |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
940 with contents something like: |
733 | 941 (REALVALUE BUFFER CURRENT-ALIST-ELEMENT . DEFAULT-VALUE). |
942 | |
943 BUFFER is the last buffer for which this symbol's value was | |
944 made up to date. | |
298 | 945 |
733 | 946 CURRENT-ALIST-ELEMENT is a pointer to an element of BUFFER's |
947 local_var_alist, that being the element whose car is this | |
948 variable. Or it can be a pointer to the | |
949 (CURRENT-ALIST-ELEMENT . DEFAULT-VALUE), if BUFFER does not | |
950 have an element in its alist for this variable (that is, if | |
951 BUFFER sees the default value of this variable). | |
952 | |
953 If we want to examine or set the value and BUFFER is current, | |
954 we just examine or set REALVALUE. If BUFFER is not current, we | |
955 store the current REALVALUE value into CURRENT-ALIST-ELEMENT, | |
956 then find the appropriate alist element for the buffer now | |
957 current and set up CURRENT-ALIST-ELEMENT. Then we set | |
958 REALVALUE out of that element, and store into BUFFER. | |
298 | 959 |
733 | 960 If we are setting the variable and the current buffer does |
961 not have an alist entry for this variable, an alist entry is | |
962 created. | |
963 | |
964 Note that REALVALUE can be a forwarding pointer. Each time | |
965 it is examined or set, forwarding must be done. */ | |
966 | |
967 /* What value are we caching right now? */ | |
968 current_alist_element = | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
969 XCONS (XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr)->car; |
298 | 970 |
733 | 971 /* If the current buffer is not the buffer whose binding is |
972 currently cached, or if it's a Lisp_Buffer_Local_Value and | |
973 we're looking at the default value, the cache is invalid; we | |
974 need to write it out, and find the new CURRENT-ALIST-ELEMENT. */ | |
975 if ((current_buffer | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
976 != XBUFFER (XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->car)) |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
977 || (BUFFER_LOCAL_VALUEP (valcontents) |
1508
768d4c10c2bf
* data.c (Fset): See if current_alist_element points to itself
Jim Blandy <jimb@redhat.com>
parents:
1293
diff
changeset
|
978 && EQ (XCONS (current_alist_element)->car, |
768d4c10c2bf
* data.c (Fset): See if current_alist_element points to itself
Jim Blandy <jimb@redhat.com>
parents:
1293
diff
changeset
|
979 current_alist_element))) |
298 | 980 { |
733 | 981 /* Write out the cached value for the old buffer; copy it |
982 back to its alist element. This works if the current | |
983 buffer only sees the default value, too. */ | |
984 Fsetcdr (current_alist_element, | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
985 do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->car)); |
298 | 986 |
733 | 987 /* Find the new value for CURRENT-ALIST-ELEMENT. */ |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
988 tem1 = Fassq (symbol, current_buffer->local_var_alist); |
490 | 989 if (NILP (tem1)) |
733 | 990 { |
991 /* This buffer still sees the default value. */ | |
992 | |
993 /* If the variable is a Lisp_Some_Buffer_Local_Value, | |
16931
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
994 or if this is `let' rather than `set', |
733 | 995 make CURRENT-ALIST-ELEMENT point to itself, |
996 indicating that we're seeing the default value. */ | |
16931
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
997 if (bindflag || SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
998 tem1 = XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr; |
733 | 999 |
16931
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
1000 /* If it's a Lisp_Buffer_Local_Value, being set not bound, |
8bdfc6767130
(set_internal): New subroutine. New arg BINDFLAG.
Richard M. Stallman <rms@gnu.org>
parents:
16787
diff
changeset
|
1001 give this buffer a new assoc for a local value and set |
733 | 1002 CURRENT-ALIST-ELEMENT to point to that. */ |
1003 else | |
1004 { | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1005 tem1 = Fcons (symbol, Fcdr (current_alist_element)); |
733 | 1006 current_buffer->local_var_alist = |
1007 Fcons (tem1, current_buffer->local_var_alist); | |
1008 } | |
1009 } | |
1010 /* Cache the new buffer's assoc in CURRENT-ALIST-ELEMENT. */ | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1011 XCONS (XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr)->car |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1012 = tem1; |
733 | 1013 |
1014 /* Set BUFFER, now that CURRENT-ALIST-ELEMENT is accurate. */ | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1015 XSETBUFFER (XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->car, |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1016 current_buffer); |
298 | 1017 } |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1018 valcontents = XBUFFER_LOCAL_VALUE (valcontents)->car; |
298 | 1019 } |
733 | 1020 |
298 | 1021 /* If storing void (making the symbol void), forward only through |
1022 buffer-local indicator, not through Lisp_Objfwd, etc. */ | |
1023 if (voide) | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1024 store_symval_forwarding (symbol, Qnil, newval); |
298 | 1025 else |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1026 store_symval_forwarding (symbol, valcontents, newval); |
733 | 1027 |
298 | 1028 return newval; |
1029 } | |
1030 | |
1031 /* Access or set a buffer-local symbol's default value. */ | |
1032 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1033 /* Return the default value of SYMBOL, but don't check for voidness. |
9369
379c7b900689
(Fboundp, Ffboundp, find_symbol_value, Fset, Fdefault_boundp, Fdefault_value):
Karl Heuer <kwzh@gnu.org>
parents:
9366
diff
changeset
|
1034 Return Qunbound if it is void. */ |
298 | 1035 |
1036 Lisp_Object | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1037 default_value (symbol) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1038 Lisp_Object symbol; |
298 | 1039 { |
1040 register Lisp_Object valcontents; | |
1041 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1042 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1043 valcontents = XSYMBOL (symbol)->value; |
298 | 1044 |
1045 /* For a built-in buffer-local variable, get the default value | |
1046 rather than letting do_symval_forwarding get the current value. */ | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1047 if (BUFFER_OBJFWDP (valcontents)) |
298 | 1048 { |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
1049 register int idx = XBUFFER_OBJFWD (valcontents)->offset; |
298 | 1050 |
9364
0bba3bd707c7
(Fset, default_value, Fset_default, Fkill_local_variable): Access
Karl Heuer <kwzh@gnu.org>
parents:
9301
diff
changeset
|
1051 if (XINT (*(Lisp_Object *) (idx + (char *) &buffer_local_flags)) != 0) |
298 | 1052 return *(Lisp_Object *)(idx + (char *) &buffer_defaults); |
1053 } | |
1054 | |
1055 /* Handle user-created local variables. */ | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1056 if (BUFFER_LOCAL_VALUEP (valcontents) |
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1057 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
298 | 1058 { |
1059 /* If var is set up for a buffer that lacks a local value for it, | |
1060 the current value is nominally the default value. | |
1061 But the current value slot may be more up to date, since | |
1062 ordinary setq stores just that slot. So use that. */ | |
1063 Lisp_Object current_alist_element, alist_element_car; | |
1064 current_alist_element | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1065 = XCONS (XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr)->car; |
298 | 1066 alist_element_car = XCONS (current_alist_element)->car; |
1067 if (EQ (alist_element_car, current_alist_element)) | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1068 return do_symval_forwarding (XBUFFER_LOCAL_VALUE (valcontents)->car); |
298 | 1069 else |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1070 return XCONS (XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr)->cdr; |
298 | 1071 } |
1072 /* For other variables, get the current value. */ | |
1073 return do_symval_forwarding (valcontents); | |
1074 } | |
1075 | |
1076 DEFUN ("default-boundp", Fdefault_boundp, Sdefault_boundp, 1, 1, 0, | |
1077 "Return T if SYMBOL has a non-void default value.\n\ | |
1078 This is the value that is seen in buffers that do not have their own values\n\ | |
1079 for this variable.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1080 (symbol) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1081 Lisp_Object symbol; |
298 | 1082 { |
1083 register Lisp_Object value; | |
1084 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1085 value = default_value (symbol); |
9369
379c7b900689
(Fboundp, Ffboundp, find_symbol_value, Fset, Fdefault_boundp, Fdefault_value):
Karl Heuer <kwzh@gnu.org>
parents:
9366
diff
changeset
|
1086 return (EQ (value, Qunbound) ? Qnil : Qt); |
298 | 1087 } |
1088 | |
1089 DEFUN ("default-value", Fdefault_value, Sdefault_value, 1, 1, 0, | |
1090 "Return SYMBOL's default value.\n\ | |
1091 This is the value that is seen in buffers that do not have their own values\n\ | |
1092 for this variable. The default value is meaningful for variables with\n\ | |
1093 local bindings in certain buffers.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1094 (symbol) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1095 Lisp_Object symbol; |
298 | 1096 { |
1097 register Lisp_Object value; | |
1098 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1099 value = default_value (symbol); |
9369
379c7b900689
(Fboundp, Ffboundp, find_symbol_value, Fset, Fdefault_boundp, Fdefault_value):
Karl Heuer <kwzh@gnu.org>
parents:
9366
diff
changeset
|
1100 if (EQ (value, Qunbound)) |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1101 return Fsignal (Qvoid_variable, Fcons (symbol, Qnil)); |
298 | 1102 return value; |
1103 } | |
1104 | |
1105 DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0, | |
1106 "Set SYMBOL's default value to VAL. SYMBOL and VAL are evaluated.\n\ | |
1107 The default value is seen in buffers that do not have their own values\n\ | |
1108 for this variable.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1109 (symbol, value) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1110 Lisp_Object symbol, value; |
298 | 1111 { |
1112 register Lisp_Object valcontents, current_alist_element, alist_element_buffer; | |
1113 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1114 CHECK_SYMBOL (symbol, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1115 valcontents = XSYMBOL (symbol)->value; |
298 | 1116 |
1117 /* Handle variables like case-fold-search that have special slots | |
1118 in the buffer. Make them work apparently like Lisp_Buffer_Local_Value | |
1119 variables. */ | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1120 if (BUFFER_OBJFWDP (valcontents)) |
298 | 1121 { |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
1122 register int idx = XBUFFER_OBJFWD (valcontents)->offset; |
298 | 1123 register struct buffer *b; |
9364
0bba3bd707c7
(Fset, default_value, Fset_default, Fkill_local_variable): Access
Karl Heuer <kwzh@gnu.org>
parents:
9301
diff
changeset
|
1124 register int mask = XINT (*((Lisp_Object *) |
0bba3bd707c7
(Fset, default_value, Fset_default, Fkill_local_variable): Access
Karl Heuer <kwzh@gnu.org>
parents:
9301
diff
changeset
|
1125 (idx + (char *)&buffer_local_flags))); |
298 | 1126 |
1127 if (mask > 0) | |
1128 { | |
1129 *(Lisp_Object *)(idx + (char *) &buffer_defaults) = value; | |
1130 for (b = all_buffers; b; b = b->next) | |
1131 if (!(b->local_var_flags & mask)) | |
1132 *(Lisp_Object *)(idx + (char *) b) = value; | |
1133 } | |
1134 return value; | |
1135 } | |
1136 | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1137 if (!BUFFER_LOCAL_VALUEP (valcontents) |
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1138 && !SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1139 return Fset (symbol, value); |
298 | 1140 |
1141 /* Store new value into the DEFAULT-VALUE slot */ | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1142 XCONS (XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr)->cdr = value; |
298 | 1143 |
1144 /* If that slot is current, we must set the REALVALUE slot too */ | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1145 current_alist_element |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1146 = XCONS (XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->cdr)->car; |
298 | 1147 alist_element_buffer = Fcar (current_alist_element); |
1148 if (EQ (alist_element_buffer, current_alist_element)) | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1149 store_symval_forwarding (symbol, XBUFFER_LOCAL_VALUE (valcontents)->car, |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1150 value); |
298 | 1151 |
1152 return value; | |
1153 } | |
1154 | |
1155 DEFUN ("setq-default", Fsetq_default, Ssetq_default, 2, UNEVALLED, 0, | |
6919
dabe7a363f28
(Fsetq_default): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6825
diff
changeset
|
1156 "Set the default value of variable VAR to VALUE.\n\ |
dabe7a363f28
(Fsetq_default): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6825
diff
changeset
|
1157 VAR, the variable name, is literal (not evaluated);\n\ |
dabe7a363f28
(Fsetq_default): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6825
diff
changeset
|
1158 VALUE is an expression and it is evaluated.\n\ |
dabe7a363f28
(Fsetq_default): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6825
diff
changeset
|
1159 The default value of a variable is seen in buffers\n\ |
dabe7a363f28
(Fsetq_default): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6825
diff
changeset
|
1160 that do not have their own values for the variable.\n\ |
dabe7a363f28
(Fsetq_default): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6825
diff
changeset
|
1161 \n\ |
dabe7a363f28
(Fsetq_default): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6825
diff
changeset
|
1162 More generally, you can use multiple variables and values, as in\n\ |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1163 (setq-default SYMBOL VALUE SYMBOL VALUE...)\n\ |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1164 This sets each SYMBOL's default value to the corresponding VALUE.\n\ |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1165 The VALUE for the Nth SYMBOL can refer to the new default values\n\ |
6919
dabe7a363f28
(Fsetq_default): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6825
diff
changeset
|
1166 of previous SYMs.") |
298 | 1167 (args) |
1168 Lisp_Object args; | |
1169 { | |
1170 register Lisp_Object args_left; | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1171 register Lisp_Object val, symbol; |
298 | 1172 struct gcpro gcpro1; |
1173 | |
490 | 1174 if (NILP (args)) |
298 | 1175 return Qnil; |
1176 | |
1177 args_left = args; | |
1178 GCPRO1 (args); | |
1179 | |
1180 do | |
1181 { | |
1182 val = Feval (Fcar (Fcdr (args_left))); | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1183 symbol = Fcar (args_left); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1184 Fset_default (symbol, val); |
298 | 1185 args_left = Fcdr (Fcdr (args_left)); |
1186 } | |
490 | 1187 while (!NILP (args_left)); |
298 | 1188 |
1189 UNGCPRO; | |
1190 return val; | |
1191 } | |
1192 | |
1278
0a0646ae381f
* data.c (Fmake_local_variable): If SYM forwards to a C variable,
Jim Blandy <jimb@redhat.com>
parents:
1263
diff
changeset
|
1193 /* Lisp functions for creating and removing buffer-local variables. */ |
0a0646ae381f
* data.c (Fmake_local_variable): If SYM forwards to a C variable,
Jim Blandy <jimb@redhat.com>
parents:
1263
diff
changeset
|
1194 |
298 | 1195 DEFUN ("make-variable-buffer-local", Fmake_variable_buffer_local, Smake_variable_buffer_local, |
1196 1, 1, "vMake Variable Buffer Local: ", | |
1197 "Make VARIABLE have a separate value for each buffer.\n\ | |
1198 At any time, the value for the current buffer is in effect.\n\ | |
1199 There is also a default value which is seen in any buffer which has not yet\n\ | |
1200 set its own value.\n\ | |
1201 Using `set' or `setq' to set the variable causes it to have a separate value\n\ | |
1202 for the current buffer if it was previously using the default value.\n\ | |
1203 The function `default-value' gets the default value and `set-default' sets it.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1204 (variable) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1205 register Lisp_Object variable; |
298 | 1206 { |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1207 register Lisp_Object tem, valcontents, newval; |
298 | 1208 |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1209 CHECK_SYMBOL (variable, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1210 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1211 valcontents = XSYMBOL (variable)->value; |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1212 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1213 error ("Symbol %s may not be buffer-local", XSYMBOL (variable)->name->data); |
298 | 1214 |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1215 if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents)) |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1216 return variable; |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1217 if (SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
298 | 1218 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1219 XMISCTYPE (XSYMBOL (variable)->value) = Lisp_Misc_Buffer_Local_Value; |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1220 return variable; |
298 | 1221 } |
1222 if (EQ (valcontents, Qunbound)) | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1223 XSYMBOL (variable)->value = Qnil; |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1224 tem = Fcons (Qnil, Fsymbol_value (variable)); |
298 | 1225 XCONS (tem)->car = tem; |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1226 newval = allocate_misc (); |
11239
38aef18e8e3d
(Ftype_of, do_symval_forwarding, store_symval_forwarding)
Richard M. Stallman <rms@gnu.org>
parents:
11219
diff
changeset
|
1227 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value; |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1228 XBUFFER_LOCAL_VALUE (newval)->car = XSYMBOL (variable)->value; |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1229 XBUFFER_LOCAL_VALUE (newval)->cdr = Fcons (Fcurrent_buffer (), tem); |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1230 XSYMBOL (variable)->value = newval; |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1231 return variable; |
298 | 1232 } |
1233 | |
1234 DEFUN ("make-local-variable", Fmake_local_variable, Smake_local_variable, | |
1235 1, 1, "vMake Local Variable: ", | |
1236 "Make VARIABLE have a separate value in the current buffer.\n\ | |
1237 Other buffers will continue to share a common default value.\n\ | |
6825
f70a517ae9e2
(Fsetq_default, Fmake_local_variable): Doc syntax fix.
Richard M. Stallman <rms@gnu.org>
parents:
6497
diff
changeset
|
1238 \(The buffer-local value of VARIABLE starts out as the same value\n\ |
f70a517ae9e2
(Fsetq_default, Fmake_local_variable): Doc syntax fix.
Richard M. Stallman <rms@gnu.org>
parents:
6497
diff
changeset
|
1239 VARIABLE previously had. If VARIABLE was void, it remains void.\)\n\ |
298 | 1240 See also `make-variable-buffer-local'.\n\n\ |
1241 If the variable is already arranged to become local when set,\n\ | |
1242 this function causes a local value to exist for this buffer,\n\ | |
9194
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
1243 just as setting the variable would do.\n\ |
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
1244 \n\ |
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
1245 Do not use `make-local-variable' to make a hook variable buffer-local.\n\ |
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
1246 Use `make-local-hook' instead.") |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1247 (variable) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1248 register Lisp_Object variable; |
298 | 1249 { |
1250 register Lisp_Object tem, valcontents; | |
1251 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1252 CHECK_SYMBOL (variable, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1253 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1254 valcontents = XSYMBOL (variable)->value; |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1255 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1256 error ("Symbol %s may not be buffer-local", XSYMBOL (variable)->name->data); |
298 | 1257 |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1258 if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents)) |
298 | 1259 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1260 tem = Fboundp (variable); |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
1261 |
298 | 1262 /* Make sure the symbol has a local value in this particular buffer, |
1263 by setting it to the same value it already has. */ | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1264 Fset (variable, (EQ (tem, Qt) ? Fsymbol_value (variable) : Qunbound)); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1265 return variable; |
298 | 1266 } |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1267 /* Make sure symbol is set up to hold per-buffer values */ |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1268 if (!SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
298 | 1269 { |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1270 Lisp_Object newval; |
298 | 1271 tem = Fcons (Qnil, do_symval_forwarding (valcontents)); |
1272 XCONS (tem)->car = tem; | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1273 newval = allocate_misc (); |
11239
38aef18e8e3d
(Ftype_of, do_symval_forwarding, store_symval_forwarding)
Richard M. Stallman <rms@gnu.org>
parents:
11219
diff
changeset
|
1274 XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value; |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1275 XBUFFER_LOCAL_VALUE (newval)->car = XSYMBOL (variable)->value; |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1276 XBUFFER_LOCAL_VALUE (newval)->cdr = Fcons (Qnil, tem); |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1277 XSYMBOL (variable)->value = newval; |
298 | 1278 } |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1279 /* Make sure this buffer has its own value of symbol */ |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1280 tem = Fassq (variable, current_buffer->local_var_alist); |
490 | 1281 if (NILP (tem)) |
298 | 1282 { |
13593
e27c32c7d428
(Fmake_local_variable): Call find_symbol_value
Richard M. Stallman <rms@gnu.org>
parents:
13363
diff
changeset
|
1283 /* Swap out any local binding for some other buffer, and make |
e27c32c7d428
(Fmake_local_variable): Call find_symbol_value
Richard M. Stallman <rms@gnu.org>
parents:
13363
diff
changeset
|
1284 sure the current value is permanently recorded, if it's the |
e27c32c7d428
(Fmake_local_variable): Call find_symbol_value
Richard M. Stallman <rms@gnu.org>
parents:
13363
diff
changeset
|
1285 default value. */ |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1286 find_symbol_value (variable); |
13593
e27c32c7d428
(Fmake_local_variable): Call find_symbol_value
Richard M. Stallman <rms@gnu.org>
parents:
13363
diff
changeset
|
1287 |
298 | 1288 current_buffer->local_var_alist |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1289 = Fcons (Fcons (variable, XCONS (XCONS (XBUFFER_LOCAL_VALUE (XSYMBOL (variable)->value)->cdr)->cdr)->cdr), |
298 | 1290 current_buffer->local_var_alist); |
1291 | |
1292 /* Make sure symbol does not think it is set up for this buffer; | |
1293 force it to look once again for this buffer's value */ | |
1294 { | |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1295 Lisp_Object *pvalbuf; |
13593
e27c32c7d428
(Fmake_local_variable): Call find_symbol_value
Richard M. Stallman <rms@gnu.org>
parents:
13363
diff
changeset
|
1296 |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1297 valcontents = XSYMBOL (variable)->value; |
13593
e27c32c7d428
(Fmake_local_variable): Call find_symbol_value
Richard M. Stallman <rms@gnu.org>
parents:
13363
diff
changeset
|
1298 |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1299 pvalbuf = &XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->car; |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1300 if (current_buffer == XBUFFER (*pvalbuf)) |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1301 *pvalbuf = Qnil; |
298 | 1302 } |
1278
0a0646ae381f
* data.c (Fmake_local_variable): If SYM forwards to a C variable,
Jim Blandy <jimb@redhat.com>
parents:
1263
diff
changeset
|
1303 } |
298 | 1304 |
1278
0a0646ae381f
* data.c (Fmake_local_variable): If SYM forwards to a C variable,
Jim Blandy <jimb@redhat.com>
parents:
1263
diff
changeset
|
1305 /* If the symbol forwards into a C variable, then swap in the |
0a0646ae381f
* data.c (Fmake_local_variable): If SYM forwards to a C variable,
Jim Blandy <jimb@redhat.com>
parents:
1263
diff
changeset
|
1306 variable for this buffer immediately. If C code modifies the |
0a0646ae381f
* data.c (Fmake_local_variable): If SYM forwards to a C variable,
Jim Blandy <jimb@redhat.com>
parents:
1263
diff
changeset
|
1307 variable before we swap in, then that new value will clobber the |
0a0646ae381f
* data.c (Fmake_local_variable): If SYM forwards to a C variable,
Jim Blandy <jimb@redhat.com>
parents:
1263
diff
changeset
|
1308 default value the next time we swap. */ |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1309 valcontents = XBUFFER_LOCAL_VALUE (XSYMBOL (variable)->value)->car; |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1310 if (INTFWDP (valcontents) || BOOLFWDP (valcontents) || OBJFWDP (valcontents)) |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1311 swap_in_symval_forwarding (variable, XSYMBOL (variable)->value); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1312 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1313 return variable; |
298 | 1314 } |
1315 | |
1316 DEFUN ("kill-local-variable", Fkill_local_variable, Skill_local_variable, | |
1317 1, 1, "vKill Local Variable: ", | |
1318 "Make VARIABLE no longer have a separate value in the current buffer.\n\ | |
1319 From now on the default value will apply in this buffer.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1320 (variable) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1321 register Lisp_Object variable; |
298 | 1322 { |
1323 register Lisp_Object tem, valcontents; | |
1324 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1325 CHECK_SYMBOL (variable, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1326 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1327 valcontents = XSYMBOL (variable)->value; |
298 | 1328 |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1329 if (BUFFER_OBJFWDP (valcontents)) |
298 | 1330 { |
9465
ea2ee8bd3c63
(do_symval_forwarding, store_symval_forwarding, find_symbol_value, Fset,
Karl Heuer <kwzh@gnu.org>
parents:
9369
diff
changeset
|
1331 register int idx = XBUFFER_OBJFWD (valcontents)->offset; |
9364
0bba3bd707c7
(Fset, default_value, Fset_default, Fkill_local_variable): Access
Karl Heuer <kwzh@gnu.org>
parents:
9301
diff
changeset
|
1332 register int mask = XINT (*((Lisp_Object*) |
0bba3bd707c7
(Fset, default_value, Fset_default, Fkill_local_variable): Access
Karl Heuer <kwzh@gnu.org>
parents:
9301
diff
changeset
|
1333 (idx + (char *)&buffer_local_flags))); |
298 | 1334 |
1335 if (mask > 0) | |
1336 { | |
1337 *(Lisp_Object *)(idx + (char *) current_buffer) | |
1338 = *(Lisp_Object *)(idx + (char *) &buffer_defaults); | |
1339 current_buffer->local_var_flags &= ~mask; | |
1340 } | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1341 return variable; |
298 | 1342 } |
1343 | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1344 if (!BUFFER_LOCAL_VALUEP (valcontents) |
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1345 && !SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1346 return variable; |
298 | 1347 |
1348 /* Get rid of this buffer's alist element, if any */ | |
1349 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1350 tem = Fassq (variable, current_buffer->local_var_alist); |
490 | 1351 if (!NILP (tem)) |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1352 current_buffer->local_var_alist |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1353 = Fdelq (tem, current_buffer->local_var_alist); |
298 | 1354 |
14264
215d8ba39537
(kill-local-variable): didn't update the value of
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1355 /* If the symbol is set up for the current buffer, recompute its |
215d8ba39537
(kill-local-variable): didn't update the value of
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1356 value. We have to do it now, or else forwarded objects won't |
215d8ba39537
(kill-local-variable): didn't update the value of
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1357 work right. */ |
298 | 1358 { |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1359 Lisp_Object *pvalbuf; |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1360 valcontents = XSYMBOL (variable)->value; |
9895
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1361 pvalbuf = &XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->car; |
924f7b9ce544
(store_symval_forwarding, swap_in_symval_forwarding, Fset, default_value,
Karl Heuer <kwzh@gnu.org>
parents:
9889
diff
changeset
|
1362 if (current_buffer == XBUFFER (*pvalbuf)) |
14264
215d8ba39537
(kill-local-variable): didn't update the value of
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1363 { |
215d8ba39537
(kill-local-variable): didn't update the value of
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1364 *pvalbuf = Qnil; |
14745
f78162b0fc6e
(Fkill_local_variable): Call find_symbol_value directly,
Richard M. Stallman <rms@gnu.org>
parents:
14302
diff
changeset
|
1365 find_symbol_value (variable); |
14264
215d8ba39537
(kill-local-variable): didn't update the value of
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1366 } |
298 | 1367 } |
1368 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1369 return variable; |
298 | 1370 } |
9194
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
1371 |
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
1372 DEFUN ("local-variable-p", Flocal_variable_p, Slocal_variable_p, |
12113
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1373 1, 2, 0, |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1374 "Non-nil if VARIABLE has a local binding in buffer BUFFER.\n\ |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1375 BUFFER defaults to the current buffer.") |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1376 (variable, buffer) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1377 register Lisp_Object variable, buffer; |
9194
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
1378 { |
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
1379 Lisp_Object valcontents; |
12113
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1380 register struct buffer *buf; |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1381 |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1382 if (NILP (buffer)) |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1383 buf = current_buffer; |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1384 else |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1385 { |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1386 CHECK_BUFFER (buffer, 0); |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1387 buf = XBUFFER (buffer); |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1388 } |
9194
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
1389 |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1390 CHECK_SYMBOL (variable, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1391 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1392 valcontents = XSYMBOL (variable)->value; |
12113
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1393 if (BUFFER_LOCAL_VALUEP (valcontents) |
12225
a0067d2edef7
(Flocal_variable_p): Fix backwards logical operator.
Richard M. Stallman <rms@gnu.org>
parents:
12113
diff
changeset
|
1394 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
12113
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1395 { |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1396 Lisp_Object tail, elt; |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1397 for (tail = buf->local_var_alist; CONSP (tail); tail = XCONS (tail)->cdr) |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1398 { |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1399 elt = XCONS (tail)->car; |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1400 if (EQ (variable, XCONS (elt)->car)) |
12113
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1401 return Qt; |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1402 } |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1403 } |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1404 if (BUFFER_OBJFWDP (valcontents)) |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1405 { |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1406 int offset = XBUFFER_OBJFWD (valcontents)->offset; |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1407 int mask = XINT (*(Lisp_Object *)(offset + (char *)&buffer_local_flags)); |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1408 if (mask == -1 || (buf->local_var_flags & mask)) |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1409 return Qt; |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1410 } |
d96b45f31afa
(Flocal_variable_p): New optional arg BUFFER.
Karl Heuer <kwzh@gnu.org>
parents:
12043
diff
changeset
|
1411 return Qnil; |
9194
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
1412 } |
12295
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1413 |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1414 DEFUN ("local-variable-if-set-p", Flocal_variable_if_set_p, Slocal_variable_if_set_p, |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1415 1, 2, 0, |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1416 "Non-nil if VARIABLE will be local in buffer BUFFER if it is set there.\n\ |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1417 BUFFER defaults to the current buffer.") |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1418 (variable, buffer) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1419 register Lisp_Object variable, buffer; |
12295
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1420 { |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1421 Lisp_Object valcontents; |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1422 register struct buffer *buf; |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1423 |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1424 if (NILP (buffer)) |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1425 buf = current_buffer; |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1426 else |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1427 { |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1428 CHECK_BUFFER (buffer, 0); |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1429 buf = XBUFFER (buffer); |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1430 } |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1431 |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1432 CHECK_SYMBOL (variable, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1433 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1434 valcontents = XSYMBOL (variable)->value; |
12295
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1435 |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1436 /* This means that make-variable-buffer-local was done. */ |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1437 if (BUFFER_LOCAL_VALUEP (valcontents)) |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1438 return Qt; |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1439 /* All these slots become local if they are set. */ |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1440 if (BUFFER_OBJFWDP (valcontents)) |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1441 return Qt; |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1442 if (SOME_BUFFER_LOCAL_VALUEP (valcontents)) |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1443 { |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1444 Lisp_Object tail, elt; |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1445 for (tail = buf->local_var_alist; CONSP (tail); tail = XCONS (tail)->cdr) |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1446 { |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1447 elt = XCONS (tail)->car; |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1448 if (EQ (variable, XCONS (elt)->car)) |
12295
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1449 return Qt; |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1450 } |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1451 } |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1452 return Qnil; |
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
1453 } |
298 | 1454 |
648 | 1455 /* Find the function at the end of a chain of symbol function indirections. */ |
1456 | |
1457 /* If OBJECT is a symbol, find the end of its function chain and | |
1458 return the value found there. If OBJECT is not a symbol, just | |
1459 return it. If there is a cycle in the function chain, signal a | |
1460 cyclic-function-indirection error. | |
1461 | |
1462 This is like Findirect_function, except that it doesn't signal an | |
1463 error if the chain ends up unbound. */ | |
1464 Lisp_Object | |
1648
27e9f99fe095
src/ * data.c (indirect_function): Delete unused argument ERROR.
Jim Blandy <jimb@redhat.com>
parents:
1508
diff
changeset
|
1465 indirect_function (object) |
9194
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
1466 register Lisp_Object object; |
648 | 1467 { |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3529
diff
changeset
|
1468 Lisp_Object tortoise, hare; |
648 | 1469 |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3529
diff
changeset
|
1470 hare = tortoise = object; |
648 | 1471 |
1472 for (;;) | |
1473 { | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1474 if (!SYMBOLP (hare) || EQ (hare, Qunbound)) |
648 | 1475 break; |
1476 hare = XSYMBOL (hare)->function; | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1477 if (!SYMBOLP (hare) || EQ (hare, Qunbound)) |
648 | 1478 break; |
1479 hare = XSYMBOL (hare)->function; | |
1480 | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3529
diff
changeset
|
1481 tortoise = XSYMBOL (tortoise)->function; |
648 | 1482 |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3529
diff
changeset
|
1483 if (EQ (hare, tortoise)) |
648 | 1484 Fsignal (Qcyclic_function_indirection, Fcons (object, Qnil)); |
1485 } | |
1486 | |
1487 return hare; | |
1488 } | |
1489 | |
1490 DEFUN ("indirect-function", Findirect_function, Sindirect_function, 1, 1, 0, | |
1491 "Return the function at the end of OBJECT's function chain.\n\ | |
1492 If OBJECT is a symbol, follow all function indirections and return the final\n\ | |
1493 function binding.\n\ | |
1494 If OBJECT is not a symbol, just return it.\n\ | |
1495 Signal a void-function error if the final symbol is unbound.\n\ | |
1496 Signal a cyclic-function-indirection error if there is a loop in the\n\ | |
1497 function chain of symbols.") | |
1498 (object) | |
1499 register Lisp_Object object; | |
1500 { | |
1501 Lisp_Object result; | |
1502 | |
1503 result = indirect_function (object); | |
1504 | |
1505 if (EQ (result, Qunbound)) | |
1506 return Fsignal (Qvoid_function, Fcons (object, Qnil)); | |
1507 return result; | |
1508 } | |
1509 | |
298 | 1510 /* Extract and set vector and string elements */ |
1511 | |
1512 DEFUN ("aref", Faref, Saref, 2, 2, 0, | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1513 "Return the element of ARRAY at index IDX.\n\ |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1514 ARRAY may be a vector, a string, a char-table, a bool-vector,\n\ |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1515 or a byte-code object. IDX starts at 0.") |
298 | 1516 (array, idx) |
1517 register Lisp_Object array; | |
1518 Lisp_Object idx; | |
1519 { | |
1520 register int idxval; | |
1521 | |
1522 CHECK_NUMBER (idx, 1); | |
1523 idxval = XINT (idx); | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1524 if (STRINGP (array)) |
298 | 1525 { |
1526 Lisp_Object val; | |
9966
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1527 if (idxval < 0 || idxval >= XSTRING (array)->size) |
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1528 args_out_of_range (array, idx); |
9301
e6daff3e246f
(Faref, Farray_length): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9263
diff
changeset
|
1529 XSETFASTINT (val, (unsigned char) XSTRING (array)->data[idxval]); |
298 | 1530 return val; |
1531 } | |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1532 else if (BOOL_VECTOR_P (array)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1533 { |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1534 int val; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1535 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1536 if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1537 args_out_of_range (array, idx); |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1538 |
13363
941c37982f37
(BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG):
Karl Heuer <kwzh@gnu.org>
parents:
13296
diff
changeset
|
1539 val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR]; |
941c37982f37
(BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG):
Karl Heuer <kwzh@gnu.org>
parents:
13296
diff
changeset
|
1540 return (val & (1 << (idxval % BITS_PER_CHAR)) ? Qt : Qnil); |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1541 } |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1542 else if (CHAR_TABLE_P (array)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1543 { |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1544 Lisp_Object val; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1545 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1546 if (idxval < 0) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1547 args_out_of_range (array, idx); |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1548 #if 1 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1549 if ((unsigned) idxval >= CHAR_TABLE_ORDINARY_SLOTS) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1550 args_out_of_range (array, idx); |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1551 return val = XCHAR_TABLE (array)->contents[idxval]; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1552 #else /* 0 */ |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1553 if ((unsigned) idxval < CHAR_TABLE_ORDINARY_SLOTS) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1554 val = XCHAR_TABLE (array)->data[idxval]; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1555 else |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1556 { |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1557 int charset; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1558 unsigned char c1, c2; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1559 Lisp_Object val, temp; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1560 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1561 BREAKUP_NON_ASCII_CHAR (idxval, charset, c1, c2); |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1562 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1563 try_parent_char_table: |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1564 val = XCHAR_TABLE (array)->contents[charset]; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1565 if (c1 == 0 || !CHAR_TABLE_P (val)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1566 return val; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1567 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1568 temp = XCHAR_TABLE (val)->contents[c1]; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1569 if (NILP (temp)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1570 val = XCHAR_TABLE (val)->defalt; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1571 else |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1572 val = temp; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1573 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1574 if (NILP (val) && !NILP (XCHAR_TABLE (array)->parent)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1575 { |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1576 array = XCHAR_TABLE (array)->parent; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1577 goto try_parent_char_table; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1578 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1579 } |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1580 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1581 if (c2 == 0 || !CHAR_TABLE_P (val)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1582 return val; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1583 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1584 temp = XCHAR_TABLE (val)->contents[c2]; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1585 if (NILP (temp)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1586 val = XCHAR_TABLE (val)->defalt; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1587 else |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1588 val = temp; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1589 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1590 if (NILP (val) && !NILP (XCHAR_TABLE (array)->parent)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1591 { |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1592 array = XCHAR_TABLE (array)->parent; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1593 goto try_parent_char_table; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1594 } |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1595 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1596 return val; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1597 } |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1598 #endif /* 0 */ |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1599 } |
298 | 1600 else |
9966
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1601 { |
10290
1bcc91a4b210
(Faref): Handle compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10248
diff
changeset
|
1602 int size; |
1bcc91a4b210
(Faref): Handle compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10248
diff
changeset
|
1603 if (VECTORP (array)) |
1bcc91a4b210
(Faref): Handle compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10248
diff
changeset
|
1604 size = XVECTOR (array)->size; |
1bcc91a4b210
(Faref): Handle compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10248
diff
changeset
|
1605 else if (COMPILEDP (array)) |
1bcc91a4b210
(Faref): Handle compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10248
diff
changeset
|
1606 size = XVECTOR (array)->size & PSEUDOVECTOR_SIZE_MASK; |
1bcc91a4b210
(Faref): Handle compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10248
diff
changeset
|
1607 else |
1bcc91a4b210
(Faref): Handle compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10248
diff
changeset
|
1608 wrong_type_argument (Qarrayp, array); |
1bcc91a4b210
(Faref): Handle compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10248
diff
changeset
|
1609 |
1bcc91a4b210
(Faref): Handle compiled function as pseudovector.
Richard M. Stallman <rms@gnu.org>
parents:
10248
diff
changeset
|
1610 if (idxval < 0 || idxval >= size) |
9966
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1611 args_out_of_range (array, idx); |
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1612 return XVECTOR (array)->contents[idxval]; |
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1613 } |
298 | 1614 } |
1615 | |
1616 DEFUN ("aset", Faset, Saset, 3, 3, 0, | |
5660 | 1617 "Store into the element of ARRAY at index IDX the value NEWELT.\n\ |
1618 ARRAY may be a vector or a string. IDX starts at 0.") | |
298 | 1619 (array, idx, newelt) |
1620 register Lisp_Object array; | |
1621 Lisp_Object idx, newelt; | |
1622 { | |
1623 register int idxval; | |
1624 | |
1625 CHECK_NUMBER (idx, 1); | |
1626 idxval = XINT (idx); | |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1627 if (!VECTORP (array) && !STRINGP (array) && !BOOL_VECTOR_P (array) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1628 && ! CHAR_TABLE_P (array)) |
298 | 1629 array = wrong_type_argument (Qarrayp, array); |
1630 CHECK_IMPURE (array); | |
1631 | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1632 if (VECTORP (array)) |
9966
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1633 { |
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1634 if (idxval < 0 || idxval >= XVECTOR (array)->size) |
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1635 args_out_of_range (array, idx); |
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1636 XVECTOR (array)->contents[idxval] = newelt; |
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1637 } |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1638 else if (BOOL_VECTOR_P (array)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1639 { |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1640 int val; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1641 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1642 if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1643 args_out_of_range (array, idx); |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1644 |
13363
941c37982f37
(BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG):
Karl Heuer <kwzh@gnu.org>
parents:
13296
diff
changeset
|
1645 val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR]; |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1646 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1647 if (! NILP (newelt)) |
13363
941c37982f37
(BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG):
Karl Heuer <kwzh@gnu.org>
parents:
13296
diff
changeset
|
1648 val |= 1 << (idxval % BITS_PER_CHAR); |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1649 else |
13363
941c37982f37
(BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG):
Karl Heuer <kwzh@gnu.org>
parents:
13296
diff
changeset
|
1650 val &= ~(1 << (idxval % BITS_PER_CHAR)); |
941c37982f37
(BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG):
Karl Heuer <kwzh@gnu.org>
parents:
13296
diff
changeset
|
1651 XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR] = val; |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1652 } |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1653 else if (CHAR_TABLE_P (array)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1654 { |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1655 Lisp_Object val; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1656 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1657 if (idxval < 0) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1658 args_out_of_range (array, idx); |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1659 #if 1 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1660 if (idxval >= CHAR_TABLE_ORDINARY_SLOTS) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1661 args_out_of_range (array, idx); |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1662 XCHAR_TABLE (array)->contents[idxval] = newelt; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1663 return newelt; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1664 #else /* 0 */ |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1665 if (idxval < CHAR_TABLE_ORDINARY_SLOTS) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1666 val = XCHAR_TABLE (array)->contents[idxval]; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1667 else |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1668 { |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1669 int charset; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1670 unsigned char c1, c2; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1671 Lisp_Object val, val2; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1672 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1673 BREAKUP_NON_ASCII_CHAR (idxval, charset, c1, c2); |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1674 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1675 if (c1 == 0) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1676 return XCHAR_TABLE (array)->contents[charset] = newelt; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1677 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1678 val = XCHAR_TABLE (array)->contents[charset]; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1679 if (!CHAR_TABLE_P (val)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1680 XCHAR_TABLE (array)->contents[charset] |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1681 = val = Fmake_char_table (Qnil); |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1682 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1683 if (c2 == 0) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1684 return XCHAR_TABLE (val)->contents[c1] = newelt; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1685 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1686 val2 = XCHAR_TABLE (val)->contents[c2]; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1687 if (!CHAR_TABLE_P (val2)) |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1688 XCHAR_TABLE (val)->contents[charset] |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1689 = val2 = Fmake_char_table (Qnil); |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1690 |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1691 return XCHAR_TABLE (val2)->contents[c2] = newelt; |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1692 } |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1693 #endif /* 0 */ |
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
1694 } |
298 | 1695 else |
1696 { | |
9966
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1697 if (idxval < 0 || idxval >= XSTRING (array)->size) |
d64bdd958254
(Farray_length): Delete this obsolete function.
Karl Heuer <kwzh@gnu.org>
parents:
9954
diff
changeset
|
1698 args_out_of_range (array, idx); |
298 | 1699 CHECK_NUMBER (newelt, 2); |
1700 XSTRING (array)->data[idxval] = XINT (newelt); | |
1701 } | |
1702 | |
1703 return newelt; | |
1704 } | |
1705 | |
1706 /* Arithmetic functions */ | |
1707 | |
1708 enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal }; | |
1709 | |
1710 Lisp_Object | |
1711 arithcompare (num1, num2, comparison) | |
1712 Lisp_Object num1, num2; | |
1713 enum comparison comparison; | |
1714 { | |
1715 double f1, f2; | |
1716 int floatp = 0; | |
1717 | |
1718 #ifdef LISP_FLOAT_TYPE | |
1719 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1, 0); | |
1720 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2, 0); | |
1721 | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1722 if (FLOATP (num1) || FLOATP (num2)) |
298 | 1723 { |
1724 floatp = 1; | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1725 f1 = (FLOATP (num1)) ? XFLOAT (num1)->data : XINT (num1); |
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1726 f2 = (FLOATP (num2)) ? XFLOAT (num2)->data : XINT (num2); |
298 | 1727 } |
1728 #else | |
1729 CHECK_NUMBER_COERCE_MARKER (num1, 0); | |
1730 CHECK_NUMBER_COERCE_MARKER (num2, 0); | |
1731 #endif /* LISP_FLOAT_TYPE */ | |
1732 | |
1733 switch (comparison) | |
1734 { | |
1735 case equal: | |
1736 if (floatp ? f1 == f2 : XINT (num1) == XINT (num2)) | |
1737 return Qt; | |
1738 return Qnil; | |
1739 | |
1740 case notequal: | |
1741 if (floatp ? f1 != f2 : XINT (num1) != XINT (num2)) | |
1742 return Qt; | |
1743 return Qnil; | |
1744 | |
1745 case less: | |
1746 if (floatp ? f1 < f2 : XINT (num1) < XINT (num2)) | |
1747 return Qt; | |
1748 return Qnil; | |
1749 | |
1750 case less_or_equal: | |
1751 if (floatp ? f1 <= f2 : XINT (num1) <= XINT (num2)) | |
1752 return Qt; | |
1753 return Qnil; | |
1754 | |
1755 case grtr: | |
1756 if (floatp ? f1 > f2 : XINT (num1) > XINT (num2)) | |
1757 return Qt; | |
1758 return Qnil; | |
1759 | |
1760 case grtr_or_equal: | |
1761 if (floatp ? f1 >= f2 : XINT (num1) >= XINT (num2)) | |
1762 return Qt; | |
1763 return Qnil; | |
1914
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1764 |
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1765 default: |
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1766 abort (); |
298 | 1767 } |
1768 } | |
1769 | |
1770 DEFUN ("=", Feqlsign, Seqlsign, 2, 2, 0, | |
1771 "T if two args, both numbers or markers, are equal.") | |
1772 (num1, num2) | |
1773 register Lisp_Object num1, num2; | |
1774 { | |
1775 return arithcompare (num1, num2, equal); | |
1776 } | |
1777 | |
1778 DEFUN ("<", Flss, Slss, 2, 2, 0, | |
1779 "T if first arg is less than second arg. Both must be numbers or markers.") | |
1780 (num1, num2) | |
1781 register Lisp_Object num1, num2; | |
1782 { | |
1783 return arithcompare (num1, num2, less); | |
1784 } | |
1785 | |
1786 DEFUN (">", Fgtr, Sgtr, 2, 2, 0, | |
1787 "T if first arg is greater than second arg. Both must be numbers or markers.") | |
1788 (num1, num2) | |
1789 register Lisp_Object num1, num2; | |
1790 { | |
1791 return arithcompare (num1, num2, grtr); | |
1792 } | |
1793 | |
1794 DEFUN ("<=", Fleq, Sleq, 2, 2, 0, | |
1795 "T if first arg is less than or equal to second arg.\n\ | |
1796 Both must be numbers or markers.") | |
1797 (num1, num2) | |
1798 register Lisp_Object num1, num2; | |
1799 { | |
1800 return arithcompare (num1, num2, less_or_equal); | |
1801 } | |
1802 | |
1803 DEFUN (">=", Fgeq, Sgeq, 2, 2, 0, | |
1804 "T if first arg is greater than or equal to second arg.\n\ | |
1805 Both must be numbers or markers.") | |
1806 (num1, num2) | |
1807 register Lisp_Object num1, num2; | |
1808 { | |
1809 return arithcompare (num1, num2, grtr_or_equal); | |
1810 } | |
1811 | |
1812 DEFUN ("/=", Fneq, Sneq, 2, 2, 0, | |
1813 "T if first arg is not equal to second arg. Both must be numbers or markers.") | |
1814 (num1, num2) | |
1815 register Lisp_Object num1, num2; | |
1816 { | |
1817 return arithcompare (num1, num2, notequal); | |
1818 } | |
1819 | |
1820 DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0, "T if NUMBER is zero.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1821 (number) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1822 register Lisp_Object number; |
298 | 1823 { |
1824 #ifdef LISP_FLOAT_TYPE | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1825 CHECK_NUMBER_OR_FLOAT (number, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1826 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1827 if (FLOATP (number)) |
298 | 1828 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1829 if (XFLOAT(number)->data == 0.0) |
298 | 1830 return Qt; |
1831 return Qnil; | |
1832 } | |
1833 #else | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1834 CHECK_NUMBER (number, 0); |
298 | 1835 #endif /* LISP_FLOAT_TYPE */ |
1836 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1837 if (!XINT (number)) |
298 | 1838 return Qt; |
1839 return Qnil; | |
1840 } | |
1841 | |
12043 | 1842 /* Convert between long values and pairs of Lisp integers. */ |
2515
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1843 |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1844 Lisp_Object |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1845 long_to_cons (i) |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1846 unsigned long i; |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1847 { |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1848 unsigned int top = i >> 16; |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1849 unsigned int bot = i & 0xFFFF; |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1850 if (top == 0) |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1851 return make_number (bot); |
11879
606889516975
(long_to_cons): Don't assume 32-bit longs.
Karl Heuer <kwzh@gnu.org>
parents:
11734
diff
changeset
|
1852 if (top == (unsigned long)-1 >> 16) |
2515
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1853 return Fcons (make_number (-1), make_number (bot)); |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1854 return Fcons (make_number (top), make_number (bot)); |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1855 } |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1856 |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1857 unsigned long |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1858 cons_to_long (c) |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1859 Lisp_Object c; |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1860 { |
3675
f42eaf84478f
(cons_to_long): Declare top, bot as Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
3591
diff
changeset
|
1861 Lisp_Object top, bot; |
2515
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1862 if (INTEGERP (c)) |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1863 return XINT (c); |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1864 top = XCONS (c)->car; |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1865 bot = XCONS (c)->cdr; |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1866 if (CONSP (bot)) |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1867 bot = XCONS (bot)->car; |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1868 return ((XINT (top) << 16) | XINT (bot)); |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1869 } |
c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
Jim Blandy <jimb@redhat.com>
parents:
2429
diff
changeset
|
1870 |
2429
96b55f2f19cd
Rename int-to-string to number-to-string, since it can handle
Jim Blandy <jimb@redhat.com>
parents:
2092
diff
changeset
|
1871 DEFUN ("number-to-string", Fnumber_to_string, Snumber_to_string, 1, 1, 0, |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1872 "Convert NUMBER to a string by printing it in decimal.\n\ |
1914
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1873 Uses a minus sign if negative.\n\ |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1874 NUMBER may be an integer or a floating point number.") |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1875 (number) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1876 Lisp_Object number; |
298 | 1877 { |
12528
ed5b91dd829a
(Fnumber_to_string): Make `buffer' long enough.
Karl Heuer <kwzh@gnu.org>
parents:
12295
diff
changeset
|
1878 char buffer[VALBITS]; |
298 | 1879 |
1880 #ifndef LISP_FLOAT_TYPE | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1881 CHECK_NUMBER (number, 0); |
298 | 1882 #else |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1883 CHECK_NUMBER_OR_FLOAT (number, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1884 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1885 if (FLOATP (number)) |
298 | 1886 { |
1887 char pigbuf[350]; /* see comments in float_to_string */ | |
1888 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1889 float_to_string (pigbuf, XFLOAT(number)->data); |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
1890 return build_string (pigbuf); |
298 | 1891 } |
1892 #endif /* LISP_FLOAT_TYPE */ | |
1893 | |
11701
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1894 if (sizeof (int) == sizeof (EMACS_INT)) |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1895 sprintf (buffer, "%d", XINT (number)); |
11701
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1896 else if (sizeof (long) == sizeof (EMACS_INT)) |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1897 sprintf (buffer, "%ld", XINT (number)); |
11701
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1898 else |
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1899 abort (); |
298 | 1900 return build_string (buffer); |
1901 } | |
1902 | |
1914
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1903 DEFUN ("string-to-number", Fstring_to_number, Sstring_to_number, 1, 1, 0, |
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1904 "Convert STRING to a number by parsing it as a decimal number.\n\ |
6448
9d04c87e0da1
(Fstring_to_number): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6446
diff
changeset
|
1905 This parses both integers and floating point numbers.\n\ |
9d04c87e0da1
(Fstring_to_number): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
6446
diff
changeset
|
1906 It ignores leading spaces and tabs.") |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1907 (string) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1908 register Lisp_Object string; |
298 | 1909 { |
11701
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1910 Lisp_Object value; |
1987
cd893024d6b9
* data.c (Fstring_to_number): Declare p to be an unsigned char, to
Jim Blandy <jimb@redhat.com>
parents:
1914
diff
changeset
|
1911 unsigned char *p; |
1914
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1912 |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1913 CHECK_STRING (string, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1914 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1915 p = XSTRING (string)->data; |
1914
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1916 |
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1917 /* Skip any whitespace at the front of the number. Some versions of |
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1918 atoi do this anyway, so we might as well make Emacs lisp consistent. */ |
1987
cd893024d6b9
* data.c (Fstring_to_number): Declare p to be an unsigned char, to
Jim Blandy <jimb@redhat.com>
parents:
1914
diff
changeset
|
1919 while (*p == ' ' || *p == '\t') |
1914
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1920 p++; |
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1921 |
298 | 1922 #ifdef LISP_FLOAT_TYPE |
1914
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1923 if (isfloat_string (p)) |
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
1924 return make_float (atof (p)); |
298 | 1925 #endif /* LISP_FLOAT_TYPE */ |
1926 | |
11701
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1927 if (sizeof (int) == sizeof (EMACS_INT)) |
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1928 XSETINT (value, atoi (p)); |
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1929 else if (sizeof (long) == sizeof (EMACS_INT)) |
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1930 XSETINT (value, atol (p)); |
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1931 else |
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1932 abort (); |
d0eaa6b6dc72
(Fnumber_to_string, Fstring_to_number):
Richard M. Stallman <rms@gnu.org>
parents:
11688
diff
changeset
|
1933 return value; |
298 | 1934 } |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
1935 |
298 | 1936 enum arithop |
1937 { Aadd, Asub, Amult, Adiv, Alogand, Alogior, Alogxor, Amax, Amin }; | |
1938 | |
1508
768d4c10c2bf
* data.c (Fset): See if current_alist_element points to itself
Jim Blandy <jimb@redhat.com>
parents:
1293
diff
changeset
|
1939 extern Lisp_Object float_arith_driver (); |
16787
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
1940 extern Lisp_Object fmod_float (); |
1508
768d4c10c2bf
* data.c (Fset): See if current_alist_element points to itself
Jim Blandy <jimb@redhat.com>
parents:
1293
diff
changeset
|
1941 |
298 | 1942 Lisp_Object |
3338
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
1943 arith_driver (code, nargs, args) |
298 | 1944 enum arithop code; |
1945 int nargs; | |
1946 register Lisp_Object *args; | |
1947 { | |
1948 register Lisp_Object val; | |
1949 register int argnum; | |
11688
f1e6033d8aca
(arith_driver): Make accum and next EMACS_INTs.
Richard M. Stallman <rms@gnu.org>
parents:
11341
diff
changeset
|
1950 register EMACS_INT accum; |
f1e6033d8aca
(arith_driver): Make accum and next EMACS_INTs.
Richard M. Stallman <rms@gnu.org>
parents:
11341
diff
changeset
|
1951 register EMACS_INT next; |
298 | 1952 |
10457
2ab3bd0288a9
Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents:
10290
diff
changeset
|
1953 switch (SWITCH_ENUM_CAST (code)) |
298 | 1954 { |
1955 case Alogior: | |
1956 case Alogxor: | |
1957 case Aadd: | |
1958 case Asub: | |
1959 accum = 0; break; | |
1960 case Amult: | |
1961 accum = 1; break; | |
1962 case Alogand: | |
1963 accum = -1; break; | |
1964 } | |
1965 | |
1966 for (argnum = 0; argnum < nargs; argnum++) | |
1967 { | |
1968 val = args[argnum]; /* using args[argnum] as argument to CHECK_NUMBER_... */ | |
1969 #ifdef LISP_FLOAT_TYPE | |
1970 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (val, argnum); | |
1971 | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
1972 if (FLOATP (val)) /* time to do serious math */ |
298 | 1973 return (float_arith_driver ((double) accum, argnum, code, |
1974 nargs, args)); | |
1975 #else | |
1976 CHECK_NUMBER_COERCE_MARKER (val, argnum); | |
1977 #endif /* LISP_FLOAT_TYPE */ | |
1978 args[argnum] = val; /* runs into a compiler bug. */ | |
1979 next = XINT (args[argnum]); | |
10457
2ab3bd0288a9
Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents:
10290
diff
changeset
|
1980 switch (SWITCH_ENUM_CAST (code)) |
298 | 1981 { |
1982 case Aadd: accum += next; break; | |
1983 case Asub: | |
1984 if (!argnum && nargs != 1) | |
1985 next = - next; | |
1986 accum -= next; | |
1987 break; | |
1988 case Amult: accum *= next; break; | |
1989 case Adiv: | |
1990 if (!argnum) accum = next; | |
3338
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
1991 else |
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
1992 { |
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
1993 if (next == 0) |
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
1994 Fsignal (Qarith_error, Qnil); |
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
1995 accum /= next; |
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
1996 } |
298 | 1997 break; |
1998 case Alogand: accum &= next; break; | |
1999 case Alogior: accum |= next; break; | |
2000 case Alogxor: accum ^= next; break; | |
2001 case Amax: if (!argnum || next > accum) accum = next; break; | |
2002 case Amin: if (!argnum || next < accum) accum = next; break; | |
2003 } | |
2004 } | |
2005 | |
9263
cda13734e32c
(make_number, Fsymbol_name, do_symval_forwarding, swap_in_symval_forwarding,
Karl Heuer <kwzh@gnu.org>
parents:
9194
diff
changeset
|
2006 XSETINT (val, accum); |
298 | 2007 return val; |
2008 } | |
2009 | |
6201 | 2010 #undef isnan |
2011 #define isnan(x) ((x) != (x)) | |
2012 | |
16945
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2013 #ifdef LISP_FLOAT_TYPE |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2014 |
298 | 2015 Lisp_Object |
2016 float_arith_driver (accum, argnum, code, nargs, args) | |
2017 double accum; | |
2018 register int argnum; | |
2019 enum arithop code; | |
2020 int nargs; | |
2021 register Lisp_Object *args; | |
2022 { | |
2023 register Lisp_Object val; | |
2024 double next; | |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
2025 |
298 | 2026 for (; argnum < nargs; argnum++) |
2027 { | |
2028 val = args[argnum]; /* using args[argnum] as argument to CHECK_NUMBER_... */ | |
2029 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (val, argnum); | |
2030 | |
9147
ee9adbda1ad1
(wrong_type_argument, Fconsp, Fatom, Flistp, Fnlistp, Fsymbolp, Fvectorp,
Karl Heuer <kwzh@gnu.org>
parents:
9035
diff
changeset
|
2031 if (FLOATP (val)) |
298 | 2032 { |
2033 next = XFLOAT (val)->data; | |
2034 } | |
2035 else | |
2036 { | |
2037 args[argnum] = val; /* runs into a compiler bug. */ | |
2038 next = XINT (args[argnum]); | |
2039 } | |
10457
2ab3bd0288a9
Change all occurences of SWITCH_ENUM_BUG to use SWITCH_ENUM_CAST instead.
Karl Heuer <kwzh@gnu.org>
parents:
10290
diff
changeset
|
2040 switch (SWITCH_ENUM_CAST (code)) |
298 | 2041 { |
2042 case Aadd: | |
2043 accum += next; | |
2044 break; | |
2045 case Asub: | |
2046 if (!argnum && nargs != 1) | |
2047 next = - next; | |
2048 accum -= next; | |
2049 break; | |
2050 case Amult: | |
2051 accum *= next; | |
2052 break; | |
2053 case Adiv: | |
2054 if (!argnum) | |
2055 accum = next; | |
2056 else | |
3338
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
2057 { |
16787
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
2058 if (! IEEE_FLOATING_POINT && next == 0) |
3338
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
2059 Fsignal (Qarith_error, Qnil); |
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
2060 accum /= next; |
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
2061 } |
298 | 2062 break; |
2063 case Alogand: | |
2064 case Alogior: | |
2065 case Alogxor: | |
2066 return wrong_type_argument (Qinteger_or_marker_p, val); | |
2067 case Amax: | |
6201 | 2068 if (!argnum || isnan (next) || next > accum) |
298 | 2069 accum = next; |
2070 break; | |
2071 case Amin: | |
6201 | 2072 if (!argnum || isnan (next) || next < accum) |
298 | 2073 accum = next; |
2074 break; | |
2075 } | |
2076 } | |
2077 | |
2078 return make_float (accum); | |
2079 } | |
2080 #endif /* LISP_FLOAT_TYPE */ | |
2081 | |
2082 DEFUN ("+", Fplus, Splus, 0, MANY, 0, | |
2083 "Return sum of any number of arguments, which are numbers or markers.") | |
2084 (nargs, args) | |
2085 int nargs; | |
2086 Lisp_Object *args; | |
2087 { | |
2088 return arith_driver (Aadd, nargs, args); | |
2089 } | |
2090 | |
2091 DEFUN ("-", Fminus, Sminus, 0, MANY, 0, | |
2092 "Negate number or subtract numbers or markers.\n\ | |
2093 With one arg, negates it. With more than one arg,\n\ | |
2094 subtracts all but the first from the first.") | |
2095 (nargs, args) | |
2096 int nargs; | |
2097 Lisp_Object *args; | |
2098 { | |
2099 return arith_driver (Asub, nargs, args); | |
2100 } | |
2101 | |
2102 DEFUN ("*", Ftimes, Stimes, 0, MANY, 0, | |
2103 "Returns product of any number of arguments, which are numbers or markers.") | |
2104 (nargs, args) | |
2105 int nargs; | |
2106 Lisp_Object *args; | |
2107 { | |
2108 return arith_driver (Amult, nargs, args); | |
2109 } | |
2110 | |
2111 DEFUN ("/", Fquo, Squo, 2, MANY, 0, | |
2112 "Returns first argument divided by all the remaining arguments.\n\ | |
2113 The arguments must be numbers or markers.") | |
2114 (nargs, args) | |
2115 int nargs; | |
2116 Lisp_Object *args; | |
2117 { | |
2118 return arith_driver (Adiv, nargs, args); | |
2119 } | |
2120 | |
2121 DEFUN ("%", Frem, Srem, 2, 2, 0, | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2122 "Returns remainder of X divided by Y.\n\ |
4447
ba273b48143b
(Frem): Don't accept floats, just ints and markers.
Richard M. Stallman <rms@gnu.org>
parents:
4037
diff
changeset
|
2123 Both must be integers or markers.") |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2124 (x, y) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2125 register Lisp_Object x, y; |
298 | 2126 { |
2127 Lisp_Object val; | |
2128 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2129 CHECK_NUMBER_COERCE_MARKER (x, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2130 CHECK_NUMBER_COERCE_MARKER (y, 1); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2131 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2132 if (XFASTINT (y) == 0) |
3338
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
2133 Fsignal (Qarith_error, Qnil); |
30b946dd8c66
(float_arith_driver): Detect division by zero in advance.
Richard M. Stallman <rms@gnu.org>
parents:
2961
diff
changeset
|
2134 |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2135 XSETINT (val, XINT (x) % XINT (y)); |
298 | 2136 return val; |
2137 } | |
2138 | |
5776
6130ebde8d3b
(fmod): Implement it on systems where it's missing, using drem if available.
Karl Heuer <kwzh@gnu.org>
parents:
5729
diff
changeset
|
2139 #ifndef HAVE_FMOD |
6130ebde8d3b
(fmod): Implement it on systems where it's missing, using drem if available.
Karl Heuer <kwzh@gnu.org>
parents:
5729
diff
changeset
|
2140 double |
6130ebde8d3b
(fmod): Implement it on systems where it's missing, using drem if available.
Karl Heuer <kwzh@gnu.org>
parents:
5729
diff
changeset
|
2141 fmod (f1, f2) |
6130ebde8d3b
(fmod): Implement it on systems where it's missing, using drem if available.
Karl Heuer <kwzh@gnu.org>
parents:
5729
diff
changeset
|
2142 double f1, f2; |
6130ebde8d3b
(fmod): Implement it on systems where it's missing, using drem if available.
Karl Heuer <kwzh@gnu.org>
parents:
5729
diff
changeset
|
2143 { |
16945
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2144 double r = f1; |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2145 |
13296
76034e1fc62e
[!HAVE_FMOD] (fmod): Make consistent with ANSI definition.
Karl Heuer <kwzh@gnu.org>
parents:
13200
diff
changeset
|
2146 if (f2 < 0.0) |
76034e1fc62e
[!HAVE_FMOD] (fmod): Make consistent with ANSI definition.
Karl Heuer <kwzh@gnu.org>
parents:
13200
diff
changeset
|
2147 f2 = -f2; |
16945
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2148 |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2149 /* If the magnitude of the result exceeds that of the divisor, or |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2150 the sign of the result does not agree with that of the dividend, |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2151 iterate with the reduced value. This does not yield a |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2152 particularly accurate result, but at least it will be in the |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2153 range promised by fmod. */ |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2154 do |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2155 r -= f2 * floor (r / f2); |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2156 while (f2 <= (r < 0 ? -r : r) || ((r < 0) != (f1 < 0) && ! isnan (r))); |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2157 |
d6cd00b2e214
(isnan): Define even if LISP_FLOAT_TYPE is not defined, since fmod
Paul Eggert <eggert@twinsun.com>
parents:
16931
diff
changeset
|
2158 return r; |
5776
6130ebde8d3b
(fmod): Implement it on systems where it's missing, using drem if available.
Karl Heuer <kwzh@gnu.org>
parents:
5729
diff
changeset
|
2159 } |
6130ebde8d3b
(fmod): Implement it on systems where it's missing, using drem if available.
Karl Heuer <kwzh@gnu.org>
parents:
5729
diff
changeset
|
2160 #endif /* ! HAVE_FMOD */ |
6130ebde8d3b
(fmod): Implement it on systems where it's missing, using drem if available.
Karl Heuer <kwzh@gnu.org>
parents:
5729
diff
changeset
|
2161 |
4508
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2162 DEFUN ("mod", Fmod, Smod, 2, 2, 0, |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2163 "Returns X modulo Y.\n\ |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2164 The result falls between zero (inclusive) and Y (exclusive).\n\ |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2165 Both X and Y must be numbers or markers.") |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2166 (x, y) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2167 register Lisp_Object x, y; |
4508
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2168 { |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2169 Lisp_Object val; |
11688
f1e6033d8aca
(arith_driver): Make accum and next EMACS_INTs.
Richard M. Stallman <rms@gnu.org>
parents:
11341
diff
changeset
|
2170 EMACS_INT i1, i2; |
4508
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2171 |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2172 #ifdef LISP_FLOAT_TYPE |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2173 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (x, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2174 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (y, 1); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2175 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2176 if (FLOATP (x) || FLOATP (y)) |
16787
3ad557e686b9
<float.h>: Include if STDC_HEADERS.
Paul Eggert <eggert@twinsun.com>
parents:
16756
diff
changeset
|
2177 return fmod_float (x, y); |
4508
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2178 |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2179 #else /* not LISP_FLOAT_TYPE */ |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2180 CHECK_NUMBER_COERCE_MARKER (x, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2181 CHECK_NUMBER_COERCE_MARKER (y, 1); |
4508
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2182 #endif /* not LISP_FLOAT_TYPE */ |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2183 |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2184 i1 = XINT (x); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2185 i2 = XINT (y); |
4508
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2186 |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2187 if (i2 == 0) |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2188 Fsignal (Qarith_error, Qnil); |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
2189 |
4508
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2190 i1 %= i2; |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2191 |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2192 /* If the "remainder" comes out with the wrong sign, fix it. */ |
11155
0aede77c1593
(Fmod): Fix the final adjustment, when i2 < 0 and i1 == 0.
Richard M. Stallman <rms@gnu.org>
parents:
11019
diff
changeset
|
2193 if (i2 < 0 ? i1 > 0 : i1 < 0) |
4508
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2194 i1 += i2; |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2195 |
9263
cda13734e32c
(make_number, Fsymbol_name, do_symval_forwarding, swap_in_symval_forwarding,
Karl Heuer <kwzh@gnu.org>
parents:
9194
diff
changeset
|
2196 XSETINT (val, i1); |
4508
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2197 return val; |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2198 } |
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2199 |
298 | 2200 DEFUN ("max", Fmax, Smax, 1, MANY, 0, |
2201 "Return largest of all the arguments (which must be numbers or markers).\n\ | |
2202 The value is always a number; markers are converted to numbers.") | |
2203 (nargs, args) | |
2204 int nargs; | |
2205 Lisp_Object *args; | |
2206 { | |
2207 return arith_driver (Amax, nargs, args); | |
2208 } | |
2209 | |
2210 DEFUN ("min", Fmin, Smin, 1, MANY, 0, | |
2211 "Return smallest of all the arguments (which must be numbers or markers).\n\ | |
2212 The value is always a number; markers are converted to numbers.") | |
2213 (nargs, args) | |
2214 int nargs; | |
2215 Lisp_Object *args; | |
2216 { | |
2217 return arith_driver (Amin, nargs, args); | |
2218 } | |
2219 | |
2220 DEFUN ("logand", Flogand, Slogand, 0, MANY, 0, | |
2221 "Return bitwise-and of all the arguments.\n\ | |
2222 Arguments may be integers, or markers converted to integers.") | |
2223 (nargs, args) | |
2224 int nargs; | |
2225 Lisp_Object *args; | |
2226 { | |
2227 return arith_driver (Alogand, nargs, args); | |
2228 } | |
2229 | |
2230 DEFUN ("logior", Flogior, Slogior, 0, MANY, 0, | |
2231 "Return bitwise-or of all the arguments.\n\ | |
2232 Arguments may be integers, or markers converted to integers.") | |
2233 (nargs, args) | |
2234 int nargs; | |
2235 Lisp_Object *args; | |
2236 { | |
2237 return arith_driver (Alogior, nargs, args); | |
2238 } | |
2239 | |
2240 DEFUN ("logxor", Flogxor, Slogxor, 0, MANY, 0, | |
2241 "Return bitwise-exclusive-or of all the arguments.\n\ | |
2242 Arguments may be integers, or markers converted to integers.") | |
2243 (nargs, args) | |
2244 int nargs; | |
2245 Lisp_Object *args; | |
2246 { | |
2247 return arith_driver (Alogxor, nargs, args); | |
2248 } | |
2249 | |
2250 DEFUN ("ash", Fash, Sash, 2, 2, 0, | |
2251 "Return VALUE with its bits shifted left by COUNT.\n\ | |
2252 If COUNT is negative, shifting is actually to the right.\n\ | |
2253 In this case, the sign bit is duplicated.") | |
11002
ff115809a39e
(Fash): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
10951
diff
changeset
|
2254 (value, count) |
ff115809a39e
(Fash): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
10951
diff
changeset
|
2255 register Lisp_Object value, count; |
298 | 2256 { |
2257 register Lisp_Object val; | |
2258 | |
10951
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2259 CHECK_NUMBER (value, 0); |
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2260 CHECK_NUMBER (count, 1); |
298 | 2261 |
10951
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2262 if (XINT (count) > 0) |
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2263 XSETINT (val, XINT (value) << XFASTINT (count)); |
298 | 2264 else |
10951
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2265 XSETINT (val, XINT (value) >> -XINT (count)); |
298 | 2266 return val; |
2267 } | |
2268 | |
2269 DEFUN ("lsh", Flsh, Slsh, 2, 2, 0, | |
2270 "Return VALUE with its bits shifted left by COUNT.\n\ | |
2271 If COUNT is negative, shifting is actually to the right.\n\ | |
2272 In this case, zeros are shifted in on the left.") | |
10951
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2273 (value, count) |
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2274 register Lisp_Object value, count; |
298 | 2275 { |
2276 register Lisp_Object val; | |
2277 | |
10951
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2278 CHECK_NUMBER (value, 0); |
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2279 CHECK_NUMBER (count, 1); |
298 | 2280 |
10951
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2281 if (XINT (count) > 0) |
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2282 XSETINT (val, (EMACS_UINT) XUINT (value) << XFASTINT (count)); |
298 | 2283 else |
10951
6a8b6db450dc
(Fash, Flsh): Change arg names.
Richard M. Stallman <rms@gnu.org>
parents:
10725
diff
changeset
|
2284 XSETINT (val, (EMACS_UINT) XUINT (value) >> -XINT (count)); |
298 | 2285 return val; |
2286 } | |
2287 | |
2288 DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0, | |
2289 "Return NUMBER plus one. NUMBER may be a number or a marker.\n\ | |
2290 Markers are converted to integers.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2291 (number) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2292 register Lisp_Object number; |
298 | 2293 { |
2294 #ifdef LISP_FLOAT_TYPE | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2295 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2296 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2297 if (FLOATP (number)) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2298 return (make_float (1.0 + XFLOAT (number)->data)); |
298 | 2299 #else |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2300 CHECK_NUMBER_COERCE_MARKER (number, 0); |
298 | 2301 #endif /* LISP_FLOAT_TYPE */ |
2302 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2303 XSETINT (number, XINT (number) + 1); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2304 return number; |
298 | 2305 } |
2306 | |
2307 DEFUN ("1-", Fsub1, Ssub1, 1, 1, 0, | |
2308 "Return NUMBER minus one. NUMBER may be a number or a marker.\n\ | |
2309 Markers are converted to integers.") | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2310 (number) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2311 register Lisp_Object number; |
298 | 2312 { |
2313 #ifdef LISP_FLOAT_TYPE | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2314 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number, 0); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2315 |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2316 if (FLOATP (number)) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2317 return (make_float (-1.0 + XFLOAT (number)->data)); |
298 | 2318 #else |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2319 CHECK_NUMBER_COERCE_MARKER (number, 0); |
298 | 2320 #endif /* LISP_FLOAT_TYPE */ |
2321 | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2322 XSETINT (number, XINT (number) - 1); |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2323 return number; |
298 | 2324 } |
2325 | |
2326 DEFUN ("lognot", Flognot, Slognot, 1, 1, 0, | |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2327 "Return the bitwise complement of NUMBER. NUMBER must be an integer.") |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2328 (number) |
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2329 register Lisp_Object number; |
298 | 2330 { |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2331 CHECK_NUMBER (number, 0); |
14096
f3766d691555
(Flognot): Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents:
14066
diff
changeset
|
2332 XSETINT (number, ~XINT (number)); |
14066
2c6db67067ac
(Fboundp, Ffboundp, Fmakunbound, Ffmakunbound, Fsymbol_plist, Fsymbol_name,
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
2333 return number; |
298 | 2334 } |
2335 | |
2336 void | |
2337 syms_of_data () | |
2338 { | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2339 Lisp_Object error_tail, arith_tail; |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2340 |
298 | 2341 Qquote = intern ("quote"); |
2342 Qlambda = intern ("lambda"); | |
2343 Qsubr = intern ("subr"); | |
2344 Qerror_conditions = intern ("error-conditions"); | |
2345 Qerror_message = intern ("error-message"); | |
2346 Qtop_level = intern ("top-level"); | |
2347 | |
2348 Qerror = intern ("error"); | |
2349 Qquit = intern ("quit"); | |
2350 Qwrong_type_argument = intern ("wrong-type-argument"); | |
2351 Qargs_out_of_range = intern ("args-out-of-range"); | |
2352 Qvoid_function = intern ("void-function"); | |
648 | 2353 Qcyclic_function_indirection = intern ("cyclic-function-indirection"); |
298 | 2354 Qvoid_variable = intern ("void-variable"); |
2355 Qsetting_constant = intern ("setting-constant"); | |
2356 Qinvalid_read_syntax = intern ("invalid-read-syntax"); | |
2357 | |
2358 Qinvalid_function = intern ("invalid-function"); | |
2359 Qwrong_number_of_arguments = intern ("wrong-number-of-arguments"); | |
2360 Qno_catch = intern ("no-catch"); | |
2361 Qend_of_file = intern ("end-of-file"); | |
2362 Qarith_error = intern ("arith-error"); | |
2363 Qbeginning_of_buffer = intern ("beginning-of-buffer"); | |
2364 Qend_of_buffer = intern ("end-of-buffer"); | |
2365 Qbuffer_read_only = intern ("buffer-read-only"); | |
4036 | 2366 Qmark_inactive = intern ("mark-inactive"); |
298 | 2367 |
2368 Qlistp = intern ("listp"); | |
2369 Qconsp = intern ("consp"); | |
2370 Qsymbolp = intern ("symbolp"); | |
2371 Qintegerp = intern ("integerp"); | |
2372 Qnatnump = intern ("natnump"); | |
6459
30fabcc03f0c
(Qwholenump): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6448
diff
changeset
|
2373 Qwholenump = intern ("wholenump"); |
298 | 2374 Qstringp = intern ("stringp"); |
2375 Qarrayp = intern ("arrayp"); | |
2376 Qsequencep = intern ("sequencep"); | |
2377 Qbufferp = intern ("bufferp"); | |
2378 Qvectorp = intern ("vectorp"); | |
2379 Qchar_or_string_p = intern ("char-or-string-p"); | |
2380 Qmarkerp = intern ("markerp"); | |
1293 | 2381 Qbuffer_or_string_p = intern ("buffer-or-string-p"); |
298 | 2382 Qinteger_or_marker_p = intern ("integer-or-marker-p"); |
2383 Qboundp = intern ("boundp"); | |
2384 Qfboundp = intern ("fboundp"); | |
2385 | |
2386 #ifdef LISP_FLOAT_TYPE | |
2387 Qfloatp = intern ("floatp"); | |
2388 Qnumberp = intern ("numberp"); | |
2389 Qnumber_or_marker_p = intern ("number-or-marker-p"); | |
2390 #endif /* LISP_FLOAT_TYPE */ | |
2391 | |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
2392 Qchar_table_p = intern ("char-table-p"); |
13200
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
2393 Qvector_or_char_table_p = intern ("vector-or-char-table-p"); |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
2394 |
298 | 2395 Qcdr = intern ("cdr"); |
2396 | |
8401
1eee41c8120c
(syms_of_data): Set up Qadvice_info, Qactivate_advice.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
2397 /* Handle automatic advice activation */ |
8448
b6335ce87e16
(Fdefine_function, Fdefalias): Handle advice as in Ffset.
Richard M. Stallman <rms@gnu.org>
parents:
8415
diff
changeset
|
2398 Qad_advice_info = intern ("ad-advice-info"); |
b6335ce87e16
(Fdefine_function, Fdefalias): Handle advice as in Ffset.
Richard M. Stallman <rms@gnu.org>
parents:
8415
diff
changeset
|
2399 Qad_activate = intern ("ad-activate"); |
8401
1eee41c8120c
(syms_of_data): Set up Qadvice_info, Qactivate_advice.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
2400 |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2401 error_tail = Fcons (Qerror, Qnil); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2402 |
298 | 2403 /* ERROR is used as a signaler for random errors for which nothing else is right */ |
2404 | |
2405 Fput (Qerror, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2406 error_tail); |
298 | 2407 Fput (Qerror, Qerror_message, |
2408 build_string ("error")); | |
2409 | |
2410 Fput (Qquit, Qerror_conditions, | |
2411 Fcons (Qquit, Qnil)); | |
2412 Fput (Qquit, Qerror_message, | |
2413 build_string ("Quit")); | |
2414 | |
2415 Fput (Qwrong_type_argument, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2416 Fcons (Qwrong_type_argument, error_tail)); |
298 | 2417 Fput (Qwrong_type_argument, Qerror_message, |
2418 build_string ("Wrong type argument")); | |
2419 | |
2420 Fput (Qargs_out_of_range, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2421 Fcons (Qargs_out_of_range, error_tail)); |
298 | 2422 Fput (Qargs_out_of_range, Qerror_message, |
2423 build_string ("Args out of range")); | |
2424 | |
2425 Fput (Qvoid_function, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2426 Fcons (Qvoid_function, error_tail)); |
298 | 2427 Fput (Qvoid_function, Qerror_message, |
2428 build_string ("Symbol's function definition is void")); | |
2429 | |
648 | 2430 Fput (Qcyclic_function_indirection, Qerror_conditions, |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2431 Fcons (Qcyclic_function_indirection, error_tail)); |
648 | 2432 Fput (Qcyclic_function_indirection, Qerror_message, |
2433 build_string ("Symbol's chain of function indirections contains a loop")); | |
2434 | |
298 | 2435 Fput (Qvoid_variable, Qerror_conditions, |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2436 Fcons (Qvoid_variable, error_tail)); |
298 | 2437 Fput (Qvoid_variable, Qerror_message, |
2438 build_string ("Symbol's value as variable is void")); | |
2439 | |
2440 Fput (Qsetting_constant, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2441 Fcons (Qsetting_constant, error_tail)); |
298 | 2442 Fput (Qsetting_constant, Qerror_message, |
2443 build_string ("Attempt to set a constant symbol")); | |
2444 | |
2445 Fput (Qinvalid_read_syntax, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2446 Fcons (Qinvalid_read_syntax, error_tail)); |
298 | 2447 Fput (Qinvalid_read_syntax, Qerror_message, |
2448 build_string ("Invalid read syntax")); | |
2449 | |
2450 Fput (Qinvalid_function, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2451 Fcons (Qinvalid_function, error_tail)); |
298 | 2452 Fput (Qinvalid_function, Qerror_message, |
2453 build_string ("Invalid function")); | |
2454 | |
2455 Fput (Qwrong_number_of_arguments, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2456 Fcons (Qwrong_number_of_arguments, error_tail)); |
298 | 2457 Fput (Qwrong_number_of_arguments, Qerror_message, |
2458 build_string ("Wrong number of arguments")); | |
2459 | |
2460 Fput (Qno_catch, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2461 Fcons (Qno_catch, error_tail)); |
298 | 2462 Fput (Qno_catch, Qerror_message, |
2463 build_string ("No catch for tag")); | |
2464 | |
2465 Fput (Qend_of_file, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2466 Fcons (Qend_of_file, error_tail)); |
298 | 2467 Fput (Qend_of_file, Qerror_message, |
2468 build_string ("End of file during parsing")); | |
2469 | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2470 arith_tail = Fcons (Qarith_error, error_tail); |
298 | 2471 Fput (Qarith_error, Qerror_conditions, |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2472 arith_tail); |
298 | 2473 Fput (Qarith_error, Qerror_message, |
2474 build_string ("Arithmetic error")); | |
2475 | |
2476 Fput (Qbeginning_of_buffer, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2477 Fcons (Qbeginning_of_buffer, error_tail)); |
298 | 2478 Fput (Qbeginning_of_buffer, Qerror_message, |
2479 build_string ("Beginning of buffer")); | |
2480 | |
2481 Fput (Qend_of_buffer, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2482 Fcons (Qend_of_buffer, error_tail)); |
298 | 2483 Fput (Qend_of_buffer, Qerror_message, |
2484 build_string ("End of buffer")); | |
2485 | |
2486 Fput (Qbuffer_read_only, Qerror_conditions, | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2487 Fcons (Qbuffer_read_only, error_tail)); |
298 | 2488 Fput (Qbuffer_read_only, Qerror_message, |
2489 build_string ("Buffer is read-only")); | |
2490 | |
2092
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2491 #ifdef LISP_FLOAT_TYPE |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2492 Qrange_error = intern ("range-error"); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2493 Qdomain_error = intern ("domain-error"); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2494 Qsingularity_error = intern ("singularity-error"); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2495 Qoverflow_error = intern ("overflow-error"); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2496 Qunderflow_error = intern ("underflow-error"); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2497 |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2498 Fput (Qdomain_error, Qerror_conditions, |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2499 Fcons (Qdomain_error, arith_tail)); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2500 Fput (Qdomain_error, Qerror_message, |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2501 build_string ("Arithmetic domain error")); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2502 |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2503 Fput (Qrange_error, Qerror_conditions, |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2504 Fcons (Qrange_error, arith_tail)); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2505 Fput (Qrange_error, Qerror_message, |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2506 build_string ("Arithmetic range error")); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2507 |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2508 Fput (Qsingularity_error, Qerror_conditions, |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2509 Fcons (Qsingularity_error, Fcons (Qdomain_error, arith_tail))); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2510 Fput (Qsingularity_error, Qerror_message, |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2511 build_string ("Arithmetic singularity error")); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2512 |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2513 Fput (Qoverflow_error, Qerror_conditions, |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2514 Fcons (Qoverflow_error, Fcons (Qdomain_error, arith_tail))); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2515 Fput (Qoverflow_error, Qerror_message, |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2516 build_string ("Arithmetic overflow error")); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2517 |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2518 Fput (Qunderflow_error, Qerror_conditions, |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2519 Fcons (Qunderflow_error, Fcons (Qdomain_error, arith_tail))); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2520 Fput (Qunderflow_error, Qerror_message, |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2521 build_string ("Arithmetic underflow error")); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2522 |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2523 staticpro (&Qrange_error); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2524 staticpro (&Qdomain_error); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2525 staticpro (&Qsingularity_error); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2526 staticpro (&Qoverflow_error); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2527 staticpro (&Qunderflow_error); |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2528 #endif /* LISP_FLOAT_TYPE */ |
7497fce1e426
(syms_of_data) [LISP_FLOAT_TYPE]: Define new error conditions:
Richard M. Stallman <rms@gnu.org>
parents:
1987
diff
changeset
|
2529 |
298 | 2530 staticpro (&Qnil); |
2531 staticpro (&Qt); | |
2532 staticpro (&Qquote); | |
2533 staticpro (&Qlambda); | |
2534 staticpro (&Qsubr); | |
2535 staticpro (&Qunbound); | |
2536 staticpro (&Qerror_conditions); | |
2537 staticpro (&Qerror_message); | |
2538 staticpro (&Qtop_level); | |
2539 | |
2540 staticpro (&Qerror); | |
2541 staticpro (&Qquit); | |
2542 staticpro (&Qwrong_type_argument); | |
2543 staticpro (&Qargs_out_of_range); | |
2544 staticpro (&Qvoid_function); | |
648 | 2545 staticpro (&Qcyclic_function_indirection); |
298 | 2546 staticpro (&Qvoid_variable); |
2547 staticpro (&Qsetting_constant); | |
2548 staticpro (&Qinvalid_read_syntax); | |
2549 staticpro (&Qwrong_number_of_arguments); | |
2550 staticpro (&Qinvalid_function); | |
2551 staticpro (&Qno_catch); | |
2552 staticpro (&Qend_of_file); | |
2553 staticpro (&Qarith_error); | |
2554 staticpro (&Qbeginning_of_buffer); | |
2555 staticpro (&Qend_of_buffer); | |
2556 staticpro (&Qbuffer_read_only); | |
4037
aecb99c65ab0
(syms_of_data): Staticpro Qmark_inactive.
Roland McGrath <roland@gnu.org>
parents:
4036
diff
changeset
|
2557 staticpro (&Qmark_inactive); |
298 | 2558 |
2559 staticpro (&Qlistp); | |
2560 staticpro (&Qconsp); | |
2561 staticpro (&Qsymbolp); | |
2562 staticpro (&Qintegerp); | |
2563 staticpro (&Qnatnump); | |
6459
30fabcc03f0c
(Qwholenump): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6448
diff
changeset
|
2564 staticpro (&Qwholenump); |
298 | 2565 staticpro (&Qstringp); |
2566 staticpro (&Qarrayp); | |
2567 staticpro (&Qsequencep); | |
2568 staticpro (&Qbufferp); | |
2569 staticpro (&Qvectorp); | |
2570 staticpro (&Qchar_or_string_p); | |
2571 staticpro (&Qmarkerp); | |
1293 | 2572 staticpro (&Qbuffer_or_string_p); |
298 | 2573 staticpro (&Qinteger_or_marker_p); |
2574 #ifdef LISP_FLOAT_TYPE | |
2575 staticpro (&Qfloatp); | |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
2576 staticpro (&Qnumberp); |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
2577 staticpro (&Qnumber_or_marker_p); |
298 | 2578 #endif /* LISP_FLOAT_TYPE */ |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
2579 staticpro (&Qchar_table_p); |
13200
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
2580 staticpro (&Qvector_or_char_table_p); |
298 | 2581 |
2582 staticpro (&Qboundp); | |
2583 staticpro (&Qfboundp); | |
2584 staticpro (&Qcdr); | |
8448
b6335ce87e16
(Fdefine_function, Fdefalias): Handle advice as in Ffset.
Richard M. Stallman <rms@gnu.org>
parents:
8415
diff
changeset
|
2585 staticpro (&Qad_advice_info); |
b6335ce87e16
(Fdefine_function, Fdefalias): Handle advice as in Ffset.
Richard M. Stallman <rms@gnu.org>
parents:
8415
diff
changeset
|
2586 staticpro (&Qad_activate); |
298 | 2587 |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2588 /* Types that type-of returns. */ |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2589 Qinteger = intern ("integer"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2590 Qsymbol = intern ("symbol"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2591 Qstring = intern ("string"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2592 Qcons = intern ("cons"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2593 Qmarker = intern ("marker"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2594 Qoverlay = intern ("overlay"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2595 Qfloat = intern ("float"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2596 Qwindow_configuration = intern ("window-configuration"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2597 Qprocess = intern ("process"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2598 Qwindow = intern ("window"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2599 /* Qsubr = intern ("subr"); */ |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2600 Qcompiled_function = intern ("compiled-function"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2601 Qbuffer = intern ("buffer"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2602 Qframe = intern ("frame"); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2603 Qvector = intern ("vector"); |
13715
89ffc133f813
(Ftype_of): Return `char-table' and `bool-vector' for
Karl Heuer <kwzh@gnu.org>
parents:
13593
diff
changeset
|
2604 Qchar_table = intern ("char-table"); |
89ffc133f813
(Ftype_of): Return `char-table' and `bool-vector' for
Karl Heuer <kwzh@gnu.org>
parents:
13593
diff
changeset
|
2605 Qbool_vector = intern ("bool-vector"); |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2606 |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2607 staticpro (&Qinteger); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2608 staticpro (&Qsymbol); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2609 staticpro (&Qstring); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2610 staticpro (&Qcons); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2611 staticpro (&Qmarker); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2612 staticpro (&Qoverlay); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2613 staticpro (&Qfloat); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2614 staticpro (&Qwindow_configuration); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2615 staticpro (&Qprocess); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2616 staticpro (&Qwindow); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2617 /* staticpro (&Qsubr); */ |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2618 staticpro (&Qcompiled_function); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2619 staticpro (&Qbuffer); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2620 staticpro (&Qframe); |
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2621 staticpro (&Qvector); |
13715
89ffc133f813
(Ftype_of): Return `char-table' and `bool-vector' for
Karl Heuer <kwzh@gnu.org>
parents:
13593
diff
changeset
|
2622 staticpro (&Qchar_table); |
89ffc133f813
(Ftype_of): Return `char-table' and `bool-vector' for
Karl Heuer <kwzh@gnu.org>
parents:
13593
diff
changeset
|
2623 staticpro (&Qbool_vector); |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2624 |
298 | 2625 defsubr (&Seq); |
2626 defsubr (&Snull); | |
10725
24958130d147
Rename arg OBJ to OBJECT in all type predicates.
Richard M. Stallman <rms@gnu.org>
parents:
10645
diff
changeset
|
2627 defsubr (&Stype_of); |
298 | 2628 defsubr (&Slistp); |
2629 defsubr (&Snlistp); | |
2630 defsubr (&Sconsp); | |
2631 defsubr (&Satom); | |
2632 defsubr (&Sintegerp); | |
695
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
2633 defsubr (&Sinteger_or_marker_p); |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
2634 defsubr (&Snumberp); |
e3fac20d3015
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
648
diff
changeset
|
2635 defsubr (&Snumber_or_marker_p); |
298 | 2636 #ifdef LISP_FLOAT_TYPE |
2637 defsubr (&Sfloatp); | |
2638 #endif /* LISP_FLOAT_TYPE */ | |
2639 defsubr (&Snatnump); | |
2640 defsubr (&Ssymbolp); | |
2641 defsubr (&Sstringp); | |
2642 defsubr (&Svectorp); | |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
2643 defsubr (&Schar_table_p); |
13200
5fd4e8e4185a
(Qvector_or_char_table_p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
13148
diff
changeset
|
2644 defsubr (&Svector_or_char_table_p); |
13148
18b1b690defe
(Fchartablep, Fboolvectorp): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
12528
diff
changeset
|
2645 defsubr (&Sbool_vector_p); |
298 | 2646 defsubr (&Sarrayp); |
2647 defsubr (&Ssequencep); | |
2648 defsubr (&Sbufferp); | |
2649 defsubr (&Smarkerp); | |
2650 defsubr (&Ssubrp); | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1648
diff
changeset
|
2651 defsubr (&Sbyte_code_function_p); |
298 | 2652 defsubr (&Schar_or_string_p); |
2653 defsubr (&Scar); | |
2654 defsubr (&Scdr); | |
2655 defsubr (&Scar_safe); | |
2656 defsubr (&Scdr_safe); | |
2657 defsubr (&Ssetcar); | |
2658 defsubr (&Ssetcdr); | |
2659 defsubr (&Ssymbol_function); | |
648 | 2660 defsubr (&Sindirect_function); |
298 | 2661 defsubr (&Ssymbol_plist); |
2662 defsubr (&Ssymbol_name); | |
2663 defsubr (&Smakunbound); | |
2664 defsubr (&Sfmakunbound); | |
2665 defsubr (&Sboundp); | |
2666 defsubr (&Sfboundp); | |
2667 defsubr (&Sfset); | |
2565
c1a1557bffde
(Fdefine_function): Changed name back to Fdefalias, so we get things
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2548
diff
changeset
|
2668 defsubr (&Sdefalias); |
298 | 2669 defsubr (&Ssetplist); |
2670 defsubr (&Ssymbol_value); | |
2671 defsubr (&Sset); | |
2672 defsubr (&Sdefault_boundp); | |
2673 defsubr (&Sdefault_value); | |
2674 defsubr (&Sset_default); | |
2675 defsubr (&Ssetq_default); | |
2676 defsubr (&Smake_variable_buffer_local); | |
2677 defsubr (&Smake_local_variable); | |
2678 defsubr (&Skill_local_variable); | |
9194
3db4151c3d00
(Fmake_local_variable): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
9147
diff
changeset
|
2679 defsubr (&Slocal_variable_p); |
12295
b4731504d3ab
(Flocal_variable_if_set_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
2680 defsubr (&Slocal_variable_if_set_p); |
298 | 2681 defsubr (&Saref); |
2682 defsubr (&Saset); | |
2429
96b55f2f19cd
Rename int-to-string to number-to-string, since it can handle
Jim Blandy <jimb@redhat.com>
parents:
2092
diff
changeset
|
2683 defsubr (&Snumber_to_string); |
1914
60965a5c325f
* data.c (Fstring_to_number): Skip initial spaces, to make Emacs
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
2684 defsubr (&Sstring_to_number); |
298 | 2685 defsubr (&Seqlsign); |
2686 defsubr (&Slss); | |
2687 defsubr (&Sgtr); | |
2688 defsubr (&Sleq); | |
2689 defsubr (&Sgeq); | |
2690 defsubr (&Sneq); | |
2691 defsubr (&Szerop); | |
2692 defsubr (&Splus); | |
2693 defsubr (&Sminus); | |
2694 defsubr (&Stimes); | |
2695 defsubr (&Squo); | |
2696 defsubr (&Srem); | |
4508
763987892042
(Fmod): New function; result is always same sign as divisor.
Paul Eggert <eggert@twinsun.com>
parents:
4447
diff
changeset
|
2697 defsubr (&Smod); |
298 | 2698 defsubr (&Smax); |
2699 defsubr (&Smin); | |
2700 defsubr (&Slogand); | |
2701 defsubr (&Slogior); | |
2702 defsubr (&Slogxor); | |
2703 defsubr (&Slsh); | |
2704 defsubr (&Sash); | |
2705 defsubr (&Sadd1); | |
2706 defsubr (&Ssub1); | |
2707 defsubr (&Slognot); | |
6459
30fabcc03f0c
(Qwholenump): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
6448
diff
changeset
|
2708 |
9954
18b408b05189
(syms_of_data): Set Qwholenump as function, not variable.
Karl Heuer <kwzh@gnu.org>
parents:
9895
diff
changeset
|
2709 XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function; |
298 | 2710 } |
2711 | |
490 | 2712 SIGTYPE |
298 | 2713 arith_error (signo) |
2714 int signo; | |
2715 { | |
16150
f388360fb59a
(arith_error) [POSIX_SIGNALS]: Don't reestablish handler.
Richard M. Stallman <rms@gnu.org>
parents:
16051
diff
changeset
|
2716 #if defined(USG) && !defined(POSIX_SIGNALS) |
298 | 2717 /* USG systems forget handlers when they are used; |
2718 must reestablish each time */ | |
2719 signal (signo, arith_error); | |
2720 #endif /* USG */ | |
2721 #ifdef VMS | |
2722 /* VMS systems are like USG. */ | |
2723 signal (signo, arith_error); | |
2724 #endif /* VMS */ | |
2725 #ifdef BSD4_1 | |
2726 sigrelse (SIGFPE); | |
2727 #else /* not BSD4_1 */ | |
638 | 2728 sigsetmask (SIGEMPTYMASK); |
298 | 2729 #endif /* not BSD4_1 */ |
2730 | |
2731 Fsignal (Qarith_error, Qnil); | |
2732 } | |
2733 | |
2734 init_data () | |
2735 { | |
2736 /* Don't do this if just dumping out. | |
2737 We don't want to call `signal' in this case | |
2738 so that we don't have trouble with dumping | |
2739 signal-delivering routines in an inconsistent state. */ | |
2740 #ifndef CANNOT_DUMP | |
2741 if (!initialized) | |
2742 return; | |
2743 #endif /* CANNOT_DUMP */ | |
2744 signal (SIGFPE, arith_error); | |
10605
bc37b55fcbb9
(do_symval_forwarding): Handle display-local vars.
Karl Heuer <kwzh@gnu.org>
parents:
10457
diff
changeset
|
2745 |
298 | 2746 #ifdef uts |
2747 signal (SIGEMT, arith_error); | |
2748 #endif /* uts */ | |
2749 } |