X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Ffont-lock.c;h=bb89224b80b9f9de5af53cf8697edec0b815626f;hp=ea40a1b55ceb5dd3c4269de7a57e4e243e936483;hb=ee38d21b330f5001b47a577cefb5ba7b82a3b7d3;hpb=dbf2768f7b146e97e37a27316f70bb313f1acf15 diff --git a/src/font-lock.c b/src/font-lock.c index ea40a1b..bb89224 100644 --- a/src/font-lock.c +++ b/src/font-lock.c @@ -391,28 +391,30 @@ setup_context_cache (struct buffer *buf, Bufpos pt) } } +/* GCC 2.95.4 seems to need the casts */ #define SYNTAX_START_STYLE(c1, c2) \ - (SYNTAX_CODES_MATCH_START_P (c1, c2, SYNTAX_COMMENT_STYLE_A) ? \ + ((enum comment_style) \ + (SYNTAX_CODES_MATCH_START_P (c1, c2, SYNTAX_COMMENT_STYLE_A) ? \ comment_style_a : \ SYNTAX_CODES_MATCH_START_P (c1, c2, SYNTAX_COMMENT_STYLE_B) ? \ comment_style_b : \ - comment_style_none) + comment_style_none)) #define SYNTAX_END_STYLE(c1, c2) \ - (SYNTAX_CODES_MATCH_END_P (c1, c2, SYNTAX_COMMENT_STYLE_A) ? \ + ((enum comment_style) \ + (SYNTAX_CODES_MATCH_END_P (c1, c2, SYNTAX_COMMENT_STYLE_A) ? \ comment_style_a : \ SYNTAX_CODES_MATCH_END_P (c1, c2, SYNTAX_COMMENT_STYLE_B) ? \ comment_style_b : \ - comment_style_none) + comment_style_none)) -/* GCC 2.95.4 seems to need the cast */ -#define SINGLE_SYNTAX_STYLE(c) \ - ((enum comment_style) \ - (SYNTAX_CODE_MATCHES_1CHAR_P (c, SYNTAX_COMMENT_STYLE_A) ? \ - comment_style_a : \ - SYNTAX_CODE_MATCHES_1CHAR_P (c, SYNTAX_COMMENT_STYLE_B) ? \ - comment_style_b : \ - comment_style_none)) +#define SINGLE_SYNTAX_STYLE(c) \ + ((enum comment_style) \ + (SYNTAX_CODE_MATCHES_1CHAR_P (c, SYNTAX_COMMENT_STYLE_A) ? \ + comment_style_a : \ + SYNTAX_CODE_MATCHES_1CHAR_P (c, SYNTAX_COMMENT_STYLE_B) ? \ + comment_style_b : \ + comment_style_none)) /* Set up context_cache for position PT in BUF. */ @@ -430,6 +432,7 @@ find_context (struct buffer *buf, Bufpos pt) setup_context_cache (buf, pt); pt = context_cache.cur_point; + SCS_STATISTICS_SET_FUNCTION (scs_find_context); SETUP_SYNTAX_CACHE (pt - 1, 1); if (pt > BUF_BEGV (buf)) { @@ -512,7 +515,7 @@ find_context (struct buffer *buf, Bufpos pt) context_cache.context = context_comment; context_cache.ccontext = ccontext_none; context_cache.style = SINGLE_SYNTAX_STYLE (syncode); - if (context_cache.style == comment_style_none) abort (); + if (context_cache.style == comment_style_none) ABORT (); } break; @@ -604,7 +607,7 @@ find_context (struct buffer *buf, Bufpos pt) { context_cache.ccontext = ccontext_start2; context_cache.style = SYNTAX_START_STYLE (prev_syncode, syncode); - if (context_cache.style == comment_style_none) abort (); + if (context_cache.style == comment_style_none) ABORT (); } else if ((SYNTAX_CODE_COMMENT_BITS (syncode) & SYNTAX_FIRST_CHAR_START) && @@ -632,26 +635,31 @@ find_context (struct buffer *buf, Bufpos pt) else if ((SYNTAX_CODE_COMMENT_BITS (syncode) & SYNTAX_FIRST_CHAR_END) && context_cache.context == context_block_comment && +#if 0 + /* #### pre-Matt code had: */ + (context_cache.style == + SYNTAX_END_STYLE (c, BUF_FETCH_CHAR (buf, pt+1))) && + /* why do these differ here?! */ +#endif context_cache.style == SINGLE_SYNTAX_STYLE (syncode) && (context_cache.ccontext == ccontext_start2 || context_cache.ccontext == ccontext_end1)) - /* #### is it right to check for end1 here?? - yes, because this might be a repetition of the first char - of a comment-end sequence. ie, '/xxx foo xxx/' or - '/xxx foo x/', where 'x' = '*' -- mct */ + /* check end1, to detect a repetition of the first char of a + comment-end sequence. ie, '/xxx foo xxx/' or '/xxx foo x/', + where 'x' = '*' -- mct */ { - if (context_cache.style == comment_style_none) abort (); + if (context_cache.style == comment_style_none) ABORT (); context_cache.ccontext = ccontext_end1; } else if (context_cache.ccontext == ccontext_start1) { - if (context_cache.context != context_none) abort (); + if (context_cache.context != context_none) ABORT (); context_cache.ccontext = ccontext_none; } else if (context_cache.ccontext == ccontext_end1) { - if (context_cache.context != context_block_comment) abort (); + if (context_cache.context != context_block_comment) ABORT (); context_cache.context = context_none; context_cache.ccontext = ccontext_start2; } @@ -660,7 +668,7 @@ find_context (struct buffer *buf, Bufpos pt) context_cache.context == context_none) { context_cache.context = context_block_comment; - if (context_cache.style == comment_style_none) abort (); + if (context_cache.style == comment_style_none) ABORT (); } else if (context_cache.ccontext == ccontext_none && context_cache.context == context_block_comment) @@ -683,7 +691,7 @@ context_to_symbol (enum syntactic_context context) case context_block_comment: return Qblock_comment; case context_generic_comment: return Qblock_comment; case context_generic_string: return Qstring; - default: abort (); return Qnil; /* suppress compiler warning */ + default: ABORT (); return Qnil; /* suppress compiler warning */ } }