comparison src/eval.c @ 826:6728e641994e

[xemacs-hg @ 2002-05-05 11:30:15 by ben] syntax cache, 8-bit-format, lots of code cleanup README.packages: Update info about --package-path. i.c: Create an inheritable event and pass it on to XEmacs, so that ^C can be handled properly. Intercept ^C and signal the event. "Stop Build" in VC++ now works. bytecomp-runtime.el: Doc string changes. compat.el: Some attempts to redo this to make it truly useful and fix the "multiple versions interacting with each other" problem. Not yet done. Currently doesn't work. files.el: Use with-obsolete-variable to avoid warnings in new revert-buffer code. xemacs.mak: Split up CFLAGS into a version without flags specifying the C library. The problem seems to be that minitar depends on zlib, which depends specifically on libc.lib, not on any of the other C libraries. Unless you compile with libc.lib, you get errors -- specifically, no _errno in the other libraries, which must make it something other than an int. (#### But this doesn't seem to obtain in XEmacs, which also uses zlib, and can be linked with any of the C libraries. Maybe zlib is used differently and doesn't need errno, or maybe XEmacs provides an int errno; ... I don't understand. Makefile.in.in: Fix so that packages are around when testing. abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.h, console-stream.c, console-x.c, console.c, console.h, data.c, device-msw.c, device.c, device.h, dialog-msw.c, dialog-x.c, dired-msw.c, dired.c, doc.c, doprnt.c, dumper.c, editfns.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, events.h, extents.c, extents.h, faces.c, file-coding.c, file-coding.h, fileio.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, frame.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-msw.h, glyphs-x.c, glyphs.c, glyphs.h, gui-msw.c, gui-x.c, gui.h, gutter.h, hash.h, indent.c, insdel.c, intl-win32.c, intl.c, keymap.c, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, nas.c, objects-msw.c, objects-x.c, opaque.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, process.h, profile.c, rangetab.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, regex.h, scrollbar-msw.c, search.c, select-x.c, specifier.c, specifier.h, symbols.c, symsinit.h, syntax.c, syntax.h, syswindows.h, tests.c, text.c, text.h, tooltalk.c, ui-byhand.c, ui-gtk.c, unicode.c, win32.c, window.c: Another big Ben patch. -- FUNCTIONALITY CHANGES: add partial support for 8-bit-fixed, 16-bit-fixed, and 32-bit-fixed formats. not quite done yet. (in particular, needs functions to actually convert the buffer.) NOTE: lots of changes to regex.c here. also, many new *_fmt() inline funs that take an Internal_Format argument. redo syntax cache code. make the cache per-buffer; keep the cache valid across calls to functions that use it. also keep it valid across insertions/deletions and extent changes, as much as is possible. eliminate the junky regex-reentrancy code by passing in the relevant lisp info to the regex routines as local vars. add general mechanism in extents code for signalling extent changes. fix numerous problems with the case-table implementation; yoshiki never properly transferred many algorithms from old-style to new-style case tables. redo char tables to support a default argument, so that mapping only occurs over changed args. change many chartab functions to accept Lisp_Object instead of Lisp_Char_Table *. comment out the code in font-lock.c by default, because font-lock.el no longer uses it. we should consider eliminating it entirely. Don't output bell as ^G in console-stream when not a TTY. add -mswindows-termination-handle to interface with i.c, so we can properly kill a build. add more error-checking to buffer/string macros. add some additional buffer_or_string_() funs. -- INTERFACE CHANGES AFFECTING MORE CODE: switch the arguments of write_c_string and friends to be consistent with write_fmt_string, which must have printcharfun first. change BI_* macros to BYTE_* for increased clarity; similarly for bi_* local vars. change VOID_TO_LISP to be a one-argument function. eliminate no-longer-needed CVOID_TO_LISP. -- char/string macro changes: rename MAKE_CHAR() to make_emchar() for slightly less confusion with make_char(). (The former generates an Emchar, the latter a Lisp object. Conceivably we should rename make_char() -> wrap_char() and similarly for make_int(), make_float().) Similar changes for other *CHAR* macros -- we now consistently use names with `emchar' whenever we are working with Emchars. Any remaining name with just `char' always refers to a Lisp object. rename macros with XSTRING_* to string_* except for those that reference actual fields in the Lisp_String object, following conventions used elsewhere. rename set_string_{data,length} macros (the only ones to work with a Lisp_String_* instead of a Lisp_Object) to set_lispstringp_* to make the difference clear. try to be consistent about caps vs. lowercase in macro/inline-fun names for chars and such, which wasn't the case before. we now reserve caps either for XFOO_ macros that reference object fields (e.g. XSTRING_DATA) or for things that have non-function semantics, e.g. directly modifying an arg (BREAKUP_EMCHAR) or evaluating an arg (any arg) more than once. otherwise, use lowercase. here is a summary of most of the macros/inline funs changed by all of the above changes: BYTE_*_P -> byte_*_p XSTRING_BYTE -> string_byte set_string_data/length -> set_lispstringp_data/length XSTRING_CHAR_LENGTH -> string_char_length XSTRING_CHAR -> string_emchar INTBYTE_FIRST_BYTE_P -> intbyte_first_byte_p INTBYTE_LEADING_BYTE_P -> intbyte_leading_byte_p charptr_copy_char -> charptr_copy_emchar LEADING_BYTE_* -> leading_byte_* CHAR_* -> EMCHAR_* *_CHAR_* -> *_EMCHAR_* *_CHAR -> *_EMCHAR CHARSET_BY_ -> charset_by_* BYTE_SHIFT_JIS* -> byte_shift_jis* BYTE_BIG5* -> byte_big5* REP_BYTES_BY_FIRST_BYTE -> rep_bytes_by_first_byte char_to_unicode -> emchar_to_unicode valid_char_p -> valid_emchar_p Change intbyte_strcmp -> qxestrcmp_c (duplicated functionality). -- INTERFACE CHANGES AFFECTING LESS CODE: use DECLARE_INLINE_HEADER in various places. remove '#ifdef emacs' from XEmacs-only files. eliminate CHAR_TABLE_VALUE(), which duplicated the functionality of get_char_table(). add BUFFER_TEXT_LOOP to simplify iterations over buffer text. define typedefs for signed and unsigned types of fixed sizes (INT_32_BIT, UINT_32_BIT, etc.). create ALIGN_FOR_TYPE as a higher-level interface onto ALIGN_SIZE; fix code to use it. add charptr_emchar_len to return the text length of the character pointed to by a ptr; use it in place of charcount_to_bytecount(..., 1). add emchar_len to return the text length of a given character. add types Bytexpos and Charxpos to generalize Bytebpos/Bytecount and Charbpos/Charcount, in code (particularly, the extents code and redisplay code) that works with either kind of index. rename redisplay struct params with names such as `charbpos' to e.g. `charpos' when they are e.g. a Charxpos, not a Charbpos. eliminate xxDEFUN in place of DEFUN; no longer necessary with changes awhile back to doc.c. split up big ugly combined list of EXFUNs in lisp.h on a file-by-file basis, since other prototypes are similarly split. rewrite some "*_UNSAFE" macros as inline funs and eliminate the _UNSAFE suffix. move most string code from lisp.h to text.h; the string code and text.h code is now intertwined in such a fashion that they need to be in the same place and partially interleaved. (you can't create forward references for inline funs) automated/lisp-tests.el, automated/symbol-tests.el, automated/test-harness.el: Fix test harness to output FAIL messages to stderr when in batch mode. Fix up some problems in lisp-tests/symbol-tests that were causing spurious failures.
author ben
date Sun, 05 May 2002 11:33:57 +0000
parents a634e3b7acc8
children e7ee5f8bde58
comparison
equal deleted inserted replaced
825:eb3bc15a6e0f 826:6728e641994e
296 const CIntbyte *trailer = subr->prompt ? " (interactive)>" : ">"; 296 const CIntbyte *trailer = subr->prompt ? " (interactive)>" : ">";
297 297
298 if (print_readably) 298 if (print_readably)
299 printing_unreadable_object ("%s%s%s", header, name, trailer); 299 printing_unreadable_object ("%s%s%s", header, name, trailer);
300 300
301 write_c_string (header, printcharfun); 301 write_c_string (printcharfun, header);
302 write_c_string (name, printcharfun); 302 write_c_string (printcharfun, name);
303 write_c_string (trailer, printcharfun); 303 write_c_string (printcharfun, trailer);
304 } 304 }
305 305
306 static const struct lrecord_description subr_description[] = { 306 static const struct lrecord_description subr_description[] = {
307 { XD_DOC_STRING, offsetof (Lisp_Subr, doc) }, 307 { XD_DOC_STRING, offsetof (Lisp_Subr, doc) },
308 { XD_END } 308 { XD_END }
1174 1174
1175 return 1175 return
1176 ((INTP (documentation) && XINT (documentation) < 0) || 1176 ((INTP (documentation) && XINT (documentation) < 0) ||
1177 1177
1178 (STRINGP (documentation) && 1178 (STRINGP (documentation) &&
1179 (XSTRING_BYTE (documentation, 0) == '*')) || 1179 (string_byte (documentation, 0) == '*')) ||
1180 1180
1181 /* If (STRING . INTEGER), a negative integer means a user variable. */ 1181 /* If (STRING . INTEGER), a negative integer means a user variable. */
1182 (CONSP (documentation) 1182 (CONSP (documentation)
1183 && STRINGP (XCAR (documentation)) 1183 && STRINGP (XCAR (documentation))
1184 && INTP (XCDR (documentation)) 1184 && INTP (XCDR (documentation))
5308 { 5308 {
5309 if (specpdl[speccount - 1].func == 0 5309 if (specpdl[speccount - 1].func == 0
5310 || specpdl[speccount - 1].func == specbind_unwind_local 5310 || specpdl[speccount - 1].func == specbind_unwind_local
5311 || specpdl[speccount - 1].func == specbind_unwind_wasnt_local) 5311 || specpdl[speccount - 1].func == specbind_unwind_wasnt_local)
5312 { 5312 {
5313 write_c_string (((!printing_bindings) ? " # bind (" : " "), 5313 write_c_string (stream, !printing_bindings ? " # bind (" : " ");
5314 stream);
5315 Fprin1 (specpdl[speccount - 1].symbol, stream); 5314 Fprin1 (specpdl[speccount - 1].symbol, stream);
5316 printing_bindings = 1; 5315 printing_bindings = 1;
5317 } 5316 }
5318 else 5317 else
5319 { 5318 {
5320 if (printing_bindings) write_c_string (")\n", stream); 5319 if (printing_bindings) write_c_string (stream, ")\n");
5321 write_c_string (" # (unwind-protect ...)\n", stream); 5320 write_c_string (stream, " # (unwind-protect ...)\n");
5322 printing_bindings = 0; 5321 printing_bindings = 0;
5323 } 5322 }
5324 } 5323 }
5325 if (printing_bindings) write_c_string (")\n", stream); 5324 if (printing_bindings) write_c_string (stream, ")\n");
5326 } 5325 }
5327 5326
5328 DEFUN ("backtrace", Fbacktrace, 0, 2, "", /* 5327 DEFUN ("backtrace", Fbacktrace, 0, 2, "", /*
5329 Print a trace of Lisp function calls currently active. 5328 Print a trace of Lisp function calls currently active.
5330 Optional arg STREAM specifies the output stream to send the backtrace to, 5329 Optional arg STREAM specifies the output stream to send the backtrace to,
5378 backtrace_specials (speccount, catchpdl, stream); 5377 backtrace_specials (speccount, catchpdl, stream);
5379 5378
5380 speccount = catches->pdlcount; 5379 speccount = catches->pdlcount;
5381 if (catchpdl == speccount) 5380 if (catchpdl == speccount)
5382 { 5381 {
5383 write_c_string (" # (catch ", stream); 5382 write_c_string (stream, " # (catch ");
5384 Fprin1 (catches->tag, stream); 5383 Fprin1 (catches->tag, stream);
5385 write_c_string (" ...)\n", stream); 5384 write_c_string (stream, " ...)\n");
5386 } 5385 }
5387 else 5386 else
5388 { 5387 {
5389 write_c_string (" # (condition-case ... . ", stream); 5388 write_c_string (stream, " # (condition-case ... . ");
5390 Fprin1 (Fcdr (Fcar (catches->tag)), stream); 5389 Fprin1 (Fcdr (Fcar (catches->tag)), stream);
5391 write_c_string (")\n", stream); 5390 write_c_string (stream, ")\n");
5392 } 5391 }
5393 catches = catches->next; 5392 catches = catches->next;
5394 } 5393 }
5395 else if (!backlist) 5394 else if (!backlist)
5396 break; 5395 break;
5399 if (!NILP (detailed) && backlist->pdlcount < speccount) 5398 if (!NILP (detailed) && backlist->pdlcount < speccount)
5400 { 5399 {
5401 backtrace_specials (speccount, backlist->pdlcount, stream); 5400 backtrace_specials (speccount, backlist->pdlcount, stream);
5402 speccount = backlist->pdlcount; 5401 speccount = backlist->pdlcount;
5403 } 5402 }
5404 write_c_string (((backlist->debug_on_exit) ? "* " : " "), 5403 write_c_string (stream, backlist->debug_on_exit ? "* " : " ");
5405 stream);
5406 if (backlist->nargs == UNEVALLED) 5404 if (backlist->nargs == UNEVALLED)
5407 { 5405 {
5408 Fprin1 (Fcons (*backlist->function, *backlist->args), stream); 5406 Fprin1 (Fcons (*backlist->function, *backlist->args), stream);
5409 write_c_string ("\n", stream); /* from FSFmacs 19.30 */ 5407 write_c_string (stream, "\n"); /* from FSFmacs 19.30 */
5410 } 5408 }
5411 else 5409 else
5412 { 5410 {
5413 Lisp_Object tem = *backlist->function; 5411 Lisp_Object tem = *backlist->function;
5414 Fprin1 (tem, stream); /* This can QUIT */ 5412 Fprin1 (tem, stream); /* This can QUIT */
5415 write_c_string ("(", stream); 5413 write_c_string (stream, "(");
5416 if (backlist->nargs == MANY) 5414 if (backlist->nargs == MANY)
5417 { 5415 {
5418 int i; 5416 int i;
5419 Lisp_Object tail = Qnil; 5417 Lisp_Object tail = Qnil;
5420 struct gcpro ngcpro1; 5418 struct gcpro ngcpro1;
5422 NGCPRO1 (tail); 5420 NGCPRO1 (tail);
5423 for (tail = *backlist->args, i = 0; 5421 for (tail = *backlist->args, i = 0;
5424 !NILP (tail); 5422 !NILP (tail);
5425 tail = Fcdr (tail), i++) 5423 tail = Fcdr (tail), i++)
5426 { 5424 {
5427 if (i != 0) write_c_string (" ", stream); 5425 if (i != 0) write_c_string (stream, " ");
5428 Fprin1 (Fcar (tail), stream); 5426 Fprin1 (Fcar (tail), stream);
5429 } 5427 }
5430 NUNGCPRO; 5428 NUNGCPRO;
5431 } 5429 }
5432 else 5430 else
5433 { 5431 {
5434 int i; 5432 int i;
5435 for (i = 0; i < backlist->nargs; i++) 5433 for (i = 0; i < backlist->nargs; i++)
5436 { 5434 {
5437 if (!i && EQ(tem, Qbyte_code)) { 5435 if (!i && EQ (tem, Qbyte_code))
5438 write_c_string("\"...\"", stream); 5436 {
5439 continue; 5437 write_c_string (stream, "\"...\"");
5440 } 5438 continue;
5441 if (i != 0) write_c_string (" ", stream); 5439 }
5440 if (i != 0) write_c_string (stream, " ");
5442 Fprin1 (backlist->args[i], stream); 5441 Fprin1 (backlist->args[i], stream);
5443 } 5442 }
5444 } 5443 }
5445 write_c_string (")\n", stream); 5444 write_c_string (stream, ")\n");
5446 } 5445 }
5447 backlist = backlist->next; 5446 backlist = backlist->next;
5448 } 5447 }
5449 } 5448 }
5450 Vprint_level = old_level; 5449 Vprint_level = old_level;