aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-06-20 11:59:08 -0700
committerPaul Eggert2013-06-20 11:59:08 -0700
commit1fc7100890ced39f81a822661439b1f7030df5a1 (patch)
tree2da0f1af705674883bd08d80f56c5f630c33acf9 /src
parentb932cad7124e7c1a20fc2b127201b7dee15a142f (diff)
downloademacs-1fc7100890ced39f81a822661439b1f7030df5a1.tar.gz
emacs-1fc7100890ced39f81a822661439b1f7030df5a1.zip
* syntax.c: Integer cleanups.
(SYNTAX_FLAGS_COMMENT_STYLEC): Return a boolean, not 0-or-2. All uses that need 0-or-2 changed to: (SYNTAX_FLAGS_COMMENT_STYLEC2): New macro, with the same semantics as the old SYNTAX_FLAGS_COMMENT_STYLEC. (struct lisp_parse_state, syntax_prefix_flag_p, update_syntax_table) (char_quoted, prev_char_comend_first, back_comment) (Finternal_describe_syntax_value, skip_chars, skip_syntaxes) (in_classes, forw_comment, scan_lists, scan_sexps_forward): Use bool for boolean. (update_syntax_table, skip_chars, skip_syntaxes): Prefer int to unsigned when either will do. (back_comment): Return boolean success flag, like forw_comment, instead of positive-or-minus-1 (which might have overflowed int anyway). Don't stuff ptrdiff_t into int. (syntax_spec_code, syntax_code_spec): Now const. (Fmatching_paren, scan_lists, scan_sexps_forward): Use enum syntaxcode for syntax code. (Fmatching_paren): Check that arg is a character, not just an integer. (Fstring_to_syntax): Don't assume 0377 fits in enum syntaxcode. (Finternal_describe_syntax_value): Omit no-longer-needed comparison to 0. (skip_chars): Use char, not unsigned char, when the distinction doesn't matter. (forw_comment, scan_lists): Prefer A |= B to A = A || B when B's cheap. * bytecode.c (exec_byte_code): * syntax.c (syntax_spec_code, Fchar_syntax) (Finternal_describe_syntax_value, skip_chars, skip_syntaxes) (init_syntax_once): * syntax.h (SYNTAX_WITH_FLAGS): Omit unnecessary casts.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog34
-rw-r--r--src/bytecode.c2
-rw-r--r--src/syntax.c351
-rw-r--r--src/syntax.h22
4 files changed, 208 insertions, 201 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2aeccc222cf..4e52f5b2818 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,37 @@
12013-06-20 Paul Eggert <eggert@cs.ucla.edu>
2
3 * syntax.c: Integer cleanups.
4 (SYNTAX_FLAGS_COMMENT_STYLEC): Return a boolean, not 0-or-2.
5 All uses that need 0-or-2 changed to:
6 (SYNTAX_FLAGS_COMMENT_STYLEC2): New macro, with the same semantics
7 as the old SYNTAX_FLAGS_COMMENT_STYLEC.
8 (struct lisp_parse_state, syntax_prefix_flag_p, update_syntax_table)
9 (char_quoted, prev_char_comend_first, back_comment)
10 (Finternal_describe_syntax_value, skip_chars, skip_syntaxes)
11 (in_classes, forw_comment, scan_lists, scan_sexps_forward):
12 Use bool for boolean.
13 (update_syntax_table, skip_chars, skip_syntaxes):
14 Prefer int to unsigned when either will do.
15 (back_comment): Return boolean success flag, like forw_comment,
16 instead of positive-or-minus-1 (which might have overflowed int anyway).
17 Don't stuff ptrdiff_t into int.
18 (syntax_spec_code, syntax_code_spec): Now const.
19 (Fmatching_paren, scan_lists, scan_sexps_forward):
20 Use enum syntaxcode for syntax code.
21 (Fmatching_paren): Check that arg is a character, not just an integer.
22 (Fstring_to_syntax): Don't assume 0377 fits in enum syntaxcode.
23 (Finternal_describe_syntax_value): Omit no-longer-needed
24 comparison to 0.
25 (skip_chars): Use char, not unsigned char, when the distinction
26 doesn't matter.
27 (forw_comment, scan_lists): Prefer A |= B to A = A || B when B's cheap.
28 * bytecode.c (exec_byte_code):
29 * syntax.c (syntax_spec_code, Fchar_syntax)
30 (Finternal_describe_syntax_value, skip_chars, skip_syntaxes)
31 (init_syntax_once):
32 * syntax.h (SYNTAX_WITH_FLAGS):
33 Omit unnecessary casts.
34
12013-06-20 Eli Zaretskii <eliz@gnu.org> 352013-06-20 Eli Zaretskii <eliz@gnu.org>
2 36
3 * w32fns.c (w32_wnd_proc): Don't compute the header line and mode 37 * w32fns.c (w32_wnd_proc): Don't compute the header line and mode
diff --git a/src/bytecode.c b/src/bytecode.c
index 4940fd5c182..d95c53bf055 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1636,7 +1636,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1636 c = XFASTINT (TOP); 1636 c = XFASTINT (TOP);
1637 if (NILP (BVAR (current_buffer, enable_multibyte_characters))) 1637 if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
1638 MAKE_CHAR_MULTIBYTE (c); 1638 MAKE_CHAR_MULTIBYTE (c);
1639 XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (c)]); 1639 XSETFASTINT (TOP, syntax_code_spec[SYNTAX (c)]);
1640 } 1640 }
1641 NEXT; 1641 NEXT;
1642 1642
diff --git a/src/syntax.c b/src/syntax.c
index 1b76f56dea6..ea15cf68c43 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -36,7 +36,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
36#include "intervals.h" 36#include "intervals.h"
37#include "category.h" 37#include "category.h"
38 38
39/* Then there are seven single-bit flags that have the following meanings: 39/* Eight single-bit flags have the following meanings:
40 1. This character is the first of a two-character comment-start sequence. 40 1. This character is the first of a two-character comment-start sequence.
41 2. This character is the second of a two-character comment-start sequence. 41 2. This character is the second of a two-character comment-start sequence.
42 3. This character is the first of a two-character comment-end sequence. 42 3. This character is the first of a two-character comment-end sequence.
@@ -48,16 +48,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
48 Note that any two-character sequence whose first character has flag 1 48 Note that any two-character sequence whose first character has flag 1
49 and whose second character has flag 2 will be interpreted as a comment start. 49 and whose second character has flag 2 will be interpreted as a comment start.
50 50
51 bit 6 and 8 are used to discriminate between different comment styles. 51 Bits 6 and 8 discriminate among different comment styles.
52 Languages such as C++ allow two orthogonal syntax start/end pairs 52 Languages such as C++ allow two orthogonal syntax start/end pairs
53 and bit 6 is used to determine whether a comment-end or Scommentend 53 and bit 6 determines whether a comment-end or Scommentend
54 ends style a or b. Comment markers can start style a, b, c, or bc. 54 ends style a or b. Comment markers can start style a, b, c, or bc.
55 Style a is always the default. 55 Style a is always the default.
56 For 2-char comment markers, the style b flag is only looked up on the second 56 For 2-char comment markers, the style b flag is looked up only on the second
57 char of the comment marker and on the first char of the comment ender. 57 char of the comment marker and on the first char of the comment ender.
58 For style c (like to for the nested flag), the flag can be placed on any 58 For style c (like the nested flag), the flag can be placed on any of
59 one of the chars. 59 the chars. */
60 */
61 60
62/* These macros extract specific flags from an integer 61/* These macros extract specific flags from an integer
63 that holds the syntax code and the flags. */ 62 that holds the syntax code and the flags. */
@@ -73,13 +72,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
73#define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1) 72#define SYNTAX_FLAGS_PREFIX(flags) (((flags) >> 20) & 1)
74 73
75#define SYNTAX_FLAGS_COMMENT_STYLEB(flags) (((flags) >> 21) & 1) 74#define SYNTAX_FLAGS_COMMENT_STYLEB(flags) (((flags) >> 21) & 1)
76#define SYNTAX_FLAGS_COMMENT_STYLEC(flags) (((flags) >> 22) & 2) 75#define SYNTAX_FLAGS_COMMENT_STYLEC(flags) (((flags) >> 23) & 1)
76#define SYNTAX_FLAGS_COMMENT_STYLEC2(flags) (((flags) >> 22) & 2) /* C * 2 */
77/* FLAGS should be the flags of the main char of the comment marker, e.g. 77/* FLAGS should be the flags of the main char of the comment marker, e.g.
78 the second for comstart and the first for comend. */ 78 the second for comstart and the first for comend. */
79#define SYNTAX_FLAGS_COMMENT_STYLE(flags, other_flags) \ 79#define SYNTAX_FLAGS_COMMENT_STYLE(flags, other_flags) \
80 (SYNTAX_FLAGS_COMMENT_STYLEB (flags) \ 80 (SYNTAX_FLAGS_COMMENT_STYLEB (flags) \
81 | SYNTAX_FLAGS_COMMENT_STYLEC (flags) \ 81 | SYNTAX_FLAGS_COMMENT_STYLEC2 (flags) \
82 | SYNTAX_FLAGS_COMMENT_STYLEC (other_flags)) 82 | SYNTAX_FLAGS_COMMENT_STYLEC2 (other_flags))
83 83
84#define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1) 84#define SYNTAX_FLAGS_COMMENT_NESTED(flags) (((flags) >> 22) & 1)
85 85
@@ -114,7 +114,7 @@ struct lisp_parse_state
114 int instring; /* -1 if not within string, else desired terminator. */ 114 int instring; /* -1 if not within string, else desired terminator. */
115 EMACS_INT incomment; /* -1 if in unnestable comment else comment nesting */ 115 EMACS_INT incomment; /* -1 if in unnestable comment else comment nesting */
116 int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE. */ 116 int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE. */
117 int quoted; /* Nonzero if just after an escape char at end of parsing */ 117 bool quoted; /* True if just after an escape char at end of parsing. */
118 EMACS_INT mindepth; /* Minimum depth seen while scanning. */ 118 EMACS_INT mindepth; /* Minimum depth seen while scanning. */
119 /* Char number of most recent start-of-expression at current level */ 119 /* Char number of most recent start-of-expression at current level */
120 ptrdiff_t thislevelstart; 120 ptrdiff_t thislevelstart;
@@ -143,13 +143,13 @@ static ptrdiff_t find_start_begv;
143static EMACS_INT find_start_modiff; 143static EMACS_INT find_start_modiff;
144 144
145 145
146static Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int); 146static Lisp_Object skip_chars (bool, Lisp_Object, Lisp_Object, bool);
147static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object); 147static Lisp_Object skip_syntaxes (bool, Lisp_Object, Lisp_Object);
148static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int); 148static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, bool);
149static void scan_sexps_forward (struct lisp_parse_state *, 149static void scan_sexps_forward (struct lisp_parse_state *,
150 ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, 150 ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT,
151 int, Lisp_Object, int); 151 bool, Lisp_Object, int);
152static int in_classes (int, Lisp_Object); 152static bool in_classes (int, Lisp_Object);
153 153
154/* This setter is used only in this file, so it can be private. */ 154/* This setter is used only in this file, so it can be private. */
155static void 155static void
@@ -159,7 +159,8 @@ bset_syntax_table (struct buffer *b, Lisp_Object val)
159} 159}
160 160
161/* Whether the syntax of the character C has the prefix flag set. */ 161/* Whether the syntax of the character C has the prefix flag set. */
162int syntax_prefix_flag_p (int c) 162bool
163syntax_prefix_flag_p (int c)
163{ 164{
164 return SYNTAX_PREFIX (c); 165 return SYNTAX_PREFIX (c);
165} 166}
@@ -183,12 +184,12 @@ struct gl_state_s gl_state; /* Global state of syntax parser. */
183 start/end of OBJECT. */ 184 start/end of OBJECT. */
184 185
185void 186void
186update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init, 187update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init,
187 Lisp_Object object) 188 Lisp_Object object)
188{ 189{
189 Lisp_Object tmp_table; 190 Lisp_Object tmp_table;
190 unsigned cnt = 0; 191 int cnt = 0;
191 int invalidate = 1; 192 bool invalidate = 1;
192 INTERVAL i; 193 INTERVAL i;
193 194
194 if (init) 195 if (init)
@@ -340,16 +341,16 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init,
340 gl_state.b_property = gl_state.start; 341 gl_state.b_property = gl_state.start;
341} 342}
342 343
343/* Returns TRUE if char at CHARPOS is quoted. 344/* Returns true if char at CHARPOS is quoted.
344 Global syntax-table data should be set up already to be good at CHARPOS 345 Global syntax-table data should be set up already to be good at CHARPOS
345 or after. On return global syntax data is good for lookup at CHARPOS. */ 346 or after. On return global syntax data is good for lookup at CHARPOS. */
346 347
347static int 348static bool
348char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos) 349char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos)
349{ 350{
350 register enum syntaxcode code; 351 enum syntaxcode code;
351 register ptrdiff_t beg = BEGV; 352 ptrdiff_t beg = BEGV;
352 register int quoted = 0; 353 bool quoted = 0;
353 ptrdiff_t orig = charpos; 354 ptrdiff_t orig = charpos;
354 355
355 while (charpos > beg) 356 while (charpos > beg)
@@ -466,10 +467,11 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte)
466 467
467/* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE. */ 468/* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE. */
468 469
469static int 470static bool
470prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte) 471prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte)
471{ 472{
472 int c, val; 473 int c;
474 bool val;
473 475
474 DEC_BOTH (pos, pos_byte); 476 DEC_BOTH (pos, pos_byte);
475 UPDATE_SYNTAX_TABLE_BACKWARD (pos); 477 UPDATE_SYNTAX_TABLE_BACKWARD (pos);
@@ -479,28 +481,11 @@ prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte)
479 return val; 481 return val;
480} 482}
481 483
482/* Return the SYNTAX_COMSTART_FIRST of the character before POS, POS_BYTE. */ 484/* Check whether charpos FROM is at the end of a comment.
483
484/* static int
485 * prev_char_comstart_first (pos, pos_byte)
486 * int pos, pos_byte;
487 * {
488 * int c, val;
489 *
490 * DEC_BOTH (pos, pos_byte);
491 * UPDATE_SYNTAX_TABLE_BACKWARD (pos);
492 * c = FETCH_CHAR (pos_byte);
493 * val = SYNTAX_COMSTART_FIRST (c);
494 * UPDATE_SYNTAX_TABLE_FORWARD (pos + 1);
495 * return val;
496 * } */
497
498/* Checks whether charpos FROM is at the end of a comment.
499 FROM_BYTE is the bytepos corresponding to FROM. 485 FROM_BYTE is the bytepos corresponding to FROM.
500 Do not move back before STOP. 486 Do not move back before STOP.
501 487
502 Return a positive value if we find a comment ending at FROM/FROM_BYTE; 488 Return true if we find a comment ending at FROM/FROM_BYTE.
503 return -1 otherwise.
504 489
505 If successful, store the charpos of the comment's beginning 490 If successful, store the charpos of the comment's beginning
506 into *CHARPOS_PTR, and the bytepos into *BYTEPOS_PTR. 491 into *CHARPOS_PTR, and the bytepos into *BYTEPOS_PTR.
@@ -508,8 +493,10 @@ prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte)
508 Global syntax data remains valid for backward search starting at 493 Global syntax data remains valid for backward search starting at
509 the returned value (or at FROM, if the search was not successful). */ 494 the returned value (or at FROM, if the search was not successful). */
510 495
511static int 496static bool
512back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested, int comstyle, ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr) 497back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
498 bool comnested, int comstyle, ptrdiff_t *charpos_ptr,
499 ptrdiff_t *bytepos_ptr)
513{ 500{
514 /* Look back, counting the parity of string-quotes, 501 /* Look back, counting the parity of string-quotes,
515 and recording the comment-starters seen. 502 and recording the comment-starters seen.
@@ -521,13 +508,13 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested
521 which is I+2X quotes from the comment-end. 508 which is I+2X quotes from the comment-end.
522 PARITY is current parity of quotes from the comment end. */ 509 PARITY is current parity of quotes from the comment end. */
523 int string_style = -1; /* Presumed outside of any string. */ 510 int string_style = -1; /* Presumed outside of any string. */
524 int string_lossage = 0; 511 bool string_lossage = 0;
525 /* Not a real lossage: indicates that we have passed a matching comment 512 /* Not a real lossage: indicates that we have passed a matching comment
526 starter plus a non-matching comment-ender, meaning that any matching 513 starter plus a non-matching comment-ender, meaning that any matching
527 comment-starter we might see later could be a false positive (hidden 514 comment-starter we might see later could be a false positive (hidden
528 inside another comment). 515 inside another comment).
529 Test case: { a (* b } c (* d *) */ 516 Test case: { a (* b } c (* d *) */
530 int comment_lossage = 0; 517 bool comment_lossage = 0;
531 ptrdiff_t comment_end = from; 518 ptrdiff_t comment_end = from;
532 ptrdiff_t comment_end_byte = from_byte; 519 ptrdiff_t comment_end_byte = from_byte;
533 ptrdiff_t comstart_pos = 0; 520 ptrdiff_t comstart_pos = 0;
@@ -536,8 +523,8 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested
536 or 0 if we didn't come across it yet. */ 523 or 0 if we didn't come across it yet. */
537 ptrdiff_t defun_start = 0; 524 ptrdiff_t defun_start = 0;
538 ptrdiff_t defun_start_byte = 0; 525 ptrdiff_t defun_start_byte = 0;
539 register enum syntaxcode code; 526 enum syntaxcode code;
540 int nesting = 1; /* current comment nesting */ 527 ptrdiff_t nesting = 1; /* current comment nesting */
541 int c; 528 int c;
542 int syntax = 0; 529 int syntax = 0;
543 530
@@ -550,8 +537,8 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested
550 while (from != stop) 537 while (from != stop)
551 { 538 {
552 ptrdiff_t temp_byte; 539 ptrdiff_t temp_byte;
553 int prev_syntax, com2start, com2end; 540 int prev_syntax;
554 int comstart; 541 bool com2start, com2end, comstart;
555 542
556 /* Move back and examine a character. */ 543 /* Move back and examine a character. */
557 DEC_BOTH (from, from_byte); 544 DEC_BOTH (from, from_byte);
@@ -772,7 +759,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested
772 *charpos_ptr = from; 759 *charpos_ptr = from;
773 *bytepos_ptr = from_byte; 760 *bytepos_ptr = from_byte;
774 761
775 return (from == comment_end) ? -1 : from; 762 return from != comment_end;
776} 763}
777 764
778DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0, 765DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0,
@@ -854,31 +841,28 @@ One argument, a syntax table. */)
854 into the code it signifies. 841 into the code it signifies.
855 This is used by modify-syntax-entry, and other things. */ 842 This is used by modify-syntax-entry, and other things. */
856 843
857unsigned char syntax_spec_code[0400] = 844unsigned char const syntax_spec_code[0400] =
858 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 845 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
859 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 846 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
860 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 847 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
861 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 848 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
862 (char) Swhitespace, (char) Scomment_fence, (char) Sstring, 0377, 849 Swhitespace, Scomment_fence, Sstring, 0377, Smath, 0377, 0377, Squote,
863 (char) Smath, 0377, 0377, (char) Squote, 850 Sopen, Sclose, 0377, 0377, 0377, Swhitespace, Spunct, Scharquote,
864 (char) Sopen, (char) Sclose, 0377, 0377,
865 0377, (char) Swhitespace, (char) Spunct, (char) Scharquote,
866 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 851 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
867 0377, 0377, 0377, 0377, 852 0377, 0377, 0377, 0377, Scomment, 0377, Sendcomment, 0377,
868 (char) Scomment, 0377, (char) Sendcomment, 0377, 853 Sinherit, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* @, A ... */
869 (char) Sinherit, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* @, A ... */
870 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 854 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
871 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword, 855 0377, 0377, 0377, 0377, 0377, 0377, 0377, Sword,
872 0377, 0377, 0377, 0377, (char) Sescape, 0377, 0377, (char) Ssymbol, 856 0377, 0377, 0377, 0377, Sescape, 0377, 0377, Ssymbol,
873 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* `, a, ... */ 857 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* `, a, ... */
874 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 858 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
875 0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword, 859 0377, 0377, 0377, 0377, 0377, 0377, 0377, Sword,
876 0377, 0377, 0377, 0377, (char) Sstring_fence, 0377, 0377, 0377 860 0377, 0377, 0377, 0377, Sstring_fence, 0377, 0377, 0377
877 }; 861 };
878 862
879/* Indexed by syntax code, give the letter that describes it. */ 863/* Indexed by syntax code, give the letter that describes it. */
880 864
881char syntax_code_spec[16] = 865char const syntax_code_spec[16] =
882 { 866 {
883 ' ', '.', 'w', '_', '(', ')', '\'', '\"', '$', '\\', '/', '<', '>', '@', 867 ' ', '.', 'w', '_', '(', ')', '\'', '\"', '$', '\\', '/', '<', '>', '@',
884 '!', '|' 868 '!', '|'
@@ -904,15 +888,16 @@ are listed in the documentation of `modify-syntax-entry'. */)
904 CHECK_CHARACTER (character); 888 CHECK_CHARACTER (character);
905 char_int = XINT (character); 889 char_int = XINT (character);
906 SETUP_BUFFER_SYNTAX_TABLE (); 890 SETUP_BUFFER_SYNTAX_TABLE ();
907 return make_number (syntax_code_spec[(int) SYNTAX (char_int)]); 891 return make_number (syntax_code_spec[SYNTAX (char_int)]);
908} 892}
909 893
910DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0, 894DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0,
911 doc: /* Return the matching parenthesis of CHARACTER, or nil if none. */) 895 doc: /* Return the matching parenthesis of CHARACTER, or nil if none. */)
912 (Lisp_Object character) 896 (Lisp_Object character)
913{ 897{
914 int char_int, code; 898 int char_int;
915 CHECK_NUMBER (character); 899 enum syntaxcode code;
900 CHECK_CHARACTER (character);
916 char_int = XINT (character); 901 char_int = XINT (character);
917 SETUP_BUFFER_SYNTAX_TABLE (); 902 SETUP_BUFFER_SYNTAX_TABLE ();
918 code = SYNTAX (char_int); 903 code = SYNTAX (char_int);
@@ -929,19 +914,18 @@ cons cell \(CODE . MATCHING-CHAR) which can be used, for example, as
929the value of a `syntax-table' text property. */) 914the value of a `syntax-table' text property. */)
930 (Lisp_Object string) 915 (Lisp_Object string)
931{ 916{
932 register const unsigned char *p; 917 const unsigned char *p;
933 register enum syntaxcode code;
934 int val; 918 int val;
935 Lisp_Object match; 919 Lisp_Object match;
936 920
937 CHECK_STRING (string); 921 CHECK_STRING (string);
938 922
939 p = SDATA (string); 923 p = SDATA (string);
940 code = (enum syntaxcode) syntax_spec_code[*p++]; 924 val = syntax_spec_code[*p++];
941 if (((int) code & 0377) == 0377) 925 if (val == 0377)
942 error ("Invalid syntax description letter: %c", p[-1]); 926 error ("Invalid syntax description letter: %c", p[-1]);
943 927
944 if (code == Sinherit) 928 if (val == Sinherit)
945 return Qnil; 929 return Qnil;
946 930
947 if (*p) 931 if (*p)
@@ -956,7 +940,6 @@ the value of a `syntax-table' text property. */)
956 else 940 else
957 match = Qnil; 941 match = Qnil;
958 942
959 val = (int) code;
960 while (*p) 943 while (*p)
961 switch (*p++) 944 switch (*p++)
962 { 945 {
@@ -1078,10 +1061,8 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
1078 doc: /* Insert a description of the internal syntax description SYNTAX at point. */) 1061 doc: /* Insert a description of the internal syntax description SYNTAX at point. */)
1079 (Lisp_Object syntax) 1062 (Lisp_Object syntax)
1080{ 1063{
1081 register enum syntaxcode code; 1064 int code, syntax_code;
1082 int syntax_code; 1065 bool start1, start2, end1, end2, prefix, comstyleb, comstylec, comnested;
1083 char desc, start1, start2, end1, end2, prefix,
1084 comstyleb, comstylec, comnested;
1085 char str[2]; 1066 char str[2];
1086 Lisp_Object first, match_lisp, value = syntax; 1067 Lisp_Object first, match_lisp, value = syntax;
1087 1068
@@ -1113,7 +1094,7 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
1113 } 1094 }
1114 1095
1115 syntax_code = XINT (first) & INT_MAX; 1096 syntax_code = XINT (first) & INT_MAX;
1116 code = (enum syntaxcode) (syntax_code & 0377); 1097 code = syntax_code & 0377;
1117 start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code); 1098 start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code);
1118 start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);; 1099 start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);;
1119 end1 = SYNTAX_FLAGS_COMEND_FIRST (syntax_code); 1100 end1 = SYNTAX_FLAGS_COMEND_FIRST (syntax_code);
@@ -1123,14 +1104,13 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
1123 comstylec = SYNTAX_FLAGS_COMMENT_STYLEC (syntax_code); 1104 comstylec = SYNTAX_FLAGS_COMMENT_STYLEC (syntax_code);
1124 comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax_code); 1105 comnested = SYNTAX_FLAGS_COMMENT_NESTED (syntax_code);
1125 1106
1126 if ((int) code < 0 || (int) code >= (int) Smax) 1107 if (Smax <= code)
1127 { 1108 {
1128 insert_string ("invalid"); 1109 insert_string ("invalid");
1129 return syntax; 1110 return syntax;
1130 } 1111 }
1131 desc = syntax_code_spec[(int) code];
1132 1112
1133 str[0] = desc, str[1] = 0; 1113 str[0] = syntax_code_spec[code], str[1] = 0;
1134 insert (str, 1); 1114 insert (str, 1);
1135 1115
1136 if (NILP (match_lisp)) 1116 if (NILP (match_lisp))
@@ -1431,21 +1411,21 @@ This function returns the distance traveled, either zero or negative. */)
1431} 1411}
1432 1412
1433static Lisp_Object 1413static Lisp_Object
1434skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_classes) 1414skip_chars (bool forwardp, Lisp_Object string, Lisp_Object lim,
1415 bool handle_iso_classes)
1435{ 1416{
1436 register unsigned int c; 1417 int c;
1437 unsigned char fastmap[0400]; 1418 char fastmap[0400];
1438 /* Store the ranges of non-ASCII characters. */ 1419 /* Store the ranges of non-ASCII characters. */
1439 int *char_ranges IF_LINT (= NULL); 1420 int *char_ranges IF_LINT (= NULL);
1440 int n_char_ranges = 0; 1421 int n_char_ranges = 0;
1441 int negate = 0; 1422 bool negate = 0;
1442 register ptrdiff_t i, i_byte; 1423 ptrdiff_t i, i_byte;
1443 /* Set to 1 if the current buffer is multibyte and the region 1424 /* True if the current buffer is multibyte and the region contains
1444 contains non-ASCII chars. */ 1425 non-ASCII chars. */
1445 int multibyte; 1426 bool multibyte;
1446 /* Set to 1 if STRING is multibyte and it contains non-ASCII 1427 /* True if STRING is multibyte and it contains non-ASCII chars. */
1447 chars. */ 1428 bool string_multibyte;
1448 int string_multibyte;
1449 ptrdiff_t size_byte; 1429 ptrdiff_t size_byte;
1450 const unsigned char *str; 1430 const unsigned char *str;
1451 int len; 1431 int len;
@@ -1489,7 +1469,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1489 1469
1490 if (! string_multibyte) 1470 if (! string_multibyte)
1491 { 1471 {
1492 int string_has_eight_bit = 0; 1472 bool string_has_eight_bit = 0;
1493 1473
1494 /* At first setup fastmap. */ 1474 /* At first setup fastmap. */
1495 while (i_byte < size_byte) 1475 while (i_byte < size_byte)
@@ -1544,7 +1524,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1544 if (i_byte + 1 < size_byte 1524 if (i_byte + 1 < size_byte
1545 && str[i_byte] == '-') 1525 && str[i_byte] == '-')
1546 { 1526 {
1547 unsigned int c2; 1527 int c2;
1548 1528
1549 /* Skip over the dash. */ 1529 /* Skip over the dash. */
1550 i_byte++; 1530 i_byte++;
@@ -1557,7 +1537,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1557 1537
1558 if (c <= c2) 1538 if (c <= c2)
1559 { 1539 {
1560 unsigned lim2 = c2 + 1; 1540 int lim2 = c2 + 1;
1561 while (c < lim2) 1541 while (c < lim2)
1562 fastmap[c++] = 1; 1542 fastmap[c++] = 1;
1563 if (! ASCII_CHAR_P (c2)) 1543 if (! ASCII_CHAR_P (c2))
@@ -1610,9 +1590,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1610 1590
1611 while (i_byte < size_byte) 1591 while (i_byte < size_byte)
1612 { 1592 {
1613 unsigned char leading_code; 1593 int leading_code = str[i_byte];
1614
1615 leading_code = str[i_byte];
1616 c = STRING_CHAR_AND_LENGTH (str + i_byte, len); 1594 c = STRING_CHAR_AND_LENGTH (str + i_byte, len);
1617 i_byte += len; 1595 i_byte += len;
1618 1596
@@ -1666,8 +1644,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1666 if (i_byte + 1 < size_byte 1644 if (i_byte + 1 < size_byte
1667 && str[i_byte] == '-') 1645 && str[i_byte] == '-')
1668 { 1646 {
1669 unsigned int c2; 1647 int c2, leading_code2;
1670 unsigned char leading_code2;
1671 1648
1672 /* Skip over the dash. */ 1649 /* Skip over the dash. */
1673 i_byte++; 1650 i_byte++;
@@ -1681,7 +1658,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1681 && i_byte < size_byte) 1658 && i_byte < size_byte)
1682 { 1659 {
1683 leading_code2 = str[i_byte]; 1660 leading_code2 = str[i_byte];
1684 c2 =STRING_CHAR_AND_LENGTH (str + i_byte, len); 1661 c2 = STRING_CHAR_AND_LENGTH (str + i_byte, len);
1685 i_byte += len; 1662 i_byte += len;
1686 } 1663 }
1687 1664
@@ -1695,7 +1672,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1695 } 1672 }
1696 if (! ASCII_CHAR_P (c)) 1673 if (! ASCII_CHAR_P (c))
1697 { 1674 {
1698 unsigned lim2 = leading_code2 + 1; 1675 int lim2 = leading_code2 + 1;
1699 while (leading_code < lim2) 1676 while (leading_code < lim2)
1700 fastmap[leading_code++] = 1; 1677 fastmap[leading_code++] = 1;
1701 if (c <= c2) 1678 if (c <= c2)
@@ -1728,7 +1705,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1728 for (i = 0; i < n_char_ranges; i += 2) 1705 for (i = 0; i < n_char_ranges; i += 2)
1729 { 1706 {
1730 int c1 = char_ranges[i]; 1707 int c1 = char_ranges[i];
1731 unsigned lim2 = char_ranges[i + 1] + 1; 1708 int lim2 = char_ranges[i + 1] + 1;
1732 1709
1733 for (; c1 < lim2; c1++) 1710 for (; c1 < lim2; c1++)
1734 { 1711 {
@@ -1924,13 +1901,13 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1924 1901
1925 1902
1926static Lisp_Object 1903static Lisp_Object
1927skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) 1904skip_syntaxes (bool forwardp, Lisp_Object string, Lisp_Object lim)
1928{ 1905{
1929 register unsigned int c; 1906 int c;
1930 unsigned char fastmap[0400]; 1907 unsigned char fastmap[0400];
1931 int negate = 0; 1908 bool negate = 0;
1932 register ptrdiff_t i, i_byte; 1909 ptrdiff_t i, i_byte;
1933 int multibyte; 1910 bool multibyte;
1934 ptrdiff_t size_byte; 1911 ptrdiff_t size_byte;
1935 unsigned char *str; 1912 unsigned char *str;
1936 1913
@@ -2018,7 +1995,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
2018 stop = endp; 1995 stop = endp;
2019 } 1996 }
2020 c = STRING_CHAR_AND_LENGTH (p, nbytes); 1997 c = STRING_CHAR_AND_LENGTH (p, nbytes);
2021 if (! fastmap[(int) SYNTAX (c)]) 1998 if (! fastmap[SYNTAX (c)])
2022 break; 1999 break;
2023 p += nbytes, pos++, pos_byte += nbytes; 2000 p += nbytes, pos++, pos_byte += nbytes;
2024 UPDATE_SYNTAX_TABLE_FORWARD (pos); 2001 UPDATE_SYNTAX_TABLE_FORWARD (pos);
@@ -2035,7 +2012,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
2035 p = GAP_END_ADDR; 2012 p = GAP_END_ADDR;
2036 stop = endp; 2013 stop = endp;
2037 } 2014 }
2038 if (! fastmap[(int) SYNTAX (*p)]) 2015 if (! fastmap[SYNTAX (*p)])
2039 break; 2016 break;
2040 p++, pos++, pos_byte++; 2017 p++, pos++, pos_byte++;
2041 UPDATE_SYNTAX_TABLE_FORWARD (pos); 2018 UPDATE_SYNTAX_TABLE_FORWARD (pos);
@@ -2061,7 +2038,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
2061 prev_p = p; 2038 prev_p = p;
2062 while (--p >= stop && ! CHAR_HEAD_P (*p)); 2039 while (--p >= stop && ! CHAR_HEAD_P (*p));
2063 c = STRING_CHAR (p); 2040 c = STRING_CHAR (p);
2064 if (! fastmap[(int) SYNTAX (c)]) 2041 if (! fastmap[SYNTAX (c)])
2065 break; 2042 break;
2066 pos--, pos_byte -= prev_p - p; 2043 pos--, pos_byte -= prev_p - p;
2067 } 2044 }
@@ -2078,7 +2055,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
2078 stop = endp; 2055 stop = endp;
2079 } 2056 }
2080 UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1); 2057 UPDATE_SYNTAX_TABLE_BACKWARD (pos - 1);
2081 if (! fastmap[(int) SYNTAX (p[-1])]) 2058 if (! fastmap[SYNTAX (p[-1])])
2082 break; 2059 break;
2083 p--, pos--, pos_byte--; 2060 p--, pos--, pos_byte--;
2084 } 2061 }
@@ -2092,14 +2069,14 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
2092 } 2069 }
2093} 2070}
2094 2071
2095/* Return 1 if character C belongs to one of the ISO classes 2072/* Return true if character C belongs to one of the ISO classes
2096 in the list ISO_CLASSES. Each class is represented by an 2073 in the list ISO_CLASSES. Each class is represented by an
2097 integer which is its type according to re_wctype. */ 2074 integer which is its type according to re_wctype. */
2098 2075
2099static int 2076static bool
2100in_classes (int c, Lisp_Object iso_classes) 2077in_classes (int c, Lisp_Object iso_classes)
2101{ 2078{
2102 int fits_class = 0; 2079 bool fits_class = 0;
2103 2080
2104 while (CONSP (iso_classes)) 2081 while (CONSP (iso_classes))
2105 { 2082 {
@@ -2119,26 +2096,26 @@ in_classes (int c, Lisp_Object iso_classes)
2119 FROM_BYTE is the bytepos corresponding to FROM. 2096 FROM_BYTE is the bytepos corresponding to FROM.
2120 Do not move past STOP (a charpos). 2097 Do not move past STOP (a charpos).
2121 The comment over which we have to jump is of style STYLE 2098 The comment over which we have to jump is of style STYLE
2122 (either SYNTAX_FLAGS_COMMENT_STYLE(foo) or ST_COMMENT_STYLE). 2099 (either SYNTAX_FLAGS_COMMENT_STYLE (foo) or ST_COMMENT_STYLE).
2123 NESTING should be positive to indicate the nesting at the beginning 2100 NESTING should be positive to indicate the nesting at the beginning
2124 for nested comments and should be zero or negative else. 2101 for nested comments and should be zero or negative else.
2125 ST_COMMENT_STYLE cannot be nested. 2102 ST_COMMENT_STYLE cannot be nested.
2126 PREV_SYNTAX is the SYNTAX_WITH_FLAGS of the previous character 2103 PREV_SYNTAX is the SYNTAX_WITH_FLAGS of the previous character
2127 (or 0 If the search cannot start in the middle of a two-character). 2104 (or 0 If the search cannot start in the middle of a two-character).
2128 2105
2129 If successful, return 1 and store the charpos of the comment's end 2106 If successful, return true and store the charpos of the comment's end
2130 into *CHARPOS_PTR and the corresponding bytepos into *BYTEPOS_PTR. 2107 into *CHARPOS_PTR and the corresponding bytepos into *BYTEPOS_PTR.
2131 Else, return 0 and store the charpos STOP into *CHARPOS_PTR, the 2108 Else, return false and store the charpos STOP into *CHARPOS_PTR, the
2132 corresponding bytepos into *BYTEPOS_PTR and the current nesting 2109 corresponding bytepos into *BYTEPOS_PTR and the current nesting
2133 (as defined for state.incomment) in *INCOMMENT_PTR. 2110 (as defined for state.incomment) in *INCOMMENT_PTR.
2134 2111
2135 The comment end is the last character of the comment rather than the 2112 The comment end is the last character of the comment rather than the
2136 character just after the comment. 2113 character just after the comment.
2137 2114
2138 Global syntax data is assumed to initially be valid for FROM and 2115 Global syntax data is assumed to initially be valid for FROM and
2139 remains valid for forward search starting at the returned position. */ 2116 remains valid for forward search starting at the returned position. */
2140 2117
2141static int 2118static bool
2142forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, 2119forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
2143 EMACS_INT nesting, int style, int prev_syntax, 2120 EMACS_INT nesting, int style, int prev_syntax,
2144 ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr, 2121 ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr,
@@ -2244,14 +2221,12 @@ If COUNT comments are found as expected, with nothing except whitespace
2244between them, return t; otherwise return nil. */) 2221between them, return t; otherwise return nil. */)
2245 (Lisp_Object count) 2222 (Lisp_Object count)
2246{ 2223{
2247 register ptrdiff_t from; 2224 ptrdiff_t from, from_byte, stop;
2248 ptrdiff_t from_byte; 2225 int c, c1;
2249 register ptrdiff_t stop; 2226 enum syntaxcode code;
2250 register int c, c1;
2251 register enum syntaxcode code;
2252 int comstyle = 0; /* style of comment encountered */ 2227 int comstyle = 0; /* style of comment encountered */
2253 int comnested = 0; /* whether the comment is nestable or not */ 2228 bool comnested = 0; /* whether the comment is nestable or not */
2254 int found; 2229 bool found;
2255 EMACS_INT count1; 2230 EMACS_INT count1;
2256 ptrdiff_t out_charpos, out_bytepos; 2231 ptrdiff_t out_charpos, out_bytepos;
2257 EMACS_INT dummy; 2232 EMACS_INT dummy;
@@ -2271,7 +2246,8 @@ between them, return t; otherwise return nil. */)
2271 { 2246 {
2272 do 2247 do
2273 { 2248 {
2274 int comstart_first, syntax, other_syntax; 2249 bool comstart_first;
2250 int syntax, other_syntax;
2275 2251
2276 if (from == stop) 2252 if (from == stop)
2277 { 2253 {
@@ -2299,8 +2275,7 @@ between them, return t; otherwise return nil. */)
2299 the comment section. */ 2275 the comment section. */
2300 code = Scomment; 2276 code = Scomment;
2301 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); 2277 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
2302 comnested 2278 comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
2303 = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
2304 INC_BOTH (from, from_byte); 2279 INC_BOTH (from, from_byte);
2305 UPDATE_SYNTAX_TABLE_FORWARD (from); 2280 UPDATE_SYNTAX_TABLE_FORWARD (from);
2306 } 2281 }
@@ -2336,7 +2311,8 @@ between them, return t; otherwise return nil. */)
2336 { 2311 {
2337 while (1) 2312 while (1)
2338 { 2313 {
2339 int quoted, syntax; 2314 bool quoted;
2315 int syntax;
2340 2316
2341 if (from <= stop) 2317 if (from <= stop)
2342 { 2318 {
@@ -2370,14 +2346,13 @@ between them, return t; otherwise return nil. */)
2370 c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); 2346 c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
2371 other_syntax = SYNTAX_WITH_FLAGS (c1); 2347 other_syntax = SYNTAX_WITH_FLAGS (c1);
2372 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); 2348 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
2373 comnested 2349 comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
2374 = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
2375 } 2350 }
2376 2351
2377 if (code == Scomment_fence) 2352 if (code == Scomment_fence)
2378 { 2353 {
2379 /* Skip until first preceding unquoted comment_fence. */ 2354 /* Skip until first preceding unquoted comment_fence. */
2380 int fence_found = 0; 2355 bool fence_found = 0;
2381 ptrdiff_t ini = from, ini_byte = from_byte; 2356 ptrdiff_t ini = from, ini_byte = from_byte;
2382 2357
2383 while (1) 2358 while (1)
@@ -2408,7 +2383,7 @@ between them, return t; otherwise return nil. */)
2408 { 2383 {
2409 found = back_comment (from, from_byte, stop, comnested, comstyle, 2384 found = back_comment (from, from_byte, stop, comnested, comstyle,
2410 &out_charpos, &out_bytepos); 2385 &out_charpos, &out_bytepos);
2411 if (found == -1) 2386 if (!found)
2412 { 2387 {
2413 if (c == '\n') 2388 if (c == '\n')
2414 /* This end-of-line is not an end-of-comment. 2389 /* This end-of-line is not an end-of-comment.
@@ -2458,26 +2433,25 @@ between them, return t; otherwise return nil. */)
2458 ? SYNTAX (c) : Ssymbol) 2433 ? SYNTAX (c) : Ssymbol)
2459 2434
2460static Lisp_Object 2435static Lisp_Object
2461scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpflag) 2436scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag)
2462{ 2437{
2463 Lisp_Object val; 2438 Lisp_Object val;
2464 register ptrdiff_t stop = count > 0 ? ZV : BEGV; 2439 ptrdiff_t stop = count > 0 ? ZV : BEGV;
2465 register int c, c1; 2440 int c, c1;
2466 int stringterm; 2441 int stringterm;
2467 int quoted; 2442 bool quoted;
2468 int mathexit = 0; 2443 bool mathexit = 0;
2469 register enum syntaxcode code, temp_code; 2444 enum syntaxcode code, temp_code, c_code;
2470 EMACS_INT min_depth = depth; /* Err out if depth gets less than this. */ 2445 EMACS_INT min_depth = depth; /* Err out if depth gets less than this. */
2471 int comstyle = 0; /* style of comment encountered */ 2446 int comstyle = 0; /* style of comment encountered */
2472 int comnested = 0; /* whether the comment is nestable or not */ 2447 bool comnested = 0; /* whether the comment is nestable or not */
2473 ptrdiff_t temp_pos; 2448 ptrdiff_t temp_pos;
2474 EMACS_INT last_good = from; 2449 EMACS_INT last_good = from;
2475 int found; 2450 bool found;
2476 ptrdiff_t from_byte; 2451 ptrdiff_t from_byte;
2477 ptrdiff_t out_bytepos, out_charpos; 2452 ptrdiff_t out_bytepos, out_charpos;
2478 int temp;
2479 EMACS_INT dummy; 2453 EMACS_INT dummy;
2480 int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol; 2454 bool multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol;
2481 2455
2482 if (depth > 0) min_depth = 0; 2456 if (depth > 0) min_depth = 0;
2483 2457
@@ -2494,7 +2468,8 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2494 { 2468 {
2495 while (from < stop) 2469 while (from < stop)
2496 { 2470 {
2497 int comstart_first, prefix, syntax, other_syntax; 2471 bool comstart_first, prefix;
2472 int syntax, other_syntax;
2498 UPDATE_SYNTAX_TABLE_FORWARD (from); 2473 UPDATE_SYNTAX_TABLE_FORWARD (from);
2499 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); 2474 c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
2500 syntax = SYNTAX_WITH_FLAGS (c); 2475 syntax = SYNTAX_WITH_FLAGS (c);
@@ -2520,8 +2495,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2520 the comment section */ 2495 the comment section */
2521 code = Scomment; 2496 code = Scomment;
2522 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); 2497 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
2523 comnested 2498 comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
2524 = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
2525 INC_BOTH (from, from_byte); 2499 INC_BOTH (from, from_byte);
2526 UPDATE_SYNTAX_TABLE_FORWARD (from); 2500 UPDATE_SYNTAX_TABLE_FORWARD (from);
2527 } 2501 }
@@ -2547,8 +2521,8 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2547 2521
2548 /* Some compilers can't handle this inside the switch. */ 2522 /* Some compilers can't handle this inside the switch. */
2549 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); 2523 c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
2550 temp = SYNTAX_WITH_MULTIBYTE_CHECK (c); 2524 c_code = SYNTAX_WITH_MULTIBYTE_CHECK (c);
2551 switch (temp) 2525 switch (c_code)
2552 { 2526 {
2553 case Scharquote: 2527 case Scharquote:
2554 case Sescape: 2528 case Sescape:
@@ -2631,8 +2605,8 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2631 break; 2605 break;
2632 2606
2633 /* Some compilers can't handle this inside the switch. */ 2607 /* Some compilers can't handle this inside the switch. */
2634 temp = SYNTAX_WITH_MULTIBYTE_CHECK (c); 2608 c_code = SYNTAX_WITH_MULTIBYTE_CHECK (c);
2635 switch (temp) 2609 switch (c_code)
2636 { 2610 {
2637 case Scharquote: 2611 case Scharquote:
2638 case Sescape: 2612 case Sescape:
@@ -2691,8 +2665,7 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2691 c2 = FETCH_CHAR_AS_MULTIBYTE (from_byte); 2665 c2 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
2692 other_syntax = SYNTAX_WITH_FLAGS (c2); 2666 other_syntax = SYNTAX_WITH_FLAGS (c2);
2693 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); 2667 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
2694 comnested 2668 comnested |= SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
2695 = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
2696 } 2669 }
2697 2670
2698 /* Quoting turns anything except a comment-ender 2671 /* Quoting turns anything except a comment-ender
@@ -2777,13 +2750,13 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2777 break; 2750 break;
2778 found = back_comment (from, from_byte, stop, comnested, comstyle, 2751 found = back_comment (from, from_byte, stop, comnested, comstyle,
2779 &out_charpos, &out_bytepos); 2752 &out_charpos, &out_bytepos);
2780 /* FIXME: if found == -1, then it really wasn't a comment-end. 2753 /* FIXME: if !found, it really wasn't a comment-end.
2781 For single-char Sendcomment, we can't do much about it apart 2754 For single-char Sendcomment, we can't do much about it apart
2782 from skipping the char. 2755 from skipping the char.
2783 For 2-char endcomments, we could try again, taking both 2756 For 2-char endcomments, we could try again, taking both
2784 chars as separate entities, but it's a lot of trouble 2757 chars as separate entities, but it's a lot of trouble
2785 for very little gain, so we don't bother either. -sm */ 2758 for very little gain, so we don't bother either. -sm */
2786 if (found != -1) 2759 if (found)
2787 from = out_charpos, from_byte = out_bytepos; 2760 from = out_charpos, from_byte = out_bytepos;
2788 break; 2761 break;
2789 2762
@@ -2938,7 +2911,7 @@ This includes chars with "quote" or "prefix" syntax (' or p). */)
2938/* Parse forward from FROM / FROM_BYTE to END, 2911/* Parse forward from FROM / FROM_BYTE to END,
2939 assuming that FROM has state OLDSTATE (nil means FROM is start of function), 2912 assuming that FROM has state OLDSTATE (nil means FROM is start of function),
2940 and return a description of the state of the parse at END. 2913 and return a description of the state of the parse at END.
2941 If STOPBEFORE is nonzero, stop at the start of an atom. 2914 If STOPBEFORE, stop at the start of an atom.
2942 If COMMENTSTOP is 1, stop at the start of a comment. 2915 If COMMENTSTOP is 1, stop at the start of a comment.
2943 If COMMENTSTOP is -1, stop at the start or end of a comment, 2916 If COMMENTSTOP is -1, stop at the start or end of a comment,
2944 after the beginning of a string, or after the end of a string. */ 2917 after the beginning of a string, or after the end of a string. */
@@ -2946,30 +2919,29 @@ This includes chars with "quote" or "prefix" syntax (' or p). */)
2946static void 2919static void
2947scan_sexps_forward (struct lisp_parse_state *stateptr, 2920scan_sexps_forward (struct lisp_parse_state *stateptr,
2948 ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t end, 2921 ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t end,
2949 EMACS_INT targetdepth, int stopbefore, 2922 EMACS_INT targetdepth, bool stopbefore,
2950 Lisp_Object oldstate, int commentstop) 2923 Lisp_Object oldstate, int commentstop)
2951{ 2924{
2952 struct lisp_parse_state state; 2925 struct lisp_parse_state state;
2953 2926 enum syntaxcode code;
2954 register enum syntaxcode code;
2955 int c1; 2927 int c1;
2956 int comnested; 2928 bool comnested;
2957 struct level { ptrdiff_t last, prev; }; 2929 struct level { ptrdiff_t last, prev; };
2958 struct level levelstart[100]; 2930 struct level levelstart[100];
2959 register struct level *curlevel = levelstart; 2931 struct level *curlevel = levelstart;
2960 struct level *endlevel = levelstart + 100; 2932 struct level *endlevel = levelstart + 100;
2961 register EMACS_INT depth; /* Paren depth of current scanning location. 2933 EMACS_INT depth; /* Paren depth of current scanning location.
2962 level - levelstart equals this except 2934 level - levelstart equals this except
2963 when the depth becomes negative. */ 2935 when the depth becomes negative. */
2964 EMACS_INT mindepth; /* Lowest DEPTH value seen. */ 2936 EMACS_INT mindepth; /* Lowest DEPTH value seen. */
2965 int start_quoted = 0; /* Nonzero means starting after a char quote */ 2937 bool start_quoted = 0; /* True means starting after a char quote. */
2966 Lisp_Object tem; 2938 Lisp_Object tem;
2967 ptrdiff_t prev_from; /* Keep one character before FROM. */ 2939 ptrdiff_t prev_from; /* Keep one character before FROM. */
2968 ptrdiff_t prev_from_byte; 2940 ptrdiff_t prev_from_byte;
2969 int prev_from_syntax; 2941 int prev_from_syntax;
2970 int boundary_stop = commentstop == -1; 2942 bool boundary_stop = commentstop == -1;
2971 int nofence; 2943 bool nofence;
2972 int found; 2944 bool found;
2973 ptrdiff_t out_bytepos, out_charpos; 2945 ptrdiff_t out_bytepos, out_charpos;
2974 int temp; 2946 int temp;
2975 2947
@@ -3100,8 +3072,8 @@ do { prev_from = from; \
3100 terminates the comment section. */ 3072 terminates the comment section. */
3101 state.comstyle 3073 state.comstyle
3102 = SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_from_syntax); 3074 = SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_from_syntax);
3103 comnested = SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax); 3075 comnested = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax)
3104 comnested = comnested || SYNTAX_FLAGS_COMMENT_NESTED (syntax); 3076 | SYNTAX_FLAGS_COMMENT_NESTED (syntax));
3105 state.incomment = comnested ? 1 : -1; 3077 state.incomment = comnested ? 1 : -1;
3106 state.comstr_start = prev_from; 3078 state.comstr_start = prev_from;
3107 INC_FROM; 3079 INC_FROM;
@@ -3146,9 +3118,9 @@ do { prev_from = from; \
3146 while (from < end) 3118 while (from < end)
3147 { 3119 {
3148 /* Some compilers can't handle this inside the switch. */ 3120 /* Some compilers can't handle this inside the switch. */
3149 temp = FETCH_CHAR_AS_MULTIBYTE (from_byte); 3121 int symchar = FETCH_CHAR_AS_MULTIBYTE (from_byte);
3150 temp = SYNTAX (temp); 3122 enum syntaxcode symcharcode = SYNTAX (symchar);
3151 switch (temp) 3123 switch (symcharcode)
3152 { 3124 {
3153 case Scharquote: 3125 case Scharquote:
3154 case Sescape: 3126 case Sescape:
@@ -3230,19 +3202,20 @@ do { prev_from = from; \
3230 while (1) 3202 while (1)
3231 { 3203 {
3232 int c; 3204 int c;
3205 enum syntaxcode c_code;
3233 3206
3234 if (from >= end) goto done; 3207 if (from >= end) goto done;
3235 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); 3208 c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
3236 /* Some compilers can't handle this inside the switch. */ 3209 /* Some compilers can't handle this inside the switch. */
3237 temp = SYNTAX (c); 3210 c_code = SYNTAX (c);
3238 3211
3239 /* Check TEMP here so that if the char has 3212 /* Check C_CODE here so that if the char has
3240 a syntax-table property which says it is NOT 3213 a syntax-table property which says it is NOT
3241 a string character, it does not end the string. */ 3214 a string character, it does not end the string. */
3242 if (nofence && c == state.instring && temp == Sstring) 3215 if (nofence && c == state.instring && c_code == Sstring)
3243 break; 3216 break;
3244 3217
3245 switch (temp) 3218 switch (c_code)
3246 { 3219 {
3247 case Sstring_fence: 3220 case Sstring_fence:
3248 if (!nofence) goto string_end; 3221 if (!nofence) goto string_end;
@@ -3398,25 +3371,25 @@ init_syntax_once (void)
3398 create syntax tables. */ 3371 create syntax tables. */
3399 Fput (Qsyntax_table, Qchar_table_extra_slots, make_number (0)); 3372 Fput (Qsyntax_table, Qchar_table_extra_slots, make_number (0));
3400 3373
3401 temp = AREF (Vsyntax_code_object, (int) Swhitespace); 3374 temp = AREF (Vsyntax_code_object, Swhitespace);
3402 3375
3403 Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp); 3376 Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp);
3404 3377
3405 /* Control characters should not be whitespace. */ 3378 /* Control characters should not be whitespace. */
3406 temp = AREF (Vsyntax_code_object, (int) Spunct); 3379 temp = AREF (Vsyntax_code_object, Spunct);
3407 for (i = 0; i <= ' ' - 1; i++) 3380 for (i = 0; i <= ' ' - 1; i++)
3408 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); 3381 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp);
3409 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 0177, temp); 3382 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 0177, temp);
3410 3383
3411 /* Except that a few really are whitespace. */ 3384 /* Except that a few really are whitespace. */
3412 temp = AREF (Vsyntax_code_object, (int) Swhitespace); 3385 temp = AREF (Vsyntax_code_object, Swhitespace);
3413 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ' ', temp); 3386 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ' ', temp);
3414 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\t', temp); 3387 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\t', temp);
3415 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\n', temp); 3388 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\n', temp);
3416 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 015, temp); 3389 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 015, temp);
3417 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 014, temp); 3390 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 014, temp);
3418 3391
3419 temp = AREF (Vsyntax_code_object, (int) Sword); 3392 temp = AREF (Vsyntax_code_object, Sword);
3420 for (i = 'a'; i <= 'z'; i++) 3393 for (i = 'a'; i <= 'z'; i++)
3421 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); 3394 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp);
3422 for (i = 'A'; i <= 'Z'; i++) 3395 for (i = 'A'; i <= 'Z'; i++)
@@ -3440,18 +3413,18 @@ init_syntax_once (void)
3440 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '}', 3413 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '}',
3441 Fcons (make_number (Sclose), make_number ('{'))); 3414 Fcons (make_number (Sclose), make_number ('{')));
3442 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '"', 3415 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '"',
3443 Fcons (make_number ((int) Sstring), Qnil)); 3416 Fcons (make_number (Sstring), Qnil));
3444 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\\', 3417 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\\',
3445 Fcons (make_number ((int) Sescape), Qnil)); 3418 Fcons (make_number (Sescape), Qnil));
3446 3419
3447 temp = AREF (Vsyntax_code_object, (int) Ssymbol); 3420 temp = AREF (Vsyntax_code_object, Ssymbol);
3448 for (i = 0; i < 10; i++) 3421 for (i = 0; i < 10; i++)
3449 { 3422 {
3450 c = "_-+*/&|<>="[i]; 3423 c = "_-+*/&|<>="[i];
3451 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, c, temp); 3424 SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, c, temp);
3452 } 3425 }
3453 3426
3454 temp = AREF (Vsyntax_code_object, (int) Spunct); 3427 temp = AREF (Vsyntax_code_object, Spunct);
3455 for (i = 0; i < 12; i++) 3428 for (i = 0; i < 12; i++)
3456 { 3429 {
3457 c = ".,;:?!#@~^'`"[i]; 3430 c = ".,;:?!#@~^'`"[i];
@@ -3459,7 +3432,7 @@ init_syntax_once (void)
3459 } 3432 }
3460 3433
3461 /* All multibyte characters have syntax `word' by default. */ 3434 /* All multibyte characters have syntax `word' by default. */
3462 temp = AREF (Vsyntax_code_object, (int) Sword); 3435 temp = AREF (Vsyntax_code_object, Sword);
3463 char_table_set_range (Vstandard_syntax_table, 0x80, MAX_CHAR, temp); 3436 char_table_set_range (Vstandard_syntax_table, 0x80, MAX_CHAR, temp);
3464} 3437}
3465 3438
diff --git a/src/syntax.h b/src/syntax.h
index c9af240df0c..58d39b9059c 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21 21
22extern void update_syntax_table (ptrdiff_t, EMACS_INT, int, Lisp_Object); 22extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object);
23 23
24/* The standard syntax table is stored where it will automatically 24/* The standard syntax table is stored where it will automatically
25 be used in all new buffers. */ 25 be used in all new buffers. */
@@ -99,7 +99,7 @@ enum syntaxcode
99 _syntax_temp = SYNTAX_ENTRY (c); \ 99 _syntax_temp = SYNTAX_ENTRY (c); \
100 (CONSP (_syntax_temp) \ 100 (CONSP (_syntax_temp) \
101 ? XINT (XCAR (_syntax_temp)) \ 101 ? XINT (XCAR (_syntax_temp)) \
102 : (int) Swhitespace); }) 102 : Swhitespace); })
103 103
104#define SYNTAX_MATCH(c) \ 104#define SYNTAX_MATCH(c) \
105 ({ Lisp_Object _syntax_temp; \ 105 ({ Lisp_Object _syntax_temp; \
@@ -112,14 +112,14 @@ extern Lisp_Object syntax_temp;
112#define SYNTAX(c) \ 112#define SYNTAX(c) \
113 (syntax_temp = SYNTAX_ENTRY ((c)), \ 113 (syntax_temp = SYNTAX_ENTRY ((c)), \
114 (CONSP (syntax_temp) \ 114 (CONSP (syntax_temp) \
115 ? (enum syntaxcode) (XINT (XCAR (syntax_temp)) & 0xff) \ 115 ? (enum syntaxcode) (XINT (XCAR (syntax_temp)) & 0xff) \
116 : Swhitespace)) 116 : Swhitespace))
117 117
118#define SYNTAX_WITH_FLAGS(c) \ 118#define SYNTAX_WITH_FLAGS(c) \
119 (syntax_temp = SYNTAX_ENTRY ((c)), \ 119 (syntax_temp = SYNTAX_ENTRY ((c)), \
120 (CONSP (syntax_temp) \ 120 (CONSP (syntax_temp) \
121 ? XINT (XCAR (syntax_temp)) \ 121 ? XINT (XCAR (syntax_temp)) \
122 : (int) Swhitespace)) 122 : Swhitespace))
123 123
124#define SYNTAX_MATCH(c) \ 124#define SYNTAX_MATCH(c) \
125 (syntax_temp = SYNTAX_ENTRY ((c)), \ 125 (syntax_temp = SYNTAX_ENTRY ((c)), \
@@ -130,17 +130,17 @@ extern Lisp_Object syntax_temp;
130 130
131 131
132/* Whether the syntax of the character C has the prefix flag set. */ 132/* Whether the syntax of the character C has the prefix flag set. */
133extern int syntax_prefix_flag_p (int c); 133extern bool syntax_prefix_flag_p (int c);
134 134
135/* This array, indexed by a character, contains the syntax code which that 135/* This array, indexed by a character less than 256, contains the
136 character signifies (as a char). For example, 136 syntax code which that character signifies (as an unsigned char).
137 (enum syntaxcode) syntax_spec_code['w'] is Sword. */ 137 For example, syntax_spec_code['w'] == Sword. */
138 138
139extern unsigned char syntax_spec_code[0400]; 139extern unsigned char const syntax_spec_code[0400];
140 140
141/* Indexed by syntax code, give the letter that describes it. */ 141/* Indexed by syntax code, give the letter that describes it. */
142 142
143extern char syntax_code_spec[16]; 143extern char const syntax_code_spec[16];
144 144
145/* Convert the byte offset BYTEPOS into a character position, 145/* Convert the byte offset BYTEPOS into a character position,
146 for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT. 146 for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT.