(Download): Renamed from "Anonymous FTP"; modify for
[elisp/apel.git] / poem.el
1 ;;; poem.el --- Emulate latest MULE features; -*-byte-compile-dynamic: t;-*-
2
3 ;; Copyright (C) 1998,1999 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: emulation, compatibility, Mule
7
8 ;; This file is part of APEL (A Portable Emacs Library).
9
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
14
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ;; General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
24
25 ;;; Code:
26
27 (require 'pces)
28
29 (cond ((featurep 'mule)
30        (cond ((featurep 'xemacs)
31               (require 'poem-xm)
32               )
33              ((>= emacs-major-version 20)
34               (require 'poem-e20)
35               )
36              (t
37               ;; for MULE 1.* and 2.*
38               (require 'poem-om)
39               ))
40        )
41       ((boundp 'NEMACS)
42        ;; for Nemacs and Nepoch
43        (require 'poem-nemacs)
44        )
45       (t
46        (require 'poem-ltn1)
47        ))
48
49
50 ;;; @ Emacs 20.3 emulation
51 ;;;
52
53 (defsubst-maybe string-as-unibyte (string)
54   "Return a unibyte string with the same individual bytes as STRING.
55 If STRING is unibyte, the result is STRING itself.
56 \[Emacs 20.3 emulating macro]"
57   string)
58
59 (defsubst-maybe string-as-multibyte (string)
60   "Return a multibyte string with the same individual bytes as STRING.
61 If STRING is multibyte, the result is STRING itself.
62 \[Emacs 20.3 emulating macro]"
63   string)
64
65 (defun-maybe charset-after (&optional pos)
66   "Return charset of a character in current buffer at position POS.
67 If POS is nil, it defaults to the current point.
68 If POS is out of range, the value is nil.
69 \[Emacs 20.3 emulating function]"
70   (char-charset (char-after pos))
71   )
72
73 ;;; @ XEmacs-mule emulation
74 ;;;
75
76 (defalias-maybe 'char-int 'identity)
77
78 (defalias-maybe 'int-char 'identity)
79
80 (defalias-maybe 'characterp
81   (cond
82    ((fboundp 'char-valid-p) 'char-valid-p)
83    (t 'integerp)))
84
85 (defalias-maybe 'char-or-char-int-p
86   (cond
87    ((fboundp 'char-valid-p) 'char-valid-p)
88    (t 'integerp)))
89
90 (defun-maybe char-octet (ch &optional n)
91   "Return the octet numbered N (should be 0 or 1) of char CH.
92 N defaults to 0 if omitted. [XEmacs-mule emulating function]"
93   (or (nth (if n
94                (1+ n)
95              1)
96            (split-char ch))
97       0))
98
99
100 ;;; @ end
101 ;;;
102
103 (require 'product)
104 (product-provide (provide 'poem) (require 'apel-ver))
105
106 ;;; poem.el ends here