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.1 1996/05/14 02:41:20 morioka Exp $
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.
30 (defvar xemacs-beta-version
31 (if (string-match "(beta\\([0-9]+\\))" emacs-version)
33 (substring emacs-version (match-beginning 1)(match-end 1))
40 (defalias 'char-leading-char 'char-charset)
42 (defun find-charset-string (string)
43 "Return a list of charsets in the STRING except ascii.
44 \[emu-x20.el; Mule emulating function]"
45 (delq 'ascii (charsets-in-string string))
48 (defun find-charset-region (start end)
49 "Return a list of charsets except ascii
50 in the region between START and END.
51 \[emu-x20.el; Mule emulating function]"
52 (delq 'ascii (charsets-in-region start end))
55 (defconst lc-ascii 'ascii)
56 (defconst lc-ltn1 'latin-1)
57 (defconst lc-ltn2 'latin-2)
58 (defconst lc-ltn3 'latin-3)
59 (defconst lc-ltn4 'latin-4)
60 (defconst lc-crl 'cyrillic)
61 (defconst lc-arb 'arabic)
62 (defconst lc-grk 'greek)
63 (defconst lc-hbw 'hebrew)
64 (defconst lc-ltn5 'latin-5)
65 (defconst lc-jp 'japanese)
66 (defconst lc-jp2 'japanese-2)
67 (defconst lc-kr 'korean)
68 (defconst lc-big5-1 'chinese-big5-1)
69 (defconst lc-big5-2 'chinese-big5-2)
70 (defconst lc-cn 'chinese-gb)
71 (defconst lc-cns1 'chinese-cns-1)
72 (defconst lc-cns2 'chinese-cns-2)
73 (defconst lc-cns3 'chinese-cns-3)
74 (defconst lc-cns4 'chinese-cns-4)
75 (defconst lc-cns5 'chinese-cns-5)
76 (defconst lc-cns6 'chinese-cns-6)
77 (defconst lc-cns7 'chinese-cns-7)
83 (defconst *noconv* 'noconv)
84 (defconst *ctext* 'ctext)
86 (defconst *big5* 'big5)
87 (defconst *euc-kr* 'euc-kr)
90 (defvar code-converter-is-broken
91 (and xemacs-beta-version (<= xemacs-beta-version 19)))
93 (if code-converter-is-broken
96 (defun decode-coding-region (start end coding-system &optional buffer)
97 "Decode the text between START and END which is encoded in CODING-SYSTEM.
98 \[emu-x20.el; XEmacs 20 emulating function]"
104 (narrow-to-region start end)
105 (let ((process-output-coding-system 'noconv)
106 (process-input-coding-system coding-system))
107 (call-process-region start end "cat" t t nil)
110 (defun encode-coding-region (start end coding-system &optional buffer)
111 "Encode the text between START and END which is encoded in CODING-SYSTEM.
112 \[emu-x20.el; XEmacs 20 emulating function]"
118 (narrow-to-region start end)
119 (let ((process-output-coding-system coding-system)
120 (process-input-coding-system 'noconv))
121 (call-process-region start end "cat" t t nil)
126 (defalias 'character-encode-string 'encode-coding-string)
127 (defalias 'character-decode-string 'decode-coding-string)
128 (defalias 'character-encode-region 'encode-coding-region)
129 (defalias 'character-decode-region 'decode-coding-region)
132 ;;; @ character and string
135 (defun char-bytes (chr) 1)
136 (defun char-width (chr) 1)
138 (defalias 'string-width 'length)
140 (defalias 'sref 'aref)
142 (defun truncate-string (str width &optional start-column)
143 "Truncate STR to fit in WIDTH columns.
144 Optional non-nil arg START-COLUMN specifies the starting column.
145 \[emu-x20.el; Mule 2.3 emulating function]"
147 (setq start-column 0))
148 (substring str start-column width)
155 (require 'emu-xemacs)
163 ;;; emu-x20.el ends here