diff options
| author | Paul Eggert | 2020-04-17 07:57:25 -0700 |
|---|---|---|
| committer | Paul Eggert | 2020-04-17 09:17:35 -0700 |
| commit | 27d101832ada36e431ae6cdecb5c82a180566377 (patch) | |
| tree | 13e20d71f22cf4736bbfa02be54735b1484610bb /src/syntax.c | |
| parent | 3e46a2315f1a999f5811f57a60a2a55f95d8fbb0 (diff) | |
| download | emacs-27d101832ada36e431ae6cdecb5c82a180566377.tar.gz emacs-27d101832ada36e431ae6cdecb5c82a180566377.zip | |
Prefer more inline functions in character.h
* src/buffer.h (fetch_char_advance, fetch_char_advance_no_check)
(buf_next_char_len, next_char_len, buf_prev_char_len)
(prev_char_len, inc_both, dec_both): New inline functions,
replacing the old character.h macros FETCH_CHAR_ADVANCE,
FETCH_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS, INC_POS, BUF_DEC_POS,
DEC_POS, INC_BOTH, DEC_BOTH respectively. All callers changed.
These new functions all assume buffer primitives and so need
to be here rather than in character.h.
* src/casefiddle.c (make_char_unibyte): New static function,
replacing the old MAKE_CHAR_UNIBYTE macro. All callers changed.
(do_casify_unibyte_string): Use SINGLE_BYTE_CHAR_P instead
of open-coding it.
* src/ccl.c (GET_TRANSLATION_TABLE): New static function,
replacing the old macro of the same name.
* src/character.c (string_char): Omit 2nd arg. 3rd arg can no
longer be NULL. All callers changed.
* src/character.h (SINGLE_BYTE_CHAR_P): Move up.
(MAKE_CHAR_UNIBYTE, MAKE_CHAR_MULTIBYTE, PREV_CHAR_BOUNDARY)
(STRING_CHAR_AND_LENGTH, STRING_CHAR_ADVANCE)
(FETCH_STRING_CHAR_ADVANCE)
(FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE)
(FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE)
(FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH)
(DEC_BOTH, BUF_INC_POS, BUF_DEC_POS): Remove.
(make_char_multibyte): New static function, replacing
the old macro MAKE_CHAR_MULTIBYTE. All callers changed.
(CHAR_STRING_ADVANCE): Remove; all callers changed to use
CHAR_STRING.
(NEXT_CHAR_BOUNDARY): Remove; it was unused.
(raw_prev_char_len): New inline function, replacing the
old PREV_CHAR_BOUNDARY macro. All callers changed.
(string_char_and_length): New inline function, replacing the
old STRING_CHAR_AND_LENGTH macro. All callers changed.
(STRING_CHAR): Rewrite in terms of string_char_and_length.
(string_char_advance): New inline function, replacing the old
STRING_CHAR_ADVANCE macro. All callers changed.
(fetch_string_char_advance): New inline function, replacing the
old FETCH_STRING_CHAR_ADVANCE macro. All callers changed.
(fetch_string_char_as_multibyte_advance): New inline function,
replacing the old FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE macro.
All callers changed.
(fetch_string_char_advance_no_check): New inline function,
replacing the old FETCH_STRING_CHAR_ADVANCE_NO_CHECK macro. All
callers changed.
* src/regex-emacs.c (HEAD_ADDR_VSTRING): Remove; no longer used.
* src/syntax.c (scan_lists): Use dec_bytepos instead of
open-coding it.
* src/xdisp.c (string_char_and_length): Rename from
string_char_and_length to avoid name conflict with new function in
character.h. All callers changed.
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 113 |
1 files changed, 53 insertions, 60 deletions
diff --git a/src/syntax.c b/src/syntax.c index ff125b137cf..bcf4dc07997 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -535,7 +535,7 @@ char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos) | |||
| 535 | while (charpos > beg) | 535 | while (charpos > beg) |
| 536 | { | 536 | { |
| 537 | int c; | 537 | int c; |
| 538 | DEC_BOTH (charpos, bytepos); | 538 | dec_both (&charpos, &bytepos); |
| 539 | 539 | ||
| 540 | UPDATE_SYNTAX_TABLE_BACKWARD (charpos); | 540 | UPDATE_SYNTAX_TABLE_BACKWARD (charpos); |
| 541 | c = FETCH_CHAR_AS_MULTIBYTE (bytepos); | 541 | c = FETCH_CHAR_AS_MULTIBYTE (bytepos); |
| @@ -556,11 +556,9 @@ char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos) | |||
| 556 | static ptrdiff_t | 556 | static ptrdiff_t |
| 557 | dec_bytepos (ptrdiff_t bytepos) | 557 | dec_bytepos (ptrdiff_t bytepos) |
| 558 | { | 558 | { |
| 559 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) | 559 | return (bytepos |
| 560 | return bytepos - 1; | 560 | - (!NILP (BVAR (current_buffer, enable_multibyte_characters)) |
| 561 | 561 | ? prev_char_len (bytepos) : 1)); | |
| 562 | DEC_POS (bytepos); | ||
| 563 | return bytepos; | ||
| 564 | } | 562 | } |
| 565 | 563 | ||
| 566 | /* Return a defun-start position before POS and not too far before. | 564 | /* Return a defun-start position before POS and not too far before. |
| @@ -667,7 +665,7 @@ prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte) | |||
| 667 | int c; | 665 | int c; |
| 668 | bool val; | 666 | bool val; |
| 669 | 667 | ||
| 670 | DEC_BOTH (pos, pos_byte); | 668 | dec_both (&pos, &pos_byte); |
| 671 | UPDATE_SYNTAX_TABLE_BACKWARD (pos); | 669 | UPDATE_SYNTAX_TABLE_BACKWARD (pos); |
| 672 | c = FETCH_CHAR (pos_byte); | 670 | c = FETCH_CHAR (pos_byte); |
| 673 | val = SYNTAX_COMEND_FIRST (c); | 671 | val = SYNTAX_COMEND_FIRST (c); |
| @@ -738,7 +736,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | |||
| 738 | bool com2start, com2end, comstart; | 736 | bool com2start, com2end, comstart; |
| 739 | 737 | ||
| 740 | /* Move back and examine a character. */ | 738 | /* Move back and examine a character. */ |
| 741 | DEC_BOTH (from, from_byte); | 739 | dec_both (&from, &from_byte); |
| 742 | UPDATE_SYNTAX_TABLE_BACKWARD (from); | 740 | UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 743 | 741 | ||
| 744 | prev_syntax = syntax; | 742 | prev_syntax = syntax; |
| @@ -773,7 +771,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | |||
| 773 | { | 771 | { |
| 774 | ptrdiff_t next = from, next_byte = from_byte; | 772 | ptrdiff_t next = from, next_byte = from_byte; |
| 775 | int next_c, next_syntax; | 773 | int next_c, next_syntax; |
| 776 | DEC_BOTH (next, next_byte); | 774 | dec_both (&next, &next_byte); |
| 777 | UPDATE_SYNTAX_TABLE_BACKWARD (next); | 775 | UPDATE_SYNTAX_TABLE_BACKWARD (next); |
| 778 | next_c = FETCH_CHAR_AS_MULTIBYTE (next_byte); | 776 | next_c = FETCH_CHAR_AS_MULTIBYTE (next_byte); |
| 779 | next_syntax = SYNTAX_WITH_FLAGS (next_c); | 777 | next_syntax = SYNTAX_WITH_FLAGS (next_c); |
| @@ -1150,8 +1148,7 @@ the value of a `syntax-table' text property. */) | |||
| 1150 | 1148 | ||
| 1151 | if (*p) | 1149 | if (*p) |
| 1152 | { | 1150 | { |
| 1153 | int len; | 1151 | int len, character = string_char_and_length (p, &len); |
| 1154 | int character = STRING_CHAR_AND_LENGTH (p, len); | ||
| 1155 | XSETINT (match, character); | 1152 | XSETINT (match, character); |
| 1156 | if (XFIXNAT (match) == ' ') | 1153 | if (XFIXNAT (match) == ' ') |
| 1157 | match = Qnil; | 1154 | match = Qnil; |
| @@ -1455,7 +1452,7 @@ scan_words (ptrdiff_t from, EMACS_INT count) | |||
| 1455 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 1452 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 1456 | ch0 = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 1453 | ch0 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 1457 | code = SYNTAX (ch0); | 1454 | code = SYNTAX (ch0); |
| 1458 | INC_BOTH (from, from_byte); | 1455 | inc_both (&from, &from_byte); |
| 1459 | if (words_include_escapes | 1456 | if (words_include_escapes |
| 1460 | && (code == Sescape || code == Scharquote)) | 1457 | && (code == Sescape || code == Scharquote)) |
| 1461 | break; | 1458 | break; |
| @@ -1488,7 +1485,7 @@ scan_words (ptrdiff_t from, EMACS_INT count) | |||
| 1488 | || (code != Sescape && code != Scharquote))) | 1485 | || (code != Sescape && code != Scharquote))) |
| 1489 | || word_boundary_p (ch0, ch1)) | 1486 | || word_boundary_p (ch0, ch1)) |
| 1490 | break; | 1487 | break; |
| 1491 | INC_BOTH (from, from_byte); | 1488 | inc_both (&from, &from_byte); |
| 1492 | ch0 = ch1; | 1489 | ch0 = ch1; |
| 1493 | rarely_quit (from); | 1490 | rarely_quit (from); |
| 1494 | } | 1491 | } |
| @@ -1501,7 +1498,7 @@ scan_words (ptrdiff_t from, EMACS_INT count) | |||
| 1501 | { | 1498 | { |
| 1502 | if (from == beg) | 1499 | if (from == beg) |
| 1503 | return 0; | 1500 | return 0; |
| 1504 | DEC_BOTH (from, from_byte); | 1501 | dec_both (&from, &from_byte); |
| 1505 | UPDATE_SYNTAX_TABLE_BACKWARD (from); | 1502 | UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 1506 | ch1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 1503 | ch1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 1507 | code = SYNTAX (ch1); | 1504 | code = SYNTAX (ch1); |
| @@ -1530,7 +1527,7 @@ scan_words (ptrdiff_t from, EMACS_INT count) | |||
| 1530 | { | 1527 | { |
| 1531 | if (from == beg) | 1528 | if (from == beg) |
| 1532 | break; | 1529 | break; |
| 1533 | DEC_BOTH (from, from_byte); | 1530 | dec_both (&from, &from_byte); |
| 1534 | UPDATE_SYNTAX_TABLE_BACKWARD (from); | 1531 | UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 1535 | ch0 = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 1532 | ch0 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 1536 | code = SYNTAX (ch0); | 1533 | code = SYNTAX (ch0); |
| @@ -1539,7 +1536,7 @@ scan_words (ptrdiff_t from, EMACS_INT count) | |||
| 1539 | || (code != Sescape && code != Scharquote))) | 1536 | || (code != Sescape && code != Scharquote))) |
| 1540 | || word_boundary_p (ch0, ch1)) | 1537 | || word_boundary_p (ch0, ch1)) |
| 1541 | { | 1538 | { |
| 1542 | INC_BOTH (from, from_byte); | 1539 | inc_both (&from, &from_byte); |
| 1543 | break; | 1540 | break; |
| 1544 | } | 1541 | } |
| 1545 | ch1 = ch0; | 1542 | ch1 = ch0; |
| @@ -1818,7 +1815,7 @@ skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim, | |||
| 1818 | 1815 | ||
| 1819 | leading_code = str[i_byte]; | 1816 | leading_code = str[i_byte]; |
| 1820 | } | 1817 | } |
| 1821 | c = STRING_CHAR_AND_LENGTH (str + i_byte, len); | 1818 | c = string_char_and_length (str + i_byte, &len); |
| 1822 | i_byte += len; | 1819 | i_byte += len; |
| 1823 | 1820 | ||
| 1824 | 1821 | ||
| @@ -1834,14 +1831,14 @@ skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim, | |||
| 1834 | 1831 | ||
| 1835 | /* Get the end of the range. */ | 1832 | /* Get the end of the range. */ |
| 1836 | leading_code2 = str[i_byte]; | 1833 | leading_code2 = str[i_byte]; |
| 1837 | c2 = STRING_CHAR_AND_LENGTH (str + i_byte, len); | 1834 | c2 = string_char_and_length (str + i_byte, &len); |
| 1838 | i_byte += len; | 1835 | i_byte += len; |
| 1839 | 1836 | ||
| 1840 | if (c2 == '\\' | 1837 | if (c2 == '\\' |
| 1841 | && i_byte < size_byte) | 1838 | && i_byte < size_byte) |
| 1842 | { | 1839 | { |
| 1843 | leading_code2 = str[i_byte]; | 1840 | leading_code2 = str[i_byte]; |
| 1844 | c2 = STRING_CHAR_AND_LENGTH (str + i_byte, len); | 1841 | c2 = string_char_and_length (str + i_byte, &len); |
| 1845 | i_byte += len; | 1842 | i_byte += len; |
| 1846 | } | 1843 | } |
| 1847 | 1844 | ||
| @@ -1953,7 +1950,7 @@ skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim, | |||
| 1953 | p = GAP_END_ADDR; | 1950 | p = GAP_END_ADDR; |
| 1954 | stop = endp; | 1951 | stop = endp; |
| 1955 | } | 1952 | } |
| 1956 | c = STRING_CHAR_AND_LENGTH (p, nbytes); | 1953 | c = string_char_and_length (p, &nbytes); |
| 1957 | if (! NILP (iso_classes) && in_classes (c, iso_classes)) | 1954 | if (! NILP (iso_classes) && in_classes (c, iso_classes)) |
| 1958 | { | 1955 | { |
| 1959 | if (negate) | 1956 | if (negate) |
| @@ -2175,7 +2172,7 @@ skip_syntaxes (bool forwardp, Lisp_Object string, Lisp_Object lim) | |||
| 2175 | stop = endp; | 2172 | stop = endp; |
| 2176 | } | 2173 | } |
| 2177 | if (multibyte) | 2174 | if (multibyte) |
| 2178 | c = STRING_CHAR_AND_LENGTH (p, nbytes); | 2175 | c = string_char_and_length (p, &nbytes); |
| 2179 | else | 2176 | else |
| 2180 | c = *p, nbytes = 1; | 2177 | c = *p, nbytes = 1; |
| 2181 | if (! fastmap[SYNTAX (c)]) | 2178 | if (! fastmap[SYNTAX (c)]) |
| @@ -2357,7 +2354,7 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | |||
| 2357 | /* We have encountered a nested comment of the same style | 2354 | /* We have encountered a nested comment of the same style |
| 2358 | as the comment sequence which began this comment section. */ | 2355 | as the comment sequence which began this comment section. */ |
| 2359 | nesting++; | 2356 | nesting++; |
| 2360 | INC_BOTH (from, from_byte); | 2357 | inc_both (&from, &from_byte); |
| 2361 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2358 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2362 | 2359 | ||
| 2363 | forw_incomment: | 2360 | forw_incomment: |
| @@ -2378,7 +2375,7 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | |||
| 2378 | break; | 2375 | break; |
| 2379 | else | 2376 | else |
| 2380 | { | 2377 | { |
| 2381 | INC_BOTH (from, from_byte); | 2378 | inc_both (&from, &from_byte); |
| 2382 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2379 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2383 | } | 2380 | } |
| 2384 | } | 2381 | } |
| @@ -2395,7 +2392,7 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | |||
| 2395 | as the comment sequence which began this comment section. */ | 2392 | as the comment sequence which began this comment section. */ |
| 2396 | { | 2393 | { |
| 2397 | syntax = Smax; /* So that "#|#" isn't also a comment ender. */ | 2394 | syntax = Smax; /* So that "#|#" isn't also a comment ender. */ |
| 2398 | INC_BOTH (from, from_byte); | 2395 | inc_both (&from, &from_byte); |
| 2399 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2396 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2400 | nesting++; | 2397 | nesting++; |
| 2401 | } | 2398 | } |
| @@ -2456,7 +2453,7 @@ between them, return t; otherwise return nil. */) | |||
| 2456 | comstart_first = SYNTAX_FLAGS_COMSTART_FIRST (syntax); | 2453 | comstart_first = SYNTAX_FLAGS_COMSTART_FIRST (syntax); |
| 2457 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax); | 2454 | comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax); |
| 2458 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0); | 2455 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0); |
| 2459 | INC_BOTH (from, from_byte); | 2456 | inc_both (&from, &from_byte); |
| 2460 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2457 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2461 | if (from < stop && comstart_first | 2458 | if (from < stop && comstart_first |
| 2462 | && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), | 2459 | && (c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
| @@ -2471,7 +2468,7 @@ between them, return t; otherwise return nil. */) | |||
| 2471 | code = Scomment; | 2468 | code = Scomment; |
| 2472 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); | 2469 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
| 2473 | comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); | 2470 | comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); |
| 2474 | INC_BOTH (from, from_byte); | 2471 | inc_both (&from, &from_byte); |
| 2475 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2472 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2476 | } | 2473 | } |
| 2477 | rarely_quit (++quit_count); | 2474 | rarely_quit (++quit_count); |
| @@ -2482,7 +2479,7 @@ between them, return t; otherwise return nil. */) | |||
| 2482 | comstyle = ST_COMMENT_STYLE; | 2479 | comstyle = ST_COMMENT_STYLE; |
| 2483 | else if (code != Scomment) | 2480 | else if (code != Scomment) |
| 2484 | { | 2481 | { |
| 2485 | DEC_BOTH (from, from_byte); | 2482 | dec_both (&from, &from_byte); |
| 2486 | SET_PT_BOTH (from, from_byte); | 2483 | SET_PT_BOTH (from, from_byte); |
| 2487 | return Qnil; | 2484 | return Qnil; |
| 2488 | } | 2485 | } |
| @@ -2495,7 +2492,7 @@ between them, return t; otherwise return nil. */) | |||
| 2495 | SET_PT_BOTH (from, from_byte); | 2492 | SET_PT_BOTH (from, from_byte); |
| 2496 | return Qnil; | 2493 | return Qnil; |
| 2497 | } | 2494 | } |
| 2498 | INC_BOTH (from, from_byte); | 2495 | inc_both (&from, &from_byte); |
| 2499 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2496 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2500 | /* We have skipped one comment. */ | 2497 | /* We have skipped one comment. */ |
| 2501 | count1--; | 2498 | count1--; |
| @@ -2511,7 +2508,7 @@ between them, return t; otherwise return nil. */) | |||
| 2511 | return Qnil; | 2508 | return Qnil; |
| 2512 | } | 2509 | } |
| 2513 | 2510 | ||
| 2514 | DEC_BOTH (from, from_byte); | 2511 | dec_both (&from, &from_byte); |
| 2515 | /* char_quoted does UPDATE_SYNTAX_TABLE_BACKWARD (from). */ | 2512 | /* char_quoted does UPDATE_SYNTAX_TABLE_BACKWARD (from). */ |
| 2516 | bool quoted = char_quoted (from, from_byte); | 2513 | bool quoted = char_quoted (from, from_byte); |
| 2517 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2514 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| @@ -2529,7 +2526,7 @@ between them, return t; otherwise return nil. */) | |||
| 2529 | /* We must record the comment style encountered so that | 2526 | /* We must record the comment style encountered so that |
| 2530 | later, we can match only the proper comment begin | 2527 | later, we can match only the proper comment begin |
| 2531 | sequence of the same style. */ | 2528 | sequence of the same style. */ |
| 2532 | DEC_BOTH (from, from_byte); | 2529 | dec_both (&from, &from_byte); |
| 2533 | code = Sendcomment; | 2530 | code = Sendcomment; |
| 2534 | /* Calling char_quoted, above, set up global syntax position | 2531 | /* Calling char_quoted, above, set up global syntax position |
| 2535 | at the new value of FROM. */ | 2532 | at the new value of FROM. */ |
| @@ -2547,7 +2544,7 @@ between them, return t; otherwise return nil. */) | |||
| 2547 | 2544 | ||
| 2548 | while (1) | 2545 | while (1) |
| 2549 | { | 2546 | { |
| 2550 | DEC_BOTH (from, from_byte); | 2547 | dec_both (&from, &from_byte); |
| 2551 | UPDATE_SYNTAX_TABLE_BACKWARD (from); | 2548 | UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 2552 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2549 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2553 | if (SYNTAX (c) == Scomment_fence | 2550 | if (SYNTAX (c) == Scomment_fence |
| @@ -2588,7 +2585,7 @@ between them, return t; otherwise return nil. */) | |||
| 2588 | not-quite-endcomment. */ | 2585 | not-quite-endcomment. */ |
| 2589 | if (SYNTAX (c) != code) | 2586 | if (SYNTAX (c) != code) |
| 2590 | /* It was a two-char Sendcomment. */ | 2587 | /* It was a two-char Sendcomment. */ |
| 2591 | INC_BOTH (from, from_byte); | 2588 | inc_both (&from, &from_byte); |
| 2592 | goto leave; | 2589 | goto leave; |
| 2593 | } | 2590 | } |
| 2594 | } | 2591 | } |
| @@ -2602,7 +2599,7 @@ between them, return t; otherwise return nil. */) | |||
| 2602 | else if (code != Swhitespace || quoted) | 2599 | else if (code != Swhitespace || quoted) |
| 2603 | { | 2600 | { |
| 2604 | leave: | 2601 | leave: |
| 2605 | INC_BOTH (from, from_byte); | 2602 | inc_both (&from, &from_byte); |
| 2606 | SET_PT_BOTH (from, from_byte); | 2603 | SET_PT_BOTH (from, from_byte); |
| 2607 | return Qnil; | 2604 | return Qnil; |
| 2608 | } | 2605 | } |
| @@ -2676,7 +2673,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2676 | prefix = SYNTAX_FLAGS_PREFIX (syntax); | 2673 | prefix = SYNTAX_FLAGS_PREFIX (syntax); |
| 2677 | if (depth == min_depth) | 2674 | if (depth == min_depth) |
| 2678 | last_good = from; | 2675 | last_good = from; |
| 2679 | INC_BOTH (from, from_byte); | 2676 | inc_both (&from, &from_byte); |
| 2680 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2677 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2681 | if (from < stop && comstart_first | 2678 | if (from < stop && comstart_first |
| 2682 | && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte), | 2679 | && (c = FETCH_CHAR_AS_MULTIBYTE (from_byte), |
| @@ -2692,7 +2689,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2692 | code = Scomment; | 2689 | code = Scomment; |
| 2693 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); | 2690 | comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); |
| 2694 | comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); | 2691 | comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); |
| 2695 | INC_BOTH (from, from_byte); | 2692 | inc_both (&from, &from_byte); |
| 2696 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2693 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2697 | } | 2694 | } |
| 2698 | 2695 | ||
| @@ -2705,7 +2702,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2705 | case Scharquote: | 2702 | case Scharquote: |
| 2706 | if (from == stop) | 2703 | if (from == stop) |
| 2707 | goto lose; | 2704 | goto lose; |
| 2708 | INC_BOTH (from, from_byte); | 2705 | inc_both (&from, &from_byte); |
| 2709 | /* Treat following character as a word constituent. */ | 2706 | /* Treat following character as a word constituent. */ |
| 2710 | FALLTHROUGH; | 2707 | FALLTHROUGH; |
| 2711 | case Sword: | 2708 | case Sword: |
| @@ -2721,7 +2718,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2721 | { | 2718 | { |
| 2722 | case Scharquote: | 2719 | case Scharquote: |
| 2723 | case Sescape: | 2720 | case Sescape: |
| 2724 | INC_BOTH (from, from_byte); | 2721 | inc_both (&from, &from_byte); |
| 2725 | if (from == stop) | 2722 | if (from == stop) |
| 2726 | goto lose; | 2723 | goto lose; |
| 2727 | break; | 2724 | break; |
| @@ -2732,7 +2729,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2732 | default: | 2729 | default: |
| 2733 | goto done; | 2730 | goto done; |
| 2734 | } | 2731 | } |
| 2735 | INC_BOTH (from, from_byte); | 2732 | inc_both (&from, &from_byte); |
| 2736 | rarely_quit (++quit_count); | 2733 | rarely_quit (++quit_count); |
| 2737 | } | 2734 | } |
| 2738 | goto done; | 2735 | goto done; |
| @@ -2754,7 +2751,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2754 | goto done; | 2751 | goto done; |
| 2755 | goto lose; | 2752 | goto lose; |
| 2756 | } | 2753 | } |
| 2757 | INC_BOTH (from, from_byte); | 2754 | inc_both (&from, &from_byte); |
| 2758 | UPDATE_SYNTAX_TABLE_FORWARD (from); | 2755 | UPDATE_SYNTAX_TABLE_FORWARD (from); |
| 2759 | break; | 2756 | break; |
| 2760 | 2757 | ||
| @@ -2763,7 +2760,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2763 | break; | 2760 | break; |
| 2764 | if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (from_byte)) | 2761 | if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (from_byte)) |
| 2765 | { | 2762 | { |
| 2766 | INC_BOTH (from, from_byte); | 2763 | inc_both (&from, &from_byte); |
| 2767 | } | 2764 | } |
| 2768 | if (mathexit) | 2765 | if (mathexit) |
| 2769 | { | 2766 | { |
| @@ -2803,11 +2800,11 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2803 | break; | 2800 | break; |
| 2804 | 2801 | ||
| 2805 | if (c_code == Scharquote || c_code == Sescape) | 2802 | if (c_code == Scharquote || c_code == Sescape) |
| 2806 | INC_BOTH (from, from_byte); | 2803 | inc_both (&from, &from_byte); |
| 2807 | INC_BOTH (from, from_byte); | 2804 | inc_both (&from, &from_byte); |
| 2808 | rarely_quit (++quit_count); | 2805 | rarely_quit (++quit_count); |
| 2809 | } | 2806 | } |
| 2810 | INC_BOTH (from, from_byte); | 2807 | inc_both (&from, &from_byte); |
| 2811 | if (!depth && sexpflag) goto done; | 2808 | if (!depth && sexpflag) goto done; |
| 2812 | break; | 2809 | break; |
| 2813 | default: | 2810 | default: |
| @@ -2832,7 +2829,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2832 | while (from > stop) | 2829 | while (from > stop) |
| 2833 | { | 2830 | { |
| 2834 | rarely_quit (++quit_count); | 2831 | rarely_quit (++quit_count); |
| 2835 | DEC_BOTH (from, from_byte); | 2832 | dec_both (&from, &from_byte); |
| 2836 | UPDATE_SYNTAX_TABLE_BACKWARD (from); | 2833 | UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 2837 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2834 | c = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| 2838 | int syntax = SYNTAX_WITH_FLAGS (c); | 2835 | int syntax = SYNTAX_WITH_FLAGS (c); |
| @@ -2851,7 +2848,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2851 | later, we can match only the proper comment begin | 2848 | later, we can match only the proper comment begin |
| 2852 | sequence of the same style. */ | 2849 | sequence of the same style. */ |
| 2853 | int c2, other_syntax; | 2850 | int c2, other_syntax; |
| 2854 | DEC_BOTH (from, from_byte); | 2851 | dec_both (&from, &from_byte); |
| 2855 | UPDATE_SYNTAX_TABLE_BACKWARD (from); | 2852 | UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 2856 | code = Sendcomment; | 2853 | code = Sendcomment; |
| 2857 | c2 = FETCH_CHAR_AS_MULTIBYTE (from_byte); | 2854 | c2 = FETCH_CHAR_AS_MULTIBYTE (from_byte); |
| @@ -2865,7 +2862,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2865 | if we decremented FROM in the if-statement above. */ | 2862 | if we decremented FROM in the if-statement above. */ |
| 2866 | if (code != Sendcomment && char_quoted (from, from_byte)) | 2863 | if (code != Sendcomment && char_quoted (from, from_byte)) |
| 2867 | { | 2864 | { |
| 2868 | DEC_BOTH (from, from_byte); | 2865 | dec_both (&from, &from_byte); |
| 2869 | code = Sword; | 2866 | code = Sword; |
| 2870 | } | 2867 | } |
| 2871 | else if (SYNTAX_FLAGS_PREFIX (syntax)) | 2868 | else if (SYNTAX_FLAGS_PREFIX (syntax)) |
| @@ -2882,11 +2879,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2882 | after passing it. */ | 2879 | after passing it. */ |
| 2883 | while (from > stop) | 2880 | while (from > stop) |
| 2884 | { | 2881 | { |
| 2885 | temp_pos = from_byte; | 2882 | temp_pos = dec_bytepos (from_byte); |
| 2886 | if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) | ||
| 2887 | DEC_POS (temp_pos); | ||
| 2888 | else | ||
| 2889 | temp_pos--; | ||
| 2890 | UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); | 2883 | UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); |
| 2891 | c1 = FETCH_CHAR_AS_MULTIBYTE (temp_pos); | 2884 | c1 = FETCH_CHAR_AS_MULTIBYTE (temp_pos); |
| 2892 | /* Don't allow comment-end to be quoted. */ | 2885 | /* Don't allow comment-end to be quoted. */ |
| @@ -2895,7 +2888,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2895 | quoted = char_quoted (from - 1, temp_pos); | 2888 | quoted = char_quoted (from - 1, temp_pos); |
| 2896 | if (quoted) | 2889 | if (quoted) |
| 2897 | { | 2890 | { |
| 2898 | DEC_BOTH (from, from_byte); | 2891 | dec_both (&from, &from_byte); |
| 2899 | temp_pos = dec_bytepos (temp_pos); | 2892 | temp_pos = dec_bytepos (temp_pos); |
| 2900 | UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); | 2893 | UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); |
| 2901 | } | 2894 | } |
| @@ -2906,7 +2899,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2906 | case Sword: case Ssymbol: case Squote: break; | 2899 | case Sword: case Ssymbol: case Squote: break; |
| 2907 | default: goto done2; | 2900 | default: goto done2; |
| 2908 | } | 2901 | } |
| 2909 | DEC_BOTH (from, from_byte); | 2902 | dec_both (&from, &from_byte); |
| 2910 | rarely_quit (++quit_count); | 2903 | rarely_quit (++quit_count); |
| 2911 | } | 2904 | } |
| 2912 | goto done2; | 2905 | goto done2; |
| @@ -2919,7 +2912,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2919 | temp_pos = dec_bytepos (from_byte); | 2912 | temp_pos = dec_bytepos (from_byte); |
| 2920 | UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); | 2913 | UPDATE_SYNTAX_TABLE_BACKWARD (from - 1); |
| 2921 | if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (temp_pos)) | 2914 | if (from != stop && c == FETCH_CHAR_AS_MULTIBYTE (temp_pos)) |
| 2922 | DEC_BOTH (from, from_byte); | 2915 | dec_both (&from, &from_byte); |
| 2923 | } | 2916 | } |
| 2924 | if (mathexit) | 2917 | if (mathexit) |
| 2925 | { | 2918 | { |
| @@ -2962,7 +2955,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2962 | { | 2955 | { |
| 2963 | if (from == stop) | 2956 | if (from == stop) |
| 2964 | goto lose; | 2957 | goto lose; |
| 2965 | DEC_BOTH (from, from_byte); | 2958 | dec_both (&from, &from_byte); |
| 2966 | UPDATE_SYNTAX_TABLE_BACKWARD (from); | 2959 | UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 2967 | if (!char_quoted (from, from_byte)) | 2960 | if (!char_quoted (from, from_byte)) |
| 2968 | { | 2961 | { |
| @@ -2981,7 +2974,7 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag) | |||
| 2981 | { | 2974 | { |
| 2982 | if (from == stop) | 2975 | if (from == stop) |
| 2983 | goto lose; | 2976 | goto lose; |
| 2984 | DEC_BOTH (from, from_byte); | 2977 | dec_both (&from, &from_byte); |
| 2985 | UPDATE_SYNTAX_TABLE_BACKWARD (from); | 2978 | UPDATE_SYNTAX_TABLE_BACKWARD (from); |
| 2986 | if (!char_quoted (from, from_byte)) | 2979 | if (!char_quoted (from, from_byte)) |
| 2987 | { | 2980 | { |
| @@ -3091,7 +3084,7 @@ the prefix syntax flag (p). */) | |||
| 3091 | 3084 | ||
| 3092 | SETUP_SYNTAX_TABLE (pos, -1); | 3085 | SETUP_SYNTAX_TABLE (pos, -1); |
| 3093 | 3086 | ||
| 3094 | DEC_BOTH (pos, pos_byte); | 3087 | dec_both (&pos, &pos_byte); |
| 3095 | 3088 | ||
| 3096 | while (!char_quoted (pos, pos_byte) | 3089 | while (!char_quoted (pos, pos_byte) |
| 3097 | /* Previous statement updates syntax table. */ | 3090 | /* Previous statement updates syntax table. */ |
| @@ -3103,7 +3096,7 @@ the prefix syntax flag (p). */) | |||
| 3103 | 3096 | ||
| 3104 | if (pos <= beg) | 3097 | if (pos <= beg) |
| 3105 | break; | 3098 | break; |
| 3106 | DEC_BOTH (pos, pos_byte); | 3099 | dec_both (&pos, &pos_byte); |
| 3107 | rarely_quit (pos); | 3100 | rarely_quit (pos); |
| 3108 | } | 3101 | } |
| 3109 | 3102 | ||
| @@ -3180,7 +3173,7 @@ scan_sexps_forward (struct lisp_parse_state *state, | |||
| 3180 | prev_from = from; | 3173 | prev_from = from; |
| 3181 | prev_from_byte = from_byte; | 3174 | prev_from_byte = from_byte; |
| 3182 | if (from != BEGV) | 3175 | if (from != BEGV) |
| 3183 | DEC_BOTH (prev_from, prev_from_byte); | 3176 | dec_both (&prev_from, &prev_from_byte); |
| 3184 | 3177 | ||
| 3185 | /* Use this macro instead of `from++'. */ | 3178 | /* Use this macro instead of `from++'. */ |
| 3186 | #define INC_FROM \ | 3179 | #define INC_FROM \ |
| @@ -3189,7 +3182,7 @@ do { prev_from = from; \ | |||
| 3189 | temp = FETCH_CHAR_AS_MULTIBYTE (prev_from_byte); \ | 3182 | temp = FETCH_CHAR_AS_MULTIBYTE (prev_from_byte); \ |
| 3190 | prev_prev_from_syntax = prev_from_syntax; \ | 3183 | prev_prev_from_syntax = prev_from_syntax; \ |
| 3191 | prev_from_syntax = SYNTAX_WITH_FLAGS (temp); \ | 3184 | prev_from_syntax = SYNTAX_WITH_FLAGS (temp); \ |
| 3192 | INC_BOTH (from, from_byte); \ | 3185 | inc_both (&from, &from_byte); \ |
| 3193 | if (from < end) \ | 3186 | if (from < end) \ |
| 3194 | UPDATE_SYNTAX_TABLE_FORWARD (from); \ | 3187 | UPDATE_SYNTAX_TABLE_FORWARD (from); \ |
| 3195 | } while (0) | 3188 | } while (0) |