diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-06-20 11:59:08 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-06-20 11:59:08 -0700 |
commit | 1fc7100890ced39f81a822661439b1f7030df5a1 (patch) | |
tree | 2da0f1af705674883bd08d80f56c5f630c33acf9 /src/syntax.h | |
parent | b932cad7124e7c1a20fc2b127201b7dee15a142f (diff) |
* 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/syntax.h')
-rw-r--r-- | src/syntax.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/syntax.h b/src/syntax.h index c9af240df0..58d39b9059 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 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; \ @@ -112,14 +112,14 @@ extern Lisp_Object syntax_temp; #define SYNTAX(c) \ (syntax_temp = SYNTAX_ENTRY ((c)), \ (CONSP (syntax_temp) \ - ? (enum syntaxcode) (XINT (XCAR (syntax_temp)) & 0xff) \ + ? (enum syntaxcode) (XINT (XCAR (syntax_temp)) & 0xff) \ : Swhitespace)) #define SYNTAX_WITH_FLAGS(c) \ (syntax_temp = SYNTAX_ENTRY ((c)), \ (CONSP (syntax_temp) \ - ? XINT (XCAR (syntax_temp)) \ - : (int) Swhitespace)) + ? XINT (XCAR (syntax_temp)) \ + : 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. |