Mercurial > hg > octave-kai > gnulib-hg
changeset 1204:28ff40a118b8
(re_search_2): Fix call to CHAR_HEAD_P.
(re_match_2_internal): Use PTR_BYTE_POS and PT_BYTE.
author | Richard Stallman <rms@gnu.org> |
---|---|
date | Fri, 09 Jan 1998 23:24:24 +0000 |
parents | 2b6373ef4d3b |
children | 594755a693bf |
files | regex.c |
diffstat | 1 files changed, 26 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/regex.c +++ b/regex.c @@ -3904,7 +3904,7 @@ int len = 0; /* Find the head of multibyte form. */ - while (!CHAR_HEAD_P (p)) + while (!CHAR_HEAD_P (*p)) p--, len++; /* Adjust it. */ @@ -5319,15 +5319,17 @@ is the character at D, and S2 is the syntax of C2. */ int c1, c2, s1, s2; int pos1 = PTR_TO_OFFSET (d - 1); + int charpos; GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); #ifdef emacs - UPDATE_SYNTAX_TABLE (pos1 ? pos1 : 1); + charpos = BYTE_TO_CHAR (pos1 ? pos1 : 1); + UPDATE_SYNTAX_TABLE (charpos); #endif s1 = SYNTAX (c1); #ifdef emacs - UPDATE_SYNTAX_TABLE_FORWARD (pos1 + 1); + UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1); #endif s2 = SYNTAX (c2); @@ -5354,15 +5356,17 @@ is the character at D, and S2 is the syntax of C2. */ int c1, c2, s1, s2; int pos1 = PTR_TO_OFFSET (d - 1); + int charpos; GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); #ifdef emacs - UPDATE_SYNTAX_TABLE (pos1); + charpos = BYTE_TO_CHAR (pos1); + UPDATE_SYNTAX_TABLE (charpos); #endif s1 = SYNTAX (c1); #ifdef emacs - UPDATE_SYNTAX_TABLE_FORWARD (pos1 + 1); + UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1); #endif s2 = SYNTAX (c2); @@ -5389,9 +5393,11 @@ is the character at D, and S2 is the syntax of C2. */ int c1, c2, s1, s2; int pos1 = PTR_TO_OFFSET (d); + int charpos; GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); #ifdef emacs + charpos = BYTE_TO_CHAR (pos1); UPDATE_SYNTAX_TABLE (pos1); #endif s2 = SYNTAX (c2); @@ -5405,7 +5411,7 @@ { GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); #ifdef emacs - UPDATE_SYNTAX_TABLE_BACKWARD (pos1 - 1); + UPDATE_SYNTAX_TABLE_BACKWARD (charpos - 1); #endif s1 = SYNTAX (c1); @@ -5430,8 +5436,14 @@ /* C1 is the character before D, S1 is the syntax of C1, C2 is the character at D, and S2 is the syntax of C2. */ int c1, c2, s1, s2; + int pos1 = PTR_TO_OFFSET (d); + int charpos; GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); +#ifdef emacs + charpos = BYTE_TO_CHAR (pos1 - 1); + UPDATE_SYNTAX_TABLE (pos1); +#endif s1 = SYNTAX (c1); /* Case 2: S1 is not Sword. */ @@ -5442,6 +5454,9 @@ if (!AT_STRINGS_END (d)) { GET_CHAR_AFTER_2 (c2, d, string1, end1, string2, end2); +#ifdef emacs + UPDATE_SYNTAX_TABLE_FORWARD (charpos); +#endif s2 = SYNTAX (c2); /* ... and S2 is Sword, and WORD_BOUNDARY_P (C1, C2) @@ -5455,19 +5470,19 @@ #ifdef emacs case before_dot: DEBUG_PRINT1 ("EXECUTING before_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) >= PT) + if (PTR_BYTE_POS ((unsigned char *) d) >= PT_BYTE) goto fail; break; case at_dot: DEBUG_PRINT1 ("EXECUTING at_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) != PT) + if (PTR_BYTE_POS ((unsigned char *) d) != PT_BYTE) goto fail; break; case after_dot: DEBUG_PRINT1 ("EXECUTING after_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) <= PT) + if (PTR_BYTE_POS ((unsigned char *) d) <= PT_BYTE) goto fail; break; @@ -5483,7 +5498,7 @@ PREFETCH (); #ifdef emacs { - int pos1 = PTR_TO_OFFSET (d); + int pos1 = BYTE_TO_CHAR (PTR_TO_OFFSET (d)); UPDATE_SYNTAX_TABLE (pos1); } #endif @@ -5517,7 +5532,7 @@ PREFETCH (); #ifdef emacs { - int pos1 = PTR_TO_OFFSET (d); + int pos1 = BYTE_TO_CHAR (PTR_TO_OFFSET (d)); UPDATE_SYNTAX_TABLE (pos1); } #endif