(M-40132'): Unify GT-53970.
[chise/xemacs-chise.git-] / src / syntax.h
index e141eb0..76301cf 100644 (file)
@@ -1,5 +1,6 @@
 /* Declarations having to do with XEmacs syntax tables.
    Copyright (C) 1985, 1992, 1993 Free Software Foundation, Inc.
+   Copyright (C) 2001 MORIOKA Tomohiko
 
 This file is part of XEmacs.
 
@@ -20,8 +21,8 @@ Boston, MA 02111-1307, USA.  */
 
 /* Synched up with: FSF 19.28. */
 
-#ifndef _XEMACS_SYNTAX_H_
-#define _XEMACS_SYNTAX_H_
+#ifndef INCLUDED_syntax_h_
+#define INCLUDED_syntax_h_
 
 #include "chartab.h"
 
@@ -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 */
@@ -69,12 +74,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 int SYNTAX_CODE_UNSAFE (Lisp_Char_Table *table, Emchar c);
+INLINE_HEADER int
+SYNTAX_CODE_UNSAFE (Lisp_Char_Table *table, Emchar c)
+{
+  int code = CHAR_TABLE_VALUE_UNSAFE (table, c);
+  int 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))
+#endif
 
-INLINE int SYNTAX_CODE (struct Lisp_Char_Table *table, Emchar c);
-INLINE int
-SYNTAX_CODE (struct Lisp_Char_Table *table, Emchar c)
+INLINE_HEADER int SYNTAX_CODE (Lisp_Char_Table *table, Emchar c);
+INLINE_HEADER int
+SYNTAX_CODE (Lisp_Char_Table *table, Emchar c)
 {
   return SYNTAX_CODE_UNSAFE (table, c);
 }
@@ -85,9 +115,9 @@ SYNTAX_CODE (struct Lisp_Char_Table *table, Emchar c)
 #define SYNTAX_FROM_CODE(code) ((enum syntaxcode) ((code) & 0177))
 #define SYNTAX(table, c) SYNTAX_FROM_CODE (SYNTAX_CODE (table, c))
 
-INLINE int WORD_SYNTAX_P (struct Lisp_Char_Table *table, Emchar c);
-INLINE int
-WORD_SYNTAX_P (struct Lisp_Char_Table *table, Emchar c)
+INLINE_HEADER int WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c);
+INLINE_HEADER int
+WORD_SYNTAX_P (Lisp_Char_Table *table, Emchar c)
 {
   return SYNTAX (table, c) == Sword;
 }
@@ -170,13 +200,19 @@ WORD_SYNTAX_P (struct Lisp_Char_Table *table, Emchar c)
 #define SYNTAX_SECOND_CHAR_END   0x03
 #define SYNTAX_SECOND_CHAR       0x33
 
-#define SYNTAX_START_P(table, a, b)                                    \
-  ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START)          \
-   && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START))
 
-#define SYNTAX_END_P(table, a, b)                                      \
-  ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END)            \
-   && (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END))
+/* #### These are now more or less equivalent to
+   SYNTAX_COMMENT_MATCH_START ...*/
+/* a and b must be first and second start chars for a common type */
+#define SYNTAX_START_P(table, a, b)                                     \
+  (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START) >> 2)    \
+   & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_START))
+
+/* ... and  SYNTAX_COMMENT_MATCH_END */
+/* a and b must be first and second end chars for a common type */
+#define SYNTAX_END_P(table, a, b)                                       \
+  (((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_END) >> 2)      \
+   & (SYNTAX_COMMENT_BITS (table, b) & SYNTAX_SECOND_CHAR_END))
 
 #define SYNTAX_STYLES_MATCH_START_P(table, a, b, mask)                     \
   ((SYNTAX_COMMENT_BITS (table, a) & SYNTAX_FIRST_CHAR_START & (mask))     \
@@ -224,23 +260,19 @@ WORD_SYNTAX_P (struct Lisp_Char_Table *table, Emchar c)
 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. */
 
-extern CONST unsigned char syntax_spec_code[0400];
+extern const unsigned char syntax_spec_code[0400];
 
 /* Indexed by syntax code, give the letter that describes it. */
 
-extern CONST unsigned char syntax_code_spec[];
+extern const unsigned char syntax_code_spec[];
 
-Lisp_Object scan_lists (struct buffer *buf, int from, int count,
+Lisp_Object scan_lists (struct buffer *buf, Bufpos from, int count,
                        int depth, int sexpflag, int no_error);
-int char_quoted (struct buffer *buf, int pos);
+int char_quoted (struct buffer *buf, Bufpos pos);
 
 /* NOTE: This does not refer to the mirror table, but to the
    syntax table itself. */
@@ -248,7 +280,10 @@ Lisp_Object syntax_match (Lisp_Object table, Emchar ch);
 
 extern int no_quit_in_re_search;
 extern struct buffer *regex_emacs_buffer;
+extern int regex_emacs_buffer_p;
 
-void update_syntax_table (struct Lisp_Char_Table *ct);
+#ifndef UTF2000
+void update_syntax_table (Lisp_Char_Table *ct);
+#endif
 
-#endif /* _XEMACS_SYNTAX_H_ */
+#endif /* INCLUDED_syntax_h_ */