comparison src/search.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 167135c7a7ae
children 190b164ddcac
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
124 int posix); 124 int posix);
125 125
126 static void 126 static void
127 matcher_overflow (void) 127 matcher_overflow (void)
128 { 128 {
129 error ("Stack overflow in regexp matcher"); 129 stack_overflow ("Stack overflow in regexp matcher", Qunbound);
130 } 130 }
131 131
132 /* Compile a regexp and signal a Lisp error if anything goes wrong. 132 /* Compile a regexp and signal a Lisp error if anything goes wrong.
133 PATTERN is the pattern to compile. 133 PATTERN is the pattern to compile.
134 CP is the place to put the result. 134 CP is the place to put the result.
157 re_compile_pattern ((char *) XSTRING_DATA (pattern), 157 re_compile_pattern ((char *) XSTRING_DATA (pattern),
158 XSTRING_LENGTH (pattern), &cp->buf); 158 XSTRING_LENGTH (pattern), &cp->buf);
159 re_set_syntax (old); 159 re_set_syntax (old);
160 if (val) 160 if (val)
161 { 161 {
162 maybe_signal_error (Qinvalid_regexp, list1 (build_string (val)), 162 maybe_signal_error (Qinvalid_regexp, 0, build_string (val),
163 Qsearch, errb); 163 Qsearch, errb);
164 return 0; 164 return 0;
165 } 165 }
166 166
167 cp->regexp = Fcopy_sequence (pattern); 167 cp->regexp = Fcopy_sequence (pattern);
827 if (syntaxp) 827 if (syntaxp)
828 { 828 {
829 if (c < 0400 && syntax_spec_code[c] < (unsigned char) Smax) 829 if (c < 0400 && syntax_spec_code[c] < (unsigned char) Smax)
830 fastmap[c] = 1; 830 fastmap[c] = 1;
831 else 831 else
832 signal_simple_error ("Invalid syntax designator", 832 invalid_argument ("Invalid syntax designator",
833 make_char (c)); 833 make_char (c));
834 } 834 }
835 else 835 else
836 { 836 {
837 if (c == '\\') 837 if (c == '\\')
1035 else 1035 else
1036 { 1036 {
1037 CHECK_INT_COERCE_MARKER (limit); 1037 CHECK_INT_COERCE_MARKER (limit);
1038 lim = XINT (limit); 1038 lim = XINT (limit);
1039 if (n > 0 ? lim < BUF_PT (buf) : lim > BUF_PT (buf)) 1039 if (n > 0 ? lim < BUF_PT (buf) : lim > BUF_PT (buf))
1040 error ("Invalid search limit (wrong side of point)"); 1040 invalid_argument ("Invalid search limit (wrong side of point)",
1041 Qunbound);
1041 if (lim > BUF_ZV (buf)) 1042 if (lim > BUF_ZV (buf))
1042 lim = BUF_ZV (buf); 1043 lim = BUF_ZV (buf);
1043 if (lim < BUF_BEGV (buf)) 1044 if (lim < BUF_BEGV (buf))
1044 lim = BUF_BEGV (buf); 1045 lim = BUF_BEGV (buf);
1045 } 1046 }
2278 2279
2279 if (! NILP (string)) 2280 if (! NILP (string))
2280 { 2281 {
2281 CHECK_STRING (string); 2282 CHECK_STRING (string);
2282 if (!EQ (last_thing_searched, Qt)) 2283 if (!EQ (last_thing_searched, Qt))
2283 error ("last thing matched was not a string"); 2284 invalid_argument ("last thing matched was not a string", Qunbound);
2284 /* If the match data 2285 /* If the match data
2285 were abstracted into a special "match data" type instead 2286 were abstracted into a special "match data" type instead
2286 of the typical half-assed "let the implementation be 2287 of the typical half-assed "let the implementation be
2287 visible" form it's in, we could extend it to include 2288 visible" form it's in, we could extend it to include
2288 the last string matched and the buffer used for that 2289 the last string matched and the buffer used for that
2300 sub = XINT (strbuffer); 2301 sub = XINT (strbuffer);
2301 if (sub < 0 || sub >= (int) search_regs.num_regs) 2302 if (sub < 0 || sub >= (int) search_regs.num_regs)
2302 args_out_of_range (strbuffer, make_int (search_regs.num_regs)); 2303 args_out_of_range (strbuffer, make_int (search_regs.num_regs));
2303 } 2304 }
2304 if (!BUFFERP (last_thing_searched)) 2305 if (!BUFFERP (last_thing_searched))
2305 error ("last thing matched was not a buffer"); 2306 invalid_argument ("last thing matched was not a buffer", Qunbound);
2306 buffer = last_thing_searched; 2307 buffer = last_thing_searched;
2307 buf = XBUFFER (buffer); 2308 buf = XBUFFER (buffer);
2308 } 2309 }
2309 2310
2310 syntax_table = XCHAR_TABLE (buf->mirror_syntax_table); 2311 syntax_table = XCHAR_TABLE (buf->mirror_syntax_table);
2311 2312
2312 case_action = nochange; /* We tried an initialization */ 2313 case_action = nochange; /* We tried an initialization */
2313 /* but some C compilers blew it */ 2314 /* but some C compilers blew it */
2314 2315
2315 if (search_regs.num_regs == 0) 2316 if (search_regs.num_regs == 0)
2316 error ("replace-match called before any match found"); 2317 signal_error (Qinvalid_operation, "replace-match called before any match found", Qunbound);
2317 2318
2318 if (NILP (string)) 2319 if (NILP (string))
2319 { 2320 {
2320 if (search_regs.start[sub] < BUF_BEGV (buf) 2321 if (search_regs.start[sub] < BUF_BEGV (buf)
2321 || search_regs.start[sub] > search_regs.end[sub] 2322 || search_regs.start[sub] > search_regs.end[sub]
2745 Lisp_Object *data; 2746 Lisp_Object *data;
2746 int i; 2747 int i;
2747 Charcount len; 2748 Charcount len;
2748 2749
2749 if (NILP (last_thing_searched)) 2750 if (NILP (last_thing_searched))
2750 /*error ("match-data called before any match found");*/ 2751 /*error ("match-data called before any match found", Qunbound);*/
2751 return Qnil; 2752 return Qnil;
2752 2753
2753 data = alloca_array (Lisp_Object, 2 * search_regs.num_regs); 2754 data = alloca_array (Lisp_Object, 2 * search_regs.num_regs);
2754 2755
2755 len = -1; 2756 len = -1;
2980 syms_of_search (void) 2981 syms_of_search (void)
2981 { 2982 {
2982 2983
2983 DEFERROR_STANDARD (Qsearch_failed, Qinvalid_operation); 2984 DEFERROR_STANDARD (Qsearch_failed, Qinvalid_operation);
2984 DEFERROR_STANDARD (Qinvalid_regexp, Qsyntax_error); 2985 DEFERROR_STANDARD (Qinvalid_regexp, Qsyntax_error);
2986 Fput (Qinvalid_regexp, Qerror_lacks_explanatory_string, Qt);
2985 2987
2986 DEFSUBR (Flooking_at); 2988 DEFSUBR (Flooking_at);
2987 DEFSUBR (Fposix_looking_at); 2989 DEFSUBR (Fposix_looking_at);
2988 DEFSUBR (Fstring_match); 2990 DEFSUBR (Fstring_match);
2989 DEFSUBR (Fposix_string_match); 2991 DEFSUBR (Fposix_string_match);