1 ;;; pccl-om.el --- Portable CCL utility for Mule 1.* and Mule 2.*
3 ;; Copyright (C) 1998 Free Software Foundation, Inc.
4 ;; Copyright (C) 1998 Tanaka Akira
6 ;; Author: Tanaka Akira <akr@jaist.ac.jp>
7 ;; Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
8 ;; Keywords: emulation, compatibility, Mule
10 ;; This file is part of APEL (A Portable Emacs Library).
12 ;; This program is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 2, or (at
15 ;; your option) any later version.
17 ;; This program is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'ccl))
32 (broken-facility ccl-accept-symbol-as-program
33 "Emacs does not accept symbol as CCL program.")
36 (defun make-ccl-coding-system
37 (coding-system mnemonic doc-string decoder encoder)
39 Define a new CODING-SYSTEM by CCL programs DECODER and ENCODER.
41 CODING-SYSTEM, DECODER and ENCODER must be symbol."
42 (setq decoder (symbol-value decoder)
43 encoder (symbol-value encoder))
44 (make-coding-system coding-system 4 mnemonic doc-string
45 nil ; Mule takes one more optional argument: EOL-TYPE.
46 (cons decoder encoder)))
49 (defun ccl-execute (ccl-prog reg)
50 "Execute CCL-PROG with registers initialized by REGISTERS.
51 If CCL-PROG is symbol, it is dereferenced.
52 \[Emacs 20.3 emulating function]"
54 (if (symbolp ccl-prog) (symbol-value ccl-prog) ccl-prog)
57 (defun ccl-execute-on-string (ccl-prog status string &optional contin)
58 "Execute CCL-PROG with initial STATUS on STRING.
59 If CCL-PROG is symbol, it is dereferenced.
60 \[Emacs 20.3 emulating function]"
62 (if (symbolp ccl-prog) (symbol-value ccl-prog) ccl-prog)
65 (broken-facility ccl-execute-on-string-ignore-contin
66 "CONTIN argument for ccl-execute-on-string is ignored.")
69 (define-ccl-program test-ccl-eof-block
76 (make-ccl-coding-system
77 'test-ccl-eof-block-cs ?T "CCL_EOF_BLOCK tester"
78 'test-ccl-eof-block 'test-ccl-eof-block)
81 (broken-facility ccl-execute-eof-block-on-encoding-null
82 "Emacs forgets executing CCL_EOF_BLOCK with encoding on empty input."
83 (equal (code-convert-string "" *internal* 'test-ccl-eof-block-cs) "[EOF]"))
85 (broken-facility ccl-execute-eof-block-on-encoding-some
86 "Emacs forgets executing CCL_EOF_BLOCK with encoding on non-empty input."
87 (equal (code-convert-string "a" *internal* 'test-ccl-eof-block-cs) "a[EOF]"))
89 (broken-facility ccl-execute-eof-block-on-decoding-null
90 "Emacs forgets executing CCL_EOF_BLOCK with decoding on empty input."
91 (equal (code-convert-string "" 'test-ccl-eof-block-cs *internal*) "[EOF]"))
93 (broken-facility ccl-execute-eof-block-on-decoding-some
94 "Emacs forgets executing CCL_EOF_BLOCK with decoding on non-empty input."
95 (equal (code-convert-string "a" 'test-ccl-eof-block-cs *internal*) "a[EOF]"))
97 (broken-facility ccl-execute-eof-block-on-encoding
98 "Emacs may forget executing CCL_EOF_BLOCK with encoding."
99 (not (or (broken-p 'ccl-execute-eof-block-on-encoding-null)
100 (broken-p 'ccl-execute-eof-block-on-encoding-some)))
103 (broken-facility ccl-execute-eof-block-on-decoding
104 "Emacs may forget executing CCL_EOF_BLOCK with decoding."
105 (not (or (broken-p 'ccl-execute-eof-block-on-decoding-null)
106 (broken-p 'ccl-execute-eof-block-on-decoding-some)))
109 (broken-facility ccl-execute-eof-block
110 "Emacs may forget executing CCL_EOF_BLOCK."
111 (not (or (broken-p 'ccl-execute-eof-block-on-encoding)
112 (broken-p 'ccl-execute-eof-block-on-decoding)))
115 (broken-facility ccl-cascading-read
116 "Emacs CCL read command does not accept more than 2 arguments."
119 (define-ccl-program cascading-read-test
130 ;;; pccl-om.el ends here