X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fsyntax.h;h=0a650e7739a7699140a2206d9c9bd9f1c02c63eb;hb=1d0f965ba499c40eb5b24415c62ec0dc2b0b8ff7;hp=8ea4fcbc1c5b7b393a8031cc085b366baaa34edc;hpb=ac7d0619aad74b1d57c4748ebb3ab29d9c32e3d8;p=chise%2Fxemacs-chise.git.1 diff --git a/src/syntax.h b/src/syntax.h index 8ea4fcb..0a650e7 100644 --- a/src/syntax.h +++ b/src/syntax.h @@ -1,5 +1,6 @@ /* Declarations having to do with XEmacs syntax tables. Copyright (C) 1985, 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 2001,2003,2004 MORIOKA Tomohiko This file is part of XEmacs. @@ -45,6 +46,10 @@ integers. We can do this successfully because syntax tables are now an abstract type, where we control all access. */ +/* The standard syntax table is stored where it will automatically + be used in all new buffers. */ +extern Lisp_Object Vstandard_syntax_table; + enum syntaxcode { Swhitespace, /* whitespace character */ @@ -73,11 +78,37 @@ enum syntaxcode charset_syntax (struct buffer *buf, Lisp_Object charset, /* Return the syntax code for a particular character and mirror table. */ +#ifdef UTF2000 +INLINE_HEADER enum syntaxcode +SYNTAX_CODE_UNSAFE (Lisp_Char_Table *table, Emchar c); +INLINE_HEADER enum syntaxcode +SYNTAX_CODE_UNSAFE (Lisp_Char_Table *table, Emchar c) +{ + Lisp_Object code = CHAR_TABLE_VALUE_UNSAFE (table, c); + enum syntaxcode ret = Spunct; + + if (CONSP (code)) + code = XCAR (code); + ret = XINT (code); + + if (ret == Sinherit) + { + code = CHAR_TABLE_VALUE_UNSAFE (XCHAR_TABLE + (Vstandard_syntax_table), c); + if (CONSP (code)) + code = XCAR (code); + return XINT (code); + } + else + return ret; +} +#else #define SYNTAX_CODE_UNSAFE(table, c) \ - XINT (CHAR_TABLE_VALUE_UNSAFE (table, c)) + ((enum syntaxcode) XINT (CHAR_TABLE_VALUE_UNSAFE (table, c))) +#endif -INLINE_HEADER int SYNTAX_CODE (Lisp_Char_Table *table, Emchar c); -INLINE_HEADER int +INLINE_HEADER enum syntaxcode SYNTAX_CODE (Lisp_Char_Table *table, Emchar c); +INLINE_HEADER enum syntaxcode SYNTAX_CODE (Lisp_Char_Table *table, Emchar c) { return SYNTAX_CODE_UNSAFE (table, c); @@ -257,10 +288,6 @@ determine that no second character is needed to terminate the comment. EXFUN (Fchar_syntax, 2); EXFUN (Fforward_word, 2); -/* The standard syntax table is stored where it will automatically - be used in all new buffers. */ -extern Lisp_Object Vstandard_syntax_table; - /* 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. */ @@ -285,7 +312,9 @@ extern struct buffer *regex_emacs_buffer; /* Target text (string or buffer), used for syntax-table properties. */ extern Lisp_Object regex_match_object; +#ifndef UTF2000 void update_syntax_table (Lisp_Char_Table *ct); +#endif /* The syntax table cache */ @@ -390,7 +419,7 @@ struct syntax_cache syntax table to the cache. */ Lisp_Object object; /* The buffer or string the current syntax cache applies to. */ - int syntax_code; /* Syntax code of current char. */ + enum syntaxcode syntax_code; /* Syntax code of current char. */ Lisp_Object current_syntax_table; /* Syntax table for current pos. */ Lisp_Object old_prop; /* Syntax-table prop at prev pos. */ @@ -488,6 +517,42 @@ void update_syntax_cache (int pos, int count); #define SETUP_SYNTAX_CACHE_FOR_BUFFER(BUFFER, FROM, COUNT) \ SETUP_SYNTAX_CACHE_FOR_OBJECT (Qnil, (BUFFER), (FROM), (COUNT)) +#ifdef UTF2000 +#define SETUP_SYNTAX_CACHE_FOR_OBJECT(OBJECT, BUFFER, FROM, COUNT) \ + do { \ + syntax_cache.buffer = (BUFFER); \ + syntax_cache.object = (OBJECT); \ + if (NILP (syntax_cache.object)) \ + { \ + XSETBUFFER (syntax_cache.object, syntax_cache.buffer); \ + } \ + else if (EQ (syntax_cache.object, Qt)) \ + { \ + XSETBUFFER (syntax_cache.object, syntax_cache.buffer); \ + } \ + else if (STRINGP (syntax_cache.object)) \ + { \ + /* do nothing */; \ + } \ + else if (BUFFERP (syntax_cache.object)) \ + { \ + syntax_cache.buffer = XBUFFER (syntax_cache.object); \ + } \ + else \ + { \ + /* OBJECT must be buffer/string/t/nil */ \ + assert(0); \ + } \ + syntax_cache.current_syntax_table \ + = syntax_cache.buffer->syntax_table; \ + syntax_cache.use_code = 0; \ + if (lookup_syntax_properties) \ + { \ + SYNTAX_CACHE_STATISTICS_COUNT_INIT; \ + update_syntax_cache ((FROM) + ((COUNT) > 0 ? 0 : -1), (COUNT)); \ + } \ + } while (0) +#else #define SETUP_SYNTAX_CACHE_FOR_OBJECT(OBJECT, BUFFER, FROM, COUNT) \ do { \ syntax_cache.buffer = (BUFFER); \ @@ -522,6 +587,7 @@ void update_syntax_cache (int pos, int count); update_syntax_cache ((FROM) + ((COUNT) > 0 ? 0 : -1), (COUNT)); \ } \ } while (0) +#endif #define SYNTAX_CODE_PREFIX(c) \ ((c >> 7) & 1)