| 1 | ;;; poem-xm.el --- poem module for XEmacs-mule; -*-byte-compile-dynamic: t;-*- |
|---|
| 2 | |
|---|
| 3 | ;; Copyright (C) 1998,1999 Free Software Foundation, Inc. |
|---|
| 4 | |
|---|
| 5 | ;; Author: MORIOKA Tomohiko <tomo@m17n.org> |
|---|
| 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 | (eval-when-compile |
|---|
| 28 | (require 'poe)) |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | ;;; @ buffer representation |
|---|
| 32 | ;;; |
|---|
| 33 | |
|---|
| 34 | (defsubst-maybe set-buffer-multibyte (flag) |
|---|
| 35 | "Set the multibyte flag of the current buffer to FLAG. |
|---|
| 36 | If FLAG is t, this makes the buffer a multibyte buffer. |
|---|
| 37 | If FLAG is nil, this makes the buffer a single-byte buffer. |
|---|
| 38 | The buffer contents remain unchanged as a sequence of bytes |
|---|
| 39 | but the contents viewed as characters do change. |
|---|
| 40 | \[Emacs 20.3 emulating function]" |
|---|
| 41 | flag) |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | ;;; @ character |
|---|
| 45 | ;;; |
|---|
| 46 | |
|---|
| 47 | ;; avoid bug of XEmacs |
|---|
| 48 | (or (integerp (car (cdr (split-char ?a)))) |
|---|
| 49 | (defun split-char (char) |
|---|
| 50 | "Return list of charset and one or two position-codes of CHAR." |
|---|
| 51 | (let ((charset (char-charset char))) |
|---|
| 52 | (if (eq charset 'ascii) |
|---|
| 53 | (list charset (char-int char)) |
|---|
| 54 | (let ((i 0) |
|---|
| 55 | (len (charset-dimension charset)) |
|---|
| 56 | (code (if (integerp char) |
|---|
| 57 | char |
|---|
| 58 | (char-int char))) |
|---|
| 59 | dest) |
|---|
| 60 | (while (< i len) |
|---|
| 61 | (setq dest (cons (logand code 127) dest) |
|---|
| 62 | code (lsh code -7) |
|---|
| 63 | i (1+ i))) |
|---|
| 64 | (cons charset dest))))) |
|---|
| 65 | ) |
|---|
| 66 | |
|---|
| 67 | (defmacro char-next-index (char index) |
|---|
| 68 | "Return index of character succeeding CHAR whose index is INDEX." |
|---|
| 69 | `(1+ ,index)) |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | ;;; @ string |
|---|
| 73 | ;;; |
|---|
| 74 | |
|---|
| 75 | (defun-maybe string-to-int-list (str) |
|---|
| 76 | (mapcar #'char-int str)) |
|---|
| 77 | |
|---|
| 78 | (defalias 'looking-at-as-unibyte 'looking-at) |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | ;;; @ end |
|---|
| 82 | ;;; |
|---|
| 83 | |
|---|
| 84 | (require 'product) |
|---|
| 85 | (product-provide (provide 'poem-xm) (require 'apel-ver)) |
|---|
| 86 | |
|---|
| 87 | ;;; poem-xm.el ends here |
|---|