;; Chinese character set (GB2312)
-;; (modify-syntax-entry (make-char 'chinese-gb2312) "w")
-(modify-syntax-entry (make-char 'chinese-gb2312 33) "_")
-(modify-syntax-entry (make-char 'chinese-gb2312 34) "_")
-(modify-syntax-entry (make-char 'chinese-gb2312 41) "_")
-(modify-syntax-entry ?\\e$A!2\e(B "(\e$A!3\e(B")
-(modify-syntax-entry ?\\e$A!4\e(B "(\e$A!5\e(B")
-(modify-syntax-entry ?\\e$A!6\e(B "(\e$A!7\e(B")
-(modify-syntax-entry ?\\e$A!8\e(B "(\e$A!9\e(B")
-(modify-syntax-entry ?\\e$A!:\e(B "(\e$A!;\e(B")
-(modify-syntax-entry ?\\e$A!<\e(B "(\e$A!=\e(B")
-(modify-syntax-entry ?\\e$A!>\e(B "(\e$A!?\e(B")
-(modify-syntax-entry ?\\e$A#(\e(B "(\e$A#)\e(B")
-(modify-syntax-entry ?\\e$A#{\e(B "(\e$A#}\e(B")
-(modify-syntax-entry ?\\e$A#[\e(B "(\e$A#]\e(B")
-(modify-syntax-entry ?\\e$A!3\e(B ")\e$A!2\e(B")
-(modify-syntax-entry ?\\e$A!5\e(B ")\e$A!4\e(B")
-(modify-syntax-entry ?\\e$A!7\e(B ")\e$A!6\e(B")
-(modify-syntax-entry ?\\e$A!9\e(B ")\e$A!8\e(B")
-(modify-syntax-entry ?\\e$A!;\e(B ")\e$A!:\e(B")
-(modify-syntax-entry ?\\e$A!=\e(B ")\e$A!<\e(B")
-(modify-syntax-entry ?\\e$A!?\e(B ")\e$A!>\e(B")
-(modify-syntax-entry ?\\e$A#)\e(B ")\e$A#(\e(B")
-(modify-syntax-entry ?\\e$A#}\e(B ")\e$A#{\e(B")
-(modify-syntax-entry ?\\e$A#]\e(B ")\e$A#[\e(B")
-
-(let ((chars "\e$A#,!"!##.!$#;#:#?#!!C!-!'#|#_!.!/!0!1#"!e#`!d\e(B"))
- (dotimes (i (length chars))
- (modify-syntax-entry (aref chars i) ".")))
-
-(modify-category-entry (make-char 'chinese-gb2312) ?c)
-(modify-category-entry (make-char 'chinese-gb2312) ?\|)
-(modify-category-entry (make-char 'chinese-gb2312 35) ?A)
-(modify-category-entry (make-char 'chinese-gb2312 36) ?H)
-(modify-category-entry (make-char 'chinese-gb2312 37) ?K)
-(modify-category-entry (make-char 'chinese-gb2312 38) ?G)
-(modify-category-entry (make-char 'chinese-gb2312 39) ?Y)
-(let ((row 48))
- (while (< row 127)
- (modify-category-entry (make-char 'chinese-gb2312 row) ?C)
- (setq row (1+ row))))
+(map-charset-chars #'modify-syntax-entry 'chinese-gb2312 "_" #x2121 #x217E)
+(map-charset-chars #'modify-syntax-entry 'chinese-gb2312 "_" #x2221 #x227E)
+(map-charset-chars #'modify-syntax-entry 'chinese-gb2312 "_" #x2921 #x297E)
+
+(map-charset-chars #'modify-category-entry 'chinese-gb2312 ?c)
+(map-charset-chars #'modify-category-entry 'chinese-gb2312 ?A #x2330 #x2339)
+(map-charset-chars #'modify-category-entry 'chinese-gb2312 ?A #x2341 #x235A)
+(map-charset-chars #'modify-category-entry 'chinese-gb2312 ?A #x2361 #x237A)
+(map-charset-chars #'modify-category-entry 'chinese-gb2312 ?H #x2421 #x247E)
+(map-charset-chars #'modify-category-entry 'chinese-gb2312 ?K #x2521 #x257E)
+(map-charset-chars #'modify-category-entry 'chinese-gb2312 ?G #x2621 #x267E)
+(map-charset-chars #'modify-category-entry 'chinese-gb2312 ?Y #x2721 #x277E)
+(map-charset-chars #'modify-category-entry 'chinese-gb2312 ?C #x3021 #x7E7E)
+ (let ((tbl (standard-case-table)))
+ (dotimes (i 26)
+ (set-case-syntax-pair (make-char 'chinese-gb2312 #x23 (+ #x41 i))
+ (make-char 'chinese-gb2312 #x23 (+ #x61 i)) tbl))
+ (dotimes (i 24)
+ (set-case-syntax-pair (make-char 'chinese-gb2312 #x26 (+ #x21 i))
+ (make-char 'chinese-gb2312 #x26 (+ #x41 i)) tbl))
+ (dotimes (i 33)
+ (set-case-syntax-pair (make-char 'chinese-gb2312 #x27 (+ #x21 i))
+ (make-char 'chinese-gb2312 #x27 (+ #x51 i)) tbl)))
+
;; Chinese character set (BIG5)
-(let ((from (decode-big5-char #xA141))
- (to (decode-big5-char #xA15D)))
- (while (< from to)
- (modify-syntax-entry from ".")
- (setq from (1+ from))))
-(let ((from (decode-big5-char #xA1A5))
- (to (decode-big5-char #xA1AD)))
- (while (< from to)
- (modify-syntax-entry from ".")
- (setq from (1+ from))))
-(let ((from (decode-big5-char #xA1AD))
- (to (decode-big5-char #xA2AF)))
- (while (< from to)
- (modify-syntax-entry from "_")
- (setq from (1+ from))))
-
-(let ((parens "\e$(0!>!?!@!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z![!\!]!^!_!`!a!b!c\e(B")
- open close)
- (dotimes (i (/ (length parens) 2))
- (setq open (aref parens (* i 2))
- close (aref parens (1+ (* i 2))))
- (modify-syntax-entry open (format "(%c" close))
- (modify-syntax-entry close (format ")%c" open))))
-
-(let ((generic-big5-1-char (make-char 'chinese-big5-1))
- (generic-big5-2-char (make-char 'chinese-big5-2)))
-;; (modify-syntax-entry generic-big5-1-char "w")
-;; (modify-syntax-entry generic-big5-2-char "w")
-
- (modify-category-entry generic-big5-1-char ?c)
- (modify-category-entry generic-big5-2-char ?c)
-
- (modify-category-entry generic-big5-1-char ?C)
- (modify-category-entry generic-big5-2-char ?C)
-
- (modify-category-entry generic-big5-1-char ?\|)
- (modify-category-entry generic-big5-2-char ?\|))
-
-(let ((tbl (standard-case-table)))
- (dotimes (i 22)
- (set-case-syntax-pair (decode-big5-char (+ #xA2CF i))
- (decode-big5-char (+ #xA2CF i 26)) tbl))
- (dotimes (i 4)
- (set-case-syntax-pair (decode-big5-char (+ #xA2E4 i))
- (decode-big5-char (+ #xA340 i)) tbl))
- (dotimes (i 24)
- (set-case-syntax-pair (decode-big5-char (+ #xA344 i))
- (decode-big5-char (+ #xA344 i 24)) tbl)))
-
+(map-charset-chars #'modify-category-entry 'big5 ?c)
+(map-charset-chars #'modify-category-entry 'big5 ?C #xA259 #xA25F)
+(map-charset-chars #'modify-category-entry 'big5 ?C #xA440 #xC67E)
+(map-charset-chars #'modify-category-entry 'big5 ?C #xC940 #xF9DF)
;; Chinese character set (CNS11643)
(let ((tbl (standard-case-table))
(i 32))
(while (< i 128)
- (set-case-syntax-pair (make-char 'vietnamese-viscii-upper i)
- (make-char 'vietnamese-viscii-lower i)
- tbl)
+ (let* ((char (decode-char 'vietnamese-viscii-upper i))
+ (charl (decode-char 'vietnamese-viscii-lower i))
+ (uc (encode-char char 'ucs))
+ (lc (encode-char charl 'ucs)))
+ (set-case-syntax-pair char (decode-char 'vietnamese-viscii-lower i)
+ tbl)
+ (if uc (modify-category-entry uc ?v))
+ (if lc (modify-category-entry lc ?v)))
(setq i (1+ i))))
-;; Unicode (mule-unicode-0100-24ff)
++(let ((tbl (standard-case-table)))
++ (dotimes (i 22)
++ (set-case-syntax-pair (decode-big5-char (+ #xA2CF i))
++ (decode-big5-char (+ #xA2CF i 26)) tbl))
++ (dotimes (i 4)
++ (set-case-syntax-pair (decode-big5-char (+ #xA2E4 i))
++ (decode-big5-char (+ #xA340 i)) tbl))
++ (dotimes (i 24)
++ (set-case-syntax-pair (decode-big5-char (+ #xA344 i))
++ (decode-big5-char (+ #xA344 i 24)) tbl)))
++
+
+;; Latin
+
+(modify-category-entry '(#x80 . #x024F) ?l)
(let ((tbl (standard-case-table)) c)
Lisp_Object contents[1];
};
-/* A char table is a kind of vectorlike, with contents are like a
+ /* If a struct is made to look like a vector, this macro returns the length
+ of the shortest vector that would hold that struct. */
+ #define VECSIZE(type) ((sizeof (type) - (sizeof (struct Lisp_Vector) \
+ - sizeof (Lisp_Object)) \
+ + sizeof(Lisp_Object) - 1) /* round up */ \
+ / sizeof (Lisp_Object))
+
+ /* Like VECSIZE, but used when the pseudo-vector has non-Lisp_Object fields
+ at the end and we need to compute the number of Lisp_Object fields (the
+ ones that the GC needs to trace). */
+ #define PSEUDOVECSIZE(type, nonlispfield) \
+ ((OFFSETOF(type, nonlispfield) - OFFSETOF(struct Lisp_Vector, contents[0])) \
+ / sizeof (Lisp_Object))
+
+/* A char-table is a kind of vectorlike, with contents are like a
vector but with a few other slots. For some purposes, it makes
- sense to handle a chartable with type struct Lisp_Vector. An
+ sense to handle a char-table with type struct Lisp_Vector. An
element of a char table can be any Lisp objects, but if it is a sub
char-table, we treat it a table that contains information of a
- group of characters of the same charsets or a specific character of
- a charset. A sub char-table has the same structure as a char table
- except for that the former omits several slots at the tail. A sub
- char table appears only in an element of a char table, and there's
- no way to access it directly from Emacs Lisp program. */
-
-/* This is the number of slots that apply to characters or character
- sets. The first 128 are for ASCII, the next 128 are for 8-bit
- European characters, and the last 128 are for multibyte characters.
- The first 256 are indexed by the code itself, but the last 128 are
- indexed by (charset-id + 128). */
-#define CHAR_TABLE_ORDINARY_SLOTS 384
-
-/* These are the slot of the default values for single byte
- characters. As 0x9A is never be a charset-id, it is safe to use
- that slot for ASCII. 0x9E and 0x80 are charset-ids of
- eight-bit-control and eight-bit-graphic respectively. */
-#define CHAR_TABLE_DEFAULT_SLOT_ASCII (0x9A + 128)
-#define CHAR_TABLE_DEFAULT_SLOT_8_BIT_CONTROL (0x9E + 128)
-#define CHAR_TABLE_DEFAULT_SLOT_8_BIT_GRAPHIC (0x80 + 128)
-
-/* This is the number of slots that apply to characters of ASCII and
- 8-bit Europeans only. */
-#define CHAR_TABLE_SINGLE_BYTE_SLOTS 256
+ specific range of characters. A sub char-table has the same
+ structure as a vector. A sub char table appears only in an element
+ of a char-table, and there's no way to access it directly from
+ Emacs Lisp program. */
/* This is the number of slots that every char table must have. This
counts the ordinary slots and the top, defalt, parent, and purpose