(split-char): Redefine if it has bug.
[elisp/apel.git] / emu-e20_2.el
1 ;;; emu-e20_2.el --- emu API implementation for Emacs 20.1 and 20.2
2
3 ;; Copyright (C) 1996,1997,1998 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 emu.
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 ;;; Commentary:
26
27 ;;    This module requires Emacs 20.1 and 20.2.
28
29 ;;; Code:
30
31 (defsubst-maybe set-buffer-multibyte (flag)
32   "Set the multibyte flag of the current buffer to FLAG.
33 If FLAG is t, this makes the buffer a multibyte buffer.
34 If FLAG is nil, this makes the buffer a single-byte buffer.
35 The buffer contents remain unchanged as a sequence of bytes
36 but the contents viewed as characters do change."
37   (setq enable-multibyte-characters flag)
38   )
39
40
41 ;;; @ character
42 ;;;
43
44 (defalias 'char-length 'char-bytes)
45
46 (defmacro char-next-index (char index)
47   "Return index of character succeeding CHAR whose index is INDEX."
48   `(+ ,index (char-bytes ,char)))
49
50
51 ;;; @ string
52 ;;;
53
54 (defalias 'sset 'store-substring)
55
56 (defun string-to-char-list (string)
57   "Return a list of which elements are characters in the STRING."
58   (let* ((len (length string))
59          (i 0)
60          l chr)
61     (while (< i len)
62       (setq chr (sref string i))
63       (setq l (cons chr l))
64       (setq i (+ i (char-bytes chr)))
65       )
66     (nreverse l)
67     ))
68
69 (defalias 'string-to-int-list 'string-to-char-list)
70
71 (defun looking-at-as-unibyte (regexp)
72   "Like `looking-at', but string is regarded as unibyte sequence."
73   (let (enable-multibyte-characters)
74     (looking-at regexp)
75     ))
76
77 ;;; @@ obsoleted aliases
78 ;;;
79 ;;; You should not use them.
80
81 (defalias 'string-columns 'string-width)
82 (make-obsolete 'string-columns 'string-width)
83
84
85 ;;; @ end
86 ;;;
87
88 (provide 'emu-e20_2)
89
90 ;;; emu-e20_2.el ends here