summaryrefslogtreecommitdiff
path: root/src/syntax.h
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1997-02-20 06:57:02 +0000
committerKarl Heuer <kwzh@gnu.org>1997-02-20 06:57:02 +0000
commite0b8ff939dbb3ea39fcd7967d5d45e7b33ee45a1 (patch)
tree2c3ca2f7edfd64bbb2bd51f4061ffbb521483374 /src/syntax.h
parent93da5fff9b9bdfc4792699433e33db046f26d0d8 (diff)
downloademacs-e0b8ff939dbb3ea39fcd7967d5d45e7b33ee45a1.tar.gz
(SET_RAW_SYNTAX_ENTRY): Handle syntax of multibyte
characters. (SYNTAX_ENTRY_FOLLOW_PARENT): New macro. (SYNTAX_ENTRY): Handle syntax of multibyte characters. (SYNTAX, SYNTAX_WITH_FLAGS, SYNTAX_MATCH): Don't signal error even if a syntax entry is not cons.
Diffstat (limited to 'src/syntax.h')
-rw-r--r--src/syntax.h92
1 files changed, 44 insertions, 48 deletions
diff --git a/src/syntax.h b/src/syntax.h
index a4a8fb2a632..a9cbb1dd901 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -51,95 +51,91 @@ enum syntaxcode
Smax /* Upper bound on codes that are meaningful */
};
-/* Fetch the syntax entry for char C from table TABLE.
- This returns the whole entry (normally a cons cell)
- and does not do any kind of inheritance. */
-
-#if 1
-#define RAW_SYNTAX_ENTRY(table, c) \
- (XCHAR_TABLE (table)->contents[(unsigned char) (c)])
+/* Set the syntax entry VAL for char C in table TABLE. */
#define SET_RAW_SYNTAX_ENTRY(table, c, val) \
- (XCHAR_TABLE (table)->contents[(unsigned char) (c)] = (val))
+ ((unsigned)(c) < 128 \
+ ? (XCHAR_TABLE (table)->contents[(unsigned) (c)] = (val)) \
+ : Faset ((table), (unsigned) (c), (val)))
+
+/* Fetch the syntax entry for char C in syntax table TABLE.
+ This macro is called only when C is less than CHAR_TABLE_ORDINARY_SLOTS.
+ Do inheritance. */
+
+#ifdef __GNUC__
+#define SYNTAX_ENTRY_FOLLOW_PARENT(table, c) \
+ ({ Lisp_Object tbl = table; \
+ Lisp_Object temp = XCHAR_TABLE (tbl)->contents[(c)]; \
+ while (NILP (temp)) \
+ { \
+ tbl = XCHAR_TABLE (tbl)->parent; \
+ if (NILP (tbl)) \
+ break; \
+ temp = XCHAR_TABLE (tbl)->contents[(c)]; \
+ } \
+ temp; })
#else
-#define RAW_SYNTAX_ENTRY(table, c) \
- ((c) >= 128 \
- ? raw_syntax_table_lookup (table, c) \
- : XCHAR_TABLE (table)->contents[(unsigned char) (c)])
+extern Lisp_Object syntax_temp;
+extern Lisp_Object syntax_parent_lookup ();
-#define SET_RAW_SYNTAX_ENTRY(table, c, val) \
- ((c) >= 128 \
- ? set_raw_syntax_table_lookup (table, c, (val)) \
- : XCHAR_TABLE (table)->contents[(unsigned char) (c)] = (val))
+#define SYNTAX_ENTRY_FOLLOW_PARENT(table, c) \
+ (syntax_temp = XCHAR_TABLE (table)->contents[(c)], \
+ (NILP (syntax_temp) \
+ ? syntax_parent_lookup (table, (c)) \
+ : syntax_temp))
#endif
+/* Fetch the syntax entry for char C in the current syntax table.
+ This returns the whole entry (normally a cons cell).
+ Do Inheritance. */
+
+#define SYNTAX_ENTRY(c) \
+ ((unsigned) (c) < CHAR_TABLE_ORDINARY_SLOTS \
+ ? SYNTAX_ENTRY_FOLLOW_PARENT (current_buffer->syntax_table, (unsigned) (c))\
+ : Faref (current_buffer->syntax_table, make_number (c)))
+
/* Extract the information from the entry for character C
- in syntax table TABLE. Do inheritance. */
+ in the current syntax table. */
#ifdef __GNUC__
-#define SYNTAX_ENTRY(c) \
- ({ Lisp_Object temp, table; \
- unsigned char cc = (c); \
- table = current_buffer->syntax_table; \
- while (!NILP (table)) \
- { \
- temp = RAW_SYNTAX_ENTRY (table, cc); \
- if (!NILP (temp)) \
- break; \
- table = XCHAR_TABLE (table)->parent; \
- } \
- temp; })
-
#define SYNTAX(c) \
({ Lisp_Object temp; \
temp = SYNTAX_ENTRY (c); \
(CONSP (temp) \
? (enum syntaxcode) (XINT (XCONS (temp)->car) & 0xff) \
- : wrong_type_argument (Qconsp, temp)); })
+ : Swhitespace); })
#define SYNTAX_WITH_FLAGS(c) \
({ Lisp_Object temp; \
temp = SYNTAX_ENTRY (c); \
(CONSP (temp) \
? XINT (XCONS (temp)->car) \
- : wrong_type_argument (Qconsp, temp)); })
+ : (int) Swhitespace); })
#define SYNTAX_MATCH(c) \
({ Lisp_Object temp; \
temp = SYNTAX_ENTRY (c); \
(CONSP (temp) \
? XINT (XCONS (temp)->cdr) \
- : wrong_type_argument (Qconsp, temp)); })
+ : Qnil); })
#else
-extern Lisp_Object syntax_temp;
-extern Lisp_Object syntax_parent_lookup ();
-
-#define SYNTAX_ENTRY(c) \
- (syntax_temp \
- = RAW_SYNTAX_ENTRY (current_buffer->syntax_table, (c)), \
- (NILP (syntax_temp) \
- ? (syntax_temp \
- = syntax_parent_lookup (current_buffer->syntax_table, \
- (unsigned char) (c))) \
- : syntax_temp))
-
#define SYNTAX(c) \
(syntax_temp = SYNTAX_ENTRY ((c)), \
(CONSP (syntax_temp) \
? (enum syntaxcode) (XINT (XCONS (syntax_temp)->car) & 0xff) \
- : wrong_type_argument (Qconsp, syntax_temp)))
+ : Swhitespace))
#define SYNTAX_WITH_FLAGS(c) \
(syntax_temp = SYNTAX_ENTRY ((c)), \
(CONSP (syntax_temp) \
? XINT (XCONS (syntax_temp)->car) \
- : wrong_type_argument (Qconsp, syntax_temp)))
+ : (int) Swhitespace))
#define SYNTAX_MATCH(c) \
(syntax_temp = SYNTAX_ENTRY ((c)), \
(CONSP (syntax_temp) \
? XINT (XCONS (syntax_temp)->cdr) \
- : wrong_type_argument (Qconsp, syntax_temp)))
+ : Qnil))
#endif
/* Then there are six single-bit flags that have the following meanings: