Commits

Anonymous committed 8b3665e

Import Mule-UCS sources at 0.84 KOUGETSUDAI

Comments (0)

Files changed (85)

+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+2001-08-31  Hideyuki SHIRAI  <shirai@meadowy.org>
+
+	* emacs-20.7-mule-4.1.patch.txt: Fix comment.
+
+2001-08-30  Hideyuki SHIRAI  <shirai@meadowy.org>
+
+	* emacs-20.7-mule-4.1.patch.txt: Fix diff of src/Makefile.in.
+	(Thanks Yamaoka-san)
+
+2001-08-29  Hideyuki SHIRAI  <shirai@meadowy.org>
+
+	* emacs-20.7-mule-4.1.patch.txt: Replace file. (Thanks
+	Yatagawa-san)
+
+2000-06-29  MIYASHITA Hisashi  <himi@m17n.org>
+
+	* emacs-20.7-mule-4.1.patch.txt: New file.
+	* extension-for-20_6.patch: Removed.
+
+2000-06-22  MIYASHITA Hisashi  <himi@bird.scphys.kyoto-u.ac.jp>
+
+	* mucs-comp.el (compile-file-list-2nd): Add ./lisp/un-supple.el.
+
+2000-06-16  MIYASHITA Hisashi  <himi@bird.scphys.kyoto-u.ac.jp>
+
+	* mucs-comp.el (compile-file-list-1st): Add ./lisp/mule-uni.el.
+
+2000-06-14  MIYASHITA Hisashi  <himi@bird.scphys.kyoto-u.ac.jp>
+
+	* mucs-comp.el:reindented.
+
+2000-05-15  Miyashita Hisashi  <himi@bird.scphys.kyoto-u.ac.jp>
+
+	* ccl.c: Removed.  Use the patch instead.
+	* extension-for-20_6.patch: New file.
+
+2000-05-11  Miyashita Hisashi  <himi@bird.scphys.kyoto-u.ac.jp>
+
+	* mucs-comp.el (compile-file-list-1st):
+	Add ./lisp/unidata.el.
+
+	* ccl.c:
+	New file.
+
+2000-04-08  Miyashita Hisashi  <himi@bird.scphys.kyoto-u.ac.jp>
+
+	* COPYING:
+	New file.
+
+2000-03-10  Miyashita Hisashi  <himi@bird.scphys.kyoto-u.ac.jp>
+
+	* mucs-comp.el :
+	Remove old compiled files before byte-compilation.
+
+2000-02-22  Miyashita Hisashi  <himi@bird.scphys.kyoto-u.ac.jp>
+
+	* mucs-comp.el:
+	Change copyright date.
+
+2000-02-21  Miyashita Hisashi  <himi@bird.scphys.kyoto-u.ac.jp>
+
+	* mucs-comp.el:
+	Add utf.el to compile-file-list-1st, and protect byte-compile-file function with
+	save-excursion form.  Because it may change current
+	buffer environment.
+
+2000-02-02  Miyashita Hisashi  <himi@bird.scphys.kyoto-u.ac.jp>
+
+	* mucs-comp.el:
+	Add mccl-font.el to compile-file-list-1st.
+
+1999-11-09  Miyashita Hisashi  <himi@bird.scphys.kyoto-u.ac.jp>
+
+	* mucs-comp.el (compile-file-list-1st):
+	Add "./lisp/mucs-error.el".
+	(compile-file-list-2nd):
+	Use "./lisp/un-define.el" instead of "./lisp/un-sample.el"
+
+1999-06-20  Miyashita Hisashi  <himi@meadow.scphys.kyoto-u.ac.jp>
+
+	* mucs-comp.el :
+	New file for compilation.
+	
+	
+
+# Makefile for Mule-UCS
+
+# This file is part of XEmacs.
+
+# XEmacs is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any
+# later version.
+
+# XEmacs is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with XEmacs; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+VERSION = 0.50
+AUTHOR_VERSION = 0.84
+MAINTAINER = Stephen J. Turnbull <stephen@xemacs.org>
+PACKAGE = mule-ucs
+PKG_TYPE = regular
+REQUIRES = 
+CATEGORY = mule
+
+EXTRA_SOURCES = \
+	lisp/ChangeLog \
+	lisp/un-trbase.el
+
+ELCS = lisp/mucs.elc lisp/mucs-ccl.elc lisp/mucs-error.elc \
+	lisp/mucs-type.elc lisp/mule-uni.elc lisp/mccl-font.elc \
+	lisp/tae.elc lisp/tbl-mg.elc lisp/trans-util.elc lisp/txt-tbl.elc \
+	lisp/unicode.elc lisp/un-data.elc lisp/un-define.elc \
+	lisp/un-supple.elc lisp/un-tools.elc lisp/unidata.elc lisp/utf.elc
+
+AUTOLOAD_PATH = lisp
+
+DATA_1_FILES = README.XEmacs mucs-comp.el ChangeLog Makefile \
+	lisp/MuleUni.txt \
+	lisp/README \
+	lisp/README.Unicode \
+	lisp/type.txt \
+	doc/mule-ucs.sgml \
+	doc/mule-ucs.texi
+DATA_1_DEST = $(PACKAGE)/
+DATA_2_FILES = $(wildcard lisp/reldata/*.el)
+DATA_2_DEST = $(PACKAGE)/reldata/
+
+include ../../XEmacs.rules
+
+ifeq ($(BUILD_WITHOUT_MULE),)
+
+# I don't think we want to depend on $(ELCS) here.
+all:: $(AUTOLOAD_PATH)/auto-autoloads.elc
+	$(XEMACS) -no-autoloads -batch -l mucs-comp.el
+
+srckit: srckit-std
+
+binkit: binkit-common
+
+else
+all::
+	@echo Sorry, Mule-UCS requires XEmacs/Mule to build.
+
+# Two noops
+srckit:
+binkit:
+
+endif
+* This is the Mule-UCS package by Hisashi Miyashita <himi@m17n.org>.
+
+* Packaged for XEmacs by Stephen J. Turnbull <stephen@xemacs.org>.
+
+* This file Copyright 2001 Free Software Foundation.
+
+    This file is part of XEmacs.
+
+    XEmacs is free software.  You may copy and modify this file for
+    any personal use.  You may redistribute copies (verbatim or
+    modified) under the terms of the GNU General Public License
+    (GPL), version 2 or or any later version (at your option).
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+* This package is experimental.  Several features depend on features
+which are partially implemented or unimplemented in XEmacs.  In
+particular, the JIS X 0213 support and Big5 support currently do not
+work, and may not be provided in any given copy of the package.
+
+* This package apparently corresponds to Mule-UCS 0.84 (KOUGETSUDAI).
+
+* Implementation notes
+
+Mule-UCS provides its own build system in ./mucs-comp.el.
+
+There are three subpackages provided: the Unicode coding system
+(incompletely separated from Mule-UCS), the JIS X 0213 coding system,
+and the Big5 coding system.  Big5 and JIS X 0213 coding systems are
+currently disabled.  They proved the big5-comp.el and x0213-comp.el
+libraries respectively to build themselves.
+
+* Note that the directory structure for the distribution is required
+for building.  The relative paths can be changed, but for current
+purposes they should be considered as hard-coded in mucs-comp.el.
+
+*****    It is not possible to rebuild this package in place.    *****
+*****                         Period!!                           *****
+
+* Distribution file list (CVS, self, and parent directories omitted).
+Files marked [*] are part of the XEmacs packaging infrastructure.
+Those marked [**] have been changed for XEmacs.  All others are
+verbatim from upstream.
+
+.:
+COPYING
+ChangeLog
+Makefile [*]
+README.XEmacs [*]
+doc
+emacs-20.7-mule-4.1.patch.txt
+lisp
+mucs-comp.el
+package-info.in [*]
+
+./doc:
+mule-ucs.sgml
+mule-ucs.texi [**]
+
+./lisp:
+ChangeLog
+MuleUni.txt
+README
+README.Unicode
+big5conv
+jisx0213
+mccl-font.el
+mucs-ccl.el
+mucs-error.el
+mucs-type.el
+mucs.el
+mule-uni.el
+reldata
+tae.el
+tbl-mg.el
+trans-util.el
+txt-tbl.el
+type.txt
+un-data.el
+un-define.el
+un-supple.el
+un-tools.el
+un-trbase.el
+unicode.el
+unidata.el
+utf.el
+
+./lisp/big5conv:
+README
+big5-comp.el
+big5c-cns.el
+big5c-ucs.el
+big5conv.el
+big5type.el
+
+./lisp/jisx0213:
+ChangeLog
+egg-sim-jisx0213.el
+jisx0213.el
+readme.txt
+ujisx0213.el
+x0213-cdef.el
+x0213-char.el
+x0213-comp.el
+x0213-csys.el
+x0213-font.el
+x0213-mime.el
+x0213-sjis.el
+x0213-udef.el
+x0213-util.el
+
+./lisp/reldata:
+u-cns-1.el
+u-cns-2.el
+u-cns-3.el
+u-cns-4.el
+u-cns-5.el
+u-cns-6.el
+u-cns-7.el
+uascii.el
+ubig5.el
+uethiopic.el
+ugb2312.el
+uipa.el
+uiscii.el
+uiso8859-1.el
+uiso8859-14.el
+uiso8859-15.el
+uiso8859-2.el
+uiso8859-3.el
+uiso8859-4.el
+uiso8859-5.el
+uiso8859-6.el
+uiso8859-7.el
+uiso8859-8.el
+uiso8859-9.el
+ujisx0201.el
+ujisx0208.el
+ujisx0212.el
+uksc5601.el
+usisheng.el
+usupple.el
+utibetan.el
+utis620.el
+uviscii.el
+

doc/mule-ucs.sgml

+<!doctype sinfo system>
+<head>
+<title>mule-ucs document (English Version)
+<author> Miyashita Hisashi(HIMI) <mail>himi@bird.scphys.kyoto-u.ac.jp</mail>
+<date>1997/11/1
+
+<toc>
+</head>
+
+<body>
+
+<abstract>
+
+MULE-UCS is a coding system and character code translator system.  This has
+an universal ability to translate from any character sets to any, and
+constract new coding systems easily.
+
+<p>
+
+And MULE-UCS have a package to translate between MULE INTERNAL CODE and
+ISO-10646, So you can handle ISO-10646 based coding systems on
+Emacs/Mule(But can't work on 20.2, this version have no extended CCL), Mule
+3.0 and Meadow.
+
+<p>
+</abstract>
+<h1> Design goal
+<node> Designgoal
+<p>
+MULE-UCS is a character code translator system.
+I set the goal of this system as follows.
+<p>
+
+<dl>
+<dt> map character codepoint. 
+<dd> MULE-UCS have to map character codepoint fast, and give a flexible way
+to change mapping policy. </dd>
+<dt> utilize character codetables
+<dd> MULE-UCS can handle multiple codepoint tables, and then reorganize many
+character set. </dd>
+<dt> generate coding system.
+<dd> MULE-UCS can generate coding systems from your own translation rule.
+Of course including a CCL to convert font codepoint.
+</dl>
+<p>
+
+MULE-UCS have following supplementary features, too.
+<ul>
+<li> Very biased(:-P) MULE-INTERNAL and ISO-10646 translator. and
+ISO-10646 coding-system. </li>
+<li> Convertor tables from text representation to MULE-UCS awarable emacs
+lisp representation. </li>
+</ul>
+
+<h1> MULE-UCS overview.
+<node> overview
+<p>
+
+MULE-UCS consists of these modules mainly.
+
+<ol>
+<li> Association compiler.
+<li> Table organizer.
+<li> CCL generator.
+</ol>
+
+<dl>
+<dt> Association compiler.
+<dd> On MULE-UCS, codepoint mapping rule is described by association
+list(alist).  Association compiler generate table set from an assocation
+list for encoding and decoding.  Association compiler also optimize tables.
+<dt> Table oranizer.
+<dd> Table Organizer can 
+</dl>

doc/mule-ucs.texi

+\input texinfo @c  -*-texinfo-*-
+
+@setfilename mule-ucs
+@settitle MULE-UCS Manual
+
+<head>
+<title>mule-ucs document (English Version)
+<author> Miyashita Hisashi(HIMI) <mail>himi@bird.scphys.kyoto-u.ac.jp</mail>
+<date>1997/11/1
+
+<abstract>
+MULE-UCS is a character code translator.  This has an universal ability to
+translate from any character sets to any, and constract new coding systems
+easily.
+<p>
+And MULE-UCS have a package to translate between MULE INTERNAL CODE and
+ISO-10646, So you can handle ISO-10646 based coding systems on
+Emacs/Mule(But can't work on 20.2, this version have no extended CCL), Mule
+3.0 and Meadow.
+<p>
+</abstract>
+
+<h1> Design

emacs-20.7-mule-4.1.patch.txt

+// 2001/08/29: 2nd release, includes fix (1), (2), (3) and (a).
+// 2000/06/16: 1st release, includes fix (1).
+
+This is unofficial patch for Emacs 20.7 (with MULE 4.0) to upgrade Emacs
+20.7 (with MULE 4.1).  In this context, MULE stands for "Multilingal
+Environment", not "MULtilingal enhancement to GNU Emacs".
+
+Note that this patch also contains several fixes below;
+
+(1) A fix for CCL interpretor (some problem on MapMultiple instraction).
+    Patch from Miyashita Hisashi who also known as "himi".  The original
+    patch can be found in Mule-UCS 0.80.
+
+(2) A fix for building problem under Windows.  Patch from KOSEKI
+    Yoshinori (in meadow-users-jp)
+
+(3) A fix for the problem of invalid post-read-conversion with
+    decode-coding-string(). Patch from Miyashita Hisashi (in mule-ja)
+
+(a) Define a new target (bytecomp) to easy building.  Patch from Katsumi
+    Yamaoka (in mule-ja)
+
+This patch is provided by the author "as is" and any express or implied
+warranties are disclaimed.
+
+How to apply:
+	% tar xzvf emacs-20.7.tar.gz
+	% tar xzvf leim-20.7.tar.gz
+	% cd emacs-20.7
+        % patch -p1 < somewhere/emacs-20.7-mule-4.1.patch
+	% sh configure
+	% make
+	% make install
+
+-- 
+Satoshi Yatagawa <yatagawa@cc.teu.ac.jp>
+diff -ur emacs-20.7/lisp/international/ccl.el emacs-20.7-mule-4.1/lisp/international/ccl.el
+--- emacs-20.7/lisp/international/ccl.el	Sat May 20 20:57:06 2000
++++ emacs-20.7-mule-4.1/lisp/international/ccl.el	Thu Aug 30 09:32:54 2001
+@@ -249,6 +249,13 @@
+     (aset ccl-program-vector ccl-current-ic data)
+     (setq ccl-current-ic (1+ ccl-current-ic))))
+ 
++;; Embed pair of SYMBOL and PROP where (get SYMBOL PROP) should give
++;; proper index number for SYMBOL.  PROP should be
++;; `translation-table-id', `code-conversion-map-id', or
++;; `ccl-program-idx'.
++(defun ccl-embed-symbol (symbol prop)
++  (ccl-embed-data (cons symbol prop)))
++
+ ;; Embed string STR of length LEN in `ccl-program-vector' at
+ ;; `ccl-current-ic'.
+ (defun ccl-embed-string (len str)
+@@ -312,18 +319,6 @@
+ (defun ccl-increment-ic (inc)
+   (setq ccl-current-ic (+ ccl-current-ic inc)))
+ 
+-;;;###autoload
+-(defun ccl-program-p (obj)
+-  "T if OBJECT is a valid CCL compiled code."
+-  (and (vectorp obj)
+-       (let ((i 0) (len (length obj)) (flag t))
+-	 (if (> len 1)
+-	     (progn
+-	       (while (and flag (< i len))
+-		 (setq flag (integerp (aref obj i)))
+-		 (setq i (1+ i)))
+-	       flag)))))
+-
+ ;; If non-nil, index of the start of the current loop.
+ (defvar ccl-loop-head nil)
+ ;; If non-nil, list of absolute addresses of the breaking points of
+@@ -842,11 +837,8 @@
+       (error "CCL: Invalid number of arguments: %s" cmd))
+   (if (not (symbolp (nth 1 cmd)))
+       (error "CCL: Subroutine should be a symbol: %s" cmd))
+-  (let* ((name (nth 1 cmd))
+-	 (idx (get name 'ccl-program-idx)))
+-    (if (not idx)
+-	(error "CCL: Unknown subroutine name: %s" name))
+-    (ccl-embed-code 'call 0 idx))
++  (ccl-embed-code 'call 1 0)
++  (ccl-embed-symbol (nth 1 cmd) 'ccl-program-idx)
+   nil)
+ 
+ ;; Compile END statement.
+@@ -892,7 +884,7 @@
+ 	       (error "CCL: Invalid translation table %s in %s" Rrr cmd))
+ 	   (ccl-embed-extended-command 'translate-character-const-tbl
+ 				       rrr RRR 0)
+-	   (ccl-embed-data Rrr))
++	   (ccl-embed-symbol Rrr 'translation-table-id))
+ 	  (t
+ 	   (ccl-check-register Rrr cmd)
+ 	   (ccl-embed-extended-command 'translate-character rrr RRR Rrr))))
+@@ -939,7 +931,7 @@
+     (ccl-embed-extended-command 'map-single rrr RRR 0)
+     (cond ((symbolp map)
+ 	   (if (get map 'code-conversion-map)
+-	       (ccl-embed-data map)
++	       (ccl-embed-symbol map 'code-conversion-map-id)
+ 	     (error "CCL: Invalid map: %s" map)))
+ 	  (t
+ 	   (error "CCL: Invalid type of arguments: %s" cmd))))
+@@ -960,7 +952,7 @@
+       (setq map (car args))
+       (cond ((symbolp map)
+ 	     (if (get map 'code-conversion-map)
+-		 (ccl-embed-data map)
++		 (ccl-embed-symbol map 'code-conversion-map-id)
+ 	       (error "CCL: Invalid map: %s" map)))
+ 	    ((numberp map)
+ 	     (ccl-embed-data map))
+@@ -1295,8 +1287,12 @@
+ (defmacro declare-ccl-program (name &optional vector)
+   "Declare NAME as a name of CCL program.
+ 
+-To compile a CCL program which calls another CCL program not yet
+-defined, it must be declared as a CCL program in advance.
++This macro exists for backward compatibility.  In the old version of
++Emacs, to compile a CCL program which calls another CCL program not
++yet defined, it must be declared as a CCL program in advance.  But,
++now CCL program names are resolved not at compile time but before
++execution.
++
+ Optional arg VECTOR is a compiled CCL code of the CCL program."
+   `(put ',name 'ccl-program-idx (register-ccl-program ',name ,vector)))
+ 
+@@ -1313,20 +1309,16 @@
+ ;;;###autoload
+ (defmacro check-ccl-program (ccl-program &optional name)
+   "Check validity of CCL-PROGRAM.
+-If CCL-PROGRAM is a symbol denoting a valid CCL program, return
++If CCL-PROGRAM is a symbol denoting a CCL program, return
+ CCL-PROGRAM, else return nil.
+ If CCL-PROGRAM is a vector and optional arg NAME (symbol) is supplied,
+ register CCL-PROGRAM by name NAME, and return NAME."
+-  `(let ((result ,ccl-program))
+-     (cond ((symbolp ,ccl-program)
+-	    (or (numberp (get ,ccl-program 'ccl-program-idx))
+-		(setq result nil)))
+-	   ((vectorp ,ccl-program)
+-	    (setq result ,name)
+-	    (register-ccl-program result ,ccl-program))
+-	   (t
+-	    (setq result nil)))
+-     result))
++  `(if (ccl-program-p ,ccl-program)
++       (if (vectorp ,ccl-program)
++	   (progn
++	     (register-ccl-program ,name ,ccl-program)
++	     ,name)
++	 ,ccl-program)))
+ 
+ ;;;###autoload
+ (defun ccl-execute-with-args (ccl-prog &rest args)
+diff -ur emacs-20.7/lisp/international/mule-cmds.el emacs-20.7-mule-4.1/lisp/international/mule-cmds.el
+--- emacs-20.7/lisp/international/mule-cmds.el	Thu Dec  2 16:42:38 1999
++++ emacs-20.7-mule-4.1/lisp/international/mule-cmds.el	Thu Aug 30 09:32:54 2001
+@@ -1191,16 +1191,22 @@
+ 	coding-category-raw-text	'raw-text
+ 	coding-category-sjis		'japanese-shift-jis
+ 	coding-category-big5		'chinese-big5
++	coding-category-utf-8           nil
++	coding-category-utf-16-be       nil
++	coding-category-utf-16-le       nil
+ 	coding-category-ccl		nil
+ 	coding-category-binary		'no-conversion)
+ 
+   (set-coding-priority
+-   '(coding-category-iso-8-1
++   '(coding-category-utf-16-be
++     coding-category-utf-16-le
++     coding-category-iso-8-1
+      coding-category-iso-8-2
+      coding-category-iso-7-tight
+      coding-category-iso-7
+      coding-category-iso-7-else
+      coding-category-iso-8-else
++     coding-category-utf-8
+      coding-category-emacs-mule 
+      coding-category-raw-text
+      coding-category-sjis
+diff -ur emacs-20.7/lisp/international/mule-conf.el emacs-20.7-mule-4.1/lisp/international/mule-conf.el
+--- emacs-20.7/lisp/international/mule-conf.el	Fri Jun  4 08:27:31 1999
++++ emacs-20.7-mule-4.1/lisp/international/mule-conf.el	Thu Aug 30 09:32:54 2001
+@@ -351,17 +351,23 @@
+       coding-category-iso-7-else	'iso-2022-7bit-lock
+       coding-category-iso-8-else	'iso-2022-8bit-ss2
+       coding-category-ccl		nil
++      coding-category-utf-8             nil
++      coding-category-utf-16-be         nil
++      coding-category-utf-16-le         nil
+       coding-category-big5		'chinese-big5
+       coding-category-raw-text		'raw-text
+       coding-category-binary		'no-conversion)
+ 
+ (set-coding-priority
+- '(coding-category-iso-8-1
++ '(coding-category-utf-16-be
++   coding-category-utf-16-le
++   coding-category-iso-8-1
+    coding-category-iso-8-2
+    coding-category-iso-7-tight
+    coding-category-iso-7
+    coding-category-iso-7-else
+    coding-category-iso-8-else
++   coding-category-utf-8
+    coding-category-emacs-mule
+    coding-category-raw-text
+    coding-category-sjis 
+diff -ur emacs-20.7/lisp/international/mule.el emacs-20.7-mule-4.1/lisp/international/mule.el
+--- emacs-20.7/lisp/international/mule.el	Thu Dec  2 20:25:27 1999
++++ emacs-20.7-mule-4.1/lisp/international/mule.el	Thu Aug 30 09:32:54 2001
+@@ -24,10 +24,10 @@
+ 
+ ;;; Code:
+ 
+-(defconst mule-version "4.0 (HANANOEN)" "\
++(defconst mule-version "4.1 (AOI)" "\
+ Version number and name of this version of MULE (multilingual environment).")
+ 
+-(defconst mule-version-date "1998.7.1" "\
++(defconst mule-version-date "1999.7.30" "\
+ Distribution date of this version of MULE (multilingual environment).")
+ 
+ (defun load-with-code-conversion (fullname file &optional noerror nomessage)
+@@ -306,8 +306,9 @@
+ ;; o coding-category
+ ;;
+ ;; The value is a coding category the coding system belongs to.  The
+-;; function `make-coding-system' and `define-coding-system-alias' sets
+-;; this value automatically.
++;; function `make-coding-system' sets this value automatically 
++;; unless PROPERTIES(the argument) have any `coding-category' slots.
++;; `define-coding-system-alias' only inherits this value.
+ ;;
+ ;; o alias-coding-systems
+ ;;
+@@ -522,7 +523,10 @@
+     subsidiaries))
+ 
+ (defun make-coding-system (coding-system type mnemonic doc-string
+-					 &optional flags properties)
++					 &optional
++					 flags
++					 properties
++					 eol-type)
+   "Define a new coding system CODING-SYSTEM (symbol).
+ Remaining arguments are TYPE, MNEMONIC, DOC-STRING, FLAGS (optional), 
+ and PROPERTIES (optional) which construct a coding-spec of CODING-SYSTEM
+@@ -583,6 +587,21 @@
+ also sets properties `coding-category' and `alias-coding-systems'
+ automatically.
+ 
++EOL-TYPE specifies an EOL type of the coding-system in
++one of the following formats: 
++1. symbol
++     The candidates are unix(UNIX(LF) type EOL),
++     dos(DOS(CRLF) type EOL) , or mac(MAC(CR) type EOL)
++     currently.
++2. vector of coding-systems. (The length must be 3.)
++     The EOL type is undecided. When this coding-system is selected,
++     an EOL type is selected among the specified coding-systems.
++     The first one is for UNIX type EOL, the second one is
++     for DOS type EOL, and the third one is for MAC type EOL.
++3. number
++     0, 1, and 2 means UNIX, DOS, and MAC type EOL respectively,
++     any other numbers are forbidden.
++
+ Kludgy features for backward compatibility:
+ 
+ 1. If TYPE is 4 and car or cdr of FLAGS is a vector, the vector is
+@@ -695,18 +714,37 @@
+ 	  (while l
+ 	    (plist-put plist (car (car l)) (cdr (car l)))
+ 	    (setq l (cdr l)))))
++      (setq coding-category (plist-get plist 'coding-category))
+       (aset coding-spec coding-spec-plist-idx plist))
+     (put coding-system 'coding-system coding-spec)
+     (put coding-category 'coding-systems
+ 	 (cons coding-system (get coding-category 'coding-systems))))
+ 
+-  ;; Next, set a value of `eol-type' property.  The value is a vector
+-  ;; of subsidiary coding systems, each corresponds to a coding system
++  ;; Next, set a value of `eol-type' property.
++  (if (and (not eol-type)
++	   (or (<= type 3) (= type 5)))
++  ;; If the argument eol-type is not specified, set a vector
++  ;; of subsidiary coding systems,
++  ;; each corresponds to a coding system
+   ;; for the detected end-of-line format.
+-  (put coding-system 'eol-type
+-       (if (or (<= type 3) (= type 5))
+-	   (make-subsidiary-coding-system coding-system)
+-	 0))
++      (setq eol-type (make-subsidiary-coding-system coding-system)))
++  (setq eol-type
++	(cond ((eq eol-type 'unix)
++	       0)
++	      ((eq eol-type 'dos)
++	       1)
++	      ((eq eol-type 'mac)
++	       2)
++	      ((or (null eol-type)
++		   (and (vectorp eol-type)
++			(= (length eol-type) 3))
++		   (and (numberp eol-type)
++			(and (>= eol-type 0)
++			     (<= eol-type 2))))
++	       eol-type)
++	      (t
++	       (error "Invalid EOL-TYPE spec:%S" eol-type))))
++  (put coding-system 'eol-type eol-type)
+ 
+   ;; At last, register CODING-SYSTEM in `coding-system-list' and
+   ;; `coding-system-alist'.
+diff -ur emacs-20.7/lisp/international/titdic-cnv.el emacs-20.7-mule-4.1/lisp/international/titdic-cnv.el
+--- emacs-20.7/lisp/international/titdic-cnv.el	Tue Apr 14 10:04:19 1998
++++ emacs-20.7-mule-4.1/lisp/international/titdic-cnv.el	Thu Aug 30 09:32:54 2001
+@@ -335,7 +335,7 @@
+     (set-buffer-file-coding-system 'iso-2022-7bit)
+     (let ((standard-output (current-buffer)))
+       (with-temp-buffer
+-	(let ((coding-system-for-read 'no-conversion))
++	(let ((coding-system-for-read 'raw-text))
+ 	  (insert-file-contents (expand-file-name filename)))
+ 	(set-buffer-multibyte t)
+ 	
+diff -ur emacs-20.7/lisp/loaddefs.el emacs-20.7-mule-4.1/lisp/loaddefs.el
+--- emacs-20.7/lisp/loaddefs.el	Thu Jul 15 01:41:03 1999
++++ emacs-20.7-mule-4.1/lisp/loaddefs.el	Thu Aug 30 09:32:54 2001
+@@ -2100,13 +2100,10 @@
+ ;;;***
+ 
+ ;;;### (autoloads (ccl-execute-with-args check-ccl-program define-ccl-program
+-;;;;;;  declare-ccl-program ccl-dump ccl-compile ccl-program-p) "ccl"
+-;;;;;;  "international/ccl.el" (13993 12532))
++;;;;;;  declare-ccl-program ccl-dump ccl-compile) "ccl" "international/ccl.el"
++;;;;;;  (14236 17288))
+ ;;; Generated autoloads from international/ccl.el
+ 
+-(autoload (quote ccl-program-p) "ccl" "\
+-T if OBJECT is a valid CCL compiled code." nil nil)
+-
+ (autoload (quote ccl-compile) "ccl" "\
+ Return a compiled code of CCL-PROGRAM as a vector of integer." nil nil)
+ 
+@@ -2116,8 +2113,12 @@
+ (autoload (quote declare-ccl-program) "ccl" "\
+ Declare NAME as a name of CCL program.
+ 
+-To compile a CCL program which calls another CCL program not yet
+-defined, it must be declared as a CCL program in advance.
++This macro exists for backward compatibility.  In the old version of
++Emacs, to compile a CCL program which calls another CCL program not
++yet defined, it must be declared as a CCL program in advance.  But,
++now CCL program names are resolved not at compile time but before
++execution.
++
+ Optional arg VECTOR is a compiled CCL code of the CCL program." nil (quote macro))
+ 
+ (autoload (quote define-ccl-program) "ccl" "\
+@@ -2127,7 +2128,7 @@
+ 
+ (autoload (quote check-ccl-program) "ccl" "\
+ Check validity of CCL-PROGRAM.
+-If CCL-PROGRAM is a symbol denoting a valid CCL program, return
++If CCL-PROGRAM is a symbol denoting a CCL program, return
+ CCL-PROGRAM, else return nil.
+ If CCL-PROGRAM is a vector and optional arg NAME (symbol) is supplied,
+ register CCL-PROGRAM by name NAME, and return NAME." nil (quote macro))
+diff -ur emacs-20.7/lisp/loadup.el emacs-20.7-mule-4.1/lisp/loadup.el
+--- emacs-20.7/lisp/loadup.el	Mon May 10 20:42:12 1999
++++ emacs-20.7-mule-4.1/lisp/loadup.el	Thu Aug 30 09:32:54 2001
+@@ -285,6 +285,8 @@
+ ;; Avoid error if user loads some more libraries now.
+ (setq purify-flag nil)
+ 
++(setq toggle-debug-on-error t)
++
+ ;; For machines with CANNOT_DUMP defined in config.h,
+ ;; this file must be loaded each time Emacs is run.
+ ;; So run the startup code now.  First, remove `-l loadup' from args.
+diff -ur emacs-20.7/src/Makefile.in emacs-20.7-mule-4.1/src/Makefile.in
+--- emacs-20.7/src/Makefile.in	Mon Apr 26 14:19:42 1999
++++ emacs-20.7-mule-4.1/src/Makefile.in	Thu Aug 30 09:34:15 2001
+@@ -804,7 +804,14 @@
+ #define OBJECTS_MACHINE
+ #endif
+ 
+-all: emacs OTHER_FILES
++all: emacs bytecomp OTHER_FILES
++
++bytecomp: emacs
++	./emacs -batch -q -f batch-byte-compile \
++	${lispsource}ange-ftp.el ${lispsource}international/ccl.el \
++	${lispsource}international/mule-cmds.el \
++	${lispsource}international/mule.el \
++	${lispsource}international/titdic-cnv.el
+ 
+ emacs: temacs ${etc}DOC ${lisp}
+ #ifdef CANNOT_DUMP
+diff -ur emacs-20.7/src/callproc.c emacs-20.7-mule-4.1/src/callproc.c
+--- emacs-20.7/src/callproc.c	Wed May 24 22:58:24 2000
++++ emacs-20.7-mule-4.1/src/callproc.c	Thu Aug 30 09:32:54 2001
+@@ -358,6 +358,7 @@
+ 
+   display = nargs >= 4 ? args[3] : Qnil;
+ 
++  infile = ENCODE_FILE (infile);
+   filefd = open (XSTRING (infile)->data, O_RDONLY, 0);
+   if (filefd < 0)
+     {
+@@ -482,6 +483,7 @@
+     else if (STRINGP (error_file))
+       {
+ #ifdef DOS_NT
++	error_file = ENCODE_FILE (error_file);
+ 	fd_error = open (XSTRING (error_file)->data,
+ 			 O_WRONLY | O_TRUNC | O_CREAT | O_TEXT,
+ 			 S_IREAD | S_IWRITE);
+diff -ur emacs-20.7/src/ccl.c emacs-20.7-mule-4.1/src/ccl.c
+--- emacs-20.7/src/ccl.c	Sat Feb 26 19:11:31 2000
++++ emacs-20.7-mule-4.1/src/ccl.c	Thu Aug 30 09:32:54 2001
+@@ -19,16 +19,14 @@
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.  */
+ 
+-#include <stdio.h>
+-
+ #ifdef emacs
+-
+ #include <config.h>
+-
+-#ifdef STDC_HEADERS
+-#include <stdlib.h>
+ #endif
+ 
++#include <stdio.h>
++
++#ifdef emacs
++
+ #include "lisp.h"
+ #include "charset.h"
+ #include "ccl.h"
+@@ -59,7 +57,11 @@
+    is an index for Vccl_protram_table. */
+ Lisp_Object Qccl_program_idx;
+ 
+-/* Vector of CCL program names vs corresponding program data.  */
++/* Table of registered CCL programs.  Each element is a vector of
++   NAME, CCL_PROG, and RESOLVEDP where NAME (symbol) is the name of
++   the program, CCL_PROG (vector) is the compiled code of the program,
++   RESOLVEDP (t or nil) is the flag to tell if symbols in CCL_PROG is
++   already resolved to index numbers or not.  */
+ Lisp_Object Vccl_program_table;
+ 
+ /* CCL (Code Conversion Language) is a simple language which has
+@@ -291,10 +293,15 @@
+ 					*/
+ 
+ #define CCL_Call		0x13 /* Call the CCL program whose ID is
+-					(CC..C).
+-					1:CCCCCCCCCCCCCCCCCCCC000XXXXX
+-					------------------------------
+-					call (CC..C)
++					CC..C or cc..c.
++					1:CCCCCCCCCCCCCCCCCCCCFFFXXXXX
++					[2:00000000cccccccccccccccccccc]
++					------------------------------
++					if (FFF)
++					  call (cc..c)
++					  IC++;
++					else
++					  call (CC..C)
+ 					*/
+ 
+ #define CCL_WriteConstString	0x14 /* Write a constant or a string:
+@@ -530,7 +537,10 @@
+    At first, VAL0 is set to reg[rrr], and it is translated by the
+    first map to VAL1.  Then, VAL1 is translated by the next map to
+    VAL2.  This mapping is iterated until the last map is used.  The
+-   result of the mapping is the last value of VAL?.
++   result of the mapping is the last value of VAL?.  When the mapping
++   process reached to the end of the map set, it moves to the next
++   map set.  If the next does not exit, the mapping process terminates,
++   and regard the last value as a result.
+ 
+    But, when VALm is mapped to VALn and VALn is not a number, the
+    mapping proceed as below:
+@@ -541,8 +551,12 @@
+    In VALn is t, VALm is reverted to reg[rrr] and the mapping of VALm
+    proceed to the next map.
+ 
+-   If VALn is lambda, the whole mapping process terminates, and VALm
+-   is the result of this mapping.
++   If VALn is lambda, move to the next map set like reaching to the
++   end of the current map set.
++
++   If VALn is a symbol, call the CCL program refered by it.
++   Then, use reg[rrr] as a mapped value except for -1, -2 and -3.
++   Such special values are regarded as nil, t, and lambda respectively.
+ 
+    Each map is a Lisp vector of the following format (a) or (b):
+ 	(a)......[STARTPOINT VAL1 VAL2 ...]
+@@ -570,7 +584,7 @@
+ 					 N:SEPARATOR_z (< 0)
+ 				      */
+ 
+-#define MAX_MAP_SET_LEVEL 20
++#define MAX_MAP_SET_LEVEL 30
+ 
+ typedef struct
+ {
+@@ -581,19 +595,44 @@
+ static tr_stack mapping_stack[MAX_MAP_SET_LEVEL];
+ static tr_stack *mapping_stack_pointer;
+ 
+-#define PUSH_MAPPING_STACK(restlen, orig)                 \
+-{                                                           \
+-  mapping_stack_pointer->rest_length = (restlen);         \
+-  mapping_stack_pointer->orig_val = (orig);               \
+-  mapping_stack_pointer++;                                \
+-}
++/* If this variable is non-zero, it indicates the stack_idx
++   of immediately called by CCL_MapMultiple. */
++static int stack_idx_of_map_multiple = 0;
++
++#define PUSH_MAPPING_STACK(restlen, orig)		\
++  do {							\
++    mapping_stack_pointer->rest_length = (restlen);	\
++    mapping_stack_pointer->orig_val = (orig);		\
++    mapping_stack_pointer++;				\
++  } while (0)
+ 
+-#define POP_MAPPING_STACK(restlen, orig)                  \
+-{                                                           \
+-  mapping_stack_pointer--;                                \
+-  (restlen) = mapping_stack_pointer->rest_length;         \
+-  (orig) = mapping_stack_pointer->orig_val;               \
+-}                                                           \
++#define POP_MAPPING_STACK(restlen, orig)		\
++  do {							\
++    mapping_stack_pointer--;				\
++    (restlen) = mapping_stack_pointer->rest_length;	\
++    (orig) = mapping_stack_pointer->orig_val;		\
++  } while (0)
++
++#define CCL_CALL_FOR_MAP_INSTRUCTION(symbol, ret_ic)		\
++  do {								\
++    struct ccl_program called_ccl;				\
++    if (stack_idx >= 256					\
++	|| (setup_ccl_program (&called_ccl, (symbol)) != 0))	\
++      {								\
++	if (stack_idx > 0)					\
++	  {							\
++	    ccl_prog = ccl_prog_stack_struct[0].ccl_prog;	\
++	    ic = ccl_prog_stack_struct[0].ic;			\
++	  }							\
++	CCL_INVALID_CMD;					\
++      }								\
++    ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog;	\
++    ccl_prog_stack_struct[stack_idx].ic = (ret_ic);		\
++    stack_idx++;						\
++    ccl_prog = called_ccl.prog;					\
++    ic = CCL_HEADER_MAIN;					\
++    goto ccl_repeat;						\
++  } while (0)
+ 
+ #define CCL_MapSingle		0x12 /* Map by single code conversion map
+ 					1:ExtendedCOMMNDXXXRRRrrrXXXXX
+@@ -780,6 +819,9 @@
+   if (ccl->buf_magnification ==0) /* We can't produce any bytes.  */
+     dst = NULL;
+ 
++  /* Set mapping stack pointer. */
++  mapping_stack_pointer = mapping_stack;
++
+ #ifdef CCL_DEBUG
+   ccl_backtrace_idx = 0;
+ #endif
+@@ -950,16 +992,27 @@
+ 	  jump_address = ic;
+ 	  goto ccl_set_expr;
+ 
+-	case CCL_Call:		/* CCCCCCCCCCCCCCCCCCCC000XXXXX */
++	case CCL_Call:		/* 1:CCCCCCCCCCCCCCCCCCCCFFFXXXXX */
+ 	  {
+ 	    Lisp_Object slot;
++	    int prog_id;
++
++	    /* If FFF is nonzero, the CCL program ID is in the
++               following code.  */
++	    if (rrr)
++	      {
++		prog_id = XINT (ccl_prog[ic]);
++		ic++;
++	      }
++	    else
++	      prog_id = field1;
+ 
+ 	    if (stack_idx >= 256
+-		|| field1 < 0
+-		|| field1 >= XVECTOR (Vccl_program_table)->size
+-		|| (slot = XVECTOR (Vccl_program_table)->contents[field1],
+-		    !CONSP (slot))
+-		|| !VECTORP (XCONS (slot)->cdr))
++		|| prog_id < 0
++		|| prog_id >= XVECTOR (Vccl_program_table)->size
++		|| (slot = XVECTOR (Vccl_program_table)->contents[prog_id],
++		    !VECTORP (slot))
++		|| !VECTORP (XVECTOR (slot)->contents[1]))
+ 	      {
+ 		if (stack_idx > 0)
+ 		  {
+@@ -972,7 +1025,7 @@
+ 	    ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog;
+ 	    ccl_prog_stack_struct[stack_idx].ic = ic;
+ 	    stack_idx++;
+-	    ccl_prog = XVECTOR (XCONS (slot)->cdr)->contents;
++	    ccl_prog = XVECTOR (XVECTOR (slot)->contents[1])->contents;
+ 	    ic = CCL_HEADER_MAIN;
+ 	  }
+ 	  break;
+@@ -1134,46 +1187,6 @@
+ 		  }
+ 	      
+ 		i = *src++;
+-		if (i == LEADING_CODE_COMPOSITION)
+-		  {
+-		    if (src >= src_end)
+-		      goto ccl_read_multibyte_character_suspend;
+-		    if (*src == 0xFF)
+-		      {
+-			ccl->private_state = COMPOSING_WITH_RULE_HEAD;
+-			src++;
+-		      }
+-		    else
+-		      ccl->private_state = COMPOSING_NO_RULE_HEAD;
+-
+-		    continue;
+-		  }
+-		if (ccl->private_state != COMPOSING_NO)
+-		  {
+-		    /* composite character */
+-		    if (i < 0xA0)
+-		      ccl->private_state = COMPOSING_NO;
+-		    else
+-		      {
+-			if (COMPOSING_WITH_RULE_RULE == ccl->private_state)
+-			  {
+-			    ccl->private_state = COMPOSING_WITH_RULE_HEAD;
+-			    continue;
+-			  }
+-			else if (COMPOSING_WITH_RULE_HEAD == ccl->private_state)
+-			  ccl->private_state = COMPOSING_WITH_RULE_RULE;
+-
+-			if (i == 0xA0)
+-			  {
+-			    if (src >= src_end)
+-			      goto ccl_read_multibyte_character_suspend;
+-			    i = *src++ & 0x7F;
+-			  }
+-			else
+-			  i -= 0x20;
+-		      }
+-		  }
+-
+ 		if (i < 0x80)
+ 		  {
+ 		    /* ASCII */
+@@ -1240,8 +1253,6 @@
+ 	      i = reg[RRR]; /* charset */
+ 	      if (i == CHARSET_ASCII)
+ 		i = reg[rrr] & 0xFF;
+-	      else if (i == CHARSET_COMPOSITION)
+-		i = MAKE_COMPOSITE_CHAR (reg[rrr]);
+ 	      else if (CHARSET_DIMENSION (i) == 1)
+ 		i = ((i - 0x70) << 7) | (reg[rrr] & 0x7F);
+ 	      else if (i < MIN_CHARSET_PRIVATE_DIMENSION2)
+@@ -1254,13 +1265,7 @@
+ 	      break;
+ 
+ 	    case CCL_TranslateCharacter:
+-	      i = reg[RRR]; /* charset */
+-	      if (i == CHARSET_COMPOSITION)
+-		{
+-		  reg[RRR] = -1;
+-		  break;
+-		}
+-	      CCL_MAKE_CHAR (i, reg[rrr], i);
++	      CCL_MAKE_CHAR (reg[RRR], reg[rrr], i);
+ 	      op = translate_char (GET_TRANSLATION_TABLE (reg[Rrr]),
+ 				   i, -1, 0, 0);
+ 	      SPLIT_CHAR (op, reg[RRR], i, j);
+@@ -1273,13 +1278,7 @@
+ 	    case CCL_TranslateCharacterConstTbl:
+ 	      op = XINT (ccl_prog[ic]); /* table */
+ 	      ic++;
+-	      i = reg[RRR]; /* charset */
+-	      if (i == CHARSET_COMPOSITION)
+-		{
+-		  reg[RRR] = -1;
+-		  break;
+-		}
+-	      CCL_MAKE_CHAR (i, reg[rrr], i);
++	      CCL_MAKE_CHAR (reg[RRR], reg[rrr], i);
+ 	      op = translate_char (GET_TRANSLATION_TABLE (op), i, -1, 0, 0);
+ 	      SPLIT_CHAR (op, reg[RRR], i, j);
+ 	      if (j != -1)
+@@ -1319,7 +1318,7 @@
+ 
+ 		    /* Check map varidity.  */
+ 		    if (!CONSP (map)) continue;
+-		    map = XCONS(map)->cdr;
++		    map = XCDR (map);
+ 		    if (!VECTORP (map)) continue;
+ 		    size = XVECTOR (map)->size;
+ 		    if (size <= 1) continue;
+@@ -1363,14 +1362,18 @@
+ 		      }
+ 		    else if (CONSP (content))
+ 		      {
+-			attrib = XCONS (content)->car;
+-			value = XCONS (content)->cdr;
++			attrib = XCAR (content);
++			value = XCDR (content);
+ 			if (!NUMBERP (attrib) || !NUMBERP (value))
+ 			  continue;
+ 			reg[RRR] = i;
+ 			reg[rrr] = XUINT (value);
+ 			break;
+ 		      }
++		    else if (SYMBOLP (content))
++		      CCL_CALL_FOR_MAP_INSTRUCTION (content, fin_ic);
++		    else
++		      CCL_INVALID_CMD;
+ 		  }
+ 		if (i == j)
+ 		  reg[RRR] = -1;
+@@ -1383,10 +1386,27 @@
+ 		Lisp_Object map, content, attrib, value;
+ 		int point, size, map_vector_size;
+ 		int map_set_rest_length, fin_ic;
++		int current_ic = this_ic;
++
++		/* inhibit recursive call on MapMultiple. */
++		if (stack_idx_of_map_multiple > 0)
++		  {
++		    if (stack_idx_of_map_multiple <= stack_idx)
++		      {
++			stack_idx_of_map_multiple = 0;
++			mapping_stack_pointer = mapping_stack;
++			CCL_INVALID_CMD;
++		      }
++		  }
++		else
++		  mapping_stack_pointer = mapping_stack;
++		stack_idx_of_map_multiple = 0;
+ 
+ 		map_set_rest_length =
+ 		  XINT (ccl_prog[ic++]); /* number of maps and separators. */
+ 		fin_ic = ic + map_set_rest_length;
++		op = reg[rrr];
++
+ 		if ((map_set_rest_length > reg[RRR]) && (reg[RRR] >= 0))
+ 		  {
+ 		    ic += reg[RRR];
+@@ -1397,101 +1417,165 @@
+ 		  {
+ 		    ic = fin_ic;
+ 		    reg[RRR] = -1;
++		    mapping_stack_pointer = mapping_stack;
+ 		    break;
+ 		  }
+-		mapping_stack_pointer = mapping_stack;
+-		op = reg[rrr];
+-		PUSH_MAPPING_STACK (0, op);
+-		reg[RRR] = -1;
+-		map_vector_size = XVECTOR (Vcode_conversion_map_vector)->size;
+-		for (;map_set_rest_length > 0;i++, map_set_rest_length--)
+-		  {
+-		    point = XINT(ccl_prog[ic++]);
+-		    if (point < 0)
+-		      {
+-			point = -point;
+-			if (mapping_stack_pointer
+-			    >= &mapping_stack[MAX_MAP_SET_LEVEL])
+-			  {
+-			    CCL_INVALID_CMD;
+-			  }
+-			PUSH_MAPPING_STACK (map_set_rest_length - point,
+-					    reg[rrr]);
+-			map_set_rest_length = point + 1;
+-			reg[rrr] = op;
+-			continue;
+-		      }
+-
+-		    if (point >= map_vector_size) continue;
+-		    map = (XVECTOR (Vcode_conversion_map_vector)
+-			   ->contents[point]);
+-
+-		    /* Check map varidity.  */
+-		    if (!CONSP (map)) continue;
+-		    map = XCONS (map)->cdr;
+-		    if (!VECTORP (map)) continue;
+-		    size = XVECTOR (map)->size;
+-		    if (size <= 1) continue;
+-
+-		    content = XVECTOR (map)->contents[0];
+ 
+-		    /* check map type,
+-		       [STARTPOINT VAL1 VAL2 ...] or
+-		       [t ELEMENT STARTPOINT ENDPOINT]  */
+-		    if (NUMBERP (content))
+-		      {
+-			point = XUINT (content);
+-			point = op - point + 1;
+-			if (!((point >= 1) && (point < size))) continue;
+-			content = XVECTOR (map)->contents[point];
+-		      }
+-		    else if (EQ (content, Qt))
+-		      {
+-			if (size != 4) continue;
+-			if ((op >= XUINT (XVECTOR (map)->contents[2])) &&
+-			    (op < XUINT (XVECTOR (map)->contents[3])))
+-			  content = XVECTOR (map)->contents[1];
+-			else
+-			  continue;
+-		      }
+-		    else 
+-		      continue;
++		if (mapping_stack_pointer <= (mapping_stack + 1))
++		  {
++		    /* Set up initial state. */
++		    mapping_stack_pointer = mapping_stack;
++		    PUSH_MAPPING_STACK (0, op);
++		    reg[RRR] = -1;
++		  }
++		else
++		  {
++		    /* Recover after calling other ccl program. */
++		    int orig_op;
+ 
+-		    if (NILP (content))
+-		      continue;
+-		    else if (NUMBERP (content))
++		    POP_MAPPING_STACK (map_set_rest_length, orig_op);
++		    POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
++		    switch (op)
+ 		      {
+-			op = XINT (content);
+-			reg[RRR] = i;
+-			i += map_set_rest_length;
+-			POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
+-		      }
+-		    else if (CONSP (content))
+-		      {
+-			attrib = XCONS (content)->car;
+-			value = XCONS (content)->cdr;
+-			if (!NUMBERP (attrib) || !NUMBERP (value))
+-			  continue;
+-			reg[RRR] = i;
+-			op = XUINT (value);
+-			i += map_set_rest_length;
+-			POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
+-		      }
+-		    else if (EQ (content, Qt))
+-		      {
+-			reg[RRR] = i;
++		      case -1:
++			/* Regard it as Qnil. */
++			op = orig_op;
++			i++;
++			ic++;
++			map_set_rest_length--;
++			break;
++		      case -2:
++			/* Regard it as Qt. */
+ 			op = reg[rrr];
++			i++;
++			ic++;
++			map_set_rest_length--;
++			break;
++		      case -3:
++			/* Regard it as Qlambda. */
++			op = orig_op;
++			i += map_set_rest_length;
++			ic += map_set_rest_length;
++			map_set_rest_length = 0;
++			break;
++		      default:
++			/* Regard it as normal mapping. */
+ 			i += map_set_rest_length;
++			ic += map_set_rest_length;
+ 			POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
+-		      }
+-		    else if (EQ (content, Qlambda))
+-		      {
+-			reg[RRR] = i;
+ 			break;
+ 		      }
+-		    else
+-		      CCL_INVALID_CMD;
+ 		  }
++		map_vector_size = XVECTOR (Vcode_conversion_map_vector)->size;
++		
++		do {
++		  for (;map_set_rest_length > 0;i++, ic++, map_set_rest_length--)
++		    {
++		      point = XINT(ccl_prog[ic]);
++		      if (point < 0)
++			{
++			  /* +1 is for including separator. */
++			  point = -point + 1;
++			  if (mapping_stack_pointer
++			      >= &mapping_stack[MAX_MAP_SET_LEVEL])
++			    CCL_INVALID_CMD;
++			  PUSH_MAPPING_STACK (map_set_rest_length - point,
++					      reg[rrr]);
++			  map_set_rest_length = point;
++			  reg[rrr] = op;
++			  continue;
++			}
++
++		      if (point >= map_vector_size) continue;
++		      map = (XVECTOR (Vcode_conversion_map_vector)
++			     ->contents[point]);
++
++		      /* Check map varidity.  */
++		      if (!CONSP (map)) continue;
++		      map = XCDR (map);
++		      if (!VECTORP (map)) continue;
++		      size = XVECTOR (map)->size;
++		      if (size <= 1) continue;
++
++		      content = XVECTOR (map)->contents[0];
++
++		      /* check map type,
++			 [STARTPOINT VAL1 VAL2 ...] or
++			 [t ELEMENT STARTPOINT ENDPOINT]  */
++		      if (NUMBERP (content))
++			{
++			  point = XUINT (content);
++			  point = op - point + 1;
++			  if (!((point >= 1) && (point < size))) continue;
++			  content = XVECTOR (map)->contents[point];
++			}
++		      else if (EQ (content, Qt))
++			{
++			  if (size != 4) continue;
++			  if ((op >= XUINT (XVECTOR (map)->contents[2])) &&
++			      (op < XUINT (XVECTOR (map)->contents[3])))
++			    content = XVECTOR (map)->contents[1];
++			  else
++			    continue;
++			}
++		      else 
++			continue;
++
++		      if (NILP (content))
++			continue;
++
++		      reg[RRR] = i;
++		      if (NUMBERP (content))
++			{
++			  op = XINT (content);
++			  i += map_set_rest_length - 1;
++			  ic += map_set_rest_length - 1;
++			  POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
++			  map_set_rest_length++;
++			}
++		      else if (CONSP (content))
++			{
++			  attrib = XCAR (content);
++			  value = XCDR (content);
++			  if (!NUMBERP (attrib) || !NUMBERP (value))
++			    continue;
++			  op = XUINT (value);
++			  i += map_set_rest_length - 1;
++			  ic += map_set_rest_length - 1;
++			  POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
++			  map_set_rest_length++;
++			}
++		      else if (EQ (content, Qt))
++			{
++			  op = reg[rrr];
++			}
++		      else if (EQ (content, Qlambda))
++			{
++			  i += map_set_rest_length;
++			  ic += map_set_rest_length;
++			  break;
++			}
++		      else if (SYMBOLP (content))
++			{
++			  if (mapping_stack_pointer
++			      >= &mapping_stack[MAX_MAP_SET_LEVEL])
++			    CCL_INVALID_CMD;
++			  PUSH_MAPPING_STACK (map_set_rest_length, reg[rrr]);
++			  PUSH_MAPPING_STACK (map_set_rest_length, op);
++			  stack_idx_of_map_multiple = stack_idx + 1;
++			  CCL_CALL_FOR_MAP_INSTRUCTION (content, current_ic);
++			}
++		      else
++			CCL_INVALID_CMD;
++		    }
++		  if (mapping_stack_pointer <= (mapping_stack + 1))
++		    break;
++		  POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
++		  i += map_set_rest_length;
++		  ic += map_set_rest_length;
++		  POP_MAPPING_STACK (map_set_rest_length, reg[rrr]);
++		} while (1);
++
+ 		ic = fin_ic;
+ 	      }
+ 	      reg[rrr] = op;
+@@ -1514,7 +1598,7 @@
+ 		    reg[RRR] = -1;
+ 		    break;
+ 		  }
+-		map = XCONS(map)->cdr;
++		map = XCDR (map);
+ 		if (!VECTORP (map))
+ 		  {
+ 		    reg[RRR] = -1;
+@@ -1538,13 +1622,15 @@
+ 		    else if (EQ (content, Qt));
+ 		    else if (CONSP (content))
+ 		      {
+-			attrib = XCONS (content)->car;
+-			value = XCONS (content)->cdr;
++			attrib = XCAR (content);
++			value = XCDR (content);
+ 			if (!NUMBERP (attrib) || !NUMBERP (value))
+ 			  continue;
+ 			reg[rrr] = XUINT(value);
+ 			break;
+ 		      }
++		    else if (SYMBOLP (content))
++		      CCL_CALL_FOR_MAP_INSTRUCTION (content, ic);
+ 		    else
+ 		      reg[RRR] = -1;
+ 		  }
+@@ -1631,20 +1717,141 @@
+   return (dst ? dst - destination : 0);
+ }
+ 
++/* Resolve symbols in the specified CCL code (Lisp vector).  This
++   function converts symbols of code conversion maps and character
++   translation tables embeded in the CCL code into their ID numbers.
++
++   The return value is a vector (CCL itself or a new vector in which
++   all symbols are resolved), Qt if resolving of some symbol failed,
++   or nil if CCL contains invalid data.  */
++
++Lisp_Object
++resolve_symbol_ccl_program (ccl)
++     Lisp_Object ccl;
++{
++  int i, veclen, unresolved = 0;
++  Lisp_Object result, contents, val;
++
++  result = ccl;
++  veclen = XVECTOR (result)->size;
++
++  for (i = 0; i < veclen; i++)
++    {
++      contents = XVECTOR (result)->contents[i];
++      if (INTEGERP (contents))
++	continue;
++      else if (CONSP (contents)
++	       && SYMBOLP (XCAR (contents))
++	       && SYMBOLP (XCDR (contents)))
++	{
++	  /* This is the new style for embedding symbols.  The form is
++	     (SYMBOL . PROPERTY).  (get SYMBOL PROPERTY) should give
++	     an index number.  */
++
++	  if (EQ (result, ccl))
++	    result =  Fcopy_sequence (ccl);
++
++	  val = Fget (XCAR (contents), XCDR (contents));
++	  if (NATNUMP (val))
++	    XVECTOR (result)->contents[i] = val;
++	  else
++	    unresolved = 1;
++	  continue;
++	}
++      else if (SYMBOLP (contents))
++	{
++	  /* This is the old style for embedding symbols.  This style
++             may lead to a bug if, for instance, a translation table
++             and a code conversion map have the same name.  */
++	  if (EQ (result, ccl))
++	    result = Fcopy_sequence (ccl);
++
++	  val = Fget (contents, Qtranslation_table_id);
++	  if (NATNUMP (val))
++	    XVECTOR (result)->contents[i] = val;
++	  else
++	    {
++	      val = Fget (contents, Qcode_conversion_map_id);
++	      if (NATNUMP (val))
++		XVECTOR (result)->contents[i] = val;
++	      else
++		{
++		  val = Fget (contents, Qccl_program_idx);
++		  if (NATNUMP (val))
++		    XVECTOR (result)->contents[i] = val;
++		  else
++		    unresolved = 1;
++		}
++	    }
++	  continue;
++	}
++      return Qnil;
++    }
++
++  return (unresolved ? Qt : result);
++}
++
++/* Return the compiled code (vector) of CCL program CCL_PROG.
++   CCL_PROG is a name (symbol) of the program or already compiled
++   code.  If necessary, resolve symbols in the compiled code to index
++   numbers.  If we failed to get the compiled code or to resolve
++   symbols, return Qnil.  */
++
++static Lisp_Object
++ccl_get_compiled_code (ccl_prog)
++     Lisp_Object ccl_prog;
++{
++  Lisp_Object val, slot;
++
++  if (VECTORP (ccl_prog))
++    {
++      val = resolve_symbol_ccl_program (ccl_prog);
++      return (VECTORP (val) ? val : Qnil);
++    }
++  if (!SYMBOLP (ccl_prog))
++    return Qnil;
++
++  val = Fget (ccl_prog, Qccl_program_idx);
++  if (! NATNUMP (val)
++      || XINT (val) >= XVECTOR (Vccl_program_table)->size)
++    return Qnil;
++  slot = XVECTOR (Vccl_program_table)->contents[XINT (val)];
++  if (! VECTORP (slot)
++      || XVECTOR (slot)->size != 3
++      || ! VECTORP (XVECTOR (slot)->contents[1]))
++    return Qnil;
++  if (NILP (XVECTOR (slot)->contents[2]))
++    {
++      val = resolve_symbol_ccl_program (XVECTOR (slot)->contents[1]);
++      if (! VECTORP (val))
++	return Qnil;
++      XVECTOR (slot)->contents[1] = val;
++      XVECTOR (slot)->contents[2] = Qt;
++    }
++  return XVECTOR (slot)->contents[1];
++}
++
+ /* Setup fields of the structure pointed by CCL appropriately for the
+-   execution of compiled CCL code in VEC (vector of integer).
+-   If VEC is nil, we skip setting ups based on VEC.  */
+-void
+-setup_ccl_program (ccl, vec)
++   execution of CCL program CCL_PROG.  CCL_PROG is the name (symbol)
++   of the CCL program or the already compiled code (vector).
++   Return 0 if we succeed this setup, else return -1.
++
++   If CCL_PROG is nil, we just reset the structure pointed by CCL.  */
++int
++setup_ccl_program (ccl, ccl_prog)
+      struct ccl_program *ccl;
+-     Lisp_Object vec;
++     Lisp_Object ccl_prog;
+ {
+   int i;
+ 
+-  if (VECTORP (vec))
++  if (! NILP (ccl_prog))
+     {
+-      struct Lisp_Vector *vp = XVECTOR (vec);
++      struct Lisp_Vector *vp;
+ 
++      ccl_prog = ccl_get_compiled_code (ccl_prog);
++      if (! VECTORP (ccl_prog))
++	return -1;
++      vp = XVECTOR (ccl_prog);
+       ccl->size = vp->size;
+       ccl->prog = vp->contents;
+       ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]);
+@@ -1657,64 +1864,38 @@
+   ccl->private_state = 0;
+   ccl->status = 0;
+   ccl->stack_idx = 0;
++  return 0;
+ }
+ 
+-/* Resolve symbols in the specified CCL code (Lisp vector).  This
+-   function converts symbols of code conversion maps and character
+-   translation tables embeded in the CCL code into their ID numbers.  */
++#ifdef emacs
+ 
+-Lisp_Object
+-resolve_symbol_ccl_program (ccl)
+-     Lisp_Object ccl;
++DEFUN ("ccl-program-p", Fccl_program_p, Sccl_program_p, 1, 1, 0,
++  "Return t if OBJECT is a CCL program name or a compiled CCL program code.")
++  (object)
++     Lisp_Object object;
+ {
+-  int i, veclen;
+-  Lisp_Object result, contents, prop;
+-
+-  result = ccl;
+-  veclen = XVECTOR (result)->size;
++  Lisp_Object val;
+ 
+-  /* Set CCL program's table ID */
+-  for (i = 0; i < veclen; i++)
++  if (VECTORP (object))
+     {
+-      contents = XVECTOR (result)->contents[i];
+-      if (SYMBOLP (contents))
+-	{
+-	  if (EQ(result, ccl))
+-	    result = Fcopy_sequence (ccl);
+-
+-	  prop = Fget (contents, Qtranslation_table_id);
+-	  if (NUMBERP (prop))
+-	    {
+-	      XVECTOR (result)->contents[i] = prop;
+-	      continue;
+-	    }
+-	  prop = Fget (contents, Qcode_conversion_map_id);
+-	  if (NUMBERP (prop))
+-	    {
+-	      XVECTOR (result)->contents[i] = prop;
+-	      continue;
+-	    }
+-	  prop = Fget (contents, Qccl_program_idx);
+-	  if (NUMBERP (prop))
+-	    {
+-	      XVECTOR (result)->contents[i] = prop;
+-	      continue;
+-	    }
+-	}
++      val = resolve_symbol_ccl_program (object);
++      return (VECTORP (val) ? Qt : Qnil);
+     }
++  if (!SYMBOLP (object))
++    return Qnil;
+ 
+-  return result;
++  val = Fget (object, Qccl_program_idx);
++  return ((! NATNUMP (val)
++	   || XINT (val) >= XVECTOR (Vccl_program_table)->size)
++	  ? Qnil : Qt);
+ }
+ 
+-
+-#ifdef emacs
+-
+ DEFUN ("ccl-execute", Fccl_execute, Sccl_execute, 2, 2, 0,
+   "Execute CCL-PROGRAM with registers initialized by REGISTERS.\n\
+ \n\
+-CCL-PROGRAM is a symbol registered by register-ccl-program,\n\
++CCL-PROGRAM is a CCL program name (symbol)\n\
+ or a compiled code generated by `ccl-compile' (for backward compatibility,\n\
+-in this case, the execution is slower).\n\
++in this case, the overhead of the execution is bigger than the former case).\n\
+ No I/O commands should appear in CCL-PROGRAM.\n\
+ \n\
+ REGISTERS is a vector of [R0 R1 ... R7] where RN is an initial value\n\
+@@ -1727,27 +1908,14 @@
+ {
+   struct ccl_program ccl;
+   int i;
+-  Lisp_Object ccl_id;
+ 
+-  if ((SYMBOLP (ccl_prog)) &&
+-      (!NILP (ccl_id = Fget (ccl_prog, Qccl_program_idx))))
+-    {
+-      ccl_prog = XVECTOR (Vccl_program_table)->contents[XUINT (ccl_id)];
+-      CHECK_LIST (ccl_prog, 0);
+-      ccl_prog = XCONS (ccl_prog)->cdr;
+-      CHECK_VECTOR (ccl_prog, 1);
+-    }
+-  else
+-    {
+-      CHECK_VECTOR (ccl_prog, 1);
+-      ccl_prog = resolve_symbol_ccl_program (ccl_prog);
+-    }
++  if (setup_ccl_program (&ccl, ccl_prog) < 0)
++    error ("Invalid CCL program");
+ 
+-  CHECK_VECTOR (reg, 2);
++  CHECK_VECTOR (reg, 1);
+   if (XVECTOR (reg)->size != 8)
+-    error ("Invalid length of vector REGISTERS");
++    error ("Length of vector REGISTERS is not 9");
+ 
+-  setup_ccl_program (&ccl, ccl_prog);
+   for (i = 0; i < 8; i++)
+     ccl.reg[i] = (INTEGERP (XVECTOR (reg)->contents[i])
+ 		  ? XINT (XVECTOR (reg)->contents[i])
+@@ -1795,30 +1963,18 @@
+   int i, produced;
+   int outbufsize;
+   char *outbuf;
+-  struct gcpro gcpro1, gcpro2, gcpro3;
+-  Lisp_Object ccl_id;
++  struct gcpro gcpro1, gcpro2;
+ 
+-  if ((SYMBOLP (ccl_prog)) &&
+-      (!NILP (ccl_id = Fget (ccl_prog, Qccl_program_idx))))
+-    {
+-      ccl_prog = XVECTOR (Vccl_program_table)->contents[XUINT (ccl_id)];
+-      CHECK_LIST (ccl_prog, 0);
+-      ccl_prog = XCONS (ccl_prog)->cdr;
+-      CHECK_VECTOR (ccl_prog, 1);
+-    }
+-  else
+-    {
+-      CHECK_VECTOR (ccl_prog, 1);
+-      ccl_prog = resolve_symbol_ccl_program (ccl_prog);
+-    }
++  if (setup_ccl_program (&ccl, ccl_prog) < 0)
++    error ("Invalid CCL program");
+ 
+   CHECK_VECTOR (status, 1);
+   if (XVECTOR (status)->size != 9)
+-    error ("Invalid length of vector STATUS");
++    error ("Length of vector STATUS is not 9");
+   CHECK_STRING (str, 2);
+-  GCPRO3 (ccl_prog, status, str);
+ 
+-  setup_ccl_program (&ccl, ccl_prog);
++  GCPRO2 (status, str);
++
+   for (i = 0; i < 8; i++)