comparison src/lread.c @ 563:183866b06e0b

[xemacs-hg @ 2001-05-24 07:50:48 by ben] Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c: -- defsymbol -> DEFSYMBOL. -- add an error type to all errors. -- eliminate the error functions in eval.c that let you just use Qerror as the type. -- redo the error API to be more consistent, sensibly named, and easier to use. -- redo the error hierarchy somewhat. create new errors: structure-formation-error, gui-error, invalid-constant, stack-overflow, out-of-memory, process-error, network-error, sound-error, printing-unreadable-object, base64-conversion- error; coding-system-error renamed to text-conversion error; some others. -- fix Mule problems in error strings in emodules.c, tooltalk.c. -- fix error handling in mswin open-network-stream. -- Mule-ize all sound files and clean up the headers. -- nativesound.h -> sound.h and used for all sound files. -- move some shared stuff into glyphs-shared.c: first attempt at eliminating some of the massive GTK code duplication. xemacs.mak: add glyphs-shared.c. xemacs-faq.texi: document how to debug X errors subr.el: fix doc string to reflect reality
author ben
date Thu, 24 May 2001 07:51:33 +0000
parents ed498ef2108b
children 190b164ddcac
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
218 218
219 219
220 static DOESNT_RETURN 220 static DOESNT_RETURN
221 read_syntax_error (const char *string) 221 read_syntax_error (const char *string)
222 { 222 {
223 signal_error (Qinvalid_read_syntax, 223 signal_error (Qinvalid_read_syntax, string, Qunbound);
224 list1 (build_translated_string (string)));
225 } 224 }
226 225
227 static Lisp_Object 226 static Lisp_Object
228 continuable_read_syntax_error (const char *string) 227 continuable_read_syntax_error (const char *string)
229 { 228 {
230 return Fsignal (Qinvalid_read_syntax, 229 return signal_continuable_error (Qinvalid_read_syntax, string, Qunbound);
231 list1 (build_translated_string (string)));
232 } 230 }
233 231
234 232
235 /* Handle unreading and rereading of characters. */ 233 /* Handle unreading and rereading of characters. */
236 static Emchar 234 static Emchar
242 { 240 {
243 Emchar c; 241 Emchar c;
244 struct buffer *b = XBUFFER (readcharfun); 242 struct buffer *b = XBUFFER (readcharfun);
245 243
246 if (!BUFFER_LIVE_P (b)) 244 if (!BUFFER_LIVE_P (b))
247 error ("Reading from killed buffer"); 245 invalid_operation ("Reading from killed buffer", Qunbound);
248 246
249 if (BUF_PT (b) >= BUF_ZV (b)) 247 if (BUF_PT (b) >= BUF_ZV (b))
250 return -1; 248 return -1;
251 c = BUF_FETCH_CHAR (b, BUF_PT (b)); 249 c = BUF_FETCH_CHAR (b, BUF_PT (b));
252 BUF_SET_PT (b, BUF_PT (b) + 1); 250 BUF_SET_PT (b, BUF_PT (b) + 1);
425 { 423 {
426 Lisp_Object tem; 424 Lisp_Object tem;
427 EMACS_INT pos; 425 EMACS_INT pos;
428 426
429 if (!INTP (XCDR (victim))) 427 if (!INTP (XCDR (victim)))
430 signal_simple_error ("Bogus doc string reference", victim); 428 invalid_byte_code ("Bogus doc string reference", victim);
431 pos = XINT (XCDR (victim)); 429 pos = XINT (XCDR (victim));
432 if (pos < 0) 430 if (pos < 0)
433 pos = -pos; /* kludge to mark a user variable */ 431 pos = -pos; /* kludge to mark a user variable */
434 tem = unparesseuxify_doc_string (fd, pos, 0, Vload_file_name_internal); 432 tem = unparesseuxify_doc_string (fd, pos, 0, Vload_file_name_internal);
435 if (!STRINGP (tem)) 433 if (!STRINGP (tem))
436 signal_error (Qerror, tem); 434 signal_error_1 (Qinvalid_byte_code, tem);
437 return tem; 435 return tem;
438 } 436 }
439 437
440 static Lisp_Object 438 static Lisp_Object
441 load_force_doc_string_unwind (Lisp_Object oldlist) 439 load_force_doc_string_unwind (Lisp_Object oldlist)
471 Lisp_Object ivan; 469 Lisp_Object ivan;
472 470
473 NGCPRO1 (juan); 471 NGCPRO1 (juan);
474 ivan = Fread (juan); 472 ivan = Fread (juan);
475 if (!CONSP (ivan)) 473 if (!CONSP (ivan))
476 signal_simple_error ("invalid lazy-loaded byte code", ivan); 474 invalid_byte_code ("invalid lazy-loaded byte code", ivan);
477 XCOMPILED_FUNCTION (john)->instructions = XCAR (ivan); 475 XCOMPILED_FUNCTION (john)->instructions = XCAR (ivan);
478 /* v18 or v19 bytecode file. Need to Ebolify. */ 476 /* v18 or v19 bytecode file. Need to Ebolify. */
479 if (XCOMPILED_FUNCTION (john)->flags.ebolified 477 if (XCOMPILED_FUNCTION (john)->flags.ebolified
480 && VECTORP (XCDR (ivan))) 478 && VECTORP (XCDR (ivan)))
481 ebolify_bytecode_constants (XCDR (ivan)); 479 ebolify_bytecode_constants (XCDR (ivan));
596 -1); 594 -1);
597 595
598 if (fd < 0) 596 if (fd < 0)
599 { 597 {
600 if (NILP (noerror)) 598 if (NILP (noerror))
601 signal_file_error ("Cannot open load file", file); 599 signal_error (Qfile_error, "Cannot open load file", file);
602 else 600 else
603 { 601 {
604 UNGCPRO; 602 UNGCPRO;
605 return Qnil; 603 return Qnil;
606 } 604 }
814 { 812 {
815 check_int_range (XINT (mode), 0, 7); 813 check_int_range (XINT (mode), 0, 7);
816 return XINT (mode); 814 return XINT (mode);
817 } 815 }
818 else 816 else
819 signal_simple_error ("Invalid value", mode); 817 invalid_argument ("Invalid value", mode);
820 return 0; /* unreached */ 818 return 0; /* unreached */
821 } 819 }
822 820
823 static int 821 static int
824 decode_mode (Lisp_Object mode) 822 decode_mode (Lisp_Object mode)
1408 while (1) 1406 while (1)
1409 { 1407 {
1410 QUIT; 1408 QUIT;
1411 1409
1412 if (b != 0 && !BUFFER_LIVE_P (b)) 1410 if (b != 0 && !BUFFER_LIVE_P (b))
1413 error ("Reading from killed buffer"); 1411 invalid_operation ("Reading from killed buffer", Qunbound);
1414 1412
1415 c = readchar (readcharfun); 1413 c = readchar (readcharfun);
1416 if (c == ';') 1414 if (c == ';')
1417 { 1415 {
1418 /* Skip comment */ 1416 /* Skip comment */
1485 if (NILP (buffer)) 1483 if (NILP (buffer))
1486 buf = Fcurrent_buffer (); 1484 buf = Fcurrent_buffer ();
1487 else 1485 else
1488 buf = Fget_buffer (buffer); 1486 buf = Fget_buffer (buffer);
1489 if (NILP (buf)) 1487 if (NILP (buf))
1490 error ("No such buffer."); 1488 invalid_argument ("No such buffer", Qunbound);
1491 1489
1492 if (NILP (printflag)) 1490 if (NILP (printflag))
1493 tem = Qsymbolp; /* #### #@[]*&$#*[& SI:NULL-STREAM */ 1491 tem = Qsymbolp; /* #### #@[]*&$#*[& SI:NULL-STREAM */
1494 else 1492 else
1495 tem = printflag; 1493 tem = printflag;
1670 { 1668 {
1671 /* This function can GC */ 1669 /* This function can GC */
1672 Emchar c = readchar (readcharfun); 1670 Emchar c = readchar (readcharfun);
1673 1671
1674 if (c < 0) 1672 if (c < 0)
1675 signal_error (Qend_of_file, list1 (READCHARFUN_MAYBE (readcharfun))); 1673 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun));
1676 1674
1677 switch (c) 1675 switch (c)
1678 { 1676 {
1679 case 'a': return '\007'; 1677 case 'a': return '\007';
1680 case 'b': return '\b'; 1678 case 'b': return '\b';
1688 case '\n': return -1; 1686 case '\n': return -1;
1689 1687
1690 case 'M': 1688 case 'M':
1691 c = readchar (readcharfun); 1689 c = readchar (readcharfun);
1692 if (c < 0) 1690 if (c < 0)
1693 signal_error (Qend_of_file, list1 (READCHARFUN_MAYBE (readcharfun))); 1691 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun));
1694 if (c != '-') 1692 if (c != '-')
1695 error ("Invalid escape character syntax"); 1693 syntax_error ("Invalid escape character syntax", Qunbound);
1696 c = readchar (readcharfun); 1694 c = readchar (readcharfun);
1697 if (c < 0) 1695 if (c < 0)
1698 signal_error (Qend_of_file, list1 (READCHARFUN_MAYBE (readcharfun))); 1696 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun));
1699 if (c == '\\') 1697 if (c == '\\')
1700 c = read_escape (readcharfun); 1698 c = read_escape (readcharfun);
1701 return c | 0200; 1699 return c | 0200;
1702 1700
1703 /* Originally, FSF_KEYS provided a degree of FSF Emacs 1701 /* Originally, FSF_KEYS provided a degree of FSF Emacs
1723 byte_compiled code will still work fsfmacs, though... --Stig 1721 byte_compiled code will still work fsfmacs, though... --Stig
1724 1722
1725 #define ctl_modifier (0x400000) 1723 #define ctl_modifier (0x400000)
1726 #define meta_modifier (0x800000) 1724 #define meta_modifier (0x800000)
1727 */ 1725 */
1728 #define FSF_LOSSAGE(mask) \ 1726 #define FSF_LOSSAGE(mask) \
1729 if (fail_on_bucky_bit_character_escapes || \ 1727 if (fail_on_bucky_bit_character_escapes || \
1730 ((c = readchar (readcharfun)) != '-')) \ 1728 ((c = readchar (readcharfun)) != '-')) \
1731 error ("Invalid escape character syntax"); \ 1729 syntax_error ("Invalid escape character syntax", Qunbound); \
1732 c = readchar (readcharfun); \ 1730 c = readchar (readcharfun); \
1733 if (c < 0) \ 1731 if (c < 0) \
1734 signal_error (Qend_of_file, list1 (READCHARFUN_MAYBE (readcharfun))); \ 1732 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun)); \
1735 if (c == '\\') \ 1733 if (c == '\\') \
1736 c = read_escape (readcharfun); \ 1734 c = read_escape (readcharfun); \
1737 return c | mask 1735 return c | mask
1738 1736
1739 case 'S': FSF_LOSSAGE (shift_modifier); 1737 case 'S': FSF_LOSSAGE (shift_modifier);
1740 case 'H': FSF_LOSSAGE (hyper_modifier); 1738 case 'H': FSF_LOSSAGE (hyper_modifier);
1741 case 'A': FSF_LOSSAGE (alt_modifier); 1739 case 'A': FSF_LOSSAGE (alt_modifier);
1749 #endif /* FSF_KEYS */ 1747 #endif /* FSF_KEYS */
1750 1748
1751 case 'C': 1749 case 'C':
1752 c = readchar (readcharfun); 1750 c = readchar (readcharfun);
1753 if (c < 0) 1751 if (c < 0)
1754 signal_error (Qend_of_file, list1 (READCHARFUN_MAYBE (readcharfun))); 1752 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun));
1755 if (c != '-') 1753 if (c != '-')
1756 error ("Invalid escape character syntax"); 1754 syntax_error ("Invalid escape character syntax", Qunbound);
1757 case '^': 1755 case '^':
1758 c = readchar (readcharfun); 1756 c = readchar (readcharfun);
1759 if (c < 0) 1757 if (c < 0)
1760 signal_error (Qend_of_file, list1 (READCHARFUN_MAYBE (readcharfun))); 1758 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun));
1761 if (c == '\\') 1759 if (c == '\\')
1762 c = read_escape (readcharfun); 1760 c = read_escape (readcharfun);
1763 /* FSFmacs junk for non-ASCII controls. 1761 /* FSFmacs junk for non-ASCII controls.
1764 Not used here. */ 1762 Not used here. */
1765 if (c == '?') 1763 if (c == '?')
1851 { 1849 {
1852 if (c == '\\') 1850 if (c == '\\')
1853 { 1851 {
1854 c = readchar (readcharfun); 1852 c = readchar (readcharfun);
1855 if (c < 0) 1853 if (c < 0)
1856 signal_error (Qend_of_file, list1 (READCHARFUN_MAYBE (readcharfun))); 1854 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun));
1857 *saw_a_backslash = 1; 1855 *saw_a_backslash = 1;
1858 } 1856 }
1859 Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), c); 1857 Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), c);
1860 QUIT; 1858 QUIT;
1861 c = readchar (readcharfun); 1859 c = readchar (readcharfun);
2211 2209
2212 retry: 2210 retry:
2213 QUIT; 2211 QUIT;
2214 c = readchar (readcharfun); 2212 c = readchar (readcharfun);
2215 if (c < 0) 2213 if (c < 0)
2216 signal_error (Qend_of_file, list1 (READCHARFUN_MAYBE (readcharfun))); 2214 signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun));
2217 2215
2218 switch (c) 2216 switch (c)
2219 { 2217 {
2220 default: 2218 default:
2221 { 2219 {
2817 else if (ch == ')') 2815 else if (ch == ')')
2818 read_syntax_error ("')' in a vector"); 2816 read_syntax_error ("')' in a vector");
2819 else 2817 else
2820 #endif 2818 #endif
2821 if (ch != '.') 2819 if (ch != '.')
2822 signal_simple_error ("BUG! Internal reader error", elt); 2820 signal_error (Qinternal_error, "BUG! Internal reader error", elt);
2823 else if (!s->allow_dotted_lists) 2821 else if (!s->allow_dotted_lists)
2824 read_syntax_error ("\".\" in a vector"); 2822 read_syntax_error ("\".\" in a vector");
2825 else 2823 else
2826 { 2824 {
2827 if (!NILP (s->tail)) 2825 if (!NILP (s->tail))
3116 DEFSUBR (Flocate_file); 3114 DEFSUBR (Flocate_file);
3117 DEFSUBR (Flocate_file_clear_hashing); 3115 DEFSUBR (Flocate_file_clear_hashing);
3118 DEFSUBR (Feval_buffer); 3116 DEFSUBR (Feval_buffer);
3119 DEFSUBR (Feval_region); 3117 DEFSUBR (Feval_region);
3120 3118
3121 defsymbol (&Qstandard_input, "standard-input"); 3119 DEFSYMBOL (Qstandard_input);
3122 defsymbol (&Qread_char, "read-char"); 3120 DEFSYMBOL (Qread_char);
3123 defsymbol (&Qcurrent_load_list, "current-load-list"); 3121 DEFSYMBOL (Qcurrent_load_list);
3124 defsymbol (&Qload, "load"); 3122 DEFSYMBOL (Qload);
3125 defsymbol (&Qload_file_name, "load-file-name"); 3123 DEFSYMBOL (Qload_file_name);
3126 defsymbol (&Qfset, "fset"); 3124 DEFSYMBOL (Qfset);
3127 3125
3128 #ifdef LISP_BACKQUOTES 3126 #ifdef LISP_BACKQUOTES
3129 defsymbol (&Qbackquote, "backquote"); 3127 DEFSYMBOL (Qbackquote);
3130 defsymbol (&Qbacktick, "`"); 3128 defsymbol (&Qbacktick, "`");
3131 defsymbol (&Qcomma, ","); 3129 defsymbol (&Qcomma, ",");
3132 defsymbol (&Qcomma_at, ",@"); 3130 defsymbol (&Qcomma_at, ",@");
3133 defsymbol (&Qcomma_dot, ",."); 3131 defsymbol (&Qcomma_dot, ",.");
3134 #endif 3132 #endif
3135 3133
3136 defsymbol (&Qexists, "exists"); 3134 DEFSYMBOL (Qexists);
3137 defsymbol (&Qreadable, "readable"); 3135 DEFSYMBOL (Qreadable);
3138 defsymbol (&Qwritable, "writable"); 3136 DEFSYMBOL (Qwritable);
3139 defsymbol (&Qexecutable, "executable"); 3137 DEFSYMBOL (Qexecutable);
3140 } 3138 }
3141 3139
3142 void 3140 void
3143 structure_type_create (void) 3141 structure_type_create (void)
3144 { 3142 {
3290 3288
3291 /* So that early-early stuff will work */ 3289 /* So that early-early stuff will work */
3292 Ffset (Qload, intern ("load-internal")); 3290 Ffset (Qload, intern ("load-internal"));
3293 3291
3294 #ifdef FEATUREP_SYNTAX 3292 #ifdef FEATUREP_SYNTAX
3295 defsymbol (&Qfeaturep, "featurep"); 3293 DEFSYMBOL (Qfeaturep);
3296 Fprovide(intern("xemacs")); 3294 Fprovide(intern("xemacs"));
3297 #ifdef INFODOCK 3295 #ifdef INFODOCK
3298 Fprovide(intern("infodock")); 3296 Fprovide(intern("infodock"));
3299 #endif /* INFODOCK */ 3297 #endif /* INFODOCK */
3300 #endif /* FEATUREP_SYNTAX */ 3298 #endif /* FEATUREP_SYNTAX */