comparison src/lread.c @ 814:a634e3b7acc8

[xemacs-hg @ 2002-04-14 12:41:59 by ben] latest changes TODO.ben-mule-21-5: Update. make-docfile.c: Add basic support for handling ISO 2022 doc strings -- we parse the basic charset designation sequences so we know whether we're in ASCII and have to pay attention to end quotes and such. Reformat code according to coding standards. abbrev.el: Add `global-abbrev-mode', which turns on or off abbrev-mode in all buffers. Added `defining-abbrev-turns-on-abbrev-mode' -- if non-nil, defining an abbrev through an interactive function will automatically turn on abbrev-mode, either globally or locally depending on the command. This is the "what you'd expect" behavior. indent.el: general function for indenting a balanced expression in a mode-correct way. Works similar to indent-region in that a mode can specify a specific command to do the whole operation; if not, figure out the region using forward-sexp and indent each line using indent-according-to-mode. keydefs.el: Removed. Modify M-C-backslash to do indent-region-or-balanced-expression. Make S-Tab just insert a TAB char, like it's meant to do. make-docfile.el: Now that we're using the call-process-in-lisp, we need to load an extra file win32-native.el because we're running a bare temacs. menubar-items.el: Totally redo the Cmds menu so that most used commands appear directly on the menu and less used commands appear in submenus. The old way may have been very pretty, but rather impractical. process.el: Under Windows, don't ever use old-call-process-internal, even in batch mode. We can do processes in batch mode. subr.el: Someone recoded truncate-string-to-width, saying "the FSF version is too complicated and does lots of hard-to-understand stuff" but the resulting recoded version was *totally* wrong! it misunderstood the basic point of this function, which is work in *columns* not chars. i dumped ours and copied the version from FSF 21.1. Also added truncate-string-with-continuation-dots, since this idiom is used often. config.inc.samp, xemacs.mak: Separate out debug and optimize flags. Remove all vestiges of USE_MINIMAL_TAGBITS, USE_INDEXED_LRECORD_IMPLEMENTATION, and GUNG_HO, since those ifdefs have long been removed. Make error-checking support actually work. Some rearrangement of config.inc.samp to make it more logical. Remove callproc.c and ntproc.c from xemacs.mak, no longer used. Make pdump the default. lisp.h: Add support for strong type-checking of Bytecount, Bytebpos, Charcount, Charbpos, and others, by making them classes, overloading the operators to provide integer-like operation and carefully controlling what operations are allowed. Not currently enabled in C++ builds because there are still a number of compile errors, and it won't really work till we merge in my "8-bit-Mule" workspace, in which I make use of the new types Charxpos, Bytexpos, Memxpos, representing a "position" either in a buffer or a string. (This is especially important in the extent code.) abbrev.c, alloc.c, eval.c, buffer.c, buffer.h, editfns.c, fns.c, text.h: Warning fixes, some of them related to new C++ strict type checking of Bytecount, Charbpos, etc. dired.c: Caught an actual error due to strong type checking -- char len being passed when should be byte len. alloc.c, backtrace.h, bytecode.c, bytecode.h, eval.c, sysdep.c: Further optimize Ffuncall: -- process arg list at compiled-function creation time, converting into an array for extra-quick access at funcall time. -- rewrite funcall_compiled_function to use it, and inline this function. -- change the order of check for magic stuff in SPECBIND_FAST_UNSAFE to be faster. -- move the check for need to garbage collect into the allocation code, so only a single flag needs to be checked in funcall. buffer.c, symbols.c: add debug funs to check on mule optimization info in buffers and strings. eval.c, emacs.c, text.c, regex.c, scrollbar-msw.c, search.c: Fix evil crashes due to eistrings not properly reinitialized under pdump. Redo a bit some of the init routines; convert some complex_vars_of() into simple vars_of(), because they didn't need complex processing. callproc.c, emacs.c, event-stream.c, nt.c, process.c, process.h, sysdep.c, sysdep.h, syssignal.h, syswindows.h, ntproc.c: Delete. Hallelujah, praise the Lord, there is no god but Allah!!! fix so that processes can be invoked in bare temacs -- thereby eliminating any need for callproc.c. (currently only eliminated under NT.) remove all crufty and unnecessary old process code in ntproc.c and elsewhere. move non-callproc-specific stuff (mostly environment) into process.c, so callproc.c can be left out under NT. console-tty.c, doc.c, file-coding.c, file-coding.h, lstream.c, lstream.h: fix doc string handling so it works with Japanese, etc docs. change handling of "character mode" so callers don't have to manually set it (quite error-prone). event-msw.c: spacing fixes. lread.c: eliminate unused crufty vintage-19 "FSF defun hack" code. lrecord.h: improve pdump description docs. buffer.c, ntheap.c, unexnt.c, win32.c, emacs.c: Mule-ize some unexec and startup code. It was pseudo-Mule-ized before by simply always calling the ...A versions of functions, but that won't cut it -- eventually we want to be able to run properly even if XEmacs has been installed in a Japanese directory. (The current problem is the timing of the loading of the Unicode tables; this will eventually be fixed.) Go through and fix various other places where the code was not Mule-clean. Provide a function mswindows_get_module_file_name() to get our own name without resort to PATH_MAX and such. Add a big comment in main() about the problem with Unicode table load timing that I just alluded to. emacs.c: When error-checking is enabled (interpreted as "user is developing XEmacs"), don't ask user to "pause to read messages" when a fatal error has occurred, because it will wedge if we are in an inner modal loop (typically when a menu is popped up) and make us unable to get a useful stack trace in the debugger. text.c: Correct update_entirely_ascii_p_flag to actually work. lisp.h, symsinit.h: declarations for above changes.
author ben
date Sun, 14 Apr 2002 12:43:31 +0000
parents a5954632b187
children 6728e641994e
comparison
equal deleted inserted replaced
813:9541922fb765 814:a634e3b7acc8
148 static int load_byte_code_version; 148 static int load_byte_code_version;
149 149
150 /* An array describing all known built-in structure types */ 150 /* An array describing all known built-in structure types */
151 static structure_type_dynarr *the_structure_type_dynarr; 151 static structure_type_dynarr *the_structure_type_dynarr;
152 152
153 #if 0 /* FSF defun hack */
154 /* When nonzero, read conses in pure space */
155 static int read_pure;
156 #endif
157
158 #if 0 /* FSF stuff */ 153 #if 0 /* FSF stuff */
159 /* For use within read-from-string (this reader is non-reentrant!!) */ 154 /* For use within read-from-string (this reader is non-reentrant!!) */
160 static int read_from_string_index; 155 static int read_from_string_index;
161 static int read_from_string_limit; 156 static int read_from_string_limit;
162 #endif 157 #endif
190 The approach we use is clean, solves all of these problems, and is 185 The approach we use is clean, solves all of these problems, and is
191 probably easier to implement anyway. We just save a list of all 186 probably easier to implement anyway. We just save a list of all
192 the containing objects that have (#$ . INT) conses in them (this 187 the containing objects that have (#$ . INT) conses in them (this
193 will only be compiled-function objects and lists), and when the 188 will only be compiled-function objects and lists), and when the
194 file is finished loading, we go through and fill in all the 189 file is finished loading, we go through and fill in all the
195 doc strings at once. */ 190 doc strings at once. --ben */
196 191
197 /* This contains the last string skipped with #@. */ 192 /* This contains the last string skipped with #@. */
198 static char *saved_doc_string; 193 static char *saved_doc_string;
199 /* Length of buffer allocated in saved_doc_string. */ 194 /* Length of buffer allocated in saved_doc_string. */
200 static int saved_doc_string_size; 195 static int saved_doc_string_size;
315 call1 (readcharfun, make_char (c)); 310 call1 (readcharfun, make_char (c));
316 } 311 }
317 312
318 static Lisp_Object read0 (Lisp_Object readcharfun); 313 static Lisp_Object read0 (Lisp_Object readcharfun);
319 static Lisp_Object read1 (Lisp_Object readcharfun); 314 static Lisp_Object read1 (Lisp_Object readcharfun);
320 /* allow_dotted_lists means that something like (foo bar . baz)
321 is acceptable. If -1, means check for starting with defun
322 and make structure pure. (not implemented, probably for very
323 good reasons)
324 */
325 /*
326 If check_for_doc_references, look for (#$ . INT) doc references
327 in the list and record if load_force_doc_strings is non-zero.
328 (Such doc references will be destroyed during the loadup phase
329 by replacing with Qzero, because Snarf-documentation will fill
330 them in again.)
331
332 WARNING: If you set this, you sure as hell better not call
333 free_list() on the returned list here. */
334
335 static Lisp_Object read_list (Lisp_Object readcharfun, 315 static Lisp_Object read_list (Lisp_Object readcharfun,
336 Emchar terminator, 316 Emchar terminator,
337 int allow_dotted_lists, 317 int allow_dotted_lists,
338 int check_for_doc_references); 318 int check_for_doc_references);
339 319
424 if (!INTP (XCDR (victim))) 404 if (!INTP (XCDR (victim)))
425 invalid_byte_code ("Bogus doc string reference", victim); 405 invalid_byte_code ("Bogus doc string reference", victim);
426 pos = XINT (XCDR (victim)); 406 pos = XINT (XCDR (victim));
427 if (pos < 0) 407 if (pos < 0)
428 pos = -pos; /* kludge to mark a user variable */ 408 pos = -pos; /* kludge to mark a user variable */
429 tem = unparesseuxify_doc_string (fd, pos, 0, Vload_file_name_internal); 409 tem = unparesseuxify_doc_string (fd, pos, 0, Vload_file_name_internal, 0);
430 if (!STRINGP (tem)) 410 if (!STRINGP (tem))
431 signal_error_1 (Qinvalid_byte_code, tem); 411 signal_error_1 (Qinvalid_byte_code, tem);
432 return tem; 412 return tem;
433 } 413 }
434 414
460 assert (COMPILED_FUNCTIONP (john)); 440 assert (COMPILED_FUNCTIONP (john));
461 if (CONSP (XCOMPILED_FUNCTION (john)->instructions)) 441 if (CONSP (XCOMPILED_FUNCTION (john)->instructions))
462 { 442 {
463 struct gcpro ngcpro1; 443 struct gcpro ngcpro1;
464 Lisp_Object juan = (pas_de_holgazan_ici 444 Lisp_Object juan = (pas_de_holgazan_ici
465 (fd, XCOMPILED_FUNCTION (john)->instructions)); 445 (fd,
446 XCOMPILED_FUNCTION (john)->instructions));
466 Lisp_Object ivan; 447 Lisp_Object ivan;
467 448
468 NGCPRO1 (juan); 449 NGCPRO1 (juan);
469 ivan = Fread (juan); 450 ivan = Fread (juan);
470 if (!CONSP (ivan)) 451 if (!CONSP (ivan))
1365 #else /* !LOADHIST */ 1346 #else /* !LOADHIST */
1366 #define build_load_history(x,y) 1347 #define build_load_history(x,y)
1367 #endif /* !LOADHIST */ 1348 #endif /* !LOADHIST */
1368 1349
1369 1350
1370 #if 0 /* FSFmacs defun hack */
1371 Lisp_Object
1372 unreadpure (void) /* Used as unwind-protect function in readevalloop */
1373 {
1374 read_pure = 0;
1375 return Qnil;
1376 }
1377 #endif /* 0 */
1378
1379 static void 1351 static void
1380 readevalloop (Lisp_Object readcharfun, 1352 readevalloop (Lisp_Object readcharfun,
1381 Lisp_Object sourcename, 1353 Lisp_Object sourcename,
1382 Lisp_Object (*evalfun) (Lisp_Object), 1354 Lisp_Object (*evalfun) (Lisp_Object),
1383 int printflag) 1355 int printflag)
1427 1399
1428 /* Ignore whitespace here, so we can detect eof. */ 1400 /* Ignore whitespace here, so we can detect eof. */
1429 if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r') 1401 if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r')
1430 continue; 1402 continue;
1431 1403
1432 #if 0 /* FSFmacs defun hack */ 1404 unreadchar (readcharfun, c);
1433 if (purify_flag && c == '(') 1405 Vread_objects = Qnil;
1434 { 1406 if (NILP (Vload_read_function))
1435 int count1 = specpdl_depth (); 1407 val = read0 (readcharfun);
1436 record_unwind_protect (unreadpure, Qnil);
1437 val = read_list (readcharfun, ')', -1, 1);
1438 unbind_to (count1);
1439 }
1440 else 1408 else
1441 #else /* No "defun hack" -- Emacs 19 uses read-time syntax for bytecodes */ 1409 val = call1 (Vload_read_function, readcharfun);
1442 {
1443 unreadchar (readcharfun, c);
1444 Vread_objects = Qnil;
1445 if (NILP (Vload_read_function))
1446 val = read0 (readcharfun);
1447 else
1448 val = call1 (Vload_read_function, readcharfun);
1449 }
1450 #endif
1451 val = (*evalfun) (val); 1410 val = (*evalfun) (val);
1452 if (printflag) 1411 if (printflag)
1453 { 1412 {
1454 Vvalues = Fcons (val, Vvalues); 1413 Vvalues = Fcons (val, Vvalues);
1455 if (EQ (Vstandard_output, Qt)) 1414 if (EQ (Vstandard_output, Qt))
2843 } 2802 }
2844 read_syntax_error (". in wrong context"); 2803 read_syntax_error (". in wrong context");
2845 } 2804 }
2846 } 2805 }
2847 2806
2848 #if 0 /* FSFmacs defun hack, or something ... */
2849 if (NILP (tail) && defun_hack && EQ (elt, Qdefun) && !read_pure)
2850 {
2851 record_unwind_protect (unreadpure, Qzero);
2852 read_pure = 1;
2853 }
2854 #endif
2855
2856 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK 2807 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
2857 if (s->length == 1 && s->allow_dotted_lists && EQ (XCAR (s->head), Qfset)) 2808 if (s->length == 1 && s->allow_dotted_lists && EQ (XCAR (s->head), Qfset))
2858 { 2809 {
2859 if (CONSP (elt) && EQ (XCAR (elt), Qquote) && CONSP (XCDR (elt))) 2810 if (CONSP (elt) && EQ (XCAR (elt), Qquote) && CONSP (XCDR (elt)))
2860 Vcurrent_compiled_function_annotation = XCAR (XCDR (elt)); 2811 Vcurrent_compiled_function_annotation = XCAR (XCDR (elt));
2873 s->length++; 2824 s->length++;
2874 return s; 2825 return s;
2875 } 2826 }
2876 2827
2877 2828
2878 #if 0 /* FSFmacs defun hack */ 2829 /* allow_dotted_lists means that something like (foo bar . baz)
2879 /* -1 for allow_dotted_lists means allow_dotted_lists and check 2830 is acceptable. If -1, means check for starting with defun
2880 for starting with defun and make structure pure. */ 2831 and make structure pure. (not implemented, probably for very
2881 #endif 2832 good reasons)
2833
2834 If check_for_doc_references, look for (#$ . INT) doc references
2835 in the list and record if load_force_doc_strings is non-zero.
2836 (Such doc references will be destroyed during the loadup phase
2837 by replacing with Qzero, because Snarf-documentation will fill
2838 them in again.)
2839
2840 WARNING: If you set this, you sure as hell better not call
2841 free_list() on the returned list here.
2842 */
2882 2843
2883 static Lisp_Object 2844 static Lisp_Object
2884 read_list (Lisp_Object readcharfun, 2845 read_list (Lisp_Object readcharfun,
2885 Emchar terminator, 2846 Emchar terminator,
2886 int allow_dotted_lists, 2847 int allow_dotted_lists,
2995 2956
2996 UNGCPRO; 2957 UNGCPRO;
2997 tem = s.head; 2958 tem = s.head;
2998 len = XINT (Flength (tem)); 2959 len = XINT (Flength (tem));
2999 2960
3000 #if 0 /* FSFmacs defun hack */ 2961 s.head = make_vector (len, Qnil);
3001 if (read_pure)
3002 s.head = make_pure_vector (len, Qnil);
3003 else
3004 #endif
3005 s.head = make_vector (len, Qnil);
3006 2962
3007 for (i = 0, p = &(XVECTOR_DATA (s.head)[0]); 2963 for (i = 0, p = &(XVECTOR_DATA (s.head)[0]);
3008 i < len; 2964 i < len;
3009 i++, p++) 2965 i++, p++)
3010 { 2966 {