0
|
1 /* Lisp parsing and input streams.
|
|
2 Copyright (C) 1985-1989, 1992-1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Tinker Systems.
|
|
4 Copyright (C) 1996 Ben Wing.
|
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Mule 2.0, FSF 19.30. */
|
|
24
|
|
25 /* This file has been Mule-ized. */
|
|
26
|
|
27 #include <config.h>
|
|
28 #include "lisp.h"
|
|
29
|
|
30 #ifndef standalone
|
|
31 #include "buffer.h"
|
|
32 #include "bytecode.h"
|
|
33 #include "commands.h"
|
|
34 #include "insdel.h"
|
|
35 #include "lstream.h"
|
|
36 #include "opaque.h"
|
159
|
37 #include <paths.h>
|
0
|
38 #endif
|
70
|
39 #ifdef MULE
|
|
40 #include "mule-coding.h"
|
|
41 #endif
|
0
|
42
|
|
43 #include "sysfile.h"
|
|
44
|
|
45 #ifdef LISP_FLOAT_TYPE
|
|
46 #define THIS_FILENAME lread
|
|
47 #include "sysfloat.h"
|
|
48 #endif /* LISP_FLOAT_TYPE */
|
|
49
|
|
50 Lisp_Object Qread_char, Qstandard_input;
|
|
51 Lisp_Object Qvariable_documentation;
|
|
52 #define LISP_BACKQUOTES
|
|
53 #ifdef LISP_BACKQUOTES
|
|
54 /* FSFmacs says:
|
|
55
|
|
56 Nonzero means inside a new-style backquote
|
|
57 with no surrounding parentheses.
|
|
58 Fread initializes this to zero, so we need not specbind it
|
|
59 or worry about what happens to it when there is an error.
|
|
60
|
|
61 But this is fucking typical Stallman bogosity. Nested
|
|
62 backquotes are perfectly legal and fail utterly with
|
|
63 this silliness. */
|
|
64 static int new_backquote_flag, old_backquote_flag;
|
|
65 Lisp_Object Qbackquote, Qbacktick, Qcomma, Qcomma_at, Qcomma_dot;
|
173
|
66 #endif
|
0
|
67 Lisp_Object Qvariable_domain; /* I18N3 */
|
|
68 Lisp_Object Vvalues, Vstandard_input, Vafter_load_alist;
|
|
69 Lisp_Object Qcurrent_load_list;
|
|
70 Lisp_Object Qload, Qload_file_name;
|
|
71 Lisp_Object Qlocate_file_hash_table;
|
|
72 Lisp_Object Qfset;
|
|
73
|
|
74 int puke_on_fsf_keys;
|
|
75
|
140
|
76 /* This symbol is also used in fns.c */
|
|
77 #define FEATUREP_SYNTAX
|
|
78
|
|
79 #ifdef FEATUREP_SYNTAX
|
209
|
80 Lisp_Object Qfeaturep;
|
140
|
81 #endif
|
|
82
|
0
|
83 /* non-zero if inside `load' */
|
|
84 int load_in_progress;
|
|
85
|
|
86 /* Whether Fload_internal() should check whether the .el is newer
|
|
87 when loading .elc */
|
|
88 int load_warn_when_source_newer;
|
|
89 /* Whether Fload_internal() should check whether the .elc doesn't exist */
|
|
90 int load_warn_when_source_only;
|
|
91 /* Whether Fload_internal() should ignore .elc files when no suffix is given */
|
|
92 int load_ignore_elc_files;
|
|
93
|
|
94 /* Directory in which the sources were found. */
|
|
95 Lisp_Object Vsource_directory;
|
|
96
|
|
97 /* Search path for files to be loaded. */
|
|
98 Lisp_Object Vload_path;
|
|
99
|
|
100 /* Search path for files when dumping. */
|
|
101 /* Lisp_Object Vdump_load_path; */
|
|
102
|
|
103 /* This is the user-visible association list that maps features to
|
|
104 lists of defs in their load files. */
|
|
105 Lisp_Object Vload_history;
|
|
106
|
|
107 /* This is used to build the load history. */
|
|
108 Lisp_Object Vcurrent_load_list;
|
|
109
|
|
110 /* Name of file actually being read by `load'. */
|
|
111 Lisp_Object Vload_file_name;
|
|
112
|
|
113 /* Same as Vload_file_name but not Lisp-accessible. This ensures that
|
|
114 our #$ checks are reliable. */
|
|
115 Lisp_Object Vload_file_name_internal;
|
|
116
|
|
117 Lisp_Object Vload_file_name_internal_the_purecopy;
|
|
118
|
|
119 /* Function to use for reading, in `load' and friends. */
|
|
120 Lisp_Object Vload_read_function;
|
|
121
|
245
|
122 /* The association list of objects read with the #n=object form.
|
|
123 Each member of the list has the form (n . object), and is used to
|
|
124 look up the object for the corresponding #n# construct.
|
|
125 It must be set to nil before all top-level calls to read0. */
|
|
126 Lisp_Object read_objects;
|
|
127
|
0
|
128 /* Nonzero means load should forcibly load all dynamic doc strings. */
|
|
129 /* Note that this always happens (with some special behavior) when
|
|
130 purify_flag is set. */
|
|
131 static int load_force_doc_strings;
|
|
132
|
|
133 /* List of descriptors now open for Fload_internal. */
|
|
134 static Lisp_Object Vload_descriptor_list;
|
|
135
|
|
136 /* In order to implement "load_force_doc_strings", we keep
|
|
137 a list of all the compiled-function objects and such
|
|
138 that we have created in the process of loading this file.
|
|
139 See the rant below.
|
|
140
|
|
141 We specbind this just like Vload_file_name, so there's no
|
|
142 problems with recursive loading. */
|
|
143 static Lisp_Object Vload_force_doc_string_list;
|
|
144
|
|
145 /* A resizing-buffer stream used to temporarily hold data while reading */
|
|
146 static Lisp_Object Vread_buffer_stream;
|
|
147
|
|
148 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
|
|
149 Lisp_Object Vcurrent_compiled_function_annotation;
|
|
150 #endif
|
|
151
|
16
|
152 static int load_byte_code_version;
|
|
153
|
0
|
154 /* An array describing all known built-in structure types */
|
185
|
155 static structure_type_dynarr *the_structure_type_dynarr;
|
0
|
156
|
|
157 #if 0 /* FSFmacs defun hack */
|
|
158 /* When nonzero, read conses in pure space */
|
|
159 static int read_pure;
|
|
160 #endif
|
|
161
|
|
162 #if 0 /* FSFmacs bogosity */
|
|
163 /* For use within read-from-string (this reader is non-reentrant!!) */
|
|
164 static int read_from_string_index;
|
|
165 static int read_from_string_limit;
|
|
166 #endif
|
|
167
|
|
168 #if 0 /* More FSF implementation kludges. */
|
|
169 /* In order to implement load-force-doc-string, FSF saves the
|
|
170 #@-quoted string when it's seen, and goes back and retrieves
|
|
171 it later.
|
|
172
|
|
173 This approach is not only kludgy, but it in general won't work
|
|
174 correctly because there's no stack of remembered #@-quoted-strings
|
|
175 and those strings don't generally appear in the file in the same
|
|
176 order as their #$ references. (Yes, that is amazingly stupid too.
|
|
177 WHY IN THE FUCKING HELL CAN'T RMS EVER IMPLEMENT ANYTHING IN A SANE
|
|
178 WAY? It would be trivially easy to always encode the #@ string
|
|
179 [which is a comment, anyway] in the middle of the (#$ . INT) cons
|
|
180 reference. That way, it would be really easy to implement
|
|
181 load-force-doc-string in a non-kludgy way by just retrieving the
|
|
182 string immediately, because it's delivered on a silver platter.)
|
|
183
|
|
184 And finally, this stupid approach doesn't work under Mule, or
|
|
185 under MS-DOS or Windows NT, or under VMS, or any other place
|
|
186 where you either can't do an ftell() or don't get back a byte
|
|
187 count.
|
|
188
|
|
189 Oh, and one more lossage in this approach: If you attempt to
|
|
190 dump any ELC files that were compiled with `byte-compile-dynamic'
|
|
191 (as opposed to just `byte-compile-dynamic-docstring'), you
|
|
192 get hosed. FMH! (as the illustrious JWZ was prone to utter)
|
|
193
|
|
194 The approach we use is clean, solves all of these problems, and is
|
|
195 probably easier to implement anyway. We just save a list of all
|
|
196 the containing objects that have (#$ . INT) conses in them (this
|
|
197 will only be compiled-function objects and lists), and when the
|
|
198 file is finished loading, we go through and fill in all the
|
|
199 doc strings at once. */
|
|
200
|
|
201 /* This contains the last string skipped with #@. */
|
|
202 static char *saved_doc_string;
|
|
203 /* Length of buffer allocated in saved_doc_string. */
|
|
204 static int saved_doc_string_size;
|
|
205 /* Length of actual data in saved_doc_string. */
|
|
206 static int saved_doc_string_length;
|
|
207 /* This is the file position that string came from. */
|
|
208 static int saved_doc_string_position;
|
|
209 #endif
|
|
210
|
|
211
|
|
212
|
|
213 static DOESNT_RETURN
|
|
214 syntax_error (CONST char *string)
|
|
215 {
|
|
216 signal_error (Qinvalid_read_syntax,
|
|
217 list1 (build_translated_string (string)));
|
|
218 }
|
|
219
|
|
220 static Lisp_Object
|
|
221 continuable_syntax_error (CONST char *string)
|
|
222 {
|
|
223 return Fsignal (Qinvalid_read_syntax,
|
|
224 list1 (build_translated_string (string)));
|
|
225 }
|
|
226
|
|
227
|
|
228 /* Handle unreading and rereading of characters. */
|
|
229 static Emchar
|
|
230 readchar (Lisp_Object readcharfun)
|
|
231 {
|
|
232 /* This function can GC */
|
|
233
|
|
234 if (BUFFERP (readcharfun))
|
|
235 {
|
|
236 Emchar c;
|
|
237 struct buffer *b = XBUFFER (readcharfun);
|
173
|
238
|
0
|
239 if (!BUFFER_LIVE_P (b))
|
|
240 error ("Reading from killed buffer");
|
|
241
|
|
242 if (BUF_PT (b) >= BUF_ZV (b))
|
|
243 return -1;
|
|
244 c = BUF_FETCH_CHAR (b, BUF_PT (b));
|
|
245 BUF_SET_PT (b, BUF_PT (b) + 1);
|
|
246
|
|
247 return c;
|
|
248 }
|
|
249 else if (LSTREAMP (readcharfun))
|
|
250 {
|
16
|
251 Emchar c = Lstream_get_emchar (XLSTREAM (readcharfun));
|
|
252 #ifdef DEBUG_XEMACS /* testing Mule */
|
|
253 static int testing_mule = 0; /* Change via debugger */
|
|
254 if (testing_mule) {
|
|
255 if (c >= 0x20 && c <= 0x7E) fprintf (stderr, "%c", c);
|
|
256 else if (c == '\n') fprintf (stderr, "\\n\n");
|
|
257 else fprintf (stderr, "\\%o ", c);
|
|
258 }
|
|
259 #endif
|
|
260 return c;
|
0
|
261 }
|
|
262 else if (MARKERP (readcharfun))
|
|
263 {
|
|
264 Emchar c;
|
|
265 Bufpos mpos = marker_position (readcharfun);
|
|
266 struct buffer *inbuffer = XMARKER (readcharfun)->buffer;
|
|
267
|
|
268 if (mpos >= BUF_ZV (inbuffer))
|
|
269 return -1;
|
|
270 c = BUF_FETCH_CHAR (inbuffer, mpos);
|
|
271 set_marker_position (readcharfun, mpos + 1);
|
|
272 return c;
|
|
273 }
|
|
274 else
|
|
275 {
|
|
276 Lisp_Object tem = call0 (readcharfun);
|
|
277
|
|
278 if (!CHAR_OR_CHAR_INTP (tem))
|
|
279 return -1;
|
|
280 return XCHAR_OR_CHAR_INT (tem);
|
|
281 }
|
|
282 }
|
|
283
|
|
284 /* Unread the character C in the way appropriate for the stream READCHARFUN.
|
|
285 If the stream is a user function, call it with the char as argument. */
|
|
286
|
|
287 static void
|
|
288 unreadchar (Lisp_Object readcharfun, Emchar c)
|
|
289 {
|
|
290 if (c == -1)
|
|
291 /* Don't back up the pointer if we're unreading the end-of-input mark,
|
|
292 since readchar didn't advance it when we read it. */
|
|
293 ;
|
|
294 else if (BUFFERP (readcharfun))
|
|
295 BUF_SET_PT (XBUFFER (readcharfun), BUF_PT (XBUFFER (readcharfun)) - 1);
|
|
296 else if (LSTREAMP (readcharfun))
|
|
297 {
|
|
298 Lstream_unget_emchar (XLSTREAM (readcharfun), c);
|
16
|
299 #ifdef DEBUG_XEMACS /* testing Mule */
|
|
300 {
|
|
301 static int testing_mule = 0; /* Set this using debugger */
|
|
302 if (testing_mule)
|
|
303 fprintf (stderr,
|
|
304 (c >= 0x20 && c <= 0x7E) ? "UU%c" :
|
|
305 ((c == '\n') ? "UU\\n\n" : "UU\\%o"), c);
|
|
306 }
|
|
307 #endif
|
0
|
308 }
|
|
309 else if (MARKERP (readcharfun))
|
|
310 set_marker_position (readcharfun, marker_position (readcharfun) - 1);
|
|
311 else
|
|
312 call1 (readcharfun, make_char (c));
|
|
313 }
|
|
314
|
|
315 static Lisp_Object read0 (Lisp_Object readcharfun);
|
|
316 static Lisp_Object read1 (Lisp_Object readcharfun);
|
|
317 /* allow_dotted_lists means that something like (foo bar . baz)
|
|
318 is acceptable. If -1, means check for starting with defun
|
|
319 and make structure pure. (not implemented, probably for very
|
|
320 good reasons)
|
|
321 */
|
|
322 /*
|
|
323 If check_for_doc_references, look for (#$ . INT) doc references
|
|
324 in the list and record if load_force_doc_strings is non-zero.
|
|
325 (Such doc references will be destroyed during the loadup phase
|
|
326 by replacing with Qzero, because Snarf-documentation will fill
|
|
327 them in again.)
|
|
328
|
|
329 WARNING: If you set this, you sure as hell better not call
|
|
330 free_list() on the returned list here. */
|
|
331
|
|
332 static Lisp_Object read_list (Lisp_Object readcharfun,
|
|
333 Emchar terminator,
|
|
334 int allow_dotted_lists,
|
|
335 int check_for_doc_references);
|
|
336
|
|
337 /* get a character from the tty */
|
|
338
|
|
339 #ifdef standalone /* This primitive is normally not defined */
|
|
340
|
|
341 #define kludge DEFUN /* to keep this away from make-docfile... */
|
|
342 kludge ("read-char", Fread_char, Sread_char, 0, 0, 0, "") ()
|
|
343 {
|
|
344 return getchar ();
|
|
345 }
|
|
346 #undef kludge
|
|
347 #endif /* standalone */
|
|
348
|
|
349
|
|
350
|
173
|
351 static void readevalloop (Lisp_Object readcharfun,
|
0
|
352 Lisp_Object sourcefile,
|
|
353 Lisp_Object (*evalfun) (Lisp_Object),
|
|
354 int printflag);
|
|
355
|
|
356 static Lisp_Object
|
|
357 load_unwind (Lisp_Object stream) /* used as unwind-protect function in load */
|
|
358 {
|
|
359 Lstream_close (XLSTREAM (stream));
|
|
360 if (--load_in_progress < 0)
|
|
361 load_in_progress = 0;
|
|
362 return Qnil;
|
|
363 }
|
|
364
|
|
365 static Lisp_Object
|
|
366 load_descriptor_unwind (Lisp_Object oldlist)
|
|
367 {
|
|
368 Vload_descriptor_list = oldlist;
|
|
369 return Qnil;
|
|
370 }
|
|
371
|
|
372 static Lisp_Object
|
|
373 load_file_name_internal_unwind (Lisp_Object oldval)
|
|
374 {
|
|
375 Vload_file_name_internal = oldval;
|
|
376 return Qnil;
|
|
377 }
|
|
378
|
|
379 static Lisp_Object
|
|
380 load_file_name_internal_the_purecopy_unwind (Lisp_Object oldval)
|
|
381 {
|
|
382 Vload_file_name_internal_the_purecopy = oldval;
|
|
383 return Qnil;
|
|
384 }
|
|
385
|
|
386 static Lisp_Object
|
70
|
387 load_byte_code_version_unwind (Lisp_Object oldval)
|
|
388 {
|
|
389 load_byte_code_version = XINT (oldval);
|
|
390 return Qnil;
|
|
391 }
|
|
392
|
|
393 /* The plague is coming.
|
|
394
|
|
395 Ring around the rosy, pocket full of posy,
|
|
396 Ashes ashes, they all fall down.
|
|
397 */
|
|
398 void
|
|
399 ebolify_bytecode_constants (Lisp_Object vector)
|
|
400 {
|
173
|
401 int len = XVECTOR_LENGTH (vector);
|
70
|
402 int i;
|
|
403
|
|
404 for (i = 0; i < len; i++)
|
|
405 {
|
173
|
406 Lisp_Object el = XVECTOR_DATA (vector)[i];
|
70
|
407
|
|
408 /* We don't check for `eq', `equal', and the others that have
|
|
409 bytecode opcodes. This might lose if someone passes #'eq or
|
|
410 something to `funcall', but who would really do that? As
|
|
411 they say in law, we've made a "good-faith effort" to
|
|
412 unfuckify ourselves. And doing it this way avoids screwing
|
|
413 up args to `make-hashtable' and such. As it is, we have to
|
|
414 add an extra Ebola check in decode_weak_list_type(). --ben */
|
|
415 if (EQ (el, Qassoc))
|
|
416 el = Qold_assoc;
|
|
417 if (EQ (el, Qdelq))
|
|
418 el = Qold_delq;
|
|
419 #if 0
|
|
420 /* I think this is a bad idea because it will probably mess
|
|
421 with keymap code. */
|
|
422 if (EQ (el, Qdelete))
|
|
423 el = Qold_delete;
|
|
424 #endif
|
|
425 if (EQ (el, Qrassq))
|
|
426 el = Qold_rassq;
|
|
427 if (EQ (el, Qrassoc))
|
|
428 el = Qold_rassoc;
|
173
|
429 XVECTOR_DATA (vector)[i] = el;
|
70
|
430 }
|
|
431 }
|
|
432
|
|
433 static Lisp_Object
|
0
|
434 pas_de_lache_ici (int fd, Lisp_Object victim)
|
|
435 {
|
|
436 Lisp_Object tem;
|
|
437 EMACS_INT pos;
|
|
438
|
|
439 if (!INTP (XCDR (victim)))
|
|
440 signal_simple_error ("Bogus doc string reference", victim);
|
|
441 pos = XINT (XCDR (victim));
|
|
442 if (pos < 0)
|
|
443 pos = -pos; /* kludge to mark a user variable */
|
|
444 tem = unparesseuxify_doc_string (fd, pos, 0, Vload_file_name_internal);
|
|
445 if (!STRINGP (tem))
|
|
446 signal_error (Qerror, tem);
|
|
447 return tem;
|
|
448 }
|
|
449
|
|
450 static Lisp_Object
|
|
451 load_force_doc_string_unwind (Lisp_Object oldlist)
|
|
452 {
|
|
453 struct gcpro gcpro1;
|
|
454 Lisp_Object list = Vload_force_doc_string_list;
|
|
455 Lisp_Object tail;
|
|
456 int fd = XINT (XCAR (Vload_descriptor_list));
|
|
457 /* NOTE: If purify_flag is true, we're in-place modifying objects that
|
|
458 may be in purespace (and if not, they will be). Therefore, we have
|
|
459 to be VERY careful to make sure that all objects that we create
|
|
460 are purecopied -- objects in purespace are not marked for GC, and
|
|
461 if we leave any impure objects inside of pure ones, we're really
|
|
462 screwed. */
|
|
463
|
|
464 GCPRO1 (list);
|
|
465 /* restore the old value first just in case an error occurs. */
|
|
466 Vload_force_doc_string_list = oldlist;
|
|
467
|
|
468 LIST_LOOP (tail, list)
|
|
469 {
|
|
470 Lisp_Object john = Fcar (tail);
|
|
471 if (CONSP (john))
|
|
472 {
|
|
473 assert (CONSP (XCAR (john)));
|
|
474 assert (!purify_flag); /* should have been handled in read_list() */
|
|
475 XCAR (john) = pas_de_lache_ici (fd, XCAR (john));
|
|
476 }
|
|
477 else
|
|
478 {
|
|
479 Lisp_Object doc;
|
|
480
|
|
481 assert (COMPILED_FUNCTIONP (john));
|
|
482 if (CONSP (XCOMPILED_FUNCTION (john)->bytecodes))
|
|
483 {
|
|
484 struct gcpro ngcpro1;
|
|
485 Lisp_Object juan = (pas_de_lache_ici
|
|
486 (fd, XCOMPILED_FUNCTION (john)->bytecodes));
|
|
487 Lisp_Object ivan;
|
|
488
|
|
489 NGCPRO1 (juan);
|
|
490 ivan = Fread (juan);
|
|
491 if (!CONSP (ivan))
|
|
492 signal_simple_error ("invalid lazy-loaded byte code", ivan);
|
|
493 /* Remember to purecopy; see above. */
|
|
494 XCOMPILED_FUNCTION (john)->bytecodes = Fpurecopy (XCAR (ivan));
|
70
|
495 /* v18 or v19 bytecode file. Need to Ebolify. */
|
|
496 if (XCOMPILED_FUNCTION (john)->flags.ebolified
|
|
497 && VECTORP (XCDR (ivan)))
|
|
498 ebolify_bytecode_constants (XCDR (ivan));
|
0
|
499 XCOMPILED_FUNCTION (john)->constants = Fpurecopy (XCDR (ivan));
|
|
500 NUNGCPRO;
|
|
501 }
|
|
502 doc = compiled_function_documentation (XCOMPILED_FUNCTION (john));
|
|
503 if (CONSP (doc))
|
|
504 {
|
|
505 assert (!purify_flag); /* should have been handled in
|
|
506 read_compiled_function() */
|
|
507 doc = pas_de_lache_ici (fd, doc);
|
|
508 set_compiled_function_documentation (XCOMPILED_FUNCTION (john),
|
|
509 doc);
|
|
510 }
|
|
511 }
|
|
512 }
|
|
513
|
|
514 if (!NILP (list))
|
|
515 free_list (list);
|
|
516
|
|
517 UNGCPRO;
|
|
518 return Qnil;
|
|
519 }
|
|
520
|
|
521 /* Close all descriptors in use for Fload_internal.
|
|
522 This is used when starting a subprocess. */
|
|
523
|
|
524 void
|
|
525 close_load_descs (void)
|
|
526 {
|
|
527 Lisp_Object tail;
|
|
528 LIST_LOOP (tail, Vload_descriptor_list)
|
|
529 close (XINT (XCAR (tail)));
|
|
530 }
|
|
531
|
|
532 #ifdef I18N3
|
|
533 Lisp_Object Vfile_domain;
|
|
534
|
|
535 Lisp_Object
|
|
536 restore_file_domain (Lisp_Object val)
|
|
537 {
|
|
538 Vfile_domain = val;
|
|
539 return Qnil;
|
|
540 }
|
|
541 #endif /* I18N3 */
|
|
542
|
70
|
543 DEFUN ("load-internal", Fload_internal, 1, 6, 0, /*
|
|
544 Execute a file of Lisp code named FILE; no coding-system frobbing.
|
|
545 This function is identical to `load' except for the handling of the
|
|
546 CODESYS and USED-CODESYS arguments under XEmacs/Mule. (When Mule
|
|
547 support is not present, both functions are identical and ignore the
|
|
548 CODESYS and USED-CODESYS arguments.)
|
|
549
|
|
550 If support for Mule exists in this Emacs, the file is decoded
|
|
551 according to CODESYS; if omitted, no conversion happens. If
|
|
552 USED-CODESYS is non-nil, it should be a symbol, and the actual coding
|
|
553 system that was used for the decoding is stored into it. It will in
|
|
554 general be different from CODESYS if CODESYS specifies automatic
|
|
555 encoding detection or end-of-line detection.
|
20
|
556 */
|
70
|
557 (file, no_error, nomessage, nosuffix, codesys, used_codesys))
|
0
|
558 {
|
|
559 /* This function can GC */
|
|
560 int fd = -1;
|
|
561 int speccount = specpdl_depth ();
|
|
562 int source_only = 0;
|
|
563 Lisp_Object newer = Qnil;
|
|
564 Lisp_Object handler = Qnil;
|
|
565 Lisp_Object found = Qnil;
|
|
566 struct gcpro gcpro1, gcpro2, gcpro3;
|
16
|
567 int reading_elc = 0;
|
|
568 int message_p = NILP (nomessage);
|
249
|
569 /*#ifdef DEBUG_XEMACS*/
|
16
|
570 static Lisp_Object last_file_loaded;
|
0
|
571 int pure_usage = 0;
|
249
|
572 /*#endif*/
|
0
|
573 #ifdef DOS_NT
|
|
574 int dosmode = O_TEXT;
|
|
575 #endif /* DOS_NT */
|
118
|
576 struct stat s1, s2;
|
0
|
577 GCPRO3 (file, newer, found);
|
|
578
|
|
579 CHECK_STRING (file);
|
|
580
|
249
|
581 /*#ifdef DEBUG_XEMACS*/
|
0
|
582 if (purify_flag && noninteractive)
|
16
|
583 {
|
|
584 message_p = 1;
|
|
585 last_file_loaded = file;
|
|
586 pure_usage = purespace_usage ();
|
|
587 }
|
249
|
588 /*#endif /* DEBUG_XEMACS */
|
0
|
589
|
|
590 /* If file name is magic, call the handler. */
|
|
591 handler = Ffind_file_name_handler (file, Qload);
|
|
592 if (!NILP (handler))
|
74
|
593 RETURN_UNGCPRO (call5 (handler, Qload, file, no_error,
|
82
|
594 nomessage, nosuffix));
|
0
|
595
|
|
596 /* Do this after the handler to avoid
|
|
597 the need to gcpro noerror, nomessage and nosuffix.
|
|
598 (Below here, we care only whether they are nil or not.) */
|
|
599 file = Fsubstitute_in_file_name (file);
|
|
600
|
70
|
601 #ifdef MULE
|
|
602 if (!NILP (used_codesys))
|
|
603 CHECK_SYMBOL (used_codesys);
|
|
604 #endif
|
16
|
605
|
0
|
606 /* Avoid weird lossage with null string as arg,
|
|
607 since it would try to load a directory as a Lisp file.
|
|
608 Unix truly sucks. */
|
16
|
609 if (XSTRING_LENGTH (file) > 0)
|
0
|
610 {
|
|
611 char *foundstr;
|
|
612 int foundlen;
|
|
613
|
173
|
614 fd = locate_file (Vload_path, file,
|
0
|
615 ((!NILP (nosuffix)) ? "" :
|
|
616 load_ignore_elc_files ? ".el:" :
|
|
617 ".elc:.el:"),
|
|
618 &found,
|
|
619 -1);
|
|
620
|
|
621 if (fd < 0)
|
|
622 {
|
|
623 if (NILP (no_error))
|
|
624 signal_file_error ("Cannot open load file", file);
|
|
625 else
|
|
626 {
|
|
627 UNGCPRO;
|
|
628 return Qnil;
|
|
629 }
|
|
630 }
|
|
631
|
16
|
632 foundstr = (char *) alloca (XSTRING_LENGTH (found) + 1);
|
|
633 strcpy (foundstr, (char *) XSTRING_DATA (found));
|
0
|
634 foundlen = strlen (foundstr);
|
|
635
|
|
636 /* The omniscient JWZ thinks this is worthless, but I beg to
|
|
637 differ. --ben */
|
|
638 if (load_ignore_elc_files)
|
|
639 {
|
|
640 newer = Ffile_name_nondirectory (found);
|
|
641 }
|
|
642 else if (load_warn_when_source_newer &&
|
|
643 !memcmp (".elc", foundstr + foundlen - 4, 4))
|
|
644 {
|
|
645 if (! fstat (fd, &s1)) /* can't fail, right? */
|
|
646 {
|
|
647 int result;
|
|
648 /* temporarily hack the 'c' off the end of the filename */
|
|
649 foundstr[foundlen - 1] = '\0';
|
|
650 result = stat (foundstr, &s2);
|
|
651 if (result >= 0 &&
|
|
652 (unsigned) s1.st_mtime < (unsigned) s2.st_mtime)
|
|
653 {
|
|
654 Lisp_Object newer_name = make_string ((Bufbyte *) foundstr,
|
|
655 foundlen - 1);
|
|
656 struct gcpro nngcpro1;
|
|
657 NNGCPRO1 (newer_name);
|
|
658 newer = Ffile_name_nondirectory (newer_name);
|
|
659 NNUNGCPRO;
|
|
660 }
|
|
661 /* put the 'c' back on (kludge-o-rama) */
|
|
662 foundstr[foundlen - 1] = 'c';
|
|
663 }
|
|
664 }
|
|
665 else if (load_warn_when_source_only &&
|
|
666 /* `found' ends in ".el" */
|
|
667 !memcmp (".el", foundstr + foundlen - 3, 3) &&
|
|
668 /* `file' does not end in ".el" */
|
|
669 memcmp (".el",
|
16
|
670 XSTRING_DATA (file) + XSTRING_LENGTH (file) - 3,
|
0
|
671 3))
|
|
672 {
|
|
673 source_only = 1;
|
|
674 }
|
16
|
675
|
|
676 if (!memcmp (".elc", foundstr + foundlen - 4, 4))
|
|
677 reading_elc = 1;
|
0
|
678
|
|
679 #ifdef DOS_NT
|
|
680 /* The file was opened as binary, because that's what we'll
|
|
681 encounter most of the time. If we're loading a .el, we need
|
|
682 to reopen it in text mode. */
|
118
|
683 if (!reading_elc)
|
239
|
684 {
|
|
685 /* #### I would simply call _setmode (fd, O_RDONLY | O_TEXT).
|
|
686 This is ok on NT but maybe breaks DOS. Is there
|
|
687 any "DOS" still alive? - kkm */
|
|
688 close (fd);
|
|
689 fd = open (foundstr, O_RDONLY | O_TEXT);
|
|
690 if (fd < 0)
|
|
691 {
|
|
692 if (NILP (no_error))
|
|
693 signal_file_error ("Cannot open load file", file);
|
|
694 else
|
|
695 {
|
|
696 UNGCPRO;
|
|
697 return Qnil;
|
|
698 }
|
|
699 }
|
|
700 }
|
16
|
701 #endif /* DOS_NT */
|
118
|
702 }
|
16
|
703
|
82
|
704 #define PRINT_LOADING_MESSAGE(done) do { \
|
|
705 if (load_ignore_elc_files) \
|
|
706 { \
|
|
707 if (message_p) \
|
|
708 message ("Loading %s..." done, XSTRING_DATA (newer)); \
|
|
709 } \
|
|
710 else if (!NILP (newer)) \
|
|
711 message ("Loading %s..." done " (file %s is newer)", \
|
|
712 XSTRING_DATA (file), \
|
|
713 XSTRING_DATA (newer)); \
|
|
714 else if (source_only) \
|
16
|
715 message ("Loading %s..." done " (file %s.elc does not exist)", \
|
82
|
716 XSTRING_DATA (file), \
|
|
717 XSTRING_DATA (Ffile_name_nondirectory (file))); \
|
|
718 else if (message_p) \
|
|
719 message ("Loading %s..." done, XSTRING_DATA (file)); \
|
16
|
720 } while (0)
|
|
721
|
|
722 PRINT_LOADING_MESSAGE ("");
|
0
|
723
|
|
724 {
|
|
725 /* Lisp_Object's must be malloc'ed, not stack-allocated */
|
|
726 Lisp_Object lispstream = Qnil;
|
|
727 CONST int block_size = 8192;
|
|
728 struct gcpro ngcpro1;
|
|
729
|
|
730 NGCPRO1 (lispstream);
|
|
731 lispstream = make_filedesc_input_stream (fd, 0, -1, LSTR_CLOSING);
|
|
732 /* 64K is used for normal files; 8K should be OK here because Lisp
|
|
733 files aren't really all that big. */
|
|
734 Lstream_set_buffering (XLSTREAM (lispstream), LSTREAM_BLOCKN_BUFFERED,
|
|
735 block_size);
|
70
|
736 #ifdef MULE
|
|
737 lispstream = make_decoding_input_stream
|
|
738 (XLSTREAM (lispstream), Fget_coding_system (codesys));
|
|
739 Lstream_set_buffering (XLSTREAM (lispstream), LSTREAM_BLOCKN_BUFFERED,
|
|
740 block_size);
|
|
741 #endif /* MULE */
|
0
|
742
|
|
743 /* NOTE: Order of these is very important. Don't rearrange them. */
|
|
744 record_unwind_protect (load_unwind, lispstream);
|
|
745 record_unwind_protect (load_descriptor_unwind, Vload_descriptor_list);
|
|
746 record_unwind_protect (load_file_name_internal_unwind,
|
|
747 Vload_file_name_internal);
|
|
748 record_unwind_protect (load_file_name_internal_the_purecopy_unwind,
|
|
749 Vload_file_name_internal_the_purecopy);
|
|
750 record_unwind_protect (load_force_doc_string_unwind,
|
|
751 Vload_force_doc_string_list);
|
|
752 Vload_file_name_internal = found;
|
|
753 Vload_file_name_internal_the_purecopy = Qnil;
|
|
754 specbind (Qload_file_name, found);
|
16
|
755 Vload_descriptor_list = Fcons (make_int (fd), Vload_descriptor_list);
|
0
|
756 Vload_force_doc_string_list = Qnil;
|
|
757 #ifdef I18N3
|
|
758 record_unwind_protect (restore_file_domain, Vfile_domain);
|
|
759 Vfile_domain = Qnil; /* set it to nil; a call to #'domain will set it. */
|
|
760 #endif
|
|
761 load_in_progress++;
|
70
|
762
|
|
763 /* Now determine what sort of ELC file we're reading in. */
|
|
764 record_unwind_protect (load_byte_code_version_unwind,
|
|
765 make_int (load_byte_code_version));
|
|
766 if (reading_elc)
|
|
767 {
|
|
768 char elc_header[8];
|
|
769 int num_read;
|
|
770
|
|
771 num_read = Lstream_read (XLSTREAM (lispstream), elc_header, 8);
|
|
772 if (num_read < 8
|
|
773 || strncmp (elc_header, ";ELC", 4))
|
|
774 {
|
|
775 /* Huh? Probably not a valid ELC file. */
|
|
776 load_byte_code_version = 100; /* no Ebolification needed */
|
|
777 Lstream_unread (XLSTREAM (lispstream), elc_header, num_read);
|
|
778 }
|
|
779 else
|
|
780 load_byte_code_version = elc_header[4];
|
|
781 }
|
|
782 else
|
|
783 load_byte_code_version = 100; /* no Ebolification needed */
|
173
|
784
|
0
|
785 readevalloop (lispstream, file, Feval, 0);
|
70
|
786 #ifdef MULE
|
|
787 if (!NILP (used_codesys))
|
|
788 Fset (used_codesys,
|
|
789 XCODING_SYSTEM_NAME
|
|
790 (decoding_stream_coding_system (XLSTREAM (lispstream))));
|
|
791 #endif /* MULE */
|
0
|
792 unbind_to (speccount, Qnil);
|
|
793
|
|
794 NUNGCPRO;
|
|
795 }
|
|
796
|
|
797 {
|
|
798 Lisp_Object tem;
|
|
799 /* #### Disgusting kludge */
|
|
800 /* Run any load-hooks for this file. */
|
229
|
801 /* #### An even more disgusting kludge. There is horrible code */
|
249
|
802 /* that is relying on the fact that dumped lisp files are found */
|
229
|
803 /* via `load-path' search. */
|
|
804 Lisp_Object name = file;
|
|
805
|
|
806 if (!NILP(Ffile_name_absolute_p(file)))
|
|
807 {
|
|
808 name = Ffile_name_nondirectory(file);
|
|
809 }
|
|
810
|
249
|
811 {
|
|
812 struct gcpro ngcpro1;
|
|
813
|
|
814 NGCPRO1 (name);
|
|
815 tem = Fassoc (name, Vafter_load_alist);
|
|
816 NUNGCPRO;
|
|
817 }
|
0
|
818 if (!NILP (tem))
|
|
819 {
|
|
820 struct gcpro ngcpro1;
|
|
821
|
|
822 NGCPRO1 (tem);
|
|
823 /* Use eval so that errors give a semi-meaningful backtrace. --Stig */
|
|
824 tem = Fcons (Qprogn, Fcdr (tem));
|
|
825 Feval (tem);
|
|
826 NUNGCPRO;
|
|
827 }
|
|
828 }
|
|
829
|
249
|
830 /*#ifdef DEBUG_XEMACS*/
|
16
|
831 if (purify_flag && noninteractive)
|
0
|
832 {
|
16
|
833 if (EQ (last_file_loaded, file))
|
|
834 message_append (" (%d)", purespace_usage() - pure_usage);
|
|
835 else
|
80
|
836 message ("Loading %s ...done (%d)", XSTRING_DATA (file),
|
16
|
837 purespace_usage() - pure_usage);
|
0
|
838 }
|
249
|
839 /*#endif /* DEBUG_XEMACS */
|
0
|
840
|
16
|
841 if (!noninteractive)
|
|
842 PRINT_LOADING_MESSAGE ("done");
|
173
|
843
|
0
|
844 UNGCPRO;
|
|
845 return Qt;
|
|
846 }
|
|
847
|
|
848
|
|
849 #if 0 /* FSFmacs */
|
|
850 /* not used */
|
|
851 static int
|
|
852 complete_filename_p (Lisp_Object pathname)
|
|
853 {
|
16
|
854 REGISTER unsigned char *s = XSTRING_DATA (pathname);
|
0
|
855 return (IS_DIRECTORY_SEP (s[0])
|
16
|
856 || (XSTRING_LENGTH (pathname) > 2
|
0
|
857 && IS_DEVICE_SEP (s[1]) && IS_DIRECTORY_SEP (s[2]))
|
|
858 #ifdef ALTOS
|
|
859 || *s == '@'
|
|
860 #endif
|
|
861 );
|
|
862 }
|
|
863 #endif /* 0 */
|
|
864
|
20
|
865 DEFUN ("locate-file", Flocate_file, 2, 4, 0, /*
|
0
|
866 Search for FILENAME through PATH-LIST, expanded by one of the optional
|
185
|
867 SUFFIXES (string of suffixes separated by ":"s), checking for access
|
0
|
868 MODE (0|1|2|4 = exists|executable|writeable|readable), default readable.
|
|
869
|
|
870 `locate-file' keeps hash tables of the directories it searches through,
|
|
871 in order to speed things up. It tries valiantly to not get confused in
|
|
872 the face of a changing and unpredictable environment, but can occasionally
|
|
873 get tripped up. In this case, you will have to call
|
|
874 `locate-file-clear-hashing' to get it back on track. See that function
|
|
875 for details.
|
20
|
876 */
|
|
877 (filename, path_list, suffixes, mode))
|
0
|
878 {
|
|
879 /* This function can GC */
|
|
880 Lisp_Object tp;
|
|
881
|
|
882 CHECK_STRING (filename);
|
|
883 if (!NILP (suffixes))
|
|
884 {
|
|
885 CHECK_STRING (suffixes);
|
|
886 }
|
|
887 if (!(NILP (mode) || (INTP (mode) && XINT (mode) >= 0)))
|
|
888 mode = wrong_type_argument (Qnatnump, mode);
|
173
|
889 locate_file (path_list, filename,
|
0
|
890 ((NILP (suffixes)) ? "" :
|
16
|
891 (char *) (XSTRING_DATA (suffixes))),
|
0
|
892 &tp, (NILP (mode) ? R_OK : XINT (mode)));
|
|
893 return tp;
|
|
894 }
|
|
895
|
|
896 /* recalculate the hash table for the given string */
|
|
897
|
|
898 static Lisp_Object
|
|
899 locate_file_refresh_hashing (Lisp_Object str)
|
|
900 {
|
|
901 Lisp_Object hash =
|
16
|
902 make_directory_hash_table ((char *) XSTRING_DATA (str));
|
0
|
903 Fput (str, Qlocate_file_hash_table, hash);
|
|
904 return hash;
|
|
905 }
|
|
906
|
|
907 /* find the hash table for the given string, recalculating if necessary */
|
|
908
|
|
909 static Lisp_Object
|
|
910 locate_file_find_directory_hash_table (Lisp_Object str)
|
|
911 {
|
|
912 Lisp_Object hash = Fget (str, Qlocate_file_hash_table, Qnil);
|
|
913 if (NILP (Fhashtablep (hash)))
|
|
914 return locate_file_refresh_hashing (str);
|
|
915 return hash;
|
|
916 }
|
|
917
|
|
918 /* look for STR in PATH, optionally adding suffixes in SUFFIX */
|
|
919
|
|
920 static int
|
|
921 locate_file_in_directory (Lisp_Object path, Lisp_Object str,
|
|
922 CONST char *suffix, Lisp_Object *storeptr,
|
|
923 int mode)
|
|
924 {
|
|
925 /* This function can GC */
|
|
926 int fd;
|
|
927 int fn_size = 100;
|
|
928 char buf[100];
|
|
929 char *fn = buf;
|
|
930 int want_size;
|
|
931 struct stat st;
|
|
932 Lisp_Object filename = Qnil;
|
|
933 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
934 CONST char *nsuffix;
|
|
935
|
|
936 GCPRO3 (path, str, filename);
|
|
937
|
|
938 filename = Fexpand_file_name (str, path);
|
|
939 if (NILP (filename) || NILP (Ffile_name_absolute_p (filename)))
|
|
940 /* If there are non-absolute elts in PATH (eg ".") */
|
|
941 /* Of course, this could conceivably lose if luser sets
|
|
942 default-directory to be something non-absolute ... */
|
|
943 {
|
|
944 if (NILP (filename))
|
|
945 /* NIL means current dirctory */
|
|
946 filename = current_buffer->directory;
|
|
947 else
|
|
948 filename = Fexpand_file_name (filename,
|
|
949 current_buffer->directory);
|
|
950 if (NILP (Ffile_name_absolute_p (filename)))
|
|
951 {
|
|
952 /* Give up on this path element! */
|
|
953 UNGCPRO;
|
|
954 return -1;
|
|
955 }
|
|
956 }
|
|
957 /* Calculate maximum size of any filename made from
|
|
958 this path element/specified file name and any possible suffix. */
|
16
|
959 want_size = strlen (suffix) + XSTRING_LENGTH (filename) + 1;
|
0
|
960 if (fn_size < want_size)
|
|
961 fn = (char *) alloca (fn_size = 100 + want_size);
|
173
|
962
|
0
|
963 nsuffix = suffix;
|
173
|
964
|
0
|
965 /* Loop over suffixes. */
|
|
966 while (1)
|
|
967 {
|
|
968 char *esuffix = (char *) strchr (nsuffix, ':');
|
|
969 int lsuffix = ((esuffix) ? (esuffix - nsuffix) : strlen (nsuffix));
|
173
|
970
|
0
|
971 /* Concatenate path element/specified name with the suffix. */
|
173
|
972 strncpy (fn, (char *) XSTRING_DATA (filename),
|
16
|
973 XSTRING_LENGTH (filename));
|
|
974 fn[XSTRING_LENGTH (filename)] = 0;
|
0
|
975 if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */
|
|
976 strncat (fn, nsuffix, lsuffix);
|
173
|
977
|
0
|
978 /* Ignore file if it's a directory. */
|
|
979 if (stat (fn, &st) >= 0
|
|
980 && (st.st_mode & S_IFMT) != S_IFDIR)
|
|
981 {
|
|
982 /* Check that we can access or open it. */
|
|
983 if (mode >= 0)
|
|
984 fd = access (fn, mode);
|
|
985 else
|
|
986 #ifdef DOS_NT
|
|
987 fd = open (fn, O_RDONLY | O_BINARY, 0);
|
|
988 #else
|
|
989 fd = open (fn, O_RDONLY, 0);
|
|
990 #endif
|
173
|
991
|
0
|
992 if (fd >= 0)
|
|
993 {
|
|
994 /* We succeeded; return this descriptor and filename. */
|
|
995 if (storeptr)
|
|
996 *storeptr = build_string (fn);
|
|
997 UNGCPRO;
|
173
|
998
|
118
|
999 /* XXX FIX ME
|
|
1000 Not sure about this on NT yet. Do nothing for now.
|
|
1001 --marcpa */
|
173
|
1002 #ifndef DOS_NT
|
0
|
1003 /* If we actually opened the file, set close-on-exec flag
|
|
1004 on the new descriptor so that subprocesses can't whack
|
|
1005 at it. */
|
|
1006 if (mode < 0)
|
|
1007 (void) fcntl (fd, F_SETFD, FD_CLOEXEC);
|
118
|
1008 #endif
|
173
|
1009
|
0
|
1010 return fd;
|
|
1011 }
|
|
1012 }
|
173
|
1013
|
0
|
1014 /* Advance to next suffix. */
|
|
1015 if (esuffix == 0)
|
|
1016 break;
|
|
1017 nsuffix += lsuffix + 1;
|
|
1018 }
|
173
|
1019
|
0
|
1020 UNGCPRO;
|
|
1021 return -1;
|
|
1022 }
|
|
1023
|
|
1024 /* do the same as locate_file() but don't use any hash tables. */
|
|
1025
|
|
1026 static int
|
|
1027 locate_file_without_hash (Lisp_Object path, Lisp_Object str,
|
|
1028 CONST char *suffix, Lisp_Object *storeptr,
|
|
1029 int mode)
|
|
1030 {
|
|
1031 /* This function can GC */
|
|
1032 int absolute;
|
|
1033 struct gcpro gcpro1;
|
|
1034
|
|
1035 /* is this necessary? */
|
|
1036 GCPRO1 (path);
|
|
1037
|
|
1038 absolute = !NILP (Ffile_name_absolute_p (str));
|
|
1039
|
|
1040 for (; !NILP (path); path = Fcdr (path))
|
|
1041 {
|
|
1042 int val = locate_file_in_directory (Fcar (path), str, suffix,
|
|
1043 storeptr, mode);
|
|
1044 if (val >= 0)
|
|
1045 {
|
|
1046 UNGCPRO;
|
|
1047 return val;
|
|
1048 }
|
|
1049 if (absolute)
|
|
1050 break;
|
|
1051 }
|
173
|
1052
|
0
|
1053 UNGCPRO;
|
|
1054 return -1;
|
|
1055 }
|
|
1056
|
|
1057 /* Construct a list of all files to search for. */
|
|
1058
|
|
1059 static Lisp_Object
|
|
1060 locate_file_construct_suffixed_files (Lisp_Object str, CONST char *suffix)
|
|
1061 {
|
|
1062 int want_size;
|
|
1063 int fn_size = 100;
|
|
1064 char buf[100];
|
|
1065 char *fn = buf;
|
|
1066 CONST char *nsuffix;
|
|
1067 Lisp_Object suffixtab = Qnil;
|
173
|
1068
|
0
|
1069 /* Calculate maximum size of any filename made from
|
|
1070 this path element/specified file name and any possible suffix. */
|
16
|
1071 want_size = strlen (suffix) + XSTRING_LENGTH (str) + 1;
|
0
|
1072 if (fn_size < want_size)
|
|
1073 fn = (char *) alloca (fn_size = 100 + want_size);
|
173
|
1074
|
0
|
1075 nsuffix = suffix;
|
173
|
1076
|
0
|
1077 while (1)
|
|
1078 {
|
|
1079 char *esuffix = (char *) strchr (nsuffix, ':');
|
|
1080 int lsuffix = ((esuffix) ? (esuffix - nsuffix) : strlen (nsuffix));
|
173
|
1081
|
0
|
1082 /* Concatenate path element/specified name with the suffix. */
|
16
|
1083 strncpy (fn, (char *) XSTRING_DATA (str), XSTRING_LENGTH (str));
|
|
1084 fn[XSTRING_LENGTH (str)] = 0;
|
0
|
1085 if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */
|
|
1086 strncat (fn, nsuffix, lsuffix);
|
173
|
1087
|
0
|
1088 suffixtab = Fcons (build_string (fn), suffixtab);
|
|
1089 /* Advance to next suffix. */
|
|
1090 if (esuffix == 0)
|
|
1091 break;
|
|
1092 nsuffix += lsuffix + 1;
|
|
1093 }
|
|
1094 return Fnreverse (suffixtab);
|
|
1095 }
|
|
1096
|
|
1097 /* Search for a file whose name is STR, looking in directories
|
|
1098 in the Lisp list PATH, and trying suffixes from SUFFIX.
|
|
1099 SUFFIX is a string containing possible suffixes separated by colons.
|
|
1100 On success, returns a file descriptor. On failure, returns -1.
|
|
1101
|
|
1102 MODE nonnegative means don't open the files,
|
|
1103 just look for one for which access(file,MODE) succeeds. In this case,
|
|
1104 returns 1 on success.
|
|
1105
|
|
1106 If STOREPTR is nonzero, it points to a slot where the name of
|
|
1107 the file actually found should be stored as a Lisp string.
|
|
1108 Nil is stored there on failure.
|
|
1109
|
|
1110 Called openp() in FSFmacs. */
|
|
1111
|
|
1112 int
|
|
1113 locate_file (Lisp_Object path, Lisp_Object str, CONST char *suffix,
|
|
1114 Lisp_Object *storeptr, int mode)
|
|
1115 {
|
|
1116 /* This function can GC */
|
|
1117 Lisp_Object suffixtab = Qnil;
|
|
1118 Lisp_Object pathtail;
|
|
1119 int val;
|
|
1120 struct gcpro gcpro1, gcpro2, gcpro3;
|
|
1121
|
|
1122 if (storeptr)
|
|
1123 *storeptr = Qnil;
|
|
1124
|
|
1125 /* if this filename has directory components, it's too complicated
|
|
1126 to try and use the hash tables. */
|
|
1127 if (!NILP (Ffile_name_directory (str)))
|
|
1128 return locate_file_without_hash (path, str, suffix, storeptr,
|
|
1129 mode);
|
|
1130
|
|
1131 /* Is it really necessary to gcpro path and str? It shouldn't be
|
|
1132 unless some caller has fucked up. */
|
|
1133 GCPRO3 (path, str, suffixtab);
|
|
1134
|
|
1135 suffixtab = locate_file_construct_suffixed_files (str, suffix);
|
|
1136
|
|
1137 for (pathtail = path; !NILP (pathtail); pathtail = Fcdr (pathtail))
|
|
1138 {
|
|
1139 Lisp_Object pathel = Fcar (pathtail);
|
|
1140 Lisp_Object hashtab;
|
|
1141 Lisp_Object tail;
|
|
1142 int found;
|
|
1143
|
|
1144 /* If this path element is relative, we have to look by hand.
|
|
1145 Can't set string property in a pure string. */
|
|
1146 if (NILP (pathel) || NILP (Ffile_name_absolute_p (pathel)) ||
|
|
1147 purified (pathel))
|
|
1148 {
|
|
1149 val = locate_file_in_directory (pathel, str, suffix, storeptr,
|
|
1150 mode);
|
|
1151 if (val >= 0)
|
|
1152 {
|
|
1153 UNGCPRO;
|
|
1154 return val;
|
|
1155 }
|
|
1156 continue;
|
|
1157 }
|
|
1158
|
|
1159 hashtab = locate_file_find_directory_hash_table (pathel);
|
|
1160
|
|
1161 /* Loop over suffixes. */
|
195
|
1162 for (tail = suffixtab, found = 0; !found && CONSP (tail);
|
|
1163 tail = XCDR (tail))
|
0
|
1164 {
|
195
|
1165 if (!NILP (Fgethash (XCAR (tail), hashtab, Qnil)))
|
0
|
1166 found = 1;
|
|
1167 }
|
|
1168
|
|
1169 if (found)
|
|
1170 {
|
|
1171 /* This is a likely candidate. Look by hand in this directory
|
|
1172 so we don't get thrown off if someone byte-compiles a file. */
|
|
1173 val = locate_file_in_directory (pathel, str, suffix, storeptr,
|
|
1174 mode);
|
|
1175 if (val >= 0)
|
|
1176 {
|
|
1177 UNGCPRO;
|
|
1178 return val;
|
|
1179 }
|
|
1180
|
|
1181 /* Hmm ... the file isn't actually there. (Or possibly it's
|
|
1182 a directory ...) So refresh our hashing. */
|
|
1183 locate_file_refresh_hashing (pathel);
|
|
1184 }
|
|
1185 }
|
|
1186
|
|
1187 /* File is probably not there, but check the hard way just in case. */
|
|
1188 val = locate_file_without_hash (path, str, suffix, storeptr,
|
|
1189 mode);
|
|
1190 if (val >= 0)
|
|
1191 {
|
|
1192 /* Sneaky user added a file without telling us. */
|
|
1193 Flocate_file_clear_hashing (path);
|
|
1194 }
|
|
1195
|
|
1196 UNGCPRO;
|
|
1197 return val;
|
|
1198 }
|
|
1199
|
20
|
1200 DEFUN ("locate-file-clear-hashing", Flocate_file_clear_hashing, 1, 1, 0, /*
|
0
|
1201 Clear the hash records for the specified list of directories.
|
|
1202 `locate-file' uses a hashing scheme to speed lookup, and will correctly
|
|
1203 track the following environmental changes:
|
|
1204
|
|
1205 -- changes of any sort to the list of directories to be searched.
|
|
1206 -- addition and deletion of non-shadowing files (see below) from the
|
|
1207 directories in the list.
|
|
1208 -- byte-compilation of a .el file into a .elc file.
|
|
1209
|
|
1210 `locate-file' will primarily get confused if you add a file that shadows
|
181
|
1211 \(i.e. has the same name as) another file further down in the directory list.
|
0
|
1212 In this case, you must call `locate-file-clear-hashing'.
|
20
|
1213 */
|
181
|
1214 (path))
|
0
|
1215 {
|
|
1216 Lisp_Object pathtail;
|
|
1217
|
|
1218 for (pathtail = path; !NILP (pathtail); pathtail = Fcdr (pathtail))
|
|
1219 {
|
|
1220 Lisp_Object pathel = Fcar (pathtail);
|
|
1221 if (!purified (pathel))
|
|
1222 Fput (pathel, Qlocate_file_hash_table, Qnil);
|
|
1223 }
|
|
1224 return Qnil;
|
|
1225 }
|
|
1226
|
|
1227 #ifdef LOADHIST
|
|
1228
|
|
1229 /* Merge the list we've accumulated of globals from the current input source
|
|
1230 into the load_history variable. The details depend on whether
|
|
1231 the source has an associated file name or not. */
|
|
1232
|
|
1233 static void
|
|
1234 build_load_history (int loading, Lisp_Object source)
|
|
1235 {
|
|
1236 REGISTER Lisp_Object tail, prev, newelt;
|
|
1237 REGISTER Lisp_Object tem, tem2;
|
|
1238 int foundit;
|
|
1239
|
233
|
1240 #if !defined(LOADHIST_DUMPED)
|
0
|
1241 /* Don't bother recording anything for preloaded files. */
|
|
1242 if (purify_flag)
|
|
1243 return;
|
233
|
1244 #endif
|
0
|
1245
|
|
1246 tail = Vload_history;
|
|
1247 prev = Qnil;
|
|
1248 foundit = 0;
|
|
1249 while (!NILP (tail))
|
|
1250 {
|
|
1251 tem = Fcar (tail);
|
|
1252
|
|
1253 /* Find the feature's previous assoc list... */
|
195
|
1254 if (internal_equal (source, Fcar (tem), 0))
|
0
|
1255 {
|
|
1256 foundit = 1;
|
|
1257
|
|
1258 /* If we're loading, remove it. */
|
|
1259 if (loading)
|
173
|
1260 {
|
0
|
1261 if (NILP (prev))
|
|
1262 Vload_history = Fcdr (tail);
|
|
1263 else
|
|
1264 Fsetcdr (prev, Fcdr (tail));
|
|
1265 }
|
|
1266
|
|
1267 /* Otherwise, cons on new symbols that are not already members. */
|
|
1268 else
|
|
1269 {
|
|
1270 tem2 = Vcurrent_load_list;
|
|
1271
|
|
1272 while (CONSP (tem2))
|
|
1273 {
|
195
|
1274 newelt = XCAR (tem2);
|
0
|
1275
|
|
1276 if (NILP (Fmemq (newelt, tem)))
|
|
1277 Fsetcar (tail, Fcons (Fcar (tem),
|
|
1278 Fcons (newelt, Fcdr (tem))));
|
|
1279
|
195
|
1280 tem2 = XCDR (tem2);
|
0
|
1281 QUIT;
|
|
1282 }
|
|
1283 }
|
|
1284 }
|
|
1285 else
|
|
1286 prev = tail;
|
|
1287 tail = Fcdr (tail);
|
|
1288 QUIT;
|
|
1289 }
|
|
1290
|
|
1291 /* If we're loading, cons the new assoc onto the front of load-history,
|
|
1292 the most-recently-loaded position. Also do this if we didn't find
|
|
1293 an existing member for the current source. */
|
|
1294 if (loading || !foundit)
|
|
1295 Vload_history = Fcons (Fnreverse (Vcurrent_load_list),
|
|
1296 Vload_history);
|
|
1297 }
|
|
1298
|
|
1299 #else /* !LOADHIST */
|
|
1300 #define build_load_history(x,y)
|
|
1301 #endif /* !LOADHIST */
|
|
1302
|
|
1303
|
|
1304 #if 0 /* FSFmacs defun hack */
|
|
1305 Lisp_Object
|
|
1306 unreadpure (void) /* Used as unwind-protect function in readevalloop */
|
|
1307 {
|
|
1308 read_pure = 0;
|
|
1309 return Qnil;
|
|
1310 }
|
|
1311 #endif /* 0 */
|
|
1312
|
|
1313 static void
|
173
|
1314 readevalloop (Lisp_Object readcharfun,
|
0
|
1315 Lisp_Object sourcename,
|
|
1316 Lisp_Object (*evalfun) (Lisp_Object),
|
|
1317 int printflag)
|
|
1318 {
|
|
1319 /* This function can GC */
|
|
1320 REGISTER Emchar c;
|
|
1321 REGISTER Lisp_Object val;
|
|
1322 int speccount = specpdl_depth ();
|
|
1323 struct gcpro gcpro1;
|
|
1324 struct buffer *b = 0;
|
|
1325
|
|
1326 if (BUFFERP (readcharfun))
|
|
1327 b = XBUFFER (readcharfun);
|
|
1328 else if (MARKERP (readcharfun))
|
|
1329 b = XMARKER (readcharfun)->buffer;
|
|
1330
|
|
1331 specbind (Qstandard_input, readcharfun);
|
|
1332 specbind (Qcurrent_load_list, Qnil);
|
|
1333
|
|
1334 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
|
|
1335 Vcurrent_compiled_function_annotation = Qnil;
|
|
1336 #endif
|
|
1337 GCPRO1 (sourcename);
|
|
1338
|
|
1339 LOADHIST_ATTACH (sourcename);
|
|
1340
|
|
1341 while (1)
|
|
1342 {
|
|
1343 QUIT;
|
|
1344
|
|
1345 if (b != 0 && !BUFFER_LIVE_P (b))
|
|
1346 error ("Reading from killed buffer");
|
|
1347
|
|
1348 c = readchar (readcharfun);
|
|
1349 if (c == ';')
|
|
1350 {
|
|
1351 /* Skip comment */
|
|
1352 while ((c = readchar (readcharfun)) != '\n' && c != -1)
|
|
1353 QUIT;
|
|
1354 continue;
|
|
1355 }
|
|
1356 if (c < 0)
|
|
1357 break;
|
|
1358
|
|
1359 /* Ignore whitespace here, so we can detect eof. */
|
|
1360 if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r')
|
|
1361 continue;
|
|
1362
|
|
1363 #if 0 /* FSFmacs defun hack */
|
|
1364 if (purify_flag && c == '(')
|
|
1365 {
|
|
1366 int count1 = specpdl_depth ();
|
|
1367 record_unwind_protect (unreadpure, Qnil);
|
|
1368 val = read_list (readcharfun, ')', -1, 1);
|
|
1369 unbind_to (count1, Qnil);
|
|
1370 }
|
|
1371 else
|
|
1372 #else /* No "defun hack" -- Emacs 19 uses read-time syntax for bytecodes */
|
|
1373 {
|
|
1374 unreadchar (readcharfun, c);
|
245
|
1375 read_objects = Qnil;
|
0
|
1376 if (NILP (Vload_read_function))
|
|
1377 val = read0 (readcharfun);
|
|
1378 else
|
|
1379 val = call1 (Vload_read_function, readcharfun);
|
|
1380 }
|
|
1381 #endif
|
|
1382 val = (*evalfun) (val);
|
|
1383 if (printflag)
|
|
1384 {
|
|
1385 Vvalues = Fcons (val, Vvalues);
|
|
1386 if (EQ (Vstandard_output, Qt))
|
|
1387 Fprin1 (val, Qnil);
|
|
1388 else
|
|
1389 Fprint (val, Qnil);
|
|
1390 }
|
|
1391 }
|
|
1392
|
|
1393 build_load_history (LSTREAMP (readcharfun) ||
|
|
1394 /* This looks weird, but it's what's in FSFmacs */
|
|
1395 (b ? BUF_NARROWED (b) : BUF_NARROWED (current_buffer)),
|
|
1396 sourcename);
|
|
1397 UNGCPRO;
|
|
1398
|
|
1399 unbind_to (speccount, Qnil);
|
|
1400 }
|
|
1401
|
|
1402 #ifndef standalone
|
|
1403
|
20
|
1404 DEFUN ("eval-buffer", Feval_buffer, 0, 2, "bBuffer: ", /*
|
0
|
1405 Execute BUFFER as Lisp code.
|
|
1406 Programs can pass two arguments, BUFFER and PRINTFLAG.
|
|
1407 BUFFER is the buffer to evaluate (nil means use current buffer).
|
|
1408 PRINTFLAG controls printing of output:
|
|
1409 nil means discard it; anything else is stream for print.
|
|
1410
|
|
1411 If there is no error, point does not move. If there is an error,
|
|
1412 point remains at the end of the last character read from the buffer.
|
|
1413 Execute BUFFER as Lisp code.
|
20
|
1414 */
|
|
1415 (bufname, printflag))
|
0
|
1416 {
|
|
1417 /* This function can GC */
|
|
1418 int speccount = specpdl_depth ();
|
|
1419 Lisp_Object tem, buf;
|
|
1420
|
|
1421 if (NILP (bufname))
|
|
1422 buf = Fcurrent_buffer ();
|
|
1423 else
|
|
1424 buf = Fget_buffer (bufname);
|
|
1425 if (NILP (buf))
|
|
1426 error ("No such buffer.");
|
|
1427
|
|
1428 if (NILP (printflag))
|
|
1429 tem = Qsymbolp; /* #### #@[]*&$#*[& SI:NULL-STREAM */
|
|
1430 else
|
|
1431 tem = printflag;
|
|
1432 specbind (Qstandard_output, tem);
|
|
1433 record_unwind_protect (save_excursion_restore, save_excursion_save ());
|
|
1434 BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
|
|
1435 readevalloop (buf, XBUFFER (buf)->filename, Feval,
|
|
1436 !NILP (printflag));
|
|
1437
|
|
1438 return unbind_to (speccount, Qnil);
|
|
1439 }
|
|
1440
|
|
1441 #if 0
|
149
|
1442 xxDEFUN ("eval-current-buffer", Feval_current_buffer, 0, 1, "", /*
|
0
|
1443 Execute the current buffer as Lisp code.
|
|
1444 Programs can pass argument PRINTFLAG which controls printing of output:
|
|
1445 nil means discard it; anything else is stream for print.
|
|
1446
|
|
1447 If there is no error, point does not move. If there is an error,
|
|
1448 point remains at the end of the last character read from the buffer.
|
149
|
1449 */
|
|
1450 (printflag))
|
0
|
1451 {
|
|
1452 code omitted;
|
|
1453 }
|
149
|
1454 #endif /* 0 */
|
0
|
1455
|
20
|
1456 DEFUN ("eval-region", Feval_region, 2, 3, "r", /*
|
0
|
1457 Execute the region as Lisp code.
|
|
1458 When called from programs, expects two arguments,
|
|
1459 giving starting and ending indices in the current buffer
|
|
1460 of the text to be executed.
|
|
1461 Programs can pass third argument PRINTFLAG which controls output:
|
|
1462 nil means discard it; anything else is stream for printing it.
|
|
1463
|
|
1464 If there is no error, point does not move. If there is an error,
|
|
1465 point remains at the end of the last character read from the buffer.
|
|
1466
|
|
1467 Note: Before evaling the region, this function narrows the buffer to it.
|
|
1468 If the code being eval'd should happen to trigger a redisplay you may
|
|
1469 see some text temporarily disappear because of this.
|
20
|
1470 */
|
|
1471 (b, e, printflag))
|
0
|
1472 {
|
|
1473 /* This function can GC */
|
|
1474 int speccount = specpdl_depth ();
|
|
1475 Lisp_Object tem;
|
|
1476 Lisp_Object cbuf = Fcurrent_buffer ();
|
|
1477
|
|
1478 if (NILP (printflag))
|
|
1479 tem = Qsymbolp; /* #### #@[]*&$#*[& SI:NULL-STREAM */
|
|
1480 else
|
|
1481 tem = printflag;
|
|
1482 specbind (Qstandard_output, tem);
|
|
1483
|
|
1484 if (NILP (printflag))
|
|
1485 record_unwind_protect (save_excursion_restore, save_excursion_save ());
|
|
1486 record_unwind_protect (save_restriction_restore, save_restriction_save ());
|
|
1487
|
|
1488 /* This both uses b and checks its type. */
|
|
1489 Fgoto_char (b, cbuf);
|
|
1490 Fnarrow_to_region (make_int (BUF_BEGV (current_buffer)), e, cbuf);
|
|
1491 readevalloop (cbuf, XBUFFER (cbuf)->filename, Feval,
|
|
1492 !NILP (printflag));
|
|
1493
|
|
1494 return unbind_to (speccount, Qnil);
|
|
1495 }
|
|
1496
|
|
1497 #endif /* standalone */
|
|
1498
|
20
|
1499 DEFUN ("read", Fread, 0, 1, 0, /*
|
0
|
1500 Read one Lisp expression as text from STREAM, return as Lisp object.
|
|
1501 If STREAM is nil, use the value of `standard-input' (which see).
|
|
1502 STREAM or the value of `standard-input' may be:
|
|
1503 a buffer (read from point and advance it)
|
|
1504 a marker (read from where it points and advance it)
|
|
1505 a function (call it with no arguments for each character,
|
|
1506 call it with a char as argument to push a char back)
|
|
1507 a string (takes text from string, starting at the beginning)
|
|
1508 t (read text line using minibuffer and use it).
|
20
|
1509 */
|
|
1510 (stream))
|
0
|
1511 {
|
|
1512 if (NILP (stream))
|
|
1513 stream = Vstandard_input;
|
|
1514 if (EQ (stream, Qt))
|
|
1515 stream = Qread_char;
|
|
1516
|
245
|
1517 read_objects = Qnil;
|
|
1518
|
0
|
1519 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
|
|
1520 Vcurrent_compiled_function_annotation = Qnil;
|
|
1521 #endif
|
|
1522 #ifndef standalone
|
|
1523 if (EQ (stream, Qread_char))
|
|
1524 {
|
173
|
1525 Lisp_Object val = call1 (Qread_from_minibuffer,
|
0
|
1526 build_translated_string ("Lisp expression: "));
|
173
|
1527 return Fcar (Fread_from_string (val, Qnil, Qnil));
|
0
|
1528 }
|
|
1529 #endif
|
|
1530
|
|
1531 if (STRINGP (stream))
|
|
1532 return Fcar (Fread_from_string (stream, Qnil, Qnil));
|
|
1533
|
|
1534 return read0 (stream);
|
|
1535 }
|
|
1536
|
20
|
1537 DEFUN ("read-from-string", Fread_from_string, 1, 3, 0, /*
|
0
|
1538 Read one Lisp expression which is represented as text by STRING.
|
|
1539 Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX).
|
|
1540 START and END optionally delimit a substring of STRING from which to read;
|
|
1541 they default to 0 and (length STRING) respectively.
|
20
|
1542 */
|
|
1543 (string, start, end))
|
0
|
1544 {
|
|
1545 Bytecount startval, endval;
|
|
1546 Lisp_Object tem;
|
|
1547 Lisp_Object lispstream = Qnil;
|
|
1548 struct gcpro gcpro1;
|
|
1549
|
|
1550 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
|
|
1551 Vcurrent_compiled_function_annotation = Qnil;
|
|
1552 #endif
|
|
1553 GCPRO1 (lispstream);
|
|
1554 CHECK_STRING (string);
|
|
1555 get_string_range_byte (string, start, end, &startval, &endval,
|
|
1556 GB_HISTORICAL_STRING_BEHAVIOR);
|
|
1557 lispstream = make_lisp_string_input_stream (string, startval,
|
|
1558 endval - startval);
|
|
1559
|
245
|
1560 read_objects = Qnil;
|
|
1561
|
0
|
1562 tem = read0 (lispstream);
|
|
1563 /* Yeah, it's ugly. Gonna make something of it?
|
|
1564 At least our reader is reentrant ... */
|
|
1565 tem =
|
|
1566 (Fcons (tem, make_int
|
|
1567 (bytecount_to_charcount
|
16
|
1568 (XSTRING_DATA (string),
|
0
|
1569 startval + Lstream_byte_count (XLSTREAM (lispstream))))));
|
|
1570 Lstream_delete (XLSTREAM (lispstream));
|
|
1571 UNGCPRO;
|
|
1572 return tem;
|
|
1573 }
|
|
1574
|
|
1575
|
|
1576 #ifdef LISP_BACKQUOTES
|
|
1577
|
|
1578 static Lisp_Object
|
|
1579 backquote_unwind (Lisp_Object ptr)
|
|
1580 { /* used as unwind-protect function in read0() */
|
|
1581 int *counter = (int *) get_opaque_ptr (ptr);
|
|
1582 if (--*counter < 0)
|
173
|
1583 *counter = 0;
|
0
|
1584 free_opaque_ptr (ptr);
|
|
1585 return Qnil;
|
|
1586 }
|
|
1587
|
173
|
1588 #endif
|
0
|
1589
|
|
1590 /* Use this for recursive reads, in contexts where internal tokens
|
|
1591 are not allowed. See also read1(). */
|
|
1592 static Lisp_Object
|
|
1593 read0 (Lisp_Object readcharfun)
|
|
1594 {
|
|
1595 Lisp_Object val;
|
|
1596
|
|
1597 val = read1 (readcharfun);
|
|
1598 if (CONSP (val) && UNBOUNDP (XCAR (val)))
|
|
1599 {
|
|
1600 Emchar c = XCHAR (XCDR (val));
|
|
1601 free_cons (XCONS (val));
|
|
1602 return Fsignal (Qinvalid_read_syntax,
|
|
1603 list1 (Fchar_to_string (make_char (c))));
|
|
1604 }
|
|
1605
|
|
1606 return val;
|
|
1607 }
|
|
1608
|
|
1609 static Emchar
|
|
1610 read_escape (Lisp_Object readcharfun)
|
|
1611 {
|
|
1612 /* This function can GC */
|
|
1613 Emchar c = readchar (readcharfun);
|
|
1614 switch (c)
|
|
1615 {
|
|
1616 case 'a': return '\007';
|
|
1617 case 'b': return '\b';
|
|
1618 case 'd': return 0177;
|
|
1619 case 'e': return 033;
|
|
1620 case 'f': return '\f';
|
|
1621 case 'n': return '\n';
|
|
1622 case 'r': return '\r';
|
|
1623 case 't': return '\t';
|
|
1624 case 'v': return '\v';
|
|
1625 case '\n': return -1;
|
|
1626
|
|
1627 case 'M':
|
|
1628 c = readchar (readcharfun);
|
|
1629 if (c != '-')
|
|
1630 error ("Invalid escape character syntax");
|
|
1631 c = readchar (readcharfun);
|
|
1632 if (c == '\\')
|
|
1633 c = read_escape (readcharfun);
|
|
1634 return c | 0200;
|
|
1635
|
|
1636 #define FSF_KEYS
|
|
1637 #ifdef FSF_KEYS
|
|
1638
|
|
1639 #define alt_modifier (0x040000)
|
|
1640 #define super_modifier (0x080000)
|
|
1641 #define hyper_modifier (0x100000)
|
|
1642 #define shift_modifier (0x200000)
|
|
1643 /* fsf uses a different modifiers for meta and control. Possibly
|
173
|
1644 byte_compiled code will still work fsfmacs, though... --Stig
|
0
|
1645
|
|
1646 #define ctl_modifier (0x400000)
|
173
|
1647 #define meta_modifier (0x800000)
|
0
|
1648 */
|
|
1649 #define FSF_LOSSAGE(mask) \
|
|
1650 if (puke_on_fsf_keys || ((c = readchar (readcharfun)) != '-')) \
|
|
1651 error ("Invalid escape character syntax"); \
|
|
1652 if ((c = readchar (readcharfun)) == '\\') \
|
|
1653 c = read_escape (readcharfun); \
|
|
1654 return c | mask
|
|
1655
|
|
1656 case 'S': FSF_LOSSAGE (shift_modifier);
|
|
1657 case 'H': FSF_LOSSAGE (hyper_modifier);
|
|
1658 case 'A': FSF_LOSSAGE (alt_modifier);
|
|
1659 case 's': FSF_LOSSAGE (super_modifier);
|
|
1660 #undef alt_modifier
|
|
1661 #undef super_modifier
|
|
1662 #undef hyper_modifier
|
|
1663 #undef shift_modifier
|
|
1664 #undef FSF_LOSSAGE
|
|
1665
|
|
1666 #endif /* FSF_KEYS */
|
|
1667
|
|
1668 case 'C':
|
|
1669 c = readchar (readcharfun);
|
|
1670 if (c != '-')
|
|
1671 error ("Invalid escape character syntax");
|
|
1672 case '^':
|
|
1673 c = readchar (readcharfun);
|
|
1674 if (c == '\\')
|
|
1675 c = read_escape (readcharfun);
|
|
1676 /* FSFmacs junk for non-ASCII controls.
|
|
1677 Not used here. */
|
|
1678 if (c == '?')
|
|
1679 return 0177;
|
|
1680 else
|
173
|
1681 return c & (0200 | 037);
|
|
1682
|
0
|
1683 case '0':
|
|
1684 case '1':
|
|
1685 case '2':
|
|
1686 case '3':
|
|
1687 case '4':
|
|
1688 case '5':
|
|
1689 case '6':
|
|
1690 case '7':
|
|
1691 /* An octal escape, as in ANSI C. */
|
|
1692 {
|
|
1693 REGISTER Emchar i = c - '0';
|
|
1694 REGISTER int count = 0;
|
|
1695 while (++count < 3)
|
|
1696 {
|
|
1697 if ((c = readchar (readcharfun)) >= '0' && c <= '7')
|
|
1698 i = (i << 3) + (c - '0');
|
|
1699 else
|
|
1700 {
|
|
1701 unreadchar (readcharfun, c);
|
|
1702 break;
|
|
1703 }
|
|
1704 }
|
|
1705 return i;
|
|
1706 }
|
|
1707
|
|
1708 case 'x':
|
|
1709 /* A hex escape, as in ANSI C. */
|
|
1710 {
|
|
1711 REGISTER Emchar i = 0;
|
|
1712 while (1)
|
|
1713 {
|
|
1714 c = readchar (readcharfun);
|
|
1715 /* Remember, can't use isdigit(), isalpha() etc. on Emchars */
|
|
1716 if (c >= '0' && c <= '9') i = (i << 4) + (c - '0');
|
|
1717 else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10;
|
|
1718 else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10;
|
|
1719 else
|
|
1720 {
|
|
1721 unreadchar (readcharfun, c);
|
|
1722 break;
|
|
1723 }
|
|
1724 }
|
|
1725 return i;
|
|
1726 }
|
|
1727
|
70
|
1728 #ifdef MULE
|
|
1729 /* #### need some way of reading an extended character with
|
|
1730 an escape sequence. */
|
|
1731 #endif
|
16
|
1732
|
0
|
1733 default:
|
|
1734 return c;
|
|
1735 }
|
|
1736 }
|
|
1737
|
|
1738
|
|
1739
|
|
1740 /* read symbol-constituent stuff into `Vread_buffer_stream'. */
|
|
1741 static Bytecount
|
|
1742 read_atom_0 (Lisp_Object readcharfun, Emchar firstchar, int *saw_a_backslash)
|
|
1743 {
|
|
1744 /* This function can GC */
|
|
1745 Emchar c = ((firstchar) >= 0 ? firstchar : readchar (readcharfun));
|
|
1746 Lstream_rewind (XLSTREAM (Vread_buffer_stream));
|
|
1747
|
|
1748 *saw_a_backslash = 0;
|
|
1749
|
|
1750 while (c > 040 /* #### - comma should be here as should backquote */
|
|
1751 && !(c == '\"' || c == '\'' || c == ';'
|
|
1752 || c == '(' || c == ')'
|
|
1753 #ifndef LISP_FLOAT_TYPE
|
|
1754 /* If we have floating-point support, then we need
|
|
1755 to allow <digits><dot><digits>. */
|
|
1756 || c =='.'
|
|
1757 #endif /* not LISP_FLOAT_TYPE */
|
|
1758 || c == '[' || c == ']' || c == '#'
|
|
1759 ))
|
|
1760 {
|
|
1761 if (c == '\\')
|
|
1762 {
|
|
1763 c = readchar (readcharfun);
|
|
1764 *saw_a_backslash = 1;
|
|
1765 }
|
|
1766 Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), c);
|
|
1767 QUIT;
|
|
1768 c = readchar (readcharfun);
|
|
1769 }
|
|
1770
|
|
1771 if (c >= 0)
|
|
1772 unreadchar (readcharfun, c);
|
|
1773 /* blasted terminating 0 */
|
|
1774 Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), 0);
|
|
1775 Lstream_flush (XLSTREAM (Vread_buffer_stream));
|
|
1776
|
173
|
1777 return Lstream_byte_count (XLSTREAM (Vread_buffer_stream)) - 1;
|
0
|
1778 }
|
|
1779
|
|
1780 static Lisp_Object parse_integer (CONST Bufbyte *buf, Bytecount len, int base);
|
|
1781
|
|
1782 static Lisp_Object
|
|
1783 read_atom (Lisp_Object readcharfun,
|
|
1784 Emchar firstchar,
|
|
1785 int uninterned_symbol)
|
|
1786 {
|
|
1787 /* This function can GC */
|
|
1788 int saw_a_backslash;
|
|
1789 Bytecount len = read_atom_0 (readcharfun, firstchar, &saw_a_backslash);
|
|
1790 char *read_ptr = (char *)
|
|
1791 resizing_buffer_stream_ptr (XLSTREAM (Vread_buffer_stream));
|
|
1792
|
|
1793 /* Is it an integer? */
|
|
1794 if (! (saw_a_backslash || uninterned_symbol))
|
|
1795 {
|
|
1796 /* If a token had any backslashes in it, it is disqualified from
|
|
1797 being an integer or a float. This means that 123\456 is a
|
|
1798 symbol, as is \123 (which is the way (intern "123") prints).
|
110
|
1799 Also, if token was preceded by #:, it's always a symbol.
|
0
|
1800 */
|
|
1801 char *p = read_ptr + len;
|
|
1802 char *p1 = read_ptr;
|
|
1803
|
|
1804 if (*p1 == '+' || *p1 == '-') p1++;
|
|
1805 if (p1 != p)
|
|
1806 {
|
|
1807 int c;
|
|
1808
|
|
1809 while (p1 != p && (c = *p1) >= '0' && c <= '9')
|
|
1810 p1++;
|
|
1811 #ifdef LISP_FLOAT_TYPE
|
|
1812 /* Integers can have trailing decimal points. */
|
|
1813 if (p1 > read_ptr && p1 < p && *p1 == '.')
|
|
1814 p1++;
|
|
1815 #endif
|
|
1816 if (p1 == p)
|
|
1817 {
|
|
1818 /* It is an integer. */
|
|
1819 #ifdef LISP_FLOAT_TYPE
|
|
1820 if (p1[-1] == '.')
|
|
1821 p1[-1] = '\0';
|
|
1822 #endif
|
|
1823 #if 0
|
|
1824 {
|
|
1825 int number = 0;
|
|
1826 if (sizeof (int) == sizeof (EMACS_INT))
|
|
1827 number = atoi (read_buffer);
|
|
1828 else if (sizeof (long) == sizeof (EMACS_INT))
|
|
1829 number = atol (read_buffer);
|
|
1830 else
|
|
1831 abort ();
|
173
|
1832 return make_int (number);
|
0
|
1833 }
|
|
1834 #else
|
173
|
1835 return parse_integer ((Bufbyte *) read_ptr, len, 10);
|
0
|
1836 #endif
|
|
1837 }
|
|
1838 }
|
|
1839 #ifdef LISP_FLOAT_TYPE
|
|
1840 if (isfloat_string (read_ptr))
|
|
1841 return make_float (atof (read_ptr));
|
|
1842 #endif
|
|
1843 }
|
|
1844
|
|
1845 {
|
|
1846 Lisp_Object sym;
|
|
1847 if (uninterned_symbol)
|
173
|
1848 sym = (Fmake_symbol ((purify_flag)
|
0
|
1849 ? make_pure_pname ((Bufbyte *) read_ptr, len, 0)
|
|
1850 : make_string ((Bufbyte *) read_ptr, len)));
|
|
1851 else
|
|
1852 {
|
|
1853 /* intern will purecopy pname if necessary */
|
|
1854 Lisp_Object name = make_string ((Bufbyte *) read_ptr, len);
|
|
1855 sym = Fintern (name, Qnil);
|
|
1856 }
|
|
1857 if (SYMBOL_IS_KEYWORD (sym))
|
|
1858 {
|
|
1859 /* the LISP way is to put keywords in their own package, but we don't
|
|
1860 have packages, so we do something simpler. Someday, maybe we'll
|
|
1861 have packages and then this will be reworked. --Stig. */
|
|
1862 XSYMBOL (sym)->value = sym;
|
|
1863 }
|
173
|
1864 return sym;
|
0
|
1865 }
|
|
1866 }
|
|
1867
|
|
1868
|
|
1869 static Lisp_Object
|
|
1870 parse_integer (CONST Bufbyte *buf, Bytecount len, int base)
|
|
1871 {
|
|
1872 CONST Bufbyte *lim = buf + len;
|
|
1873 CONST Bufbyte *p = buf;
|
|
1874 unsigned EMACS_INT num = 0;
|
|
1875 int negativland = 0;
|
|
1876
|
|
1877 if (*p == '-')
|
|
1878 {
|
|
1879 negativland = 1;
|
|
1880 p++;
|
|
1881 }
|
|
1882 else if (*p == '+')
|
|
1883 {
|
|
1884 p++;
|
|
1885 }
|
|
1886
|
|
1887 if (p == lim)
|
|
1888 goto loser;
|
|
1889
|
142
|
1890 for (; (p < lim) && (*p != '\0'); p++)
|
0
|
1891 {
|
|
1892 int c = *p;
|
|
1893 unsigned EMACS_INT onum;
|
|
1894
|
|
1895 if (isdigit (c))
|
|
1896 c = c - '0';
|
|
1897 else if (isupper (c))
|
|
1898 c = c - 'A' + 10;
|
|
1899 else if (islower (c))
|
|
1900 c = c - 'a' + 10;
|
|
1901 else
|
|
1902 goto loser;
|
173
|
1903
|
0
|
1904 if (c < 0 || c >= base)
|
|
1905 goto loser;
|
|
1906
|
|
1907 onum = num;
|
|
1908 num = num * base + c;
|
|
1909 if (num < onum)
|
|
1910 goto overflow;
|
|
1911 }
|
|
1912
|
|
1913 {
|
|
1914 Lisp_Object result = make_int ((negativland) ? -num : num);
|
|
1915 if (num && ((XINT (result) < 0) != negativland))
|
|
1916 goto overflow;
|
|
1917 if (XINT (result) != ((negativland) ? -num : num))
|
|
1918 goto overflow;
|
173
|
1919 return result;
|
0
|
1920 }
|
|
1921 overflow:
|
173
|
1922 return Fsignal (Qinvalid_read_syntax,
|
0
|
1923 list3 (build_translated_string
|
|
1924 ("Integer constant overflow in reader"),
|
|
1925 make_string (buf, len),
|
|
1926 make_int (base)));
|
|
1927 loser:
|
173
|
1928 return Fsignal (Qinvalid_read_syntax,
|
0
|
1929 list3 (build_translated_string
|
|
1930 ("Invalid integer constant in reader"),
|
|
1931 make_string (buf, len),
|
|
1932 make_int (base)));
|
|
1933 }
|
|
1934
|
|
1935
|
|
1936 static Lisp_Object
|
|
1937 read_integer (Lisp_Object readcharfun, int base)
|
|
1938 {
|
|
1939 /* This function can GC */
|
|
1940 int saw_a_backslash;
|
|
1941 Bytecount len = read_atom_0 (readcharfun, -1, &saw_a_backslash);
|
|
1942 return (parse_integer
|
|
1943 (resizing_buffer_stream_ptr (XLSTREAM (Vread_buffer_stream)),
|
|
1944 ((saw_a_backslash)
|
|
1945 ? 0 /* make parse_integer signal error */
|
|
1946 : len),
|
|
1947 base));
|
|
1948 }
|
|
1949
|
|
1950 static Lisp_Object
|
|
1951 read_bit_vector (Lisp_Object readcharfun)
|
|
1952 {
|
185
|
1953 unsigned_char_dynarr *dyn = Dynarr_new (unsigned_char);
|
0
|
1954 Emchar c;
|
|
1955
|
|
1956 while (1)
|
|
1957 {
|
|
1958 c = readchar (readcharfun);
|
|
1959 if (c != '0' && c != '1')
|
|
1960 break;
|
|
1961 Dynarr_add (dyn, (unsigned char) (c - '0'));
|
|
1962 }
|
|
1963
|
|
1964 if (c >= 0)
|
|
1965 unreadchar (readcharfun, c);
|
|
1966
|
|
1967 return make_bit_vector_from_byte_vector (Dynarr_atp (dyn, 0),
|
|
1968 Dynarr_length (dyn));
|
|
1969 }
|
|
1970
|
|
1971
|
|
1972
|
|
1973 /* structures */
|
|
1974
|
|
1975 struct structure_type *
|
|
1976 define_structure_type (Lisp_Object type,
|
|
1977 int (*validate) (Lisp_Object data,
|
|
1978 Error_behavior errb),
|
|
1979 Lisp_Object (*instantiate) (Lisp_Object data))
|
|
1980 {
|
|
1981 struct structure_type st;
|
|
1982
|
|
1983 st.type = type;
|
185
|
1984 st.keywords = Dynarr_new (structure_keyword_entry);
|
0
|
1985 st.validate = validate;
|
|
1986 st.instantiate = instantiate;
|
|
1987 Dynarr_add (the_structure_type_dynarr, st);
|
|
1988
|
|
1989 return Dynarr_atp (the_structure_type_dynarr,
|
|
1990 Dynarr_length (the_structure_type_dynarr) - 1);
|
|
1991 }
|
|
1992
|
|
1993 void
|
|
1994 define_structure_type_keyword (struct structure_type *st, Lisp_Object keyword,
|
|
1995 int (*validate) (Lisp_Object keyword,
|
|
1996 Lisp_Object value,
|
|
1997 Error_behavior errb))
|
|
1998 {
|
|
1999 struct structure_keyword_entry en;
|
|
2000
|
|
2001 en.keyword = keyword;
|
|
2002 en.validate = validate;
|
|
2003 Dynarr_add (st->keywords, en);
|
|
2004 }
|
|
2005
|
|
2006 static struct structure_type *
|
|
2007 recognized_structure_type (Lisp_Object type)
|
|
2008 {
|
|
2009 int i;
|
|
2010
|
|
2011 for (i = 0; i < Dynarr_length (the_structure_type_dynarr); i++)
|
|
2012 {
|
|
2013 struct structure_type *st = Dynarr_atp (the_structure_type_dynarr, i);
|
|
2014 if (EQ (st->type, type))
|
|
2015 return st;
|
|
2016 }
|
|
2017
|
|
2018 return 0;
|
|
2019 }
|
|
2020
|
|
2021 static Lisp_Object
|
|
2022 read_structure (Lisp_Object readcharfun)
|
|
2023 {
|
|
2024 Emchar c = readchar (readcharfun);
|
|
2025 Lisp_Object list = Qnil;
|
|
2026 Lisp_Object orig_list = Qnil;
|
|
2027 Lisp_Object already_seen = Qnil;
|
173
|
2028 int keyword_count;
|
0
|
2029 struct structure_type *st;
|
|
2030 struct gcpro gcpro1, gcpro2;
|
|
2031
|
|
2032 GCPRO2 (orig_list, already_seen);
|
|
2033 if (c != '(')
|
|
2034 RETURN_UNGCPRO (continuable_syntax_error ("#s not followed by paren"));
|
|
2035 list = read_list (readcharfun, ')', 0, 0);
|
|
2036 orig_list = list;
|
|
2037 {
|
|
2038 int len = XINT (Flength (list));
|
|
2039 if (len == 0)
|
|
2040 RETURN_UNGCPRO (continuable_syntax_error
|
|
2041 ("structure type not specified"));
|
|
2042 if (!(len & 1))
|
|
2043 RETURN_UNGCPRO
|
|
2044 (continuable_syntax_error
|
|
2045 ("structures must have alternating keyword/value pairs"));
|
|
2046 }
|
173
|
2047
|
0
|
2048 st = recognized_structure_type (XCAR (list));
|
|
2049 if (!st)
|
173
|
2050 RETURN_UNGCPRO (Fsignal (Qinvalid_read_syntax,
|
|
2051 list2 (build_translated_string
|
|
2052 ("unrecognized structure type"),
|
|
2053 XCAR (list))));
|
0
|
2054
|
|
2055 list = Fcdr (list);
|
173
|
2056 keyword_count = Dynarr_length (st->keywords);
|
0
|
2057 while (!NILP (list))
|
|
2058 {
|
|
2059 Lisp_Object keyword, value;
|
|
2060 int i;
|
173
|
2061 struct structure_keyword_entry *en = NULL;
|
|
2062
|
0
|
2063 keyword = Fcar (list);
|
|
2064 list = Fcdr (list);
|
|
2065 value = Fcar (list);
|
|
2066 list = Fcdr (list);
|
173
|
2067
|
0
|
2068 if (!NILP (memq_no_quit (keyword, already_seen)))
|
173
|
2069 RETURN_UNGCPRO (Fsignal (Qinvalid_read_syntax,
|
|
2070 list2 (build_translated_string
|
|
2071 ("structure keyword already seen"),
|
|
2072 keyword)));
|
|
2073
|
|
2074 for (i = 0; i < keyword_count; i++)
|
0
|
2075 {
|
|
2076 en = Dynarr_atp (st->keywords, i);
|
|
2077 if (EQ (keyword, en->keyword))
|
|
2078 break;
|
|
2079 }
|
|
2080
|
173
|
2081 if (i == keyword_count)
|
0
|
2082 RETURN_UNGCPRO (Fsignal (Qinvalid_read_syntax,
|
|
2083 list2 (build_translated_string
|
|
2084 ("unrecognized structure keyword"),
|
|
2085 keyword)));
|
|
2086
|
|
2087 if (en->validate && ! (en->validate) (keyword, value, ERROR_ME))
|
|
2088 RETURN_UNGCPRO
|
|
2089 (Fsignal (Qinvalid_read_syntax,
|
|
2090 list3 (build_translated_string
|
|
2091 ("invalid value for structure keyword"),
|
|
2092 keyword, value)));
|
|
2093
|
|
2094 already_seen = Fcons (keyword, already_seen);
|
|
2095 }
|
|
2096
|
|
2097 if (st->validate && ! (st->validate) (orig_list, ERROR_ME))
|
173
|
2098 RETURN_UNGCPRO (Fsignal (Qinvalid_read_syntax,
|
|
2099 list2 (build_translated_string
|
|
2100 ("invalid structure initializer"),
|
|
2101 orig_list)));
|
0
|
2102
|
|
2103 RETURN_UNGCPRO ((st->instantiate) (XCDR (orig_list)));
|
173
|
2104 }
|
0
|
2105
|
|
2106
|
|
2107 static Lisp_Object read_compiled_function (Lisp_Object readcharfun,
|
|
2108 int terminator);
|
|
2109 static Lisp_Object read_vector (Lisp_Object readcharfun, int terminator);
|
|
2110
|
|
2111 /* Get the next character; filter out whitespace and comments */
|
|
2112
|
|
2113 static Emchar
|
|
2114 reader_nextchar (Lisp_Object readcharfun)
|
|
2115 {
|
|
2116 /* This function can GC */
|
|
2117 Emchar c;
|
|
2118
|
|
2119 retry:
|
|
2120 QUIT;
|
|
2121 c = readchar (readcharfun);
|
|
2122 if (c < 0)
|
|
2123 {
|
|
2124 if (LSTREAMP (readcharfun))
|
|
2125 signal_error (Qend_of_file,
|
|
2126 list1 (build_string ("internal input stream")));
|
|
2127 else
|
|
2128 signal_error (Qend_of_file, list1 (readcharfun));
|
|
2129 }
|
|
2130
|
|
2131 switch (c)
|
|
2132 {
|
|
2133 default:
|
|
2134 {
|
|
2135 /* Ignore whitespace and control characters */
|
|
2136 if (c <= 040)
|
|
2137 goto retry;
|
173
|
2138 return c;
|
0
|
2139 }
|
|
2140
|
|
2141 case ';':
|
|
2142 {
|
|
2143 /* Comment */
|
|
2144 while ((c = readchar (readcharfun)) >= 0 && c != '\n')
|
|
2145 QUIT;
|
|
2146 goto retry;
|
|
2147 }
|
|
2148 }
|
|
2149 }
|
|
2150
|
|
2151 #if 0
|
|
2152 static Lisp_Object
|
|
2153 list2_pure (int pure, Lisp_Object a, Lisp_Object b)
|
|
2154 {
|
173
|
2155 return pure ? pure_cons (a, pure_cons (b, Qnil)) : list2 (a, b);
|
0
|
2156 }
|
|
2157 #endif
|
|
2158
|
|
2159 /* Read the next Lisp object from the stream READCHARFUN and return it.
|
|
2160 If the return value is a cons whose car is Qunbound, then read1()
|
|
2161 encountered a misplaced token (e.g. a right bracket, right paren,
|
|
2162 or dot followed by a non-number). To filter this stuff out,
|
|
2163 use read0(). */
|
173
|
2164
|
0
|
2165 static Lisp_Object
|
|
2166 read1 (Lisp_Object readcharfun)
|
|
2167 {
|
|
2168 Emchar c;
|
|
2169
|
|
2170 retry:
|
|
2171 c = reader_nextchar (readcharfun);
|
|
2172
|
|
2173 switch (c)
|
|
2174 {
|
|
2175 case '(':
|
|
2176 {
|
|
2177 #ifdef LISP_BACKQUOTES /* old backquote compatibility in lisp reader */
|
|
2178 /* if this is disabled, then other code in eval.c must be enabled */
|
|
2179 Emchar ch = reader_nextchar (readcharfun);
|
|
2180 switch (ch)
|
|
2181 {
|
|
2182 case '`':
|
|
2183 {
|
|
2184 Lisp_Object tem;
|
|
2185 int speccount = specpdl_depth ();
|
|
2186 ++old_backquote_flag;
|
|
2187 record_unwind_protect (backquote_unwind,
|
|
2188 make_opaque_ptr (&old_backquote_flag));
|
|
2189 tem = read0 (readcharfun);
|
|
2190 unbind_to (speccount, Qnil);
|
|
2191 ch = reader_nextchar (readcharfun);
|
|
2192 if (ch != ')')
|
|
2193 {
|
|
2194 unreadchar (readcharfun, ch);
|
|
2195 return Fsignal (Qinvalid_read_syntax,
|
|
2196 list1 (build_string
|
|
2197 ("Weird old-backquote syntax")));
|
|
2198 }
|
|
2199 return list2 (Qbacktick, tem);
|
|
2200 }
|
|
2201 case ',':
|
|
2202 {
|
|
2203 if (old_backquote_flag)
|
|
2204 {
|
|
2205 Lisp_Object tem, comma_type;
|
|
2206 ch = readchar (readcharfun);
|
|
2207 if (ch == '@')
|
|
2208 comma_type = Qcomma_at;
|
|
2209 else
|
|
2210 {
|
|
2211 if (ch >= 0)
|
|
2212 unreadchar (readcharfun, ch);
|
|
2213 comma_type = Qcomma;
|
|
2214 }
|
|
2215 tem = read0 (readcharfun);
|
|
2216 ch = reader_nextchar (readcharfun);
|
|
2217 if (ch != ')')
|
|
2218 {
|
|
2219 unreadchar (readcharfun, ch);
|
|
2220 return Fsignal (Qinvalid_read_syntax,
|
|
2221 list1 (build_string
|
|
2222 ("Weird old-backquote syntax")));
|
|
2223 }
|
|
2224 return list2 (comma_type, tem);
|
|
2225 }
|
|
2226 else
|
|
2227 {
|
|
2228 unreadchar (readcharfun, ch);
|
|
2229 #if 0
|
|
2230 return Fsignal (Qinvalid_read_syntax,
|
|
2231 list1 (build_string ("Comma outside of backquote")));
|
|
2232 #else
|
|
2233 /* #### - yuck....but this is reverse compatible. */
|
|
2234 /* mostly this is required by edebug, which does it's own
|
|
2235 annotated reading. We need to have an annotated_read
|
|
2236 function that records (with markers) the buffer
|
|
2237 positions of the elements that make up lists, then that
|
|
2238 can be used in edebug and bytecomp and the check above
|
|
2239 can go back in. --Stig */
|
|
2240 break;
|
|
2241 #endif
|
|
2242 }
|
|
2243 }
|
|
2244 default:
|
|
2245 unreadchar (readcharfun, ch);
|
|
2246 } /* switch(ch) */
|
|
2247 #endif /* old backquote crap... */
|
|
2248 return read_list (readcharfun, ')', 1, 1);
|
|
2249 }
|
|
2250 case '[':
|
173
|
2251 return read_vector (readcharfun, ']');
|
0
|
2252
|
|
2253 case ')':
|
|
2254 case ']':
|
|
2255 /* #### - huh? these don't do what they seem... */
|
173
|
2256 return noseeum_cons (Qunbound, make_char (c));
|
0
|
2257 case '.':
|
|
2258 {
|
|
2259 #ifdef LISP_FLOAT_TYPE
|
|
2260 /* If a period is followed by a number, then we should read it
|
|
2261 as a floating point number. Otherwise, it denotes a dotted
|
|
2262 pair.
|
|
2263 */
|
|
2264 c = readchar (readcharfun);
|
|
2265 unreadchar (readcharfun, c);
|
|
2266
|
|
2267 /* Can't use isdigit on Emchars */
|
|
2268 if (c < '0' || c > '9')
|
173
|
2269 return noseeum_cons (Qunbound, make_char ('.'));
|
0
|
2270
|
|
2271 /* Note that read_atom will loop
|
|
2272 at least once, assuring that we will not try to UNREAD
|
|
2273 two characters in a row.
|
|
2274 (I think this doesn't matter anymore because there should
|
|
2275 be no more danger in unreading multiple characters) */
|
173
|
2276 return read_atom (readcharfun, '.', 0);
|
0
|
2277
|
|
2278 #else /* ! LISP_FLOAT_TYPE */
|
173
|
2279 return noseeum_cons (Qunbound, make_char ('.'));
|
0
|
2280 #endif /* ! LISP_FLOAT_TYPE */
|
|
2281 }
|
|
2282
|
|
2283 case '#':
|
|
2284 {
|
|
2285 c = readchar (readcharfun);
|
|
2286 switch (c)
|
|
2287 {
|
|
2288 #if 0 /* FSFmacs silly char-table syntax */
|
|
2289 case '^':
|
|
2290 #endif
|
|
2291 #if 0 /* FSFmacs silly bool-vector syntax */
|
|
2292 case '&':
|
|
2293 #endif
|
|
2294 /* "#["-- byte-code constant syntax */
|
|
2295 /* purecons #[...] syntax */
|
173
|
2296 case '[': return read_compiled_function (readcharfun, ']'
|
|
2297 /*, purify_flag */ );
|
0
|
2298 /* "#:"-- quasi-implemented gensym syntax */
|
173
|
2299 case ':': return read_atom (readcharfun, -1, 1);
|
0
|
2300 /* #'x => (function x) */
|
173
|
2301 case '\'': return list2 (Qfunction, read0 (readcharfun));
|
0
|
2302 #if 0
|
|
2303 /* RMS uses this syntax for fat-strings.
|
|
2304 If we use it for vectors, then obscure bugs happen.
|
|
2305 */
|
|
2306 /* "#(" -- Scheme/CL vector syntax */
|
173
|
2307 case '(': return read_vector (readcharfun, ')');
|
0
|
2308 #endif
|
|
2309 #if 0 /* FSFmacs */
|
|
2310 case '(':
|
|
2311 {
|
|
2312 Lisp_Object tmp;
|
|
2313 struct gcpro gcpro1;
|
|
2314
|
|
2315 /* Read the string itself. */
|
|
2316 tmp = read1 (readcharfun);
|
|
2317 if (!STRINGP (tmp))
|
|
2318 {
|
|
2319 if (CONSP (tmp) && UNBOUNDP (XCAR (tmp)))
|
|
2320 free_cons (XCONS (tmp));
|
173
|
2321 return Fsignal (Qinvalid_read_syntax,
|
|
2322 list1 (build_string ("#")));
|
0
|
2323 }
|
|
2324 GCPRO1 (tmp);
|
|
2325 /* Read the intervals and their properties. */
|
|
2326 while (1)
|
|
2327 {
|
|
2328 Lisp_Object beg, end, plist;
|
|
2329 Emchar ch;
|
|
2330 int invalid = 0;
|
173
|
2331
|
0
|
2332 beg = read1 (readcharfun);
|
|
2333 if (CONSP (beg) && UNBOUNDP (XCAR (beg)))
|
|
2334 {
|
|
2335 ch = XCHAR (XCDR (beg));
|
|
2336 free_cons (XCONS (beg));
|
|
2337 if (ch == ')')
|
|
2338 break;
|
|
2339 else
|
|
2340 invalid = 1;
|
|
2341 }
|
|
2342 if (!invalid)
|
|
2343 {
|
|
2344 end = read1 (readcharfun);
|
|
2345 if (CONSP (end) && UNBOUNDP (XCAR (end)))
|
|
2346 {
|
|
2347 free_cons (XCONS (end));
|
|
2348 invalid = 1;
|
|
2349 }
|
|
2350 }
|
|
2351 if (!invalid)
|
|
2352 {
|
|
2353 plist = read1 (readcharfun);
|
|
2354 if (CONSP (plist) && UNBOUNDP (XCAR (plist)))
|
|
2355 {
|
|
2356 free_cons (XCONS (plist));
|
|
2357 invalid = 1;
|
|
2358 }
|
|
2359 }
|
|
2360 if (invalid)
|
|
2361 RETURN_UNGCPRO
|
|
2362 (Fsignal (Qinvalid_read_syntax,
|
|
2363 list2
|
|
2364 (build_string ("invalid string property list"),
|
|
2365 XCDR (plist))));
|
|
2366 Fset_text_properties (beg, end, plist, tmp);
|
|
2367 }
|
|
2368 UNGCPRO;
|
|
2369 return tmp;
|
|
2370 }
|
|
2371 #endif /* 0 */
|
|
2372 case '@':
|
|
2373 {
|
|
2374 /* #@NUMBER is used to skip NUMBER following characters.
|
|
2375 That's used in .elc files to skip over doc strings
|
|
2376 and function definitions. */
|
|
2377 int i, nskip = 0;
|
|
2378
|
|
2379 /* Read a decimal integer. */
|
|
2380 while ((c = readchar (readcharfun)) >= 0
|
|
2381 && c >= '0' && c <= '9')
|
|
2382 nskip = (10 * nskip) + (c - '0');
|
|
2383 if (c >= 0)
|
|
2384 unreadchar (readcharfun, c);
|
|
2385
|
|
2386 /* FSF has code here that maybe caches the skipped
|
|
2387 string. See above for why this is totally
|
|
2388 losing. We handle this differently. */
|
|
2389
|
|
2390 /* Skip that many characters. */
|
|
2391 for (i = 0; i < nskip && c >= 0; i++)
|
|
2392 c = readchar (readcharfun);
|
|
2393
|
|
2394 goto retry;
|
|
2395 }
|
|
2396 case '$': return Vload_file_name_internal;
|
|
2397 /* bit vectors */
|
173
|
2398 case '*': return read_bit_vector (readcharfun);
|
0
|
2399 /* #o10 => 8 -- octal constant syntax */
|
173
|
2400 case 'o': return read_integer (readcharfun, 8);
|
0
|
2401 /* #xdead => 57005 -- hex constant syntax */
|
173
|
2402 case 'x': return read_integer (readcharfun, 16);
|
0
|
2403 /* #b010 => 2 -- binary constant syntax */
|
173
|
2404 case 'b': return read_integer (readcharfun, 2);
|
0
|
2405 /* #s(foobar key1 val1 key2 val2) -- structure syntax */
|
173
|
2406 case 's': return read_structure (readcharfun);
|
0
|
2407 case '<':
|
|
2408 {
|
|
2409 unreadchar (readcharfun, c);
|
|
2410 return Fsignal (Qinvalid_read_syntax,
|
|
2411 list1 (build_string ("Cannot read unreadable object")));
|
|
2412 }
|
140
|
2413 #ifdef FEATUREP_SYNTAX
|
|
2414 case '+':
|
|
2415 case '-':
|
|
2416 {
|
|
2417 Lisp_Object fexp, obj, tem;
|
|
2418 struct gcpro gcpro1, gcpro2;
|
|
2419
|
|
2420 fexp = read0(readcharfun);
|
|
2421 obj = read0(readcharfun);
|
|
2422
|
|
2423 /* the call to `featurep' may GC. */
|
|
2424 GCPRO2(fexp, obj);
|
|
2425 tem = call1(Qfeaturep, fexp);
|
|
2426 UNGCPRO;
|
|
2427
|
|
2428 if (c == '+' && NILP(tem)) goto retry;
|
|
2429 if (c == '-' && !NILP(tem)) goto retry;
|
|
2430 return obj;
|
|
2431 }
|
|
2432 #endif
|
245
|
2433 case '0': case '1': case '2': case '3': case '4':
|
|
2434 case '5': case '6': case '7': case '8': case '9':
|
|
2435 /* Reader forms that can reuse previously read objects. */
|
|
2436 {
|
|
2437 int n = 0;
|
|
2438 Lisp_Object found;
|
|
2439
|
|
2440 /* Using read_integer() here is impossible, because it
|
|
2441 chokes on `='. Using parse_integer() is too hard.
|
|
2442 So we simply read it in, and ignore overflows, which
|
|
2443 is safe. */
|
|
2444 while (c >= '0' && c <= '9')
|
|
2445 {
|
|
2446 n *= 10;
|
|
2447 n += c - '0';
|
|
2448 c = readchar (readcharfun);
|
|
2449 }
|
|
2450 found = assq_no_quit (make_int (n), read_objects);
|
|
2451 if (c == '=')
|
|
2452 {
|
|
2453 /* #n=object returns object, but associates it with
|
|
2454 n for #n#. */
|
|
2455 Lisp_Object obj;
|
|
2456 if (CONSP (found))
|
|
2457 return Fsignal (Qinvalid_read_syntax,
|
|
2458 list2 (build_translated_string
|
|
2459 ("Multiply defined symbol label"),
|
|
2460 make_int (n)));
|
|
2461 obj = read0 (readcharfun);
|
|
2462 read_objects = Fcons (Fcons (make_int (n), obj), read_objects);
|
|
2463 return obj;
|
|
2464 }
|
|
2465 else if (c == '#')
|
|
2466 {
|
|
2467 /* #n# returns a previously read object. */
|
|
2468 if (CONSP (found))
|
|
2469 return XCDR (found);
|
|
2470 else
|
|
2471 return Fsignal (Qinvalid_read_syntax,
|
|
2472 list2 (build_translated_string
|
|
2473 ("Undefined symbol label"),
|
|
2474 make_int (n)));
|
|
2475 }
|
|
2476 return Fsignal (Qinvalid_read_syntax,
|
|
2477 list1 (build_string ("#")));
|
|
2478 }
|
0
|
2479 default:
|
|
2480 {
|
|
2481 unreadchar (readcharfun, c);
|
|
2482 return Fsignal (Qinvalid_read_syntax,
|
|
2483 list1 (build_string ("#")));
|
|
2484 }
|
|
2485 }
|
|
2486 }
|
|
2487
|
|
2488 /* Quote */
|
|
2489 case '\'': return list2 (Qquote, read0 (readcharfun));
|
|
2490
|
|
2491 #ifdef LISP_BACKQUOTES
|
|
2492 case '`':
|
|
2493 {
|
|
2494 Lisp_Object tem;
|
|
2495 int speccount = specpdl_depth ();
|
|
2496 ++new_backquote_flag;
|
|
2497 record_unwind_protect (backquote_unwind,
|
|
2498 make_opaque_ptr (&new_backquote_flag));
|
|
2499 tem = read0 (readcharfun);
|
|
2500 unbind_to (speccount, Qnil);
|
|
2501 return list2 (Qbackquote, tem);
|
|
2502 }
|
|
2503
|
|
2504 case ',':
|
|
2505 {
|
|
2506 if (new_backquote_flag)
|
|
2507 {
|
|
2508 Lisp_Object comma_type = Qnil;
|
|
2509 int ch = readchar (readcharfun);
|
|
2510
|
|
2511 if (ch == '@')
|
|
2512 comma_type = Qcomma_at;
|
|
2513 else if (ch == '.')
|
|
2514 comma_type = Qcomma_dot;
|
|
2515 else
|
|
2516 {
|
|
2517 if (ch >= 0)
|
|
2518 unreadchar (readcharfun, ch);
|
|
2519 comma_type = Qcomma;
|
|
2520 }
|
|
2521 return list2 (comma_type, read0 (readcharfun));
|
|
2522 }
|
|
2523 else
|
|
2524 {
|
|
2525 /* YUCK. 99.999% backwards compatibility. The Right
|
|
2526 Thing(tm) is to signal an error here, because it's
|
|
2527 really invalid read syntax. Instead, this permits
|
|
2528 commas to begin symbols (unless they're inside
|
|
2529 backquotes). If an error is signalled here in the
|
|
2530 future, then commas should be invalid read syntax
|
|
2531 outside of backquotes anywhere they're found (i.e.
|
|
2532 they must be quoted in symbols) -- Stig */
|
173
|
2533 return read_atom (readcharfun, c, 0);
|
0
|
2534 }
|
|
2535 }
|
|
2536 #endif
|
|
2537
|
|
2538 case '?':
|
|
2539 {
|
|
2540 /* Evil GNU Emacs "character" (ie integer) syntax */
|
|
2541 c = readchar (readcharfun);
|
|
2542 if (c < 0)
|
|
2543 return Fsignal (Qend_of_file, list1 (readcharfun));
|
|
2544
|
|
2545 if (c == '\\')
|
|
2546 c = read_escape (readcharfun);
|
173
|
2547 return make_char (c);
|
0
|
2548 }
|
|
2549
|
|
2550 case '\"':
|
|
2551 {
|
|
2552 /* String */
|
|
2553 #ifdef I18N3
|
|
2554 /* #### If the input stream is translating, then the string
|
|
2555 should be marked as translatable by setting its
|
|
2556 `string-translatable' property to t. .el and .elc files
|
|
2557 normally are translating input streams. See Fgettext()
|
|
2558 and print_internal(). */
|
|
2559 #endif
|
|
2560 int cancel = 0;
|
|
2561
|
|
2562 Lstream_rewind (XLSTREAM (Vread_buffer_stream));
|
|
2563 while ((c = readchar (readcharfun)) >= 0
|
|
2564 && c != '\"')
|
|
2565 {
|
|
2566 if (c == '\\')
|
|
2567 c = read_escape (readcharfun);
|
|
2568 /* c is -1 if \ newline has just been seen */
|
|
2569 if (c == -1)
|
|
2570 {
|
|
2571 if (Lstream_byte_count (XLSTREAM (Vread_buffer_stream)) == 0)
|
|
2572 cancel = 1;
|
|
2573 }
|
|
2574 else
|
|
2575 Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), c);
|
|
2576 QUIT;
|
|
2577 }
|
|
2578 if (c < 0)
|
|
2579 return Fsignal (Qend_of_file, list1 (readcharfun));
|
|
2580
|
|
2581 /* If purifying, and string starts with \ newline,
|
|
2582 return zero instead. This is for doc strings
|
|
2583 that we are really going to find in lib-src/DOC.nn.nn */
|
|
2584 if (purify_flag && NILP (Vdoc_file_name) && cancel)
|
173
|
2585 return Qzero;
|
0
|
2586
|
|
2587 Lstream_flush (XLSTREAM (Vread_buffer_stream));
|
|
2588 #if 0 /* FSFmacs defun hack */
|
|
2589 if (read_pure)
|
|
2590 return
|
|
2591 make_pure_string
|
|
2592 (resizing_buffer_stream_ptr (XLSTREAM (Vread_buffer_stream)),
|
|
2593 Lstream_byte_count (XLSTREAM (Vread_buffer_stream)));
|
|
2594 else
|
|
2595 #endif
|
|
2596 return
|
|
2597 make_string
|
|
2598 (resizing_buffer_stream_ptr (XLSTREAM (Vread_buffer_stream)),
|
|
2599 Lstream_byte_count (XLSTREAM (Vread_buffer_stream)));
|
|
2600 }
|
|
2601
|
|
2602 default:
|
|
2603 {
|
|
2604 /* Ignore whitespace and control characters */
|
|
2605 if (c <= 040)
|
|
2606 goto retry;
|
173
|
2607 return read_atom (readcharfun, c, 0);
|
0
|
2608 }
|
|
2609 }
|
|
2610 }
|
|
2611
|
|
2612
|
|
2613
|
|
2614 #ifdef LISP_FLOAT_TYPE
|
|
2615
|
|
2616 #define LEAD_INT 1
|
|
2617 #define DOT_CHAR 2
|
|
2618 #define TRAIL_INT 4
|
|
2619 #define E_CHAR 8
|
|
2620 #define EXP_INT 16
|
|
2621
|
|
2622 int
|
|
2623 isfloat_string (CONST char *cp)
|
|
2624 {
|
|
2625 int state = 0;
|
|
2626 CONST Bufbyte *ucp = (CONST Bufbyte *) cp;
|
173
|
2627
|
0
|
2628 if (*ucp == '+' || *ucp == '-')
|
|
2629 ucp++;
|
|
2630
|
|
2631 if (*ucp >= '0' && *ucp <= '9')
|
|
2632 {
|
|
2633 state |= LEAD_INT;
|
|
2634 while (*ucp >= '0' && *ucp <= '9')
|
|
2635 ucp++;
|
|
2636 }
|
|
2637 if (*ucp == '.')
|
|
2638 {
|
|
2639 state |= DOT_CHAR;
|
|
2640 ucp++;
|
|
2641 }
|
|
2642 if (*ucp >= '0' && *ucp <= '9')
|
|
2643 {
|
|
2644 state |= TRAIL_INT;
|
|
2645 while (*ucp >= '0' && *ucp <= '9')
|
|
2646 ucp++;
|
|
2647 }
|
|
2648 if (*ucp == 'e' || *ucp == 'E')
|
|
2649 {
|
|
2650 state |= E_CHAR;
|
|
2651 ucp++;
|
|
2652 if ((*ucp == '+') || (*ucp == '-'))
|
|
2653 ucp++;
|
|
2654 }
|
|
2655
|
|
2656 if (*ucp >= '0' && *ucp <= '9')
|
|
2657 {
|
|
2658 state |= EXP_INT;
|
|
2659 while (*ucp >= '0' && *ucp <= '9')
|
|
2660 ucp++;
|
|
2661 }
|
|
2662 return (((*ucp == 0) || (*ucp == ' ') || (*ucp == '\t') || (*ucp == '\n')
|
|
2663 || (*ucp == '\r') || (*ucp == '\f'))
|
|
2664 && (state == (LEAD_INT|DOT_CHAR|TRAIL_INT)
|
|
2665 || state == (DOT_CHAR|TRAIL_INT)
|
|
2666 || state == (LEAD_INT|E_CHAR|EXP_INT)
|
|
2667 || state == (LEAD_INT|DOT_CHAR|TRAIL_INT|E_CHAR|EXP_INT)
|
|
2668 || state == (DOT_CHAR|TRAIL_INT|E_CHAR|EXP_INT)));
|
|
2669 }
|
|
2670 #endif /* LISP_FLOAT_TYPE */
|
|
2671
|
|
2672 static void *
|
|
2673 sequence_reader (Lisp_Object readcharfun,
|
|
2674 Emchar terminator,
|
|
2675 void *state,
|
|
2676 void * (*conser) (Lisp_Object readcharfun,
|
|
2677 void *state, Charcount len))
|
|
2678 {
|
|
2679 Charcount len;
|
|
2680
|
|
2681 for (len = 0; ; len++)
|
|
2682 {
|
|
2683 Emchar ch;
|
|
2684
|
|
2685 QUIT;
|
|
2686 ch = reader_nextchar (readcharfun);
|
|
2687
|
|
2688 if (ch == terminator)
|
173
|
2689 return state;
|
0
|
2690 else
|
|
2691 unreadchar (readcharfun, ch);
|
140
|
2692 #ifdef FEATUREP_SYNTAX
|
0
|
2693 if (ch == ']')
|
|
2694 syntax_error ("\"]\" in a list");
|
|
2695 else if (ch == ')')
|
|
2696 syntax_error ("\")\" in a vector");
|
140
|
2697 #endif
|
0
|
2698 state = ((conser) (readcharfun, state, len));
|
|
2699 }
|
|
2700 }
|
|
2701
|
|
2702
|
173
|
2703 struct read_list_state
|
0
|
2704 {
|
|
2705 Lisp_Object head;
|
|
2706 Lisp_Object tail;
|
|
2707 int length;
|
|
2708 int allow_dotted_lists;
|
|
2709 Emchar terminator;
|
|
2710 };
|
|
2711
|
|
2712 static void *
|
|
2713 read_list_conser (Lisp_Object readcharfun, void *state, Charcount len)
|
|
2714 {
|
185
|
2715 struct read_list_state *s = (struct read_list_state *) state;
|
0
|
2716 Lisp_Object elt;
|
|
2717
|
|
2718 elt = read1 (readcharfun);
|
|
2719
|
|
2720 if (CONSP (elt) && UNBOUNDP (XCAR (elt)))
|
|
2721 {
|
|
2722 Lisp_Object tem = elt;
|
|
2723 Emchar ch;
|
173
|
2724
|
0
|
2725 elt = XCDR (elt);
|
|
2726 free_cons (XCONS (tem));
|
|
2727 tem = Qnil;
|
|
2728 ch = XCHAR (elt);
|
140
|
2729 #ifdef FEATUREP_SYNTAX
|
|
2730 if (ch == s->terminator) /* deal with #+, #- reader macros */
|
|
2731 {
|
|
2732 unreadchar (readcharfun, s->terminator);
|
|
2733 goto done;
|
|
2734 }
|
|
2735 else if (ch == ']')
|
|
2736 syntax_error ("']' in a list");
|
|
2737 else if (ch == ')')
|
|
2738 syntax_error ("')' in a vector");
|
|
2739 else
|
|
2740 #endif
|
0
|
2741 if (ch != '.')
|
|
2742 signal_simple_error ("BUG! Internal reader error", elt);
|
|
2743 else if (!s->allow_dotted_lists)
|
|
2744 syntax_error ("\".\" in a vector");
|
|
2745 else
|
|
2746 {
|
|
2747 if (!NILP (s->tail))
|
|
2748 XCDR (s->tail) = read0 (readcharfun);
|
|
2749 else
|
|
2750 s->head = read0 (readcharfun);
|
|
2751 elt = read1 (readcharfun);
|
|
2752 if (CONSP (elt) && UNBOUNDP (XCAR (elt)))
|
|
2753 {
|
|
2754 ch = XCHAR (XCDR (elt));
|
|
2755 free_cons (XCONS (elt));
|
|
2756 if (ch == s->terminator)
|
|
2757 {
|
|
2758 unreadchar (readcharfun, s->terminator);
|
|
2759 goto done;
|
|
2760 }
|
|
2761 }
|
|
2762 syntax_error (". in wrong context");
|
|
2763 }
|
|
2764 }
|
|
2765
|
|
2766 #if 0 /* FSFmacs defun hack, or something ... */
|
|
2767 if (NILP (tail) && defun_hack && EQ (elt, Qdefun) && !read_pure)
|
|
2768 {
|
|
2769 record_unwind_protect (unreadpure, Qzero);
|
|
2770 read_pure = 1;
|
|
2771 }
|
|
2772 #endif
|
|
2773
|
|
2774 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
|
|
2775 if (s->length == 1 && s->allow_dotted_lists && EQ (XCAR (s->head), Qfset))
|
|
2776 {
|
|
2777 if (CONSP (elt) && EQ (XCAR (elt), Qquote) && CONSP (XCDR (elt)))
|
|
2778 Vcurrent_compiled_function_annotation = XCAR (XCDR (elt));
|
|
2779 else
|
|
2780 Vcurrent_compiled_function_annotation = elt;
|
|
2781 }
|
|
2782 #endif
|
|
2783
|
|
2784 elt = Fcons (elt, Qnil);
|
|
2785 if (!NILP (s->tail))
|
|
2786 XCDR (s->tail) = elt;
|
|
2787 else
|
|
2788 s->head = elt;
|
|
2789 s->tail = elt;
|
|
2790 done:
|
|
2791 s->length++;
|
173
|
2792 return s;
|
0
|
2793 }
|
|
2794
|
|
2795
|
|
2796 #if 0 /* FSFmacs defun hack */
|
|
2797 /* -1 for allow_dotted_lists means allow_dotted_lists and check
|
|
2798 for starting with defun and make structure pure. */
|
|
2799 #endif
|
|
2800
|
|
2801 static Lisp_Object
|
|
2802 read_list (Lisp_Object readcharfun,
|
|
2803 Emchar terminator,
|
|
2804 int allow_dotted_lists,
|
|
2805 int check_for_doc_references)
|
|
2806 {
|
|
2807 struct read_list_state s;
|
|
2808 struct gcpro gcpro1, gcpro2;
|
|
2809 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
|
|
2810 Lisp_Object old_compiled_function_annotation =
|
|
2811 Vcurrent_compiled_function_annotation;
|
|
2812 #endif
|
|
2813
|
|
2814 s.head = Qnil;
|
|
2815 s.tail = Qnil;
|
|
2816 s.length = 0;
|
|
2817 s.allow_dotted_lists = allow_dotted_lists;
|
|
2818 s.terminator = terminator;
|
|
2819 GCPRO2 (s.head, s.tail);
|
|
2820
|
181
|
2821 sequence_reader (readcharfun, terminator, &s, read_list_conser);
|
0
|
2822 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
|
|
2823 Vcurrent_compiled_function_annotation = old_compiled_function_annotation;
|
|
2824 #endif
|
|
2825
|
|
2826 if ((purify_flag || load_force_doc_strings) && check_for_doc_references)
|
|
2827 {
|
|
2828 /* check now for any doc string references and record them
|
|
2829 for later. */
|
|
2830 Lisp_Object tail;
|
|
2831
|
|
2832 /* We might be dealing with an imperfect list so don't
|
|
2833 use LIST_LOOP */
|
|
2834 for (tail = s.head; CONSP (tail); tail = XCDR (tail))
|
|
2835 {
|
|
2836 Lisp_Object holding_cons = Qnil;
|
|
2837
|
|
2838 {
|
|
2839 Lisp_Object elem = XCAR (tail);
|
|
2840 /* elem might be (#$ . INT) ... */
|
|
2841 if (CONSP (elem) && EQ (XCAR (elem), Vload_file_name_internal))
|
|
2842 holding_cons = tail;
|
|
2843 /* or it might be (quote (#$ . INT)) i.e.
|
|
2844 (quote . ((#$ . INT) . nil)) in the case of
|
|
2845 `autoload' (autoload evaluates its arguments, while
|
|
2846 `defvar', `defun', etc. don't). */
|
|
2847 if (CONSP (elem) && EQ (XCAR (elem), Qquote)
|
|
2848 && CONSP (XCDR (elem)))
|
|
2849 {
|
|
2850 elem = XCAR (XCDR (elem));
|
|
2851 if (CONSP (elem) && EQ (XCAR (elem), Vload_file_name_internal))
|
|
2852 holding_cons = XCDR (XCAR (tail));
|
|
2853 }
|
|
2854 }
|
|
2855
|
|
2856 if (CONSP (holding_cons))
|
|
2857 {
|
|
2858 if (purify_flag)
|
|
2859 {
|
|
2860 if (NILP (Vdoc_file_name))
|
|
2861 /* We have not yet called Snarf-documentation, so
|
80
|
2862 assume this file is described in the DOC file
|
|
2863 and Snarf-documentation will fill in the right
|
|
2864 value later. For now, replace the whole list
|
|
2865 with 0. */
|
0
|
2866 XCAR (holding_cons) = Qzero;
|
|
2867 else
|
|
2868 /* We have already called Snarf-documentation, so
|
|
2869 make a relative file name for this file, so it
|
|
2870 can be found properly in the installed Lisp
|
|
2871 directory. We don't use Fexpand_file_name
|
|
2872 because that would make the directory absolute
|
|
2873 now. */
|
|
2874 XCAR (XCAR (holding_cons)) =
|
|
2875 concat2 (build_string ("../lisp/"),
|
|
2876 Ffile_name_nondirectory
|
|
2877 (Vload_file_name_internal));
|
|
2878 }
|
|
2879 else
|
|
2880 /* Not pure. Just add to Vload_force_doc_string_list,
|
|
2881 and the string will be filled in properly in
|
|
2882 load_force_doc_string_unwind(). */
|
|
2883 Vload_force_doc_string_list =
|
|
2884 /* We pass the cons that holds the (#$ . INT) so we
|
|
2885 can modify it in-place. */
|
|
2886 Fcons (holding_cons, Vload_force_doc_string_list);
|
|
2887 }
|
|
2888 }
|
|
2889 }
|
173
|
2890
|
0
|
2891 UNGCPRO;
|
173
|
2892 return s.head;
|
0
|
2893 }
|
|
2894
|
|
2895 static Lisp_Object
|
|
2896 read_vector (Lisp_Object readcharfun,
|
|
2897 Emchar terminator)
|
|
2898 {
|
|
2899 Lisp_Object tem;
|
|
2900 Lisp_Object *p;
|
|
2901 int len;
|
|
2902 int i;
|
|
2903 struct read_list_state s;
|
|
2904 struct gcpro gcpro1, gcpro2;
|
|
2905
|
|
2906 s.head = Qnil;
|
|
2907 s.tail = Qnil;
|
|
2908 s.length = 0;
|
|
2909 s.allow_dotted_lists = 0;
|
|
2910 GCPRO2 (s.head, s.tail);
|
173
|
2911
|
181
|
2912 sequence_reader (readcharfun, terminator, &s, read_list_conser);
|
185
|
2913
|
0
|
2914 UNGCPRO;
|
|
2915 tem = s.head;
|
|
2916 len = XINT (Flength (tem));
|
|
2917
|
|
2918 #if 0 /* FSFmacs defun hack */
|
|
2919 if (read_pure)
|
|
2920 s.head = make_pure_vector (len, Qnil);
|
|
2921 else
|
|
2922 #endif
|
|
2923 s.head = make_vector (len, Qnil);
|
|
2924
|
173
|
2925 for (i = 0, p = &(XVECTOR_DATA (s.head)[0]);
|
0
|
2926 i < len;
|
|
2927 i++, p++)
|
|
2928 {
|
|
2929 struct Lisp_Cons *otem = XCONS (tem);
|
|
2930 #if 0 /* FSFmacs defun hack */
|
|
2931 if (read_pure)
|
|
2932 tem = Fpurecopy (Fcar (tem));
|
|
2933 else
|
|
2934 #endif
|
|
2935 tem = Fcar (tem);
|
|
2936 *p = tem;
|
|
2937 tem = otem->cdr;
|
|
2938 free_cons (otem);
|
|
2939 }
|
173
|
2940 return s.head;
|
0
|
2941 }
|
|
2942
|
|
2943 static Lisp_Object
|
|
2944 read_compiled_function (Lisp_Object readcharfun, Emchar terminator)
|
|
2945 {
|
173
|
2946 /* Accept compiled functions at read-time so that we don't
|
0
|
2947 have to build them at load-time. */
|
|
2948 Lisp_Object stuff;
|
|
2949 Lisp_Object make_byte_code_args[COMPILED_DOMAIN + 1];
|
|
2950 struct gcpro gcpro1;
|
|
2951 int len;
|
|
2952 int iii;
|
|
2953 int saw_a_doc_ref = 0;
|
|
2954
|
|
2955 /* Note: we tell read_list not to search for doc references
|
|
2956 because we need to handle the "doc reference" for the
|
|
2957 instructions and constants differently. */
|
|
2958 stuff = read_list (readcharfun, terminator, 0, 0);
|
|
2959 len = XINT (Flength (stuff));
|
|
2960 if (len < COMPILED_STACK_DEPTH + 1 || len > COMPILED_DOMAIN + 1)
|
|
2961 return
|
|
2962 continuable_syntax_error ("#[...] used with wrong number of elements");
|
|
2963
|
|
2964 for (iii = 0; CONSP (stuff); iii++)
|
|
2965 {
|
|
2966 struct Lisp_Cons *victim = XCONS (stuff);
|
|
2967 make_byte_code_args[iii] = Fcar (stuff);
|
|
2968 if ((purify_flag || load_force_doc_strings)
|
|
2969 && CONSP (make_byte_code_args[iii])
|
|
2970 && EQ (XCAR (make_byte_code_args[iii]), Vload_file_name_internal))
|
|
2971 {
|
|
2972 if (purify_flag && iii == COMPILED_DOC_STRING)
|
|
2973 {
|
|
2974 /* same as in read_list(). */
|
|
2975 if (NILP (Vdoc_file_name))
|
|
2976 make_byte_code_args[iii] = Qzero;
|
|
2977 else
|
|
2978 XCAR (make_byte_code_args[iii]) =
|
|
2979 concat2 (build_string ("../lisp/"),
|
|
2980 Ffile_name_nondirectory
|
|
2981 (Vload_file_name_internal));
|
|
2982 }
|
|
2983 else
|
|
2984 saw_a_doc_ref = 1;
|
|
2985 }
|
|
2986 stuff = Fcdr (stuff);
|
|
2987 free_cons (victim);
|
|
2988 }
|
|
2989 GCPRO1 (make_byte_code_args[0]);
|
|
2990 gcpro1.nvars = len;
|
|
2991
|
70
|
2992 /* v18 or v19 bytecode file. Need to Ebolify. */
|
|
2993 if (load_byte_code_version < 20 && VECTORP (make_byte_code_args[2]))
|
|
2994 ebolify_bytecode_constants (make_byte_code_args[2]);
|
|
2995
|
0
|
2996 /* make-byte-code looks at purify_flag, which should have the same
|
|
2997 * value as our "read-pure" argument */
|
|
2998 stuff = Fmake_byte_code (len, make_byte_code_args);
|
70
|
2999 XCOMPILED_FUNCTION (stuff)->flags.ebolified = (load_byte_code_version < 20);
|
0
|
3000 if (saw_a_doc_ref)
|
|
3001 Vload_force_doc_string_list = Fcons (stuff, Vload_force_doc_string_list);
|
|
3002 UNGCPRO;
|
|
3003 return stuff;
|
|
3004 }
|
|
3005
|
|
3006
|
|
3007
|
|
3008 void
|
|
3009 init_lread (void)
|
|
3010 {
|
|
3011 #ifdef PATH_LOADSEARCH
|
|
3012 CONST char *normal = PATH_LOADSEARCH;
|
|
3013
|
|
3014 /* Don't print this warning. If the hardcoded paths don't exist, then
|
|
3015 startup.el will try and deduce one. If it fails, it knows how to
|
|
3016 handle things. */
|
|
3017 #if 0
|
|
3018 #ifndef WINDOWSNT
|
173
|
3019 /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is
|
185
|
3020 almost never correct, thereby causing a warning to be printed out that
|
0
|
3021 confuses users. Since PATH_LOADSEARCH is always overriden by the
|
|
3022 EMACSLOADPATH environment variable below, disable the warning on NT. */
|
|
3023
|
|
3024 /* Warn if dirs in the *standard* path don't exist. */
|
|
3025 if (!turn_off_warning)
|
|
3026 {
|
|
3027 Lisp_Object normal_path = decode_env_path (0, normal);
|
|
3028 for (; !NILP (normal_path); normal_path = XCDR (normal_path))
|
|
3029 {
|
|
3030 Lisp_Object dirfile;
|
|
3031 dirfile = Fcar (normal_path);
|
|
3032 if (!NILP (dirfile))
|
|
3033 {
|
|
3034 dirfile = Fdirectory_file_name (dirfile);
|
16
|
3035 if (access ((char *) XSTRING_DATA (dirfile), 0) < 0)
|
0
|
3036 stdout_out ("Warning: lisp library (%s) does not exist.\n",
|
16
|
3037 XSTRING_DATA (Fcar (normal_path)));
|
0
|
3038 }
|
|
3039 }
|
|
3040 }
|
|
3041 #endif /* WINDOWSNT */
|
|
3042 #endif /* 0 */
|
|
3043 #else /* !PATH_LOADSEARCH */
|
|
3044 CONST char *normal = 0;
|
|
3045 #endif /* !PATH_LOADSEARCH */
|
|
3046 Vvalues = Qnil;
|
|
3047
|
|
3048 /* further frobbed by startup.el if nil. */
|
|
3049 Vload_path = decode_env_path ("EMACSLOADPATH", normal);
|
|
3050
|
|
3051 /* Vdump_load_path = Qnil; */
|
|
3052 if (purify_flag && NILP (Vload_path))
|
|
3053 {
|
|
3054 /* loadup.el will frob this some more. */
|
|
3055 /* #### unix-specific */
|
209
|
3056 Vload_path = Fcons (build_string ("../lisp/"), Vload_path);
|
0
|
3057 }
|
|
3058 load_in_progress = 0;
|
|
3059
|
|
3060 Vload_descriptor_list = Qnil;
|
|
3061
|
231
|
3062 /* This used to get initialized in init_lread because all streams
|
|
3063 got closed when dumping occurs. This is no longer true --
|
|
3064 Vread_buffer_stream is a resizing output stream, and there is no
|
|
3065 reason to close it at dump-time.
|
|
3066
|
|
3067 Vread_buffer_stream is set to Qnil in vars_of_lread, and this
|
|
3068 will initialize it only once, at dump-time. */
|
|
3069 if (NILP (Vread_buffer_stream))
|
|
3070 Vread_buffer_stream = make_resizing_buffer_output_stream ();
|
0
|
3071
|
|
3072 Vload_force_doc_string_list = Qnil;
|
|
3073 }
|
|
3074
|
|
3075 void
|
|
3076 syms_of_lread (void)
|
|
3077 {
|
20
|
3078 DEFSUBR (Fread);
|
|
3079 DEFSUBR (Fread_from_string);
|
|
3080 DEFSUBR (Fload_internal);
|
|
3081 DEFSUBR (Flocate_file);
|
|
3082 DEFSUBR (Flocate_file_clear_hashing);
|
|
3083 DEFSUBR (Feval_buffer);
|
|
3084 DEFSUBR (Feval_region);
|
0
|
3085 #ifdef standalone
|
20
|
3086 DEFSUBR (Fread_char);
|
0
|
3087 #endif
|
|
3088
|
|
3089 defsymbol (&Qstandard_input, "standard-input");
|
|
3090 defsymbol (&Qread_char, "read-char");
|
|
3091 defsymbol (&Qcurrent_load_list, "current-load-list");
|
|
3092 defsymbol (&Qload, "load");
|
|
3093 defsymbol (&Qload_file_name, "load-file-name");
|
|
3094 defsymbol (&Qlocate_file_hash_table, "locate-file-hash-table");
|
|
3095 defsymbol (&Qfset, "fset");
|
|
3096
|
|
3097 #ifdef LISP_BACKQUOTES
|
|
3098 defsymbol (&Qbackquote, "backquote");
|
|
3099 defsymbol (&Qbacktick, "`");
|
|
3100 defsymbol (&Qcomma, ",");
|
|
3101 defsymbol (&Qcomma_at, ",@");
|
|
3102 defsymbol (&Qcomma_dot, ",.");
|
|
3103 #endif
|
|
3104 }
|
|
3105
|
|
3106 void
|
|
3107 structure_type_create (void)
|
|
3108 {
|
185
|
3109 the_structure_type_dynarr = Dynarr_new (structure_type);
|
0
|
3110 }
|
|
3111
|
|
3112 void
|
|
3113 vars_of_lread (void)
|
|
3114 {
|
|
3115 DEFVAR_LISP ("values", &Vvalues /*
|
|
3116 List of values of all expressions which were read, evaluated and printed.
|
|
3117 Order is reverse chronological.
|
|
3118 */ );
|
|
3119
|
|
3120 DEFVAR_LISP ("standard-input", &Vstandard_input /*
|
|
3121 Stream for read to get input from.
|
|
3122 See documentation of `read' for possible values.
|
|
3123 */ );
|
|
3124 Vstandard_input = Qt;
|
|
3125
|
|
3126 DEFVAR_LISP ("load-path", &Vload_path /*
|
|
3127 *List of directories to search for files to load.
|
|
3128 Each element is a string (directory name) or nil (try default directory).
|
|
3129
|
185
|
3130 Note that the elements of this list *may not* begin with "~", so you must
|
0
|
3131 call `expand-file-name' on them before adding them to this list.
|
|
3132
|
|
3133 Initialized based on EMACSLOADPATH environment variable, if any,
|
|
3134 otherwise to default specified in by file `paths.h' when XEmacs was built.
|
|
3135 If there were no paths specified in `paths.h', then XEmacs chooses a default
|
|
3136 value for this variable by looking around in the file-system near the
|
|
3137 directory in which the XEmacs executable resides.
|
|
3138 */ );
|
|
3139
|
|
3140 /* xxxDEFVAR_LISP ("dump-load-path", &Vdump_load_path,
|
|
3141 "*Location of lisp files to be used when dumping ONLY."); */
|
|
3142
|
|
3143 DEFVAR_BOOL ("load-in-progress", &load_in_progress /*
|
|
3144 Non-nil iff inside of `load'.
|
|
3145 */ );
|
|
3146
|
|
3147 DEFVAR_LISP ("after-load-alist", &Vafter_load_alist /*
|
|
3148 An alist of expressions to be evalled when particular files are loaded.
|
|
3149 Each element looks like (FILENAME FORMS...).
|
|
3150 When `load' is run and the file-name argument is FILENAME,
|
|
3151 the FORMS in the corresponding element are executed at the end of loading.
|
|
3152
|
|
3153 FILENAME must match exactly! Normally FILENAME is the name of a library,
|
|
3154 with no directory specified, since that is how `load' is normally called.
|
|
3155 An error in FORMS does not undo the load,
|
|
3156 but does prevent execution of the rest of the FORMS.
|
|
3157 */ );
|
|
3158 Vafter_load_alist = Qnil;
|
|
3159
|
|
3160 DEFVAR_BOOL ("load-warn-when-source-newer", &load_warn_when_source_newer /*
|
|
3161 *Whether `load' should check whether the source is newer than the binary.
|
|
3162 If this variable is true, then when a `.elc' file is being loaded and the
|
|
3163 corresponding `.el' is newer, a warning message will be printed.
|
|
3164 */ );
|
|
3165 load_warn_when_source_newer = 0;
|
|
3166
|
|
3167 DEFVAR_BOOL ("load-warn-when-source-only", &load_warn_when_source_only /*
|
|
3168 *Whether `load' should warn when loading a `.el' file instead of an `.elc'.
|
|
3169 If this variable is true, then when `load' is called with a filename without
|
|
3170 an extension, and the `.elc' version doesn't exist but the `.el' version does,
|
|
3171 then a message will be printed. If an explicit extension is passed to `load',
|
|
3172 no warning will be printed.
|
|
3173 */ );
|
|
3174 load_warn_when_source_only = 0;
|
|
3175
|
|
3176 DEFVAR_BOOL ("load-ignore-elc-files", &load_ignore_elc_files /*
|
|
3177 *Whether `load' should ignore `.elc' files when a suffix is not given.
|
|
3178 This is normally used only to bootstrap the `.elc' files when building XEmacs.
|
|
3179 */ );
|
|
3180 load_ignore_elc_files = 0;
|
|
3181
|
|
3182 #ifdef LOADHIST
|
|
3183 DEFVAR_LISP ("load-history", &Vload_history /*
|
|
3184 Alist mapping source file names to symbols and features.
|
|
3185 Each alist element is a list that starts with a file name,
|
|
3186 except for one element (optional) that starts with nil and describes
|
|
3187 definitions evaluated from buffers not visiting files.
|
|
3188 The remaining elements of each list are symbols defined as functions
|
|
3189 or variables, and cons cells `(provide . FEATURE)' and `(require . FEATURE)'.
|
|
3190 */ );
|
|
3191 Vload_history = Qnil;
|
|
3192
|
|
3193 DEFVAR_LISP ("current-load-list", &Vcurrent_load_list /*
|
|
3194 Used for internal purposes by `load'.
|
|
3195 */ );
|
|
3196 Vcurrent_load_list = Qnil;
|
|
3197 #endif
|
|
3198
|
|
3199 DEFVAR_LISP ("load-file-name", &Vload_file_name /*
|
|
3200 Full name of file being loaded by `load'.
|
|
3201 */ );
|
|
3202 Vload_file_name = Qnil;
|
|
3203
|
|
3204 DEFVAR_LISP ("load-read-function", &Vload_read_function /*
|
|
3205 "Function used by `load' and `eval-region' for reading expressions.
|
|
3206 The default is nil, which means use the function `read'.
|
|
3207 */ );
|
|
3208 Vload_read_function = Qnil;
|
|
3209
|
|
3210 DEFVAR_BOOL ("load-force-doc-strings", &load_force_doc_strings /*
|
|
3211 Non-nil means `load' should force-load all dynamic doc strings.
|
|
3212 This is useful when the file being loaded is a temporary copy.
|
|
3213 */ );
|
|
3214 load_force_doc_strings = 0;
|
|
3215
|
|
3216 DEFVAR_LISP ("source-directory", &Vsource_directory /*
|
|
3217 Directory in which XEmacs sources were found when XEmacs was built.
|
|
3218 You cannot count on them to still be there!
|
|
3219 */ );
|
|
3220 Vsource_directory = Qnil;
|
|
3221
|
|
3222 DEFVAR_BOOL ("fail-on-bucky-bit-character-escapes", &puke_on_fsf_keys /*
|
|
3223 Whether `read' should signal an error when it encounters unsupported
|
|
3224 character escape syntaxes or just read them incorrectly.
|
|
3225 */ );
|
|
3226 puke_on_fsf_keys = 0;
|
|
3227
|
|
3228 /* This must be initialized in init_lread otherwise it may start out
|
|
3229 with values saved when the image is dumped. */
|
|
3230 staticpro (&Vload_descriptor_list);
|
|
3231
|
231
|
3232 Vread_buffer_stream = Qnil;
|
0
|
3233 staticpro (&Vread_buffer_stream);
|
|
3234
|
|
3235 /* Initialized in init_lread. */
|
|
3236 staticpro (&Vload_force_doc_string_list);
|
|
3237
|
|
3238 Vload_file_name_internal = Qnil;
|
|
3239 staticpro (&Vload_file_name_internal);
|
|
3240
|
|
3241 Vload_file_name_internal_the_purecopy = Qnil;
|
|
3242 staticpro (&Vload_file_name_internal_the_purecopy);
|
|
3243
|
|
3244 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
|
|
3245 Vcurrent_compiled_function_annotation = Qnil;
|
|
3246 staticpro (&Vcurrent_compiled_function_annotation);
|
|
3247 #endif
|
|
3248
|
|
3249 /* So that early-early stuff will work */
|
|
3250 Ffset (Qload, intern ("load-internal"));
|
|
3251
|
140
|
3252 #ifdef FEATUREP_SYNTAX
|
207
|
3253 defsymbol (&Qfeaturep, "featurep");
|
140
|
3254 Fprovide(intern("xemacs"));
|
155
|
3255 #ifdef INFODOCK
|
|
3256 Fprovide(intern("infodock"));
|
231
|
3257 #endif /* INFODOCK */
|
|
3258 #endif /* FEATUREP_SYNTAX */
|
140
|
3259
|
0
|
3260 #ifdef LISP_BACKQUOTES
|
|
3261 old_backquote_flag = new_backquote_flag = 0;
|
|
3262 #endif
|
185
|
3263
|
0
|
3264 #ifdef I18N3
|
|
3265 Vfile_domain = Qnil;
|
|
3266 #endif
|
245
|
3267
|
|
3268 read_objects = Qnil;
|
|
3269 staticpro (&read_objects);
|
0
|
3270 }
|