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