118879e5a98013503bada81743935553716c5142
[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.18 1996/05/27 12:25:34 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 ;;; @@ for Mule emulation
47 ;;;
48
49 (defconst lc-ascii 0)
50 (defconst lc-ltn1 129)
51
52
53 ;;; @ coding-system
54 ;;;
55
56 (defconst *internal* nil)
57 (defconst *ctext* nil)
58 (defconst *noconv* nil)
59
60 (defun character-encode-string (str coding-system)
61   "Encode the string STR which is encoded in CODING-SYSTEM. [emu-e19.el]"
62   str)
63
64 (defun character-decode-string (str coding-system)
65   "Decode the string STR which is encoded in CODING-SYSTEM. [emu-e19.el]"
66   str)
67
68 (defun character-encode-region (start end coding-system)
69   "Encode the text between START and END which is
70 encoded in CODING-SYSTEM. [emu-e19.el]"
71   t)
72
73 (defun character-decode-region (start end coding-system)
74   "Decode the text between START and END which is
75 encoded in CODING-SYSTEM. [emu-e19.el]"
76   t)
77
78 (defun code-convert-string (str ic oc)
79   "Convert code in STRING from SOURCE code to TARGET code,
80 On successful converion, returns the result string,
81 else returns nil. [emu-e19.el; Mule emulating function]"
82   str)
83
84 (defun code-convert-region (beg end ic oc)
85   "Convert code of the text between BEGIN and END from SOURCE
86 to TARGET. On successful conversion returns t,
87 else returns nil. [emu-e19.el; Mule emulating function]"
88   t)
89
90 (defun code-detect-region (beg end)
91   "Detect coding-system of the text in the region
92 between START and END. [emu-e19.el; Mule emulating function]"
93   )
94
95 (defun set-file-coding-system (coding-system &optional force)
96   )
97
98
99 ;;; @ character
100 ;;;
101
102 (defun char-bytes (chr) 1)
103
104 (defun char-columns (character)
105   "Return number of columns a CHARACTER occupies when displayed.
106 \[emu-nemacs.el]"
107   1)
108
109 (defun char-charset (chr)
110   "Return the character set of char CHR.
111 \[emu-e19.el; XEmacs 20 emulating function]"
112   (if (< chr 128)
113       charset-ascii
114     charset-latin-1))
115
116 (defun find-charset-string (str)
117   "Return a list of leading-chars in the string.
118 \[emu-e19.el; Mule emulating function]"
119   (if (string-match "[\200-\377]" str)
120       (list lc-ltn1)
121     ))
122
123 (defun find-charset-region (start end)
124   "Return a list of leading-chars in the region between START and END.
125 \[emu-e19.el; Mule emulating function]"
126   (if (save-excursion
127         (save-restriction
128           (narrow-to-region start end)
129           (goto-char start)
130           (re-search-forward "[\200-\377]" nil t)
131           ))
132       (list lc-ltn1)
133     ))
134
135 ;;; @@ for Mule emulation
136 ;;;
137
138 (defalias 'char-width 'char-columns)
139
140 (defalias 'char-leading-char 'char-charset)
141
142
143 ;;; @ string
144 ;;;
145
146 (defalias 'string-columns 'length)
147
148 (defun string-to-char-list (str)
149   (mapcar (function identity) str)
150   )
151
152 (defalias 'string-to-int-list 'string-to-char-list)
153
154 (defalias 'sref 'aref)
155
156 (defun truncate-string (str width &optional start-column)
157   "Truncate STR to fit in WIDTH columns.
158 Optional non-nil arg START-COLUMN specifies the starting column.
159 \[emu-e19.el; Mule 2.3 emulating function]"
160   (or start-column
161       (setq start-column 0))
162   (substring str start-column width)
163   )
164
165 ;;; @@ for Mule emulation
166 ;;;
167
168 (defalias 'string-width 'length)
169
170
171 ;;; @ end
172 ;;;
173
174 (provide 'emu-e19)
175
176 ;;; emu-e19.el ends here