X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Fsearch.c;h=7ca50a6a0ff04726e241ae0cf8e6df5751a6c82f;hp=7eebe5c99510b51d16bf5d35b1a70492bf8da0e7;hb=7b241b273a632ab80d7c620b5add28d5f11b0fd3;hpb=79d2db7d65205bc85d471590726d0cf3af5598e0 diff --git a/src/search.c b/src/search.c index 7eebe5c..7ca50a6 100644 --- a/src/search.c +++ b/src/search.c @@ -1,6 +1,7 @@ /* String search routines for XEmacs. Copyright (C) 1985, 1986, 1987, 1992-1995 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. + Copyright (C) 1999,2000,2001 MORIOKA Tomohiko This file is part of XEmacs. @@ -109,7 +110,6 @@ Lisp_Object Vskip_chars_range_table; static void set_search_regs (struct buffer *buf, Bufpos beg, Charcount len); static void clear_unused_search_regs (struct re_registers *regp, int no_sub); -/* #### according to comment in 21.5, unnecessary */ static void save_search_regs (void); static Bufpos simple_search (struct buffer *buf, Bufbyte *base_pat, Bytecount len, Bytind pos, Bytind lim, @@ -788,8 +788,12 @@ skip_chars (struct buffer *buf, int forwardp, int syntaxp, int negate = 0; REGISTER int i; #ifndef emacs +#ifdef UTF2000 + Lisp_Char_Table *syntax_table = XCHAR_TABLE (buf->syntax_table); +#else Lisp_Char_Table *syntax_table = XCHAR_TABLE (buf->mirror_syntax_table); #endif +#endif Bufpos limit; if (NILP (lim)) @@ -1085,7 +1089,7 @@ search_command (Lisp_Object string, Lisp_Object limit, Lisp_Object noerror, if (!EQ (noerror, Qt)) { if (lim < BUF_BEGV (buf) || lim > BUF_ZV (buf)) - abort (); + ABORT (); BUF_SET_PT (buf, lim); return Qnil; #if 0 /* This would be clean, but maybe programs depend on @@ -1098,7 +1102,7 @@ search_command (Lisp_Object string, Lisp_Object limit, Lisp_Object noerror, } if (np < BUF_BEGV (buf) || np > BUF_ZV (buf)) - abort (); + ABORT (); BUF_SET_PT (buf, np); @@ -1319,7 +1323,11 @@ search_buffer (struct buffer *buf, Lisp_Object string, Bufpos bufpos, { /* Keep track of which character set row contains the characters that need translation. */ +#ifdef UTF2000 + int charset_base_code = c >> 6; +#else int charset_base_code = c & ~CHAR_FIELD3_MASK; +#endif if (charset_base == -1) charset_base = charset_base_code; else if (charset_base != charset_base_code) @@ -1619,7 +1627,11 @@ boyer_moore (struct buffer *buf, Bufbyte *base_pat, Bytecount len, while (!BUFBYTE_FIRST_BYTE_P (*charstart)) charstart--; untranslated = charptr_emchar (charstart); +#ifdef UTF2000 + if (charset_base == (untranslated >> 6)) +#else if (charset_base == (untranslated & ~CHAR_FIELD3_MASK)) +#endif { ch = TRANSLATE (trt, untranslated); if (!BUFBYTE_FIRST_BYTE_P (*ptr)) @@ -1989,7 +2001,11 @@ wordify (Lisp_Object buffer, Lisp_Object string) Charcount i, len; EMACS_INT punct_count = 0, word_count = 0; struct buffer *buf = decode_buffer (buffer, 0); +#ifdef UTF2000 + Lisp_Char_Table *syntax_table = XCHAR_TABLE (buf->syntax_table); +#else Lisp_Char_Table *syntax_table = XCHAR_TABLE (buf->mirror_syntax_table); +#endif CHECK_STRING (string); len = XSTRING_CHAR_LENGTH (string); @@ -2358,7 +2374,11 @@ match since only regular expressions have distinguished subexpressions. buf = XBUFFER (buffer); } +#ifdef UTF2000 + syntax_table = XCHAR_TABLE (buf->syntax_table); +#else syntax_table = XCHAR_TABLE (buf->mirror_syntax_table); +#endif case_action = nochange; /* We tried an initialization */ /* but some C compilers blew it */ @@ -2757,9 +2777,9 @@ match_limit (Lisp_Object num, int beginningp) CHECK_INT (num); n = XINT (num); - if (n < 0 || n >= search_regs.num_regs) + if (n < 0 || search_regs.num_regs <= 0) args_out_of_range (num, make_int (search_regs.num_regs)); - if (search_regs.num_regs == 0 || + if (n >= search_regs.num_regs || search_regs.start[n] < 0) return Qnil; return make_int (beginningp ? search_regs.start[n] : search_regs.end[n]); @@ -2838,7 +2858,7 @@ to hold all the values, and if INTEGERS is non-nil, no consing is done. } else /* last_thing_searched must always be Qt, a buffer, or Qnil. */ - abort (); + ABORT (); len = i; } @@ -2880,11 +2900,8 @@ LIST should have been created by calling `match-data' previously. int num_regs; int length; -#if 0 - /* #### according to 21.5 comment, unnecessary */ if (running_asynch_code) save_search_regs (); -#endif CONCHECK_LIST (list); @@ -2947,7 +2964,6 @@ LIST should have been created by calling `match-data' previously. return Qnil; } -/* #### according to 21.5 comment, unnecessary */ /* If non-zero the match data have been saved in saved_search_regs during the execution of a sentinel or filter. */ static int search_regs_saved; @@ -2971,8 +2987,6 @@ save_search_regs (void) } } -/* #### according to 21.5 comment, unnecessary - prototype in lisp.h, all calls in process.c */ /* Called upon exit from filters and sentinels. */ void restore_match_data (void)