2001-07-09 Yoshiki Hayashi <yoshiki@xemacs.org>
+ * egg-edep.el (egg-string-match-charset): More portable definition.
+ (egg-string-match-charset-end): New function.
+ Compute where matched charset ends.
+ * egg-cnv.el (egg-separate-languages): Call egg-string-match-charset-end
+ instead of match-string.
+
+2001-07-09 Yoshiki Hayashi <yoshiki@xemacs.org>
+
* egg/wnn.el (wnn-accept-charset-alist): XEmacs uses sisheng
instead of chinese-sisheng.
* egg-cnv.el (egg-separate-language): Ditto.
(cond
((eq cset 'chinese-sisheng)
(egg-string-match-charset 'chinese-sisheng str i)
- (setq l (match-end 0)
+ (setq l (egg-string-match-charset-end 'chinese-sisheng str i)
j (min j l)
lang 'Chinese))
;; XEmacs has sisheng charset while Emacs has chinese-sisheng
(car (decompose-composite-char c 'list))))))
(t
(egg-string-match-charset cset str i)
- (setq j (match-end 0)
+ (setq j (egg-string-match-charset-end cset str i)
lang (egg-charset-to-language cset))))
(if lang
(put-text-property i j 'egg-lang lang str))))
(next-single-property-change pos prop object))))
(defun egg-string-match-charset (charset string &optional start)
- (let ((cur-ct (category-table))
- category)
- (unwind-protect
- (progn
- (set-category-table (copy-category-table))
- (setq category (get-unused-category))
- (define-category category "")
- (modify-category-entry (make-char charset) category)
- (string-match (concat "\\c" (list category) "+") string start))
- (set-category-table cur-ct))))
-
-(unless (egg-string-match-charset 'japanese-jisx0208 "\e$B!#\e(B")
- (defun egg-string-match-charset (charset string &optional start)
- (let (min max)
- (if (= (charset-chars charset) 94)
- (setq min 33 max 126)
- (setq min 32 max 127))
- (string-match (if (= (charset-dimension charset) 1)
- (concat "[" (list (make-char charset min))
- "-" (list (make-char charset max))
- "]+")
- (concat "[" (list (make-char charset min min))
- "-" (list (make-char charset max max))
- "]+"))
- string start))))
+ (eq charset (char-charset (aref string (or start 0)))))
+
+(defun egg-string-match-charset-end (charset string &optional start)
+ (let ((index (or start 0))
+ (str-len (length string)))
+ (while (and (< index str-len)
+ (eq charset (char-charset (aref string index))))
+ (setq index (1+ index)))
+ index))
(provide 'egg-edep)