tm 7.66.
[elisp/apel.git] / emu-e19.el
1 ;;;
2 ;;; emu-e19.el --- Mule 2 emulation module for Emacs 19 and XEmacs 19
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-e19.el,v 7.20 1996/05/28 06:37:36 morioka Exp $
10 ;;; Keywords: emulation, compatibility, Mule, Latin-1
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 ;;; @ version and variant specific features
31 ;;;
32
33 (cond (running-xemacs
34        (require 'emu-xemacs))
35       (running-emacs-19
36        (require 'emu-19)
37        ))
38
39
40 ;;; @ character set
41 ;;;
42
43 (defconst charset-ascii 0 "Character set of ASCII")
44 (defconst charset-latin-1 129 "Character set of ISO-8859-1")
45
46 (defun charset-description (charset)
47   "Return description of CHARSET. [emu-e19.el]"
48   (if (< charset 128)
49       (documentation-property 'charset-ascii 'variable-documentation)
50     (documentation-property 'charset-latin-1 'variable-documentation)
51     ))
52
53 (defun charset-registry (charset)
54   "Return registry name of CHARSET. [emu-e19.el]"
55   (if (< charset 128)
56       "ASCII"
57     "ISO8859-1"))
58
59 (defun charset-columns (charset)
60   "Return number of columns a CHARSET occupies when displayed.
61 \[emu-e19.el]"
62   1)
63
64 (defun charset-direction (charset)
65   "Return the direction of a character of CHARSET by
66   0 (left-to-right) or 1 (right-to-left). [emu-e19.el]"
67   0)
68
69 (defun find-charset-string (str)
70   "Return a list of charsets in the string.
71 \[emu-e19.el; Mule emulating function]"
72   (if (string-match "[\200-\377]" str)
73       (list lc-ltn1)
74     ))
75
76 (defun find-charset-region (start end)
77   "Return a list of charsets in the region between START and END.
78 \[emu-e19.el; Mule emulating function]"
79   (if (save-excursion
80         (save-restriction
81           (narrow-to-region start end)
82           (goto-char start)
83           (re-search-forward "[\200-\377]" nil t)
84           ))
85       (list lc-ltn1)
86     ))
87
88 ;;; @@ for Mule emulation
89 ;;;
90
91 (defconst lc-ascii 0)
92 (defconst lc-ltn1 129)
93
94
95 ;;; @ coding-system
96 ;;;
97
98 (defconst *internal* nil)
99 (defconst *ctext* nil)
100 (defconst *noconv* nil)
101
102 (defun character-encode-string (str coding-system)
103   "Encode the string STR which is encoded in CODING-SYSTEM. [emu-e19.el]"
104   str)
105
106 (defun character-decode-string (str coding-system)
107   "Decode the string STR which is encoded in CODING-SYSTEM. [emu-e19.el]"
108   str)
109
110 (defun character-encode-region (start end coding-system)
111   "Encode the text between START and END which is
112 encoded in CODING-SYSTEM. [emu-e19.el]"
113   t)
114
115 (defun character-decode-region (start end coding-system)
116   "Decode the text between START and END which is
117 encoded in CODING-SYSTEM. [emu-e19.el]"
118   t)
119
120 (defun code-convert-string (str ic oc)
121   "Convert code in STRING from SOURCE code to TARGET code,
122 On successful converion, returns the result string,
123 else returns nil. [emu-e19.el; Mule emulating function]"
124   str)
125
126 (defun code-convert-region (beg end ic oc)
127   "Convert code of the text between BEGIN and END from SOURCE
128 to TARGET. On successful conversion returns t,
129 else returns nil. [emu-e19.el; Mule emulating function]"
130   t)
131
132 (defun code-detect-region (beg end)
133   "Detect coding-system of the text in the region
134 between START and END. [emu-e19.el; Mule emulating function]"
135   )
136
137 (defun set-file-coding-system (coding-system &optional force)
138   )
139
140
141 ;;; @ character
142 ;;;
143
144 (defun char-charset (chr)
145   "Return the character set of char CHR.
146 \[emu-e19.el; XEmacs 20 emulating function]"
147   (if (< chr 128)
148       charset-ascii
149     charset-latin-1))
150
151 (defun char-bytes (char)
152   "Return number of bytes a character in CHAR occupies in a buffer.
153 \[emu-e19.el; Mule emulating function]"
154   1)
155
156 (defun char-columns (character)
157   "Return number of columns a CHARACTER occupies when displayed.
158 \[emu-nemacs.el]"
159   1)
160
161 ;;; @@ for Mule emulation
162 ;;;
163
164 (defalias 'char-width 'char-columns)
165
166 (defalias 'char-leading-char 'char-charset)
167
168
169 ;;; @ string
170 ;;;
171
172 (defalias 'string-columns 'length)
173
174 (defun string-to-char-list (str)
175   (mapcar (function identity) str)
176   )
177
178 (defalias 'string-to-int-list 'string-to-char-list)
179
180 (defalias 'sref 'aref)
181
182 (defun truncate-string (str width &optional start-column)
183   "Truncate STR to fit in WIDTH columns.
184 Optional non-nil arg START-COLUMN specifies the starting column.
185 \[emu-e19.el; Mule 2.3 emulating function]"
186   (or start-column
187       (setq start-column 0))
188   (substring str start-column width)
189   )
190
191 ;;; @@ for Mule emulation
192 ;;;
193
194 (defalias 'string-width 'length)
195
196
197 ;;; @ end
198 ;;;
199
200 (provide 'emu-e19)
201
202 ;;; emu-e19.el ends here