;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;;; modified by KOBAYASHI Shuhei <shuhei-k@jaist.ac.jp>
;;; Version:
-;;; $Id: emu-nemacs.el,v 7.19 1996/05/09 15:06:53 morioka Exp $
+;;; $Id: emu-nemacs.el,v 7.27 1996/05/27 12:27:59 morioka Exp $
;;; Keywords: emulation, compatibility, NEmacs, Mule
;;;
;;; This file is part of tl (Tiny Library).
;;; @ character set
;;;
-(defconst lc-ascii 0)
-(defconst lc-jp 146)
+(defconst charset-ascii 0 "Character set of ASCII")
+(defconst charset-jisx0208 146 "Character set of JIS X0208-1983")
-(defun char-charset (chr)
- "Return the character set of char CHR.
-\[emu-nemacs.el; XEmacs 20 emulating function]"
- (if (< chr 128)
- lc-ascii
- lc-jp))
+;;; @@ for Mule emulation
+;;;
-(defalias 'char-leading-char 'char-charset)
+(defconst lc-ascii 0)
+(defconst lc-jp 146)
;;; @ coding system
)
-;;; @ character and string
+;;; @ character
;;;
+(defun char-charset (chr)
+ "Return the character set of char CHR.
+\[emu-nemacs.el; XEmacs 20 emulating function]"
+ (if (< chr 128)
+ charset-ascii
+ charset-jisx0208))
+
(defun char-bytes (chr)
"Return number of bytes CHAR will occupy in a buffer.
\[emu-nemacs.el; Mule emulating function]"
(if (< chr 128) 1 2))
-(defun char-width (chr)
- "Return number of columns CHAR will occupy when displayed.
-\[emu-nemacs.el; Mule emulating function]"
- (if (< chr 128) 1 2))
+(defun char-columns (character)
+ "Return number of columns a CHARACTER occupies when displayed.
+\[emu-nemacs.el]"
+ (if (< character 128)
+ 1
+ 2))
-(defun string-width (str)
- "Return number of columns STRING will occupy.
-\[emu-nemacs.el; Mule emulating function]"
- (length str))
+;;; @@ for Mule emulation
+;;;
+
+(defalias 'char-leading-char 'char-charset)
+
+(defalias 'char-width 'char-columns)
+
+
+;;; @ string
+;;;
+
+(defalias 'string-columns 'length)
(defun sref (str idx)
"Return the character in STR at index IDX.
""
(while (< column start-column)
(setq ch (aref str from)
- column (+ column (char-width ch))
+ column (+ column (char-columns ch))
from (+ from (char-bytes ch))))
(if (< width max-width)
(progn
(setq to from)
(while (<= column width)
(setq ch (aref str to)
- column (+ column (char-width ch))
+ column (+ column (char-columns ch))
to-prev to
to (+ to (char-bytes ch))))
(setq to to-prev)))
(substring str from to))))
+;;; @@ for Mule emulation
+;;;
+
+(defalias 'string-width 'length)
+
;;; @ text property emulation
;;;