2 ;;; emu-x20.el --- Mule 2 emulation module for XEmacs 20 with Mule
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
9 ;;; $Id: emu-x20.el,v 7.2 1996/05/15 14:02:54 morioka Exp morioka $
10 ;;; Keywords: emulation, compatibility, Mule, XEmacs
12 ;;; This file is part of tl (Tiny Library).
14 ;;; This program is free software; you can redistribute it and/or
15 ;;; modify it under the terms of the GNU General Public License as
16 ;;; published by the Free Software Foundation; either version 2, or
17 ;;; (at your option) any later version.
19 ;;; This program is distributed in the hope that it will be useful,
20 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 ;;; General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with This program. If not, write to the Free Software
26 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
32 (defvar xemacs-beta-version
33 (if (string-match "(beta\\([0-9]+\\))" emacs-version)
35 (substring emacs-version (match-beginning 1)(match-end 1))
42 (defalias 'char-leading-char 'char-charset)
44 (defun find-charset-string (string)
45 "Return a list of charsets in the STRING except ascii.
46 \[emu-x20.el; Mule emulating function]"
47 (delq 'ascii (charsets-in-string string))
50 (defun find-charset-region (start end)
51 "Return a list of charsets except ascii
52 in the region between START and END.
53 \[emu-x20.el; Mule emulating function]"
54 (delq 'ascii (charsets-in-region start end))
57 (defconst lc-ascii 'ascii)
58 (defconst lc-ltn1 'latin-1)
59 (defconst lc-ltn2 'latin-2)
60 (defconst lc-ltn3 'latin-3)
61 (defconst lc-ltn4 'latin-4)
62 (defconst lc-crl 'cyrillic)
63 (defconst lc-arb 'arabic)
64 (defconst lc-grk 'greek)
65 (defconst lc-hbw 'hebrew)
66 (defconst lc-ltn5 'latin-5)
67 (defconst lc-jp 'japanese)
68 (defconst lc-jp2 'japanese-2)
69 (defconst lc-kr 'korean)
70 (defconst lc-big5-1 'chinese-big5-1)
71 (defconst lc-big5-2 'chinese-big5-2)
72 (defconst lc-cn 'chinese-gb)
73 (defconst lc-cns1 'chinese-cns-1)
74 (defconst lc-cns2 'chinese-cns-2)
75 (defconst lc-cns3 'chinese-cns-3)
76 (defconst lc-cns4 'chinese-cns-4)
77 (defconst lc-cns5 'chinese-cns-5)
78 (defconst lc-cns6 'chinese-cns-6)
79 (defconst lc-cns7 'chinese-cns-7)
85 (defconst *noconv* 'noconv)
86 (defconst *ctext* 'ctext)
88 (defconst *big5* 'big5)
89 (defconst *euc-kr* 'euc-kr)
92 (defvar code-converter-is-broken
93 (and xemacs-beta-version (<= xemacs-beta-version 19)))
95 (if code-converter-is-broken
98 (defun decode-coding-region (start end coding-system &optional buffer)
99 "Decode the text between START and END which is encoded in CODING-SYSTEM.
100 \[emu-x20.el; XEmacs 20 emulating function]"
106 (narrow-to-region start end)
107 (let ((process-output-coding-system 'noconv)
108 (process-input-coding-system coding-system))
109 (call-process-region start end "cat" t t nil)
112 (defun encode-coding-region (start end coding-system &optional buffer)
113 "Encode the text between START and END which is encoded in CODING-SYSTEM.
114 \[emu-x20.el; XEmacs 20 emulating function]"
120 (narrow-to-region start end)
121 (let ((process-output-coding-system coding-system)
122 (process-input-coding-system 'noconv))
123 (call-process-region start end "cat" t t nil)
128 (defalias 'character-encode-string 'encode-coding-string)
129 (defalias 'character-decode-string 'decode-coding-string)
130 (defalias 'character-encode-region 'encode-coding-region)
131 (defalias 'character-decode-region 'decode-coding-region)
134 ;;; @ character and string
137 (defun char-bytes (chr) 1)
138 (defun char-width (chr) 1)
140 (defalias 'string-width 'length)
142 (defun string-to-int-list (str)
143 (mapcar #'char-int str)
146 (defalias 'sref 'aref)
148 (defun truncate-string (str width &optional start-column)
149 "Truncate STR to fit in WIDTH columns.
150 Optional non-nil arg START-COLUMN specifies the starting column.
151 \[emu-x20.el; Mule 2.3 emulating function]"
153 (setq start-column 0))
154 (substring str start-column width)
163 ;;; emu-x20.el ends here