7623a117212cd8135db5838ada7f4be85558c314
[elisp/apel.git] / emu-x20.el
1 ;;;
2 ;;; emu-x20.el --- Mule 2 emulation module for XEmacs 20 with Mule
3 ;;;
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko
6 ;;;
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; Version:
9 ;;;     $Id: emu-x20.el,v 3.1 1996/04/28 16:53:05 morioka Exp $
10 ;;; Keywords: emulation, compatibility, Mule, XEmacs
11 ;;;
12 ;;; This file is part of tl (Tiny Library).
13 ;;;
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.
18 ;;;
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.
23 ;;;
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.
27 ;;;
28 ;;; Code:
29
30 ;;; @ character set
31 ;;;
32
33 (defalias 'char-leading-char 'char-charset)
34
35 (defun find-charset-string (string)
36   "Return a list of charsets in the STRING except ascii.
37 \[emu-x20.el; Mule emulating function]"
38   (delq 'ascii (charsets-in-string string))
39   )
40
41 (defun find-charset-region (start end)
42   "Return a list of charsets except ascii
43 in the region between START and END.
44 \[emu-x20.el; Mule emulating function]"
45   (delq 'ascii (charsets-in-region start end))
46   )
47
48 (defconst lc-ascii  'ascii)
49 (defconst lc-ltn1   'latin-1)
50 (defconst lc-ltn2   'latin-2)
51 (defconst lc-ltn3   'latin-3)
52 (defconst lc-ltn4   'latin-4)
53 (defconst lc-crl    'cyrillic)
54 (defconst lc-arb    'arabic)
55 (defconst lc-grk    'greek)
56 (defconst lc-hbw    'hebrew)
57 (defconst lc-ltn5   'latin-5)
58 (defconst lc-jp     'japanese)
59 (defconst lc-jp2    'japanese-2)
60 (defconst lc-kr     'korean)
61 (defconst lc-big5-1 'chinese-big5-1)
62 (defconst lc-big5-2 'chinese-big5-2)
63 (defconst lc-cn     'chinese-gb)
64 (defconst lc-cns1   'chinese-cns-1)
65 (defconst lc-cns2   'chinese-cns-2)
66 (defconst lc-cns3   'chinese-cns-3)
67 (defconst lc-cns4   'chinese-cns-4)
68 (defconst lc-cns5   'chinese-cns-5)
69 (defconst lc-cns6   'chinese-cns-6)
70 (defconst lc-cns7   'chinese-cns-7)
71
72
73 ;;; @ coding-system
74 ;;;
75
76 (defconst *noconv* 'noconv)
77 (defconst *ctext*  'ctext)
78
79 (defvar code-converter-is-broken (string-match "(beta17)" emacs-version))
80
81 (if code-converter-is-broken
82 (progn
83 ;;;
84 (defun decode-coding-region (start end coding-system &optional buffer)
85   "Decode the text between START and END which is encoded in CODING-SYSTEM.
86 \[emu-x20.el; XEmacs 20 emulating function]"
87   (save-excursion
88     (if buffer
89         (set-buffer buffer)
90       )
91     (save-restriction
92       (narrow-to-region start end)
93       (let ((process-output-coding-system 'noconv)
94             (process-input-coding-system coding-system))
95         (call-process-region start end "cat" t t nil)
96         ))))
97
98 (defun encode-coding-region (start end coding-system &optional buffer)
99   "Encode the text between START and END which is encoded in CODING-SYSTEM.
100 \[emu-x20.el; XEmacs 20 emulating function]"
101   (save-excursion
102     (if buffer
103         (set-buffer buffer)
104       )
105     (save-restriction
106       (narrow-to-region start end)
107       (let ((process-output-coding-system coding-system)
108             (process-input-coding-system 'noconv))
109         (call-process-region start end "cat" t t nil)
110         ))))
111 ;;;
112 ))
113
114
115 ;;; @ character and string
116 ;;;
117
118 (defun char-bytes (chr) 1)
119 (defun char-width (chr) 1)
120
121 (defalias 'string-width 'length)
122
123 (defalias 'sref 'aref)
124
125 (defun truncate-string (str width &optional start-column)
126   "Truncate STR to fit in WIDTH columns.
127 Optional non-nil arg START-COLUMN specifies the starting column.
128 \[emu-x20.el; Mule 2.3 emulating function]"
129   (or start-column
130       (setq start-column 0))
131   (substring str start-column width)
132   )
133
134
135 ;;; @ etc
136 ;;;
137
138 (require 'emu-xemacs)
139
140
141 ;;; @ end
142 ;;;
143
144 (provide 'emu-x20)
145
146 ;;; emu-x20.el ends here