| 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., 59 Temple Place - Suite 330, |
|---|
| 23 | ;; Boston, MA 02111-1307, 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 defauls 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 'integerp) |
|---|
| 81 | |
|---|
| 82 | (defalias-maybe 'char-or-char-int-p 'integerp) |
|---|
| 83 | |
|---|
| 84 | (defun-maybe char-octet (ch &optional n) |
|---|
| 85 | "Return the octet numbered N (should be 0 or 1) of char CH. |
|---|
| 86 | N defaults to 0 if omitted. [XEmacs-mule emulating function]" |
|---|
| 87 | (or (nth (if n |
|---|
| 88 | (1+ n) |
|---|
| 89 | 1) |
|---|
| 90 | (split-char ch)) |
|---|
| 91 | 0)) |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | ;;; @ end |
|---|
| 95 | ;;; |
|---|
| 96 | |
|---|
| 97 | (require 'product) |
|---|
| 98 | (product-provide (provide 'poem) (require 'apel-ver)) |
|---|
| 99 | |
|---|
| 100 | ;;; poem.el ends here |
|---|