Commit 1fc71008 authored by Paul Eggert's avatar Paul Eggert

* 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.
parent b932cad7
2013-06-20 Paul Eggert <eggert@cs.ucla.edu>
* 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.
2013-06-20 Eli Zaretskii <eliz@gnu.org>
* w32fns.c (w32_wnd_proc): Don't compute the header line and mode
......
......@@ -1636,7 +1636,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
c = XFASTINT (TOP);
if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
MAKE_CHAR_MULTIBYTE (c);
XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (c)]);
XSETFASTINT (TOP, syntax_code_spec[SYNTAX (c)]);
}
NEXT;
......
This diff is collapsed.
......@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
extern void update_syntax_table (ptrdiff_t, EMACS_INT, int, Lisp_Object);
extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object);
/* The standard syntax table is stored where it will automatically
be used in all new buffers. */
......@@ -99,7 +99,7 @@ enum syntaxcode
_syntax_temp = SYNTAX_ENTRY (c); \
(CONSP (_syntax_temp) \
? XINT (XCAR (_syntax_temp)) \
: (int) Swhitespace); })
: Swhitespace); })
#define SYNTAX_MATCH(c) \
({ Lisp_Object _syntax_temp; \
......@@ -119,7 +119,7 @@ extern Lisp_Object syntax_temp;
(syntax_temp = SYNTAX_ENTRY ((c)), \
(CONSP (syntax_temp) \
? XINT (XCAR (syntax_temp)) \
: (int) Swhitespace))
: Swhitespace))
#define SYNTAX_MATCH(c) \
(syntax_temp = SYNTAX_ENTRY ((c)), \
......@@ -130,17 +130,17 @@ extern Lisp_Object syntax_temp;
/* Whether the syntax of the character C has the prefix flag set. */
extern int syntax_prefix_flag_p (int c);
extern bool syntax_prefix_flag_p (int c);
/* This array, indexed by a character, contains the syntax code which that
character signifies (as a char). For example,
(enum syntaxcode) syntax_spec_code['w'] is Sword. */
/* This array, indexed by a character less than 256, contains the
syntax code which that character signifies (as an unsigned char).
For example, syntax_spec_code['w'] == Sword. */
extern unsigned char syntax_spec_code[0400];
extern unsigned char const syntax_spec_code[0400];
/* Indexed by syntax code, give the letter that describes it. */
extern char syntax_code_spec[16];
extern char const syntax_code_spec[16];
/* Convert the byte offset BYTEPOS into a character position,
for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment