From: tomo Date: Mon, 17 May 1999 09:42:33 +0000 (+0000) Subject: XEmacs 21.2.13 X-Git-Tag: r21_2_14~3 X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=commitdiff_plain;h=33c8db8e2477d62fd8734f65475f2ed516167532 XEmacs 21.2.13 --- diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 90677dc..d14d7b0 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,19 @@ +1999-03-12 XEmacs Build Bot + + * XEmacs 21.2.13 is released + +1999-03-10 Martin Buchholz + + * fakemail.c (add_a_stream): Always use full ANSI prototypes. + +1999-03-06 Martin Buchholz + + * fakemail.c (main): Ansify. + (xmalloc): Ansify. + (xrealloc): Ansify. + (get_keyword): use paranoid casts ((int) (unsigned char) c) for + islower, toupper, isspace. + 1999-03-05 XEmacs Build Bot * XEmacs 21.2.12 is released diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c index 22cb1ab..1241fef 100644 --- a/lib-src/fakemail.c +++ b/lib-src/fakemail.c @@ -24,9 +24,9 @@ Boston, MA 02111-1307, USA. */ #include <../src/config.h> #if defined (BSD) && !defined (BSD4_1) && !defined (USE_FAKEMAIL) -/* This program isnot used in BSD, so just avoid loader complaints. */ +/* This program is not used in BSD, so just avoid loader complaints. */ int -main () +main (int argc, char *argv[]) { return 0; } @@ -34,7 +34,7 @@ main () #include #include int -main () +main (int argc, char *argv[]) { /* Linux /bin/mail, if it exists, is NOT the Unix v7 mail that fakemail depends on! This causes garbled mail. Better to @@ -48,7 +48,7 @@ main () #else /* not BSD 4.2 (or newer) */ #ifdef MSDOS int -main () +main (int argc, char *argv[]) { return 0; } @@ -100,11 +100,11 @@ struct header_record struct header_record *previous; }; typedef struct header_record *header; - + struct stream_record { FILE *handle; - int (*action)(); + int (*action)(FILE *); struct stream_record *rest_streams; }; typedef struct stream_record *stream_list; @@ -191,8 +191,7 @@ fatal (CONST char *s1, CONST char *s2) /* Like malloc but get fatal error if memory is exhausted. */ static char * -xmalloc (size) - size_t size; +xmalloc (size_t size) { char *result = malloc (((unsigned) size)); if (result == ((char *) NULL)) @@ -201,9 +200,7 @@ xmalloc (size) } static char * -xrealloc (ptr, size) - char *ptr; - size_t size; +xrealloc (char *ptr, size_t size) { char *result = realloc (ptr, ((unsigned) size)); if (result == ((char *) NULL)) @@ -221,7 +218,7 @@ init_linebuffer (struct linebuffer *linebuffer) } /* Read a line of text from `stream' into `linebuffer'. - * Return the length of the line. + * Return the length of the line. */ static long @@ -263,14 +260,17 @@ get_keyword (register char *field, char **rest) ptr = &keyword[0]; c = *field++; - if ((isspace (c)) || (c == ':')) - return ((char *) NULL); - *ptr++ = ((islower (c)) ? (toupper (c)) : c); - while (((c = *field++) != ':') && (!(isspace (c)))) - *ptr++ = ((islower (c)) ? (toupper (c)) : c); + if ((isspace ((int) (unsigned char) c)) || (c == ':')) + return (char *) NULL; + *ptr++ = ((islower ((int) (unsigned char) c)) ? + (toupper ((int) (unsigned char) c)) : c); + while (((c = *field++) != ':') && + (!(isspace ((int) (unsigned char) c)))) + *ptr++ = ((islower ((int) (unsigned char) c)) ? + (toupper ((int) (unsigned char) c)) : c); *ptr++ = '\0'; - while (isspace (c)) c = *field++; - if (c != ':') return ((char *) NULL); + while (isspace ((int) (unsigned char) c)) c = *field++; + if (c != ':') return (char *) NULL; *rest = field; return &keyword[0]; } @@ -371,7 +371,7 @@ close_the_streams (void) } static void -add_a_stream (FILE *the_stream, int (*closing_action)()) +add_a_stream (FILE *the_stream, int (*closing_action)(FILE *)) { stream_list old = the_streams; the_streams = new_stream (); @@ -553,7 +553,7 @@ parse_header (header the_header, register char *where) *where = '\0'; return; } - + static header read_header (void) { @@ -624,9 +624,7 @@ write_header (header the_header) } int -main (argc, argv) - int argc; - char **argv; +main (int argc, char *argv[]) { char *command_line; header the_header; @@ -655,7 +653,7 @@ main (argc, argv) args_size (the_header))); strcpy (command_line, mail_program_name); parse_header (the_header, &command_line[name_length]); - + the_pipe = popen (command_line, "w"); if (the_pipe == ((FILE *) NULL)) fatal ("cannot open pipe to real mailer", (char *) 0); diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ad6e93e..133d7dc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,58 @@ +1999-03-12 XEmacs Build Bot + + * XEmacs 21.2.13 is released + +1999-03-12 SL Baur + + * simple.el (delete-key-deletes-forward): Revert to previous + behavior. + +1999-01-18 Didier Verna + + * menubar-items.el (xemacs-splash-buffer): handle the case of + multiple elements in the splash buffer body. + + * startup.el (splash-frame-timeout): new constant: interval + between splash buffer elements. + (command-line-1): handle splash buffer with multiple elements (use + a timeout). + (splash-frame-body): Originally `startup-splash-frame-body'. + Rewrote a cleaner and more readable version. This can now be array, + in which case each element is displayed in turn in the splash buffer. + (splash-frame-static-body): new constant. Persistent information + across all splash buffer elements (preserves the possibility to give + it in different languages. + (circulate-splash-frame-elements): new function. Used as a timeout + to circulate through all splash frame elements and display them in + sequence. + (display-splash-frame): originally `startup-splash-frame'. Handle + the case of multiple elements in the splash buffer body. Now + returns a timeout id if multiple elements to display, or nil. + +1999-02-19 Jan Vroonhof + + * x-faces.el (x-init-global-faces): Add default tag to specifiers, + so they can be overridden by x-init-face-from-resources. + Additionally specify the font name also with an x tag. + +1999-03-08 Andy Piper + + * package-get.el (package-get-base): autoload. + + * menubar-items.el (default-menubar): add update menu item. Fix + custom menu to only be activated when package-base is available. + + * package-get.el (package-get-custom): don't load + package-get-custom as it is auto-generated. Fix group definition. + +1999-03-05 Didier Verna + + * cus-dep.el (Custom-make-dependencies): use `prin1-to-string' + instead of `symbol-name' (Thanks Kyle). + + * cus-edit.el (custom-save-variables): use `prin1' instead of + princ to write symbols. + 1999-03-05 XEmacs Build Bot * XEmacs 21.2.12 is released diff --git a/lisp/alist.el b/lisp/alist.el index 4a1fd3a..fbd409a 100644 --- a/lisp/alist.el +++ b/lisp/alist.el @@ -1,13 +1,11 @@ -;;; alist.el --- utility functions about assoc-list +;;; alist.el --- utility functions about association-list -;; Copyright (C) 1993,1994,1995,1996 Free Software Foundation, Inc. +;; Copyright (C) 1993,1994,1995,1996,1998 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko -;; Version: -;; $Id: alist.el,v 0.0 1997/02/28 02:18:23 tmorioka Exp $ ;; Keywords: alist -;; This file is part of SEMI (SEMI is Emacs MIME Interfaces). +;; This file is part of APEL (A Portable Emacs Library). ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as @@ -26,6 +24,7 @@ ;;; Code: +;;;###autoload (defun put-alist (item value alist) "Modify ALIST to set VALUE to ITEM. If there is a pair whose car is ITEM, replace its cdr by VALUE. @@ -40,6 +39,7 @@ return new alist whose car is the new pair and cdr is ALIST. (cons (cons item value) alist) ))) +;;;###autoload (defun del-alist (item alist) "If there is a pair whose key is ITEM, delete it from ALIST. \[tomo's ELIS emulating function]" @@ -59,6 +59,7 @@ return new alist whose car is the new pair and cdr is ALIST. ) alist)))) +;;;###autoload (defun set-alist (symbol item value) "Modify a alist indicated by SYMBOL to set VALUE to ITEM." (or (boundp symbol) @@ -67,12 +68,14 @@ return new alist whose car is the new pair and cdr is ALIST. (set symbol (put-alist item value (symbol-value symbol))) ) +;;;###autoload (defun remove-alist (symbol item) "Remove ITEM from the alist indicated by SYMBOL." (and (boundp symbol) (set symbol (del-alist item (symbol-value symbol))) )) +;;;###autoload (defun modify-alist (modifier default) "Modify alist DEFAULT into alist MODIFIER." (mapcar (function @@ -82,6 +85,7 @@ return new alist whose car is the new pair and cdr is ALIST. modifier) default) +;;;###autoload (defun set-modified-alist (sym modifier) "Modify a value of a symbol SYM into alist MODIFIER. The symbol SYM should be alist. If it is not bound, diff --git a/lisp/auto-autoloads.el b/lisp/auto-autoloads.el index c77939e..3e38aee 100644 --- a/lisp/auto-autoloads.el +++ b/lisp/auto-autoloads.el @@ -12,6 +12,35 @@ Describe the True Editor and its minions." t nil) ;;;*** +;;;### (autoloads (set-modified-alist modify-alist remove-alist set-alist del-alist put-alist) "alist" "lisp/alist.el") + +(autoload 'put-alist "alist" "\ +Modify ALIST to set VALUE to ITEM. +If there is a pair whose car is ITEM, replace its cdr by VALUE. +If there is not such pair, create new pair (ITEM . VALUE) and +return new alist whose car is the new pair and cdr is ALIST. +[tomo's ELIS like function]" nil nil) + +(autoload 'del-alist "alist" "\ +If there is a pair whose key is ITEM, delete it from ALIST. +[tomo's ELIS emulating function]" nil nil) + +(autoload 'set-alist "alist" "\ +Modify a alist indicated by SYMBOL to set VALUE to ITEM." nil nil) + +(autoload 'remove-alist "alist" "\ +Remove ITEM from the alist indicated by SYMBOL." nil nil) + +(autoload 'modify-alist "alist" "\ +Modify alist DEFAULT into alist MODIFIER." nil nil) + +(autoload 'set-modified-alist "alist" "\ +Modify a value of a symbol SYM into alist MODIFIER. +The symbol SYM should be alist. If it is not bound, +its value regard as nil." nil nil) + +;;;*** + ;;;### (autoloads (apropos-documentation apropos-value apropos apropos-command) "apropos" "lisp/apropos.el") (fset 'command-apropos 'apropos-command) @@ -1222,6 +1251,52 @@ Install a pre-bytecompiled XEmacs package into package hierarchy." t nil) ;;;### (autoloads (package-get-custom package-get-package-provider package-get package-get-dependencies package-get-all package-get-update-all package-get-delete-package package-get-save-base package-get-update-base-from-buffer package-get-update-base package-get-update-base-entry package-get-require-base package-get-download-menu) "package-get" "lisp/package-get.el") +(defvar package-get-base nil "\ +List of packages that are installed at this site. +For each element in the alist, car is the package name and the cdr is +a plist containing information about the package. Typical fields +kept in the plist are: + +version - version of this package +provides - list of symbols provided +requires - list of symbols that are required. + These in turn are provided by other packages. +filename - name of the file. +size - size of the file (aka the bundled package) +md5sum - computed md5 checksum +description - What this package is for. +type - Whether this is a 'binary (default) or 'single file package + +More fields may be added as needed. An example: + +'( + (name + (version \"\" + file \"filename\" + description \"what this package is about.\" + provides () + requires () + size + md5sum \"\" + file \"filename\" + description \"what this package is about.\" + provides () + requires () + size + md5sum \" + + * XEmacs 21.2.13 is released + 1999-03-05 XEmacs Build Bot * XEmacs 21.2.12 is released diff --git a/man/ChangeLog b/man/ChangeLog index 0cf6243..638ad5d 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +1999-03-12 XEmacs Build Bot + + * XEmacs 21.2.13 is released + 1999-03-05 XEmacs Build Bot * XEmacs 21.2.12 is released diff --git a/nt/ChangeLog b/nt/ChangeLog index ea9011f..f8c7e75 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,25 @@ +1999-03-12 XEmacs Build Bot + + * XEmacs 21.2.13 is released + +1999-03-07 Jonathan Harris + + * xemacs.mak: + Don't link lib-src programs incrementally. + Don't include debug info in release builds. + Put intermediate files in the appropriate directories. + Make "distclean" target delete all intermediate files. + +1999-03-07 Jonathan Harris + + * xemacs.mak: + Fix building on Windows 95/98 by conditionalising escape + character '^'. + Only put mule-packages in package path on MULE builds. + Only build source browser files on debug builds. + Build source browser database before link so that it's + available even if link fails. + 1999-03-05 XEmacs Build Bot * XEmacs 21.2.12 is released diff --git a/nt/xemacs.mak b/nt/xemacs.mak index fe7f4dd..c11dc15 100644 --- a/nt/xemacs.mak +++ b/nt/xemacs.mak @@ -24,10 +24,14 @@ # Synched up with: Not in FSF. # +# Shell escape character. Used for escaping ', ` and " in commands. +ESC=^ + XEMACS=.. LISP=$(XEMACS)\lisp MODULES=$(XEMACS)\modules NT=$(XEMACS)\nt +OUTDIR=$(NT)\obj # Program name and version @@ -66,11 +70,18 @@ INSTALL_DIR=c:\Program Files\Infodock\Infodock-$(INFODOCK_VERSION_STRING) INSTALL_DIR=c:\Program Files\XEmacs\XEmacs-$(XEMACS_VERSION_STRING) ! endif !endif +!if !defined(HAVE_MULE) +HAVE_MULE=0 +!endif !if !defined(PACKAGE_PATH) ! if !defined(PACKAGE_PREFIX) PACKAGE_PREFIX=c:\Program Files\XEmacs ! endif +! if $(HAVE_MULE) PACKAGE_PATH=~\.xemacs;;$(PACKAGE_PREFIX)\site-packages;$(PACKAGE_PREFIX)\mule-packages;$(PACKAGE_PREFIX)\xemacs-packages +! else +PACKAGE_PATH=~\.xemacs;;$(PACKAGE_PREFIX)\site-packages;$(PACKAGE_PREFIX)\xemacs-packages +! endif !endif PATH_PACKAGEPATH="$(PACKAGE_PATH:\=\\)" !if !defined(HAVE_MSW) @@ -79,9 +90,6 @@ HAVE_MSW=1 !if !defined(HAVE_X) HAVE_X=0 !endif -!if !defined(HAVE_MULE) -HAVE_MULE=0 -!endif !if !defined(HAVE_XPM) HAVE_XPM=0 !endif @@ -128,7 +136,10 @@ USE_INDEXED_LRECORD_IMPLEMENTATION=0 # # System configuration # -!if !defined(PROCESSOR_ARCHITECTURE) && "$(OS)" != "Windows_NT" +!if !defined(OS) +OS=Windows_95/98 +# command.com doesn't like or need '^' as an escape character +ESC= EMACS_CONFIGURATION=i586-pc-win32 !else if "$(PROCESSOR_ARCHITECTURE)" == "x86" EMACS_CONFIGURATION=i586-pc-win32 @@ -211,7 +222,7 @@ CONFIG_ERROR=1 CONFIG_ERROR=1 !endif !if $(HAVE_MSW) && $(HAVE_TOOLBARS) && !$(HAVE_XPM) -!error Toolbars require XPM support +!message Toolbars require XPM support CONFIG_ERROR=1 !endif !if $(CONFIG_ERROR) @@ -314,7 +325,7 @@ CCV=@$(CC) !if $(DEBUG_XEMACS) OPT=-Od -Zi !else -OPT=-O2 -G5 -Zi +OPT=-O2 -G5 !endif CFLAGS=-nologo -W3 $(OPT) @@ -386,7 +397,7 @@ MULE_DEFINES=-DMULE !if $(DEBUG_XEMACS) DEBUG_DEFINES=-DDEBUG_XEMACS -D_DEBUG -DEBUG_FLAGS= -debugtype:both -debug:full +DEBUG_FLAGS=-debug:full !endif !if $(USE_MINIMAL_TAGBITS) @@ -418,8 +429,6 @@ DEFINES=$(X_DEFINES) $(MSW_DEFINES) $(MULE_DEFINES) \ -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN -DWINDOWSNT -Demacs \ -DHAVE_CONFIG_H $(PROGRAM_DEFINES) $(PATH_DEFINES) -OUTDIR=obj - # # Creating simplified versions of Installation and Installation.el # @@ -429,7 +438,7 @@ OUTDIR=obj # to create a legal string in LISP for Installation.el. # !if [echo OS: $(OS)>Installation] ||\ -[echo XEmacs $(XEMACS_VERSION_STRING) $(xemacs_codename:"=\") configured for ^`$(EMACS_CONFIGURATION)^'.>>Installation] ||\ +[echo XEmacs $(XEMACS_VERSION_STRING) $(xemacs_codename:"=\") configured for $(ESC)`$(EMACS_CONFIGURATION)$(ESC)'.>>Installation] ||\ [echo Where should the build process find the source code?>>Installation] ||\ [echo $(MAKEDIR:\=\\)>>Installation] !endif @@ -449,15 +458,11 @@ OUTDIR=obj !if [echo MS Windows>>Installation] !endif !endif -!if (!defined (HAVE_MSW) && !defined (HAVE_X)) -!if [echo Please specify at least one HAVE_MSW^=1 and^/or HAVE_X^=1>>Installation] -!endif -!endif # Creation of Installation.el !if [type Installation] ||\ -[echo (setq Installation-string ^">Installation.el] ||\ +[echo (setq Installation-string $(ESC)">Installation.el] ||\ [type Installation >>Installation.el] ||\ -[echo ^")>>Installation.el] +[echo $(ESC)")>>Installation.el] !endif @@ -500,17 +505,17 @@ CONFIG_VALUES = $(LIB_SRC)\config.values !if [echo Creating $(CONFIG_VALUES) && echo ;;; Do not edit this file!>$(CONFIG_VALUES)] !endif # MAKEDIR has to be made into a string. -!if [echo blddir>>$(CONFIG_VALUES) && echo ^"$(MAKEDIR:\=\\)\\..^">>$(CONFIG_VALUES)] +!if [echo blddir>>$(CONFIG_VALUES) && echo $(ESC)"$(MAKEDIR:\=\\)\\..$(ESC)">>$(CONFIG_VALUES)] !endif -!if [echo CC>>$(CONFIG_VALUES) && echo ^"$(CC:\=\\)^">>$(CONFIG_VALUES)] +!if [echo CC>>$(CONFIG_VALUES) && echo $(ESC)"$(CC:\=\\)$(ESC)">>$(CONFIG_VALUES)] !endif -!if [echo CFLAGS>>$(CONFIG_VALUES) && echo ^"$(CFLAGS:\=\\)^">>$(CONFIG_VALUES)] +!if [echo CFLAGS>>$(CONFIG_VALUES) && echo $(ESC)"$(CFLAGS:\=\\)$(ESC)">>$(CONFIG_VALUES)] !endif -!if [echo CPP>>$(CONFIG_VALUES) && echo ^"$(CPP:\=\\)^">>$(CONFIG_VALUES)] +!if [echo CPP>>$(CONFIG_VALUES) && echo $(ESC)"$(CPP:\=\\)$(ESC)">>$(CONFIG_VALUES)] !endif -!if [echo CPPFLAGS>>$(CONFIG_VALUES) && echo ^"$(CPPFLAGS:\=\\)^">>$(CONFIG_VALUES)] +!if [echo CPPFLAGS>>$(CONFIG_VALUES) && echo $(ESC)"$(CPPFLAGS:\=\\)$(ESC)">>$(CONFIG_VALUES)] !endif -!if [echo LISPDIR>>$(CONFIG_VALUES) && echo ^"$(MAKEDIR:\=\\)\\$(LISP:\=\\)^">>$(CONFIG_VALUES)] +!if [echo LISPDIR>>$(CONFIG_VALUES) && echo $(ESC)"$(MAKEDIR:\=\\)\\$(LISP:\=\\)$(ESC)">>$(CONFIG_VALUES)] !endif # PATH_PACKAGEPATH is already a quoted string. !if [echo PACKAGE_PATH>>$(CONFIG_VALUES) && echo $(PATH_PACKAGEPATH)>>$(CONFIG_VALUES)] @@ -519,7 +524,7 @@ CONFIG_VALUES = $(LIB_SRC)\config.values # Inferred rule {$(LIB_SRC)}.c{$(LIB_SRC)}.exe : @cd $(LIB_SRC) - $(CCV) -I. -I$(XEMACS)/src -I$(XEMACS)/nt/inc $(LIB_SRC_DEFINES) $(CFLAGS) -Fe$@ $** + $(CCV) -I. -I$(XEMACS)/src -I$(XEMACS)/nt/inc $(LIB_SRC_DEFINES) $(CFLAGS) -Fe$@ $** -link -incremental:no @cd $(NT) # Individual dependencies @@ -527,7 +532,7 @@ ETAGS_DEPS = $(LIB_SRC)/getopt.c $(LIB_SRC)/getopt1.c $(LIB_SRC)/../src/regex.c $(LIB_SRC)/etags.exe : $(LIB_SRC)/etags.c $(ETAGS_DEPS) $(LIB_SRC)/movemail.exe: $(LIB_SRC)/movemail.c $(LIB_SRC)/pop.c $(ETAGS_DEPS) @cd $(LIB_SRC) - $(CCV) -I. -I$(XEMACS)/src -I$(XEMACS)/nt/inc $(LIB_SRC_DEFINES) $(CFLAGS) -Fe$@ $** wsock32.lib + $(CCV) -I. -I$(XEMACS)/src -I$(XEMACS)/nt/inc $(LIB_SRC_DEFINES) $(CFLAGS) -Fe$@ $** wsock32.lib -link -incremental:no @cd $(NT) LIB_SRC_TOOLS = \ @@ -546,10 +551,10 @@ LIB_SRC_TOOLS = \ RUNEMACS = $(XEMACS)\src\runxemacs.exe $(RUNEMACS): $(LIB_SRC)\run.c $(LIB_SRC)\run.res - $(CCV) -I$(LIB_SRC) -O2 -Fe$@ $** kernel32.lib user32.lib + $(CCV) -I$(LIB_SRC) $(CFLAGS) -Fe$@ -Fo$(LIB_SRC) -Fd$(LIB_SRC)\ $** kernel32.lib user32.lib -link -incremental:no $(LIB_SRC)\run.res: $(LIB_SRC)\run.rc - rc -I$(LIB_SRC) -FO$(LIB_SRC)\run.res $(LIB_SRC)\run.rc + rc -I$(LIB_SRC) -Fo$@ $** #------------------------------------------------------------------------------ @@ -557,7 +562,7 @@ $(LIB_SRC)\run.res: $(LIB_SRC)\run.rc LASTFILE=$(OUTDIR)\lastfile.lib LASTFILE_SRC=$(XEMACS)\src -LASTFILE_FLAGS=$(CFLAGS) $(INCLUDES) -Fo$@ -c +LASTFILE_FLAGS=$(CFLAGS) $(INCLUDES) -Fo$@ -Fd$* -c LASTFILE_OBJS= \ $(OUTDIR)\lastfile.obj @@ -589,7 +594,7 @@ LWLIB_OBJS= \ $(OUTDIR)\xlwscrollbar.obj $(LWLIB): $(LWLIB_OBJS) - link.exe -lib -nologo $(DEBUG_FLAGS) -out:$@ $(LWLIB_OBJS) + link.exe -lib -nologo -out:$@ $(LWLIB_OBJS) $(OUTDIR)\lwlib-config.obj: $(LWLIB_SRC)\lwlib-config.c $(CCV) $(LWLIB_FLAGS) $** @@ -791,7 +796,8 @@ TEMACS_LFLAGS=-nologo $(LIBRARIES) $(DEBUG_FLAGS) -base:0x1000000\ -stack:0x800000 -entry:_start -subsystem:console\ -pdb:$(TEMACS_DIR)\temacs.pdb -map:$(TEMACS_DIR)\temacs.map \ -heap:0x00100000 -out:$@ -TEMACS_CPP_FLAGS=-ML -c $(CFLAGS) $(INCLUDES) $(DEFINES) $(DEBUG_DEFINES) \ +TEMACS_CPP_FLAGS=-ML -c \ + $(CFLAGS) $(INCLUDES) $(DEFINES) $(DEBUG_DEFINES) \ -DEMACS_MAJOR_VERSION=$(emacs_major_version) \ -DEMACS_MINOR_VERSION=$(emacs_minor_version) \ $(EMACS_BETA_VERSION) \ @@ -954,7 +960,7 @@ TEMACS_OBJS= \ $(OUTDIR)\vm-limit.obj \ $(OUTDIR)\widget.obj \ $(OUTDIR)\window.obj \ - $(NT)\xemacs.res + $(OUTDIR)\xemacs.res # Rules @@ -962,8 +968,13 @@ TEMACS_OBJS= \ .SUFFIXES: .c # nmake rule +!if $(DEBUG_XEMACS) +{$(TEMACS_SRC)}.c{$(OUTDIR)}.obj: + $(CCV) $(TEMACS_CPP_FLAGS) $< -Fo$@ -Fr$*.sbr -Fd$(OUTDIR)\temacs.pdb +!else {$(TEMACS_SRC)}.c{$(OUTDIR)}.obj: - $(CCV) $(TEMACS_CPP_FLAGS) $< -Fo$@ -Fr$*.sbr + $(CCV) $(TEMACS_CPP_FLAGS) $< -Fo$@ +!endif $(OUTDIR)\TopLevelEmacsShell.obj: $(TEMACS_SRC)\EmacsShell-sub.c $(CCV) $(TEMACS_CPP_FLAGS) -DDEFINE_TOP_LEVEL_EMACS_SHELL $** -Fo$@ @@ -980,18 +991,17 @@ $(OUTDIR)\alloc.obj: $(TEMACS_SRC)\alloc.c $(TEMACS_SRC)\puresize-adjust.h # !"cd $(TEMACS_SRC); cp paths.h.in paths.h" $(TEMACS): $(TEMACS_INCLUDES) $(TEMACS_OBJS) +!if $(DEBUG_XEMACS) + @dir /b/s $(OUTDIR)\*.sbr > bscmake.tmp + bscmake -nologo -o$(TEMACS_BROWSE) @bscmake.tmp + @del bscmake.tmp +!endif link.exe @<< $(TEMACS_LFLAGS) $(TEMACS_OBJS) $(TEMACS_LIBS) << -$(NT)\xemacs.res: xemacs.rc - rc xemacs.rc - -# MSDEV Source Broswer file. "*.sbr" is too inclusive but this is harmless -$(TEMACS_BROWSE): $(TEMACS_OBJS) - @dir /b/s $(OUTDIR)\*.sbr > bscmake.tmp - bscmake -nologo -o$@ @bscmake.tmp - @del bscmake.tmp +$(OUTDIR)\xemacs.res: xemacs.rc + rc -Fo$@ xemacs.rc #------------------------------------------------------------------------------ @@ -1034,7 +1044,7 @@ dump-xemacs: $(TEMACS) # use this rule to build the complete system all: $(OUTDIR)\nul $(LASTFILE) $(LWLIB) $(LIB_SRC_TOOLS) $(RUNEMACS) \ - $(TEMACS) $(TEMACS_BROWSE) update-elc $(DOC) dump-xemacs + $(TEMACS) update-elc $(DOC) dump-xemacs temacs: $(TEMACS) @@ -1066,12 +1076,15 @@ distclean: del *.bak del *.orig del *.rej - del *.pdb del *.tmp + del Installation + del Installation.el cd $(OUTDIR) + del *.lib del *.obj + del *.pdb + del *.res del *.sbr - del *.lib cd $(XEMACS)\$(TEMACS_DIR) del puresize-adjust.h del config.h @@ -1090,6 +1103,9 @@ distclean: del *.orig del *.rej del *.exe + del *.obj + del *.pdb + del *.res del $(CONFIG_VALUES) cd $(LISP) -del /s /q *.bak *.elc *.orig *.rej diff --git a/src/.cvsignore b/src/.cvsignore index 941595c..17d59ef 100644 --- a/src/.cvsignore +++ b/src/.cvsignore @@ -7,5 +7,6 @@ GNUmakefile puresize-adjust.h sheap-adjust.h temacs +xemacs SATISFIED update-elc.stamp diff --git a/src/ChangeLog b/src/ChangeLog index 2dc99df..8b6a8ae 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,245 @@ +1999-03-12 XEmacs Build Bot + + * XEmacs 21.2.13 is released + +1999-03-12 SL Baur + + * file-coding.c: Guard ucs table initialization with ifdef MULE. + +1999-03-10 Stephen J. Turnbull + + * file-coding.c: docstring and comment improvements. + (decode_ucs4) flag possible data loss with comment. + +1999-03-10 Martin Buchholz + + * file-coding.c (Fset_ucs_char): add CHECK_INT, CHECK_CHAR + (ucs_to_char): + (Fucs_char): + (Fset_char_ucs): + (decode_coding_ucs4): + (encode_coding_ucs4): + (detect_coding_utf8): + (decode_coding_utf8): + (encode_utf8): + (encode_coding_utf8): + Add CHECK_* macros where needed to avoid crashes. + #ifdef out all composite character support using + #ifdef ENABLE_COMPOSITE_CHARS + Use normal XEmacs coding standards. + Fix docstrings. + Remove CODING_STREAM_COMPOSE, CODING_STREAM_DECOMPOSE. + +1998-09-08 MORIOKA Tomohiko + + * file-coding.c (make-coding-system): Add description about + `ucs-4' and `utf-8'. + (detection_state): Modify to implement ucs-4 and utf-8. + (detect_coding_type): Likewise. + (detect_coding_ucs4): New implementation. + (detect_coding_utf8): New implementation. + (encode_utf8): fixed. + (syms_of_mule_coding): Rename `ucs4' and `utf8' to `ucs-4' and + `utf-8'. + +1998-09-08 MORIOKA Tomohiko + + * file-coding.c (mule_char_to_ucs4): Encode 94x94 chars in ISO + 2022 registry to private area. + +1998-09-07 MORIOKA Tomohiko + + * file-coding.c (encode_utf8): New function. + (encode_coding_utf8): New implementation. + +1998-09-07 MORIOKA Tomohiko + + * file-coding.c (ucs_to_mule_table): New variable; abolish + `Vucs_to_mule_table' + (mule_to_ucs_table): renamed from `Vmule_to_ucs_table'. + (set-ucs-char): New function. + (ucs_to_char): New function. + (ucs-char): New function. + (set-char-ucs): New function. + (char-ucs): New function. + (decode_ucs4): Use `ucs_to_char'. + (complex_vars_of_mule_coding): Abolish `ucs-to-mule-table' and + `mule-to-ucs-table'. + +1998-09-06 MORIOKA Tomohiko + + * chartab.h: EXFUN `Fget_char_table'. + + * file-coding.c (encode_ucs4): New function. + (encode_coding_ucs4): Use `encode_ucs4'. + +1998-09-06 MORIOKA Tomohiko + + * file-coding.c (decode_coding_ucs4): New implementation. + +1998-09-06 MORIOKA Tomohiko + + * file-coding.c (decode_coding_ucs4): fixed. + + * file-coding.c (Vmule_to_ucs_table): New variable. + (mule_char_to_ucs4): New function. + (encode_coding_ucs4): New implementation. + (complex_vars_of_mule_coding): Define variable + `mule-to-ucs-table'. + +1998-09-06 MORIOKA Tomohiko + + * file-coding.c (decode_coding_utf8): New implementation. + +1998-09-06 MORIOKA Tomohiko + + * file-coding.c (decode_coding_utf8): fixed. + +1998-09-06 MORIOKA Tomohiko + + * file-coding.c (Vucs_to_mule_table): New variable. + (decode_ucs4): Refer `Vucs_to_mule_table'. + (complex_vars_of_mule_coding): Define variable + `ucs-to-mule-table'. + +1998-09-04 MORIOKA Tomohiko + + * file-coding.c (detect_coding_ucs4): New function (not + implemented yet). + (decode_coding_ucs4): New function. + (encode_coding_ucs4): New function (not implemented yet). + (detect_coding_utf8): New function (not implemented yet). + (decode_coding_utf8): New function. + (encode_coding_utf8): New function (not implemented yet). + (make-coding-system): New type `ucs4' and `utf8'. + (coding-system-type): Likewise. + (detection_state): Add `ucs4' and `utf8'. + (detect_coding_type): Likewise. + (mule_decode): Use `decode_coding_ucs4' and `decode_coding_utf8'. + (mule_encode): Use `encode_coding_ucs4' and `encode_coding_utf8'. + (decode_ucs4): New function (very incomplete). + (syms_of_mule_coding): Add `ucs4' and `utf8'. + + * file-coding.h: Add definitions for UCS-4 and UTF-8. + +1999-03-08 Martin Buchholz + + * mule-charset.c: + (non_ascii_valid_char_p): + (lookup_composite_char): + (composite_char_string): + (make-composite-char): + (composite-char-string): + (syms_of_mule_charset): + (complex_vars_of_mule_charset): + * mule-charset.h (LEADING_BYTE_COMPOSITE): + (CHAR_LEADING_BYTE): + (MAKE_CHAR): + * file-coding.h (CODING_STATE_COMPOSITE): + (CODING_STATE_ISO2022_LOCK): + (iso_esc_flag): + (LEADING_BYTE_COMPOSITE): + * file-coding.c (struct iso2022_decoder): + (decoding_closer): + (reset_iso2022): + (parse_iso2022_esc): + (encode_coding_iso2022): + #ifdef out all composite character support using + #ifdef ENABLE_COMPOSITE_CHARS + + * alloc.c: Define lrecord_coding_system only if ! FILE_CODING + +1999-03-04 Takeshi YAMADA + + * fns.c (Fbase64_encode_string): Calculate `allength' in the same + way of `Fbase64_encode_region'. + +1999-02-18 Katsumi Yamaoka + + * fns.c (base64_encode_1): Don't add a newline at the tail. + +1999-03-08 Andy Piper + + * menubar-msw.c (displayable_menu_item): correct off-by-one & + handling. + +1999-03-07 Martin Buchholz + + * console-stream.h (struct stream_console): + * event-unixoid.c (event_stream_unixoid_select_console): + (event_stream_unixoid_unselect_console): + * print.c (Fexternal_debugging_output): + * sysdep.c (reset_one_device): + * console-stream.c (stream_init_console): + (stream_delete_console): + (allocate_stream_console_struct): move into stream_init_console. + (free_stream_console_struct): move into stream_delete_console. + Use `fd' only for file descriptors. + Therefore, rename members of struct stream_console. + + * systime.h: Unix98 says sys/time.h should define select(), but + some systems define that in unistd.h. So include that file always. + + * glyphs.h (MAYBE_IIFORMAT_METH): Don't use leading `_'. Avoid + multiple evaluation of first arg. Do proper do {} while (0) wrapping. + (HAS_IIFORMAT_METH_P): Prevent macro from being used in + non-boolean context + (MAYBE_IIFORMAT_DEVMETH): Use standard internal macro naming convention. + + * EmacsShell.c: + * balloon_help.c: + Add #include . + Some versions of assert.h use printf() without #include'ing stdio.h + + * free-hook.c (blocktype): Add gcpro5_type to blocktype. + (log_gcpro): Remove unused variable FRAME. + (show_gcprohist): Ansify. + Comment the #endif's + + * frame-x.c (x_delete_frame): Don't use FRAME_X_SHELL_WIDGET(f) + after it's just been XtDestroy'ed! + +1999-02-18 Martin Buchholz + + * opaque.c (print_opaque): + (sizeof_opaque): + (equal_opaque): + (hash_opaque): + Egcs 1.1.1 seems to have a bug where + INTP (p->size_or_chain) + will crash XEmacs. Fix by introducing intermediate variable. + + * sound.c (Fdevice_sound_enabled_p): Fix compiler warning. + + * dired.c (Fdirectory_files): + (Ffile_name_completion): + (Ffile_name_all_completions): + (file_name_completion): + - Use `directory' instead of `dirname' to sync with FSF Emacs and + avoid compiler warnings. + - Fix up docstrings so that C variables match documentation. + +1999-03-05 Martin Buchholz + + * alloc.c: (garbage_collect_1): Reorg code to make scope of local + variables as small as possible to help out the compiler and the maintainer. + + * alloc.c: (disksave_object_finalization): + Set all the *-load-path variables to + nil, not just load-path itself. This gets the locate-file hash + tables garbage collected BEFORE dump, and has the side effect of + preventing crashes on OSF4.0+egcs. + + * alloc.c: + * gdbinit: + * dbxrc: + - Clean up gdb/dbx debugging support. + - Storing an EMACS_INT in an enum is not 64-bit clean! + - So change the enum to a set of separate variables. + - Add test cases to help debug the debugging support! + - Add `lisp-shadows' and `run-temacs' targets for dbx. + - Both dbx and gdb have been tested now. + 1999-03-05 XEmacs Build Bot * XEmacs 21.2.12 is released @@ -88,6 +330,11 @@ * s/cygwin32.h (BROKEN_SIGIO): don't define this as it causes major lockups. +1999-02-16 MORIOKA Tomohiko + + * fns.c (Fbase64_encode_string): New optional argument + `NO_LINE_BREAK'. + 1999-02-16 Martin Buchholz * gdbinit: Fix up commands to run temacs. Add lisp-shadows command. diff --git a/src/EmacsShell.c b/src/EmacsShell.c index eef2edb..7eac51a 100644 --- a/src/EmacsShell.c +++ b/src/EmacsShell.c @@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */ #include +#include #include #include #include diff --git a/src/alloc.c b/src/alloc.c index b53f506..415eca7 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -635,85 +635,83 @@ gc_record_type_p (Lisp_Object frob, CONST struct lrecord_implementation *type) /************************************************************************/ /* Debugger support */ /************************************************************************/ -/* Give gdb/dbx enough information to decode Lisp Objects. - We make sure certain symbols are defined, so gdb doesn't complain - about expressions in src/gdbinit. Values are randomly chosen. - See src/gdbinit or src/dbxrc to see how this is used. */ +/* Give gdb/dbx enough information to decode Lisp Objects. We make + sure certain symbols are always defined, so gdb doesn't complain + about expressions in src/gdbinit. See src/gdbinit or src/dbxrc to + see how this is used. */ -enum dbg_constants -{ #ifdef USE_MINIMAL_TAGBITS - dbg_valmask = (EMACS_INT) (((1UL << VALBITS) - 1) << GCBITS), - dbg_typemask = (EMACS_INT) ((1UL << GCTYPEBITS) - 1), - dbg_USE_MINIMAL_TAGBITS = 1, - dbg_Lisp_Type_Int = 100, -#else /* ! USE_MIMIMAL_TAGBITS */ - dbg_valmask = (EMACS_INT) ((1UL << VALBITS) - 1), - dbg_typemask = (EMACS_INT) (((1UL << GCTYPEBITS) - 1) << (VALBITS + GCMARKBITS)), - dbg_USE_MINIMAL_TAGBITS = 0, - dbg_Lisp_Type_Int = Lisp_Type_Int, -#endif /* ! USE_MIMIMAL_TAGBITS */ +EMACS_UINT dbg_valmask = ((1UL << VALBITS) - 1) << GCBITS; +EMACS_UINT dbg_typemask = (1UL << GCTYPEBITS) - 1; +unsigned char dbg_USE_MINIMAL_TAGBITS = 1; +unsigned char Lisp_Type_Int = 100; +#else +EMACS_UINT dbg_valmask = (1UL << VALBITS) - 1; +EMACS_UINT dbg_typemask = ((1UL << GCTYPEBITS) - 1) << (VALBITS + GCMARKBITS); +unsigned char dbg_USE_MINIMAL_TAGBITS = 0; +#endif #ifdef USE_UNION_TYPE - dbg_USE_UNION_TYPE = 1, +unsigned char dbg_USE_UNION_TYPE = 1; #else - dbg_USE_UNION_TYPE = 0, +unsigned char dbg_USE_UNION_TYPE = 0; #endif #ifdef USE_INDEXED_LRECORD_IMPLEMENTATION - dbg_USE_INDEXED_LRECORD_IMPLEMENTATION = 1, +unsigned char dbg_USE_INDEXED_LRECORD_IMPLEMENTATION = 1; #else - dbg_USE_INDEXED_LRECORD_IMPLEMENTATION = 0, +unsigned char dbg_USE_INDEXED_LRECORD_IMPLEMENTATION = 0; #endif - dbg_Lisp_Type_Char = Lisp_Type_Char, - dbg_Lisp_Type_Record = Lisp_Type_Record, #ifdef LRECORD_CONS - dbg_Lisp_Type_Cons = 101, +unsigned char Lisp_Type_Cons = 101; #else - dbg_Lisp_Type_Cons = Lisp_Type_Cons, - lrecord_cons = 201, +unsigned char lrecord_cons; #endif + #ifdef LRECORD_STRING - dbg_Lisp_Type_String = 102, +unsigned char Lisp_Type_String = 102; #else - dbg_Lisp_Type_String = Lisp_Type_String, - lrecord_string = 202, +unsigned char lrecord_string; #endif + #ifdef LRECORD_VECTOR - dbg_Lisp_Type_Vector = 103, +unsigned char Lisp_Type_Vector = 103; #else - dbg_Lisp_Type_Vector = Lisp_Type_Vector, - lrecord_vector = 203, +unsigned char lrecord_vector; #endif + #ifdef LRECORD_SYMBOL - dbg_Lisp_Type_Symbol = 104, +unsigned char Lisp_Type_Symbol = 104; #else - dbg_Lisp_Type_Symbol = Lisp_Type_Symbol, - lrecord_symbol = 204, +unsigned char lrecord_symbol; #endif + #ifndef MULE - lrecord_char_table_entry = 205, - lrecord_charset = 206, - lrecord_coding_system = 207, +unsigned char lrecord_char_table_entry; +unsigned char lrecord_charset; +#ifndef FILE_CODING +unsigned char lrecord_coding_system; #endif +#endif + #ifndef HAVE_TOOLBARS - lrecord_toolbar_button = 208, +unsigned char lrecord_toolbar_button; #endif -#ifndef HAVE_TOOLTALK - lrecord_tooltalk_message = 210, - lrecord_tooltalk_pattern = 211, + +#ifndef TOOLTALK +unsigned char lrecord_tooltalk_message; +unsigned char lrecord_tooltalk_pattern; #endif + #ifndef HAVE_DATABASE - lrecord_database = 212, +unsigned char lrecord_database; #endif - dbg_valbits = VALBITS, - dbg_gctypebits = GCTYPEBITS - /* If we don't have an actual object of this enum, pgcc (and perhaps - other compilers) might optimize away the entire type declaration :-( */ -} dbg_dummy; -/* A few macros turned into functions for ease of debugging. +unsigned char dbg_valbits = VALBITS; +unsigned char dbg_gctypebits = GCTYPEBITS; + +/* Macros turned into functions for ease of debugging. Debuggers don't know about macros! */ int dbg_eq (Lisp_Object obj1, Lisp_Object obj2); int @@ -4248,6 +4246,10 @@ disksave_object_finalization (void) Vexec_path = Qnil; Vload_path = Qnil; /* Vdump_load_path = Qnil; */ + /* Release hash tables for locate_file */ + Fset (intern ("early-package-load-path"), Qnil); + Fset (intern ("late-package-load-path"), Qnil); + Fset (intern ("last-package-load-path"), Qnil); uncache_home_directory(); #if defined(LOADHIST) && !(defined(LOADHIST_DUMPED) || \ @@ -4308,7 +4310,6 @@ garbage_collect_1 (void) char stack_top_variable; extern char *stack_bottom; #endif - int i; struct frame *f; int speccount; int cursor_changed; @@ -4425,38 +4426,45 @@ garbage_collect_1 (void) cleanup_specifiers (); /* Mark all the special slots that serve as the roots of accessibility. */ - { - struct gcpro *tail; - struct catchtag *catch; - struct backtrace *backlist; - struct specbinding *bind; + { /* staticpro() */ + int i; for (i = 0; i < staticidx; i++) - { - mark_object (*(staticvec[i])); - } + mark_object (*(staticvec[i])); + } + { /* GCPRO() */ + struct gcpro *tail; + int i; for (tail = gcprolist; tail; tail = tail->next) - { - for (i = 0; i < tail->nvars; i++) - mark_object (tail->var[i]); - } + for (i = 0; i < tail->nvars; i++) + mark_object (tail->var[i]); + } + { /* specbind() */ + struct specbinding *bind; for (bind = specpdl; bind != specpdl_ptr; bind++) { mark_object (bind->symbol); mark_object (bind->old_value); } + } + { + struct catchtag *catch; for (catch = catchlist; catch; catch = catch->next) { mark_object (catch->tag); mark_object (catch->val); } + } + { + struct backtrace *backlist; for (backlist = backtrace_list; backlist; backlist = backlist->next) { int nargs = backlist->nargs; + int i; mark_object (*backlist->function); if (nargs == UNEVALLED || nargs == MANY) @@ -4465,11 +4473,11 @@ garbage_collect_1 (void) for (i = 0; i < nargs; i++) mark_object (backlist->args[i]); } - - mark_redisplay (mark_object); - mark_profiling_info (mark_object); } + mark_redisplay (mark_object); + mark_profiling_info (mark_object); + /* OK, now do the after-mark stuff. This is for things that are only marked when something else is marked (e.g. weak hash tables). There may be complex dependencies between such objects -- e.g. diff --git a/src/balloon_help.c b/src/balloon_help.c index 8efbbeb..3410129 100644 --- a/src/balloon_help.c +++ b/src/balloon_help.c @@ -33,6 +33,7 @@ Boston, MA 02111-1307, USA. */ #include #include #include +#include #include #include diff --git a/src/chartab.h b/src/chartab.h index 2aa4931..f720dad 100644 --- a/src/chartab.h +++ b/src/chartab.h @@ -191,6 +191,7 @@ void prune_syntax_tables (int (*obj_marked_p) (Lisp_Object)); EXFUN (Fcopy_char_table, 1); EXFUN (Fmake_char_table, 1); EXFUN (Fput_char_table, 3); +EXFUN (Fget_char_table, 2); extern Lisp_Object Vall_syntax_tables; diff --git a/src/console-stream.c b/src/console-stream.c index 74d8e4a..3953850 100644 --- a/src/console-stream.c +++ b/src/console-stream.c @@ -46,41 +46,33 @@ Lisp_Object Vterminal_frame; Lisp_Object Vstdio_str; static void -allocate_stream_console_struct (struct console *con) -{ - if (!CONSOLE_STREAM_DATA (con)) - CONSOLE_STREAM_DATA (con) = xnew_and_zero (struct stream_console); - else - xzero (*CONSOLE_STREAM_DATA (con)); -} - -static void stream_init_console (struct console *con, Lisp_Object params) { Lisp_Object tty = CONSOLE_CONNECTION (con); - FILE *infd, *outfd, *errfd; + struct stream_console *stream_con; - /* Open the specified console */ + if (CONSOLE_STREAM_DATA (con) == NULL) + CONSOLE_STREAM_DATA (con) = xnew (struct stream_console); + + stream_con = CONSOLE_STREAM_DATA (con); + stream_con->needs_newline = 0; + + /* Open the specified console */ if (NILP (tty) || internal_equal (tty, Vstdio_str, 0)) { - infd = stdin; - outfd = stdout; - errfd = stderr; + stream_con->in = stdin; + stream_con->out = stdout; + stream_con->err = stderr; } else { CHECK_STRING (tty); - infd = outfd = errfd = + stream_con->in = stream_con->out = stream_con->err = fopen ((char *) XSTRING_DATA (tty), "r+"); - if (!infd) + if (!stream_con->in) error ("Unable to open tty %s", XSTRING_DATA (tty)); } - - allocate_stream_console_struct (con); - CONSOLE_STREAM_DATA (con)->infd = infd; - CONSOLE_STREAM_DATA (con)->outfd = outfd; - CONSOLE_STREAM_DATA (con)->errfd = errfd; } static void @@ -88,8 +80,8 @@ stream_init_device (struct device *d, Lisp_Object params) { struct console *con = XCONSOLE (DEVICE_CONSOLE (d)); - DEVICE_INFD (d) = fileno (CONSOLE_STREAM_DATA (con)->infd); - DEVICE_OUTFD (d) = fileno (CONSOLE_STREAM_DATA (con)->outfd); + DEVICE_INFD (d) = fileno (CONSOLE_STREAM_DATA (con)->in); + DEVICE_OUTFD (d) = fileno (CONSOLE_STREAM_DATA (con)->out); init_baud_rate (d); init_one_device (d); } @@ -100,30 +92,26 @@ stream_initially_selected_for_input (struct console *con) return noninteractive && initialized; } -static void -free_stream_console_struct (struct console *con) -{ - if (CONSOLE_STREAM_DATA (con)) - { - xfree (CONSOLE_STREAM_DATA (con)); - CONSOLE_STREAM_DATA (con) = NULL; - } -} - extern int stdout_needs_newline; static void stream_delete_console (struct console *con) { - if (/* CONSOLE_STREAM_DATA (con)->needs_newline */ - stdout_needs_newline) /* #### clean this up */ + struct stream_console *stream_con = CONSOLE_STREAM_DATA (con); + if (stream_con) { - fputc ('\n', CONSOLE_STREAM_DATA (con)->outfd); - fflush (CONSOLE_STREAM_DATA (con)->outfd); + if (/* stream_con->needs_newline */ + stdout_needs_newline) /* #### clean this up */ + { + fputc ('\n', stream_con->out); + fflush (stream_con->out); + } + if (stream_con->in != stdin) + fclose (stream_con->in); + + xfree (stream_con); + CONSOLE_STREAM_DATA (con) = NULL; } - if (CONSOLE_STREAM_DATA (con)->infd != stdin) - fclose (CONSOLE_STREAM_DATA (con)->infd); - free_stream_console_struct (con); } Lisp_Object @@ -243,7 +231,7 @@ stream_clear_to_window_end (struct window *w, int ypos1, int ypos2) static void stream_clear_region (Lisp_Object window, struct device* d, struct frame * f, face_index findex, int x, int y, - int width, int height, Lisp_Object fcolor, Lisp_Object bcolor, + int width, int height, Lisp_Object fcolor, Lisp_Object bcolor, Lisp_Object background_pixmap) { } @@ -263,8 +251,8 @@ static void stream_ring_bell (struct device *d, int volume, int pitch, int duration) { struct console *c = XCONSOLE (DEVICE_CONSOLE (d)); - fputc (07, CONSOLE_STREAM_DATA (c)->outfd); - fflush (CONSOLE_STREAM_DATA (c)->outfd); + fputc (07, CONSOLE_STREAM_DATA (c)->out); + fflush (CONSOLE_STREAM_DATA (c)->out); } diff --git a/src/console-stream.h b/src/console-stream.h index e532bd0..a097e13 100644 --- a/src/console-stream.h +++ b/src/console-stream.h @@ -32,7 +32,9 @@ DECLARE_CONSOLE_TYPE (stream); struct stream_console { - FILE *infd, *outfd, *errfd; + FILE *in; + FILE *out; + FILE *err; int needs_newline; }; diff --git a/src/dired.c b/src/dired.c index e2aed07..b2735e3 100644 --- a/src/dired.c +++ b/src/dired.c @@ -61,43 +61,43 @@ If FILES-ONLY is the symbol t, then only the "files" in the directory if FILES-ONLY is nil (the default) then both files and subdirectories will be returned. */ - (dirname, full, match, nosort, files_only)) + (directory, full, match, nosort, files_only)) { /* This function can GC */ DIR *d; Lisp_Object list = Qnil; - Bytecount dirnamelen; + Bytecount directorylen; Lisp_Object handler; struct re_pattern_buffer *bufp = NULL; int speccount = specpdl_depth (); char *statbuf, *statbuf_tail; struct gcpro gcpro1, gcpro2; - GCPRO2 (dirname, list); + GCPRO2 (directory, list); /* If the file name has special constructs in it, call the corresponding file handler. */ - handler = Ffind_file_name_handler (dirname, Qdirectory_files); + handler = Ffind_file_name_handler (directory, Qdirectory_files); if (!NILP (handler)) { UNGCPRO; if (!NILP (files_only)) - return call6 (handler, Qdirectory_files, dirname, full, match, nosort, - files_only); + return call6 (handler, Qdirectory_files, directory, full, match, + nosort, files_only); else - return call5 (handler, Qdirectory_files, dirname, full, match, + return call5 (handler, Qdirectory_files, directory, full, match, nosort); } /* #### why do we do Fexpand_file_name after file handlers here, but earlier everywhere else? */ - dirname = Fexpand_file_name (dirname, Qnil); - dirname = Ffile_name_as_directory (dirname); - dirnamelen = XSTRING_LENGTH (dirname); + directory = Fexpand_file_name (directory, Qnil); + directory = Ffile_name_as_directory (directory); + directorylen = XSTRING_LENGTH (directory); - statbuf = (char *)alloca (dirnamelen + MAXNAMLEN + 1); - memcpy (statbuf, XSTRING_DATA (dirname), dirnamelen); - statbuf_tail = statbuf + dirnamelen; + statbuf = (char *)alloca (directorylen + MAXNAMLEN + 1); + memcpy (statbuf, XSTRING_DATA (directory), directorylen); + statbuf_tail = statbuf + directorylen; /* XEmacs: this should come after Ffile_name_as_directory() to avoid potential regexp cache smashage. It comes before the opendir() @@ -118,9 +118,9 @@ If FILES-ONLY is the symbol t, then only the "files" in the directory /* Do this opendir after anything which might signal an error. NOTE: the above comment is old; previously, there was no unwind-protection in case of error, but now there is. */ - d = opendir ((char *) XSTRING_DATA (dirname)); + d = opendir ((char *) XSTRING_DATA (directory)); if (!d) - report_file_error ("Opening directory", list1 (dirname)); + report_file_error ("Opening directory", list1 (directory)); record_unwind_protect (close_directory_unwind, make_opaque_ptr ((void *)d)); @@ -157,9 +157,9 @@ If FILES-ONLY is the symbol t, then only the "files" in the directory overrun. */ if (len > MAXNAMLEN) { - cur_statbuf = (char *)xmalloc (dirnamelen + len + 1); - memcpy (cur_statbuf, statbuf, dirnamelen); - cur_statbuf_tail = cur_statbuf + dirnamelen; + cur_statbuf = (char *)xmalloc (directorylen + len + 1); + memcpy (cur_statbuf, statbuf, directorylen); + cur_statbuf_tail = cur_statbuf + directorylen; } memcpy (cur_statbuf_tail, dp->d_name, len); cur_statbuf_tail[len] = 0; @@ -182,7 +182,7 @@ If FILES-ONLY is the symbol t, then only the "files" in the directory Lisp_Object name = make_string ((Bufbyte *)dp->d_name, len); if (!NILP (full)) - name = concat2 (dirname, name); + name = concat2 (directory, name); list = Fcons (name, list); } @@ -197,79 +197,79 @@ If FILES-ONLY is the symbol t, then only the "files" in the directory } static Lisp_Object file_name_completion (Lisp_Object file, - Lisp_Object dirname, + Lisp_Object directory, int all_flag, int ver_flag); DEFUN ("file-name-completion", Ffile_name_completion, 2, 2, 0, /* -Complete file name FILE in directory DIR. -Returns the longest string common to all filenames in DIR +Complete file name FILE in directory DIRECTORY. +Returns the longest string common to all filenames in DIRECTORY that start with FILE. If there is only one and FILE matches it exactly, returns t. -Returns nil if DIR contains no name starting with FILE. +Returns nil if DIRECTORY contains no name starting with FILE. Filenames which end with any member of `completion-ignored-extensions' are not considered as possible completions for FILE unless there is no other possible completion. `completion-ignored-extensions' is not applied to the names of directories. */ - (file, dirname)) + (file, directory)) { /* This function can GC. GC checked 1996.04.06. */ Lisp_Object handler; /* If the directory name has special constructs in it, call the corresponding file handler. */ - handler = Ffind_file_name_handler (dirname, Qfile_name_completion); + handler = Ffind_file_name_handler (directory, Qfile_name_completion); if (!NILP (handler)) - return call3 (handler, Qfile_name_completion, file, dirname); + return call3 (handler, Qfile_name_completion, file, directory); /* If the file name has special constructs in it, call the corresponding file handler. */ handler = Ffind_file_name_handler (file, Qfile_name_completion); if (!NILP (handler)) - return call3 (handler, Qfile_name_completion, file, dirname); + return call3 (handler, Qfile_name_completion, file, directory); - return file_name_completion (file, dirname, 0, 0); + return file_name_completion (file, directory, 0, 0); } DEFUN ("file-name-all-completions", Ffile_name_all_completions, 2, 2, 0, /* -Return a list of all completions of file name FILE in directory DIR. -These are all file names in directory DIR which begin with FILE. +Return a list of all completions of file name FILE in directory DIRECTORY. +These are all file names in directory DIRECTORY which begin with FILE. -Filenames which end with any member of `completion-ignored-extensions' +File names which end with any member of `completion-ignored-extensions' are not considered as possible completions for FILE unless there is no other possible completion. `completion-ignored-extensions' is not applied to the names of directories. */ - (file, dirname)) + (file, directory)) { /* This function can GC. GC checked 1997.06.04. */ Lisp_Object handler; struct gcpro gcpro1; - GCPRO1 (dirname); - dirname = Fexpand_file_name (dirname, Qnil); + GCPRO1 (directory); + directory = Fexpand_file_name (directory, Qnil); /* If the file name has special constructs in it, call the corresponding file handler. */ - handler = Ffind_file_name_handler (dirname, Qfile_name_all_completions); + handler = Ffind_file_name_handler (directory, Qfile_name_all_completions); UNGCPRO; if (!NILP (handler)) return call3 (handler, Qfile_name_all_completions, file, - dirname); + directory); - return file_name_completion (file, dirname, 1, 0); + return file_name_completion (file, directory, 1, 0); } static int -file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, +file_name_completion_stat (Lisp_Object directory, DIRENTRY *dp, struct stat *st_addr) { Bytecount len = NAMLEN (dp); - Bytecount pos = XSTRING_LENGTH (dirname); + Bytecount pos = XSTRING_LENGTH (directory); int value; char *fullname = (char *) alloca (len + pos + 2); - memcpy (fullname, XSTRING_DATA (dirname), pos); + memcpy (fullname, XSTRING_DATA (directory), pos); if (!IS_DIRECTORY_SEP (fullname[pos - 1])) fullname[pos++] = DIRECTORY_SEP; @@ -306,7 +306,7 @@ file_name_completion_unwind (Lisp_Object locative) } static Lisp_Object -file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, +file_name_completion (Lisp_Object file, Lisp_Object directory, int all_flag, int ver_flag) { /* This function can GC */ @@ -321,7 +321,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, Lisp_Object locative; struct gcpro gcpro1, gcpro2, gcpro3; - GCPRO3 (file, dirname, bestmatch); + GCPRO3 (file, directory, bestmatch); CHECK_STRING (file); @@ -334,7 +334,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, #ifdef FILE_SYSTEM_CASE file = FILE_SYSTEM_CASE (file); #endif - dirname = Fexpand_file_name (dirname, Qnil); + directory = Fexpand_file_name (directory, Qnil); file_name_length = XSTRING_CHAR_LENGTH (file); /* With passcount = 0, ignore files that end in an ignored extension. @@ -355,9 +355,9 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, for (passcount = !!all_flag; NILP (bestmatch) && passcount < 2; passcount++) { - d = opendir ((char *) XSTRING_DATA (Fdirectory_file_name (dirname))); + d = opendir ((char *) XSTRING_DATA (Fdirectory_file_name (directory))); if (!d) - report_file_error ("Opening directory", list1 (dirname)); + report_file_error ("Opening directory", list1 (directory)); XCAR (locative) = make_opaque_ptr ((void *)d); /* Loop reading blocks */ @@ -387,7 +387,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, || 0 <= scmp (d_name, XSTRING_DATA (file), file_name_length)) continue; - if (file_name_completion_stat (dirname, dp, &st) < 0) + if (file_name_completion_stat (directory, dp, &st) < 0) continue; directoryp = ((st.st_mode & S_IFMT) == S_IFDIR); @@ -501,7 +501,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, } } - /* If this dirname all matches, + /* If this directory all matches, see if implicit following slash does too. */ if (directoryp && compare == matchsize @@ -831,13 +831,13 @@ If file does not exist, returns nil. { /* This function can GC. GC checked 1997.06.04. */ Lisp_Object values[12]; - Lisp_Object dirname = Qnil; + Lisp_Object directory = Qnil; struct stat s; char modes[10]; Lisp_Object handler; struct gcpro gcpro1, gcpro2; - GCPRO2 (filename, dirname); + GCPRO2 (filename, directory); filename = Fexpand_file_name (filename, Qnil); /* If the file name has special constructs in it, @@ -856,7 +856,7 @@ If file does not exist, returns nil. } #ifdef BSD4_2 - dirname = Ffile_name_directory (filename); + directory = Ffile_name_directory (filename); #endif #ifdef MSDOS @@ -906,7 +906,7 @@ If file does not exist, returns nil. { struct stat sdir; - if (!NILP (dirname) && stat ((char *) XSTRING_DATA (dirname), &sdir) == 0) + if (!NILP (directory) && stat ((char *) XSTRING_DATA (directory), &sdir) == 0) values[9] = (sdir.st_gid != s.st_gid) ? Qt : Qnil; else /* if we can't tell, assume worst */ values[9] = Qt; diff --git a/src/event-unixoid.c b/src/event-unixoid.c index 072ac61..d613f62 100644 --- a/src/event-unixoid.c +++ b/src/event-unixoid.c @@ -147,7 +147,7 @@ event_stream_unixoid_select_console (struct console *con) int infd; if (CONSOLE_STREAM_P (con)) - infd = fileno (CONSOLE_STREAM_DATA (con)->infd); + infd = fileno (CONSOLE_STREAM_DATA (con)->in); else { assert (CONSOLE_TTY_P (con)); @@ -168,7 +168,7 @@ event_stream_unixoid_unselect_console (struct console *con) int infd; if (CONSOLE_STREAM_P (con)) - infd = fileno (CONSOLE_STREAM_DATA (con)->infd); + infd = fileno (CONSOLE_STREAM_DATA (con)->in); else { assert (CONSOLE_TTY_P (con)); diff --git a/src/file-coding.c b/src/file-coding.c index ce4f83b..ee0da8d 100644 --- a/src/file-coding.c +++ b/src/file-coding.c @@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */ #include "lstream.h" #ifdef MULE #include "mule-ccl.h" +#include "chartab.h" #endif #include "file-coding.h" @@ -64,6 +65,7 @@ Lisp_Object Qpost_read_conversion; Lisp_Object Qpre_write_conversion; #ifdef MULE +Lisp_Object Qucs4, Qutf8; Lisp_Object Qbig5, Qshift_jis; Lisp_Object Qcharset_g0, Qcharset_g1, Qcharset_g2, Qcharset_g3; Lisp_Object Qforce_g0_on_output, Qforce_g1_on_output; @@ -103,8 +105,10 @@ struct iso2022_decoder /* Index for next byte to store in ISO escape sequence. */ int esc_bytes_index; +#ifdef ENABLE_COMPOSITE_CHARS /* Stuff seen so far when composing a string. */ unsigned_char_dynarr *composite_chars; +#endif /* If we saw an invalid designation sequence for a particular register, we flag it here and switch to ASCII. The next time we @@ -166,6 +170,24 @@ static void decode_coding_big5 (Lstream *decoding, static void encode_coding_big5 (Lstream *encoding, CONST unsigned char *src, unsigned_char_dynarr *dst, unsigned int n); +static int detect_coding_ucs4 (struct detection_state *st, + CONST unsigned char *src, + unsigned int n); +static void decode_coding_ucs4 (Lstream *decoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n); +static void encode_coding_ucs4 (Lstream *encoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n); +static int detect_coding_utf8 (struct detection_state *st, + CONST unsigned char *src, + unsigned int n); +static void decode_coding_utf8 (Lstream *decoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n); +static void encode_coding_utf8 (Lstream *encoding, + CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n); static int postprocess_iso2022_mask (int mask); static void reset_iso2022 (Lisp_Object coding_system, struct iso2022_decoder *iso); @@ -230,7 +252,7 @@ DEFINE_LRECORD_IMPLEMENTATION ("coding-system", coding_system, static Lisp_Object mark_coding_system (Lisp_Object obj, void (*markobj) (Lisp_Object)) { - struct Lisp_Coding_System *codesys = XCODING_SYSTEM (obj); + Lisp_Coding_System *codesys = XCODING_SYSTEM (obj); markobj (CODING_SYSTEM_NAME (codesys)); markobj (CODING_SYSTEM_DOC_STRING (codesys)); @@ -285,7 +307,7 @@ static void print_coding_system (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) { - struct Lisp_Coding_System *c = XCODING_SYSTEM (obj); + Lisp_Coding_System *c = XCODING_SYSTEM (obj); if (print_readably) error ("printing unreadable object #", c->header.uid); @@ -298,7 +320,7 @@ print_coding_system (Lisp_Object obj, Lisp_Object printcharfun, static void finalize_coding_system (void *header, int for_disksave) { - struct Lisp_Coding_System *c = (struct Lisp_Coding_System *) header; + Lisp_Coding_System *c = (Lisp_Coding_System *) header; /* Since coding systems never go away, this function is not necessary. But it would be necessary if we changed things so that coding systems could go away. */ @@ -353,7 +375,7 @@ eol_type_to_symbol (enum eol_type type) } static void -setup_eol_coding_systems (struct Lisp_Coding_System *codesys) +setup_eol_coding_systems (Lisp_Coding_System *codesys) { Lisp_Object codesys_obj; int len = string_length (XSYMBOL (CODING_SYSTEM_NAME (codesys))->name); @@ -505,11 +527,11 @@ Return the name of the given coding system. return XCODING_SYSTEM_NAME (coding_system); } -static struct Lisp_Coding_System * +static Lisp_Coding_System * allocate_coding_system (enum coding_system_type type, Lisp_Object name) { - struct Lisp_Coding_System *codesys = - alloc_lcrecord_type (struct Lisp_Coding_System, lrecord_coding_system); + Lisp_Coding_System *codesys = + alloc_lcrecord_type (Lisp_Coding_System, lrecord_coding_system); zero_lcrecord (codesys); CODING_SYSTEM_PRE_WRITE_CONVERSION (codesys) = Qnil; @@ -608,6 +630,10 @@ nil or 'undecided characters will only be present if you explicitly insert them.) 'shift-jis Shift-JIS (a Japanese encoding commonly used in PC operating systems). +'ucs-4 + ISO 10646 UCS-4 encoding. +'utf-8 + ISO 10646 UTF-8 encoding. 'iso2022 Any ISO2022-compliant encoding. Among other things, this includes JIS (the Japanese encoding commonly used for e-mail), EUC (the @@ -762,7 +788,7 @@ if TYPE is 'ccl: */ (name, type, doc_string, props)) { - struct Lisp_Coding_System *codesys; + Lisp_Coding_System *codesys; Lisp_Object rest, key, value; enum coding_system_type ty; int need_to_setup_eol_systems = 1; @@ -774,6 +800,8 @@ if TYPE is 'ccl: else if (EQ (type, Qshift_jis)) { ty = CODESYS_SHIFT_JIS; } else if (EQ (type, Qiso2022)) { ty = CODESYS_ISO2022; } else if (EQ (type, Qbig5)) { ty = CODESYS_BIG5; } + else if (EQ (type, Qucs4)) { ty = CODESYS_UCS4; } + else if (EQ (type, Qutf8)) { ty = CODESYS_UTF8; } else if (EQ (type, Qccl)) { ty = CODESYS_CCL; } #endif else if (EQ (type, Qno_conversion)) { ty = CODESYS_NO_CONVERSION; } @@ -911,8 +939,8 @@ be created. } { - struct Lisp_Coding_System *to = XCODING_SYSTEM (new_coding_system); - struct Lisp_Coding_System *from = XCODING_SYSTEM (old_coding_system); + Lisp_Coding_System *to = XCODING_SYSTEM (new_coding_system); + Lisp_Coding_System *from = XCODING_SYSTEM (old_coding_system); memcpy (((char *) to ) + sizeof (to->header), ((char *) from) + sizeof (from->header), sizeof (*from) - sizeof (from->header)); @@ -924,7 +952,7 @@ be created. static Lisp_Object subsidiary_coding_system (Lisp_Object coding_system, enum eol_type type) { - struct Lisp_Coding_System *cs = XCODING_SYSTEM (coding_system); + Lisp_Coding_System *cs = XCODING_SYSTEM (coding_system); Lisp_Object new_coding_system; if (CODING_SYSTEM_EOL_TYPE (cs) != EOL_AUTODETECT) @@ -980,6 +1008,8 @@ Return the type of CODING-SYSTEM. case CODESYS_SHIFT_JIS: return Qshift_jis; case CODESYS_ISO2022: return Qiso2022; case CODESYS_BIG5: return Qbig5; + case CODESYS_UCS4: return Qucs4; + case CODESYS_UTF8: return Qutf8; case CODESYS_CCL: return Qccl; #endif case CODESYS_NO_CONVERSION: return Qno_conversion; @@ -1282,6 +1312,20 @@ struct detection_state struct { int mask; + int in_byte; + } + ucs4; + + struct + { + int mask; + int in_byte; + } + utf8; + + struct + { + int mask; int initted; struct iso2022_decoder iso; unsigned int flags; @@ -1398,6 +1442,8 @@ detect_coding_type (struct detection_state *st, CONST unsigned char *src, #ifdef MULE st->shift_jis.mask = ~0; st->big5.mask = ~0; + st->ucs4.mask = ~0; + st->utf8.mask = ~0; st->iso2022.mask = ~0; #endif break; @@ -1414,8 +1460,14 @@ detect_coding_type (struct detection_state *st, CONST unsigned char *src, st->shift_jis.mask = detect_coding_sjis (st, src, n); if (!mask_has_at_most_one_bit_p (st->big5.mask)) st->big5.mask = detect_coding_big5 (st, src, n); - - st->mask = st->iso2022.mask | st->shift_jis.mask | st->big5.mask; + if (!mask_has_at_most_one_bit_p (st->utf8.mask)) + st->utf8.mask = detect_coding_utf8 (st, src, n); + if (!mask_has_at_most_one_bit_p (st->ucs4.mask)) + st->ucs4.mask = detect_coding_ucs4 (st, src, n); + + st->mask + = st->iso2022.mask | st->shift_jis.mask | st->big5.mask + | st->utf8.mask | st->ucs4.mask; #endif { int retval = mask_has_at_most_one_bit_p (st->mask); @@ -1677,7 +1729,7 @@ do { \ struct decoding_stream { /* Coding system that governs the conversion. */ - struct Lisp_Coding_System *codesys; + Lisp_Coding_System *codesys; /* Stream that we read the encoded data from or write the decoded data to. */ @@ -1883,9 +1935,11 @@ decoding_closer (Lstream *stream) } Dynarr_free (str->runoff); #ifdef MULE +#ifdef ENABLE_COMPOSITE_CHARS if (str->iso2022.composite_chars) Dynarr_free (str->iso2022.composite_chars); #endif +#endif return Lstream_close (str->other_end); } @@ -1902,7 +1956,7 @@ decoding_stream_coding_system (Lstream *stream) void set_decoding_stream_coding_system (Lstream *lstr, Lisp_Object codesys) { - struct Lisp_Coding_System *cs = XCODING_SYSTEM (codesys); + Lisp_Coding_System *cs = XCODING_SYSTEM (codesys); struct decoding_stream *str = DECODING_STREAM_DATA (lstr); str->codesys = cs; if (CODING_SYSTEM_EOL_TYPE (cs) != EOL_AUTODETECT) @@ -2019,6 +2073,12 @@ mule_decode (Lstream *decoding, CONST unsigned char *src, case CODESYS_BIG5: decode_coding_big5 (decoding, src, dst, n); break; + case CODESYS_UCS4: + decode_coding_ucs4 (decoding, src, dst, n); + break; + case CODESYS_UTF8: + decode_coding_utf8 (decoding, src, dst, n); + break; case CODESYS_CCL: ccl_driver (&str->ccl, src, dst, n, 0); break; @@ -2110,7 +2170,7 @@ BUFFER defaults to the current buffer if unspecified. struct encoding_stream { /* Coding system that governs the conversion. */ - struct Lisp_Coding_System *codesys; + Lisp_Coding_System *codesys; /* Stream that we read the encoded data from or write the decoded data to. */ @@ -2361,7 +2421,7 @@ encoding_stream_coding_system (Lstream *stream) void set_encoding_stream_coding_system (Lstream *lstr, Lisp_Object codesys) { - struct Lisp_Coding_System *cs = XCODING_SYSTEM (codesys); + Lisp_Coding_System *cs = XCODING_SYSTEM (codesys); struct encoding_stream *str = ENCODING_STREAM_DATA (lstr); str->codesys = cs; reset_encoding_stream (str); @@ -2425,6 +2485,12 @@ mule_encode (Lstream *encoding, CONST unsigned char *src, case CODESYS_BIG5: encode_coding_big5 (encoding, src, dst, n); break; + case CODESYS_UCS4: + encode_coding_ucs4 (encoding, src, dst, n); + break; + case CODESYS_UTF8: + encode_coding_utf8 (encoding, src, dst, n); + break; case CODESYS_CCL: ccl_driver (&str->ccl, src, dst, n, 0); break; @@ -2510,9 +2576,9 @@ text. BUFFER defaults to the current buffer if unspecified. /* Shift-JIS is a coding system encoding three character sets: ASCII, right half of JISX0201-Kana, and JISX0208. An ASCII character is encoded - as is. A character of JISX0201-Kana (TYPE94 character set) is + as is. A character of JISX0201-Kana (DIMENSION1_CHARS94 character set) is encoded by "position-code + 0x80". A character of JISX0208 - (TYPE94x94 character set) is encoded in 2-byte but two + (DIMENSION2_CHARS94 character set) is encoded in 2-byte but two position-codes are divided and shifted so that it fit in the range below. @@ -2569,12 +2635,10 @@ decode_coding_sjis (Lstream *decoding, CONST unsigned char *src, unsigned_char_dynarr *dst, unsigned int n) { unsigned char c; - unsigned int flags, ch; - enum eol_type eol_type; struct decoding_stream *str = DECODING_STREAM_DATA (decoding); - - CODING_STREAM_DECOMPOSE (str, flags, ch); - eol_type = str->eol_type; + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = str->eol_type; while (n--) { @@ -2617,7 +2681,8 @@ decode_coding_sjis (Lstream *decoding, CONST unsigned char *src, DECODE_HANDLE_END_OF_CONVERSION (flags, ch, dst); - CODING_STREAM_COMPOSE (str, flags, ch); + str->flags = flags; + str->ch = ch; } /* Convert internally-formatted data to Shift-JIS. */ @@ -2628,11 +2693,9 @@ encode_coding_sjis (Lstream *encoding, CONST unsigned char *src, { unsigned char c; struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); - unsigned int flags, ch; - enum eol_type eol_type; - - CODING_STREAM_DECOMPOSE (str, flags, ch); - eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); while (n--) { @@ -2675,7 +2738,8 @@ encode_coding_sjis (Lstream *encoding, CONST unsigned char *src, } } - CODING_STREAM_COMPOSE (str, flags, ch); + str->flags = flags; + str->ch = ch; } DEFUN ("decode-shift-jis-char", Fdecode_shift_jis_char, 1, 1, 0, /* @@ -2742,7 +2806,7 @@ Return the corresponding character code in SHIFT-JIS as a cons of two bytes. Since the number of characters in Big5 is larger than maximum characters in Emacs' charset (96x96), it can't be handled as one charset. So, in Emacs, Big5 is divided into two: `charset-big5-1' - and `charset-big5-2'. Both s are TYPE94x94. The former + and `charset-big5-2'. Both s are DIMENSION2_CHARS94. The former contains frequently used characters and the latter contains less frequently used characters. */ @@ -2858,12 +2922,10 @@ decode_coding_big5 (Lstream *decoding, CONST unsigned char *src, unsigned_char_dynarr *dst, unsigned int n) { unsigned char c; - unsigned int flags, ch; - enum eol_type eol_type; struct decoding_stream *str = DECODING_STREAM_DATA (decoding); - - CODING_STREAM_DECOMPOSE (str, flags, ch); - eol_type = str->eol_type; + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = str->eol_type; while (n--) { @@ -2899,7 +2961,8 @@ decode_coding_big5 (Lstream *decoding, CONST unsigned char *src, DECODE_HANDLE_END_OF_CONVERSION (flags, ch, dst); - CODING_STREAM_COMPOSE (str, flags, ch); + str->flags = flags; + str->ch = ch; } /* Convert internally-formatted data to Big5. */ @@ -2910,11 +2973,9 @@ encode_coding_big5 (Lstream *encoding, CONST unsigned char *src, { unsigned char c; struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); - unsigned int flags, ch; - enum eol_type eol_type; - - CODING_STREAM_DECOMPOSE (str, flags, ch); - eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); while (n--) { @@ -2962,7 +3023,8 @@ encode_coding_big5 (Lstream *encoding, CONST unsigned char *src, ch = 0; } - CODING_STREAM_COMPOSE (str, flags, ch); + str->flags = flags; + str->ch = ch; } @@ -3017,46 +3079,694 @@ Return the corresponding character code in Big5. /************************************************************************/ +/* UCS-4 methods */ +/* */ +/* UCS-4 character codes are implemented as nonnegative integers. */ +/* */ +/************************************************************************/ + +Lisp_Object ucs_to_mule_table[65536]; +Lisp_Object mule_to_ucs_table; + +DEFUN ("set-ucs-char", Fset_ucs_char, 2, 2, 0, /* +Map UCS-4 code CODE to Mule character CHARACTER. + +Return T on success, NIL on failure. +*/ + (code, character)) +{ + unsigned int c; + + CHECK_CHAR (character); + CHECK_INT (code); + c = XINT (code); + + if (c < sizeof (ucs_to_mule_table)) + { + ucs_to_mule_table[c] = character; + return Qt; + } + else + return Qnil; +} + +static Lisp_Object +ucs_to_char (unsigned long code) +{ + if (code < sizeof (ucs_to_mule_table)) + { + return ucs_to_mule_table[code]; + } + else if ((0xe00000 <= code) && (code <= 0xe00000 + 94 * 94 * 14)) + { + unsigned int c; + + code -= 0xe00000; + c = code % (94 * 94); + return make_char + (MAKE_CHAR (CHARSET_BY_ATTRIBUTES + (CHARSET_TYPE_94X94, code / (94 * 94) + '@', + CHARSET_LEFT_TO_RIGHT), + c / 94 + 33, c % 94 + 33)); + } + else + return Qnil; +} + +DEFUN ("ucs-char", Fucs_char, 1, 1, 0, /* +Return Mule character corresponding to UCS code CODE (a positive integer). +*/ + (code)) +{ + CHECK_NATNUM (code); + return ucs_to_char (XINT (code)); +} + +DEFUN ("set-char-ucs", Fset_char_ucs, 2, 2, 0, /* +Map Mule character CHARACTER to UCS code CODE (a positive integer). +*/ + (character, code)) +{ + /* #### Isn't this gilding the lily? Fput_char_table checks its args. + Fset_char_ucs is more restrictive on index arg, but should + check code arg in a char_table method. */ + CHECK_CHAR (character); + CHECK_NATNUM (code); + return Fput_char_table (character, code, mule_to_ucs_table); +} + +DEFUN ("char-ucs", Fchar_ucs, 1, 1, 0, /* +Return the UCS code (a positive integer) corresponding to CHARACTER. +*/ + (character)) +{ + return Fget_char_table (character, mule_to_ucs_table); +} + +/* Decode a UCS-4 character into a buffer. If the lookup fails, use + JIS X 0208 double-width `=' instead. + #### do something more appropriate (use blob?) + Danger, Will Robinson! Data loss. Should we signal user? */ +static void +decode_ucs4 (unsigned long ch, unsigned_char_dynarr *dst) +{ + Lisp_Object chr = ucs_to_char (ch); + + if (! NILP (chr)) + { + Bufbyte work[MAX_EMCHAR_LEN]; + int len; + + ch = XCHAR (chr); + len = (ch < 128) ? + simple_set_charptr_emchar (work, ch) : + non_ascii_set_charptr_emchar (work, ch); + Dynarr_add_many (dst, work, len); + } + else + { + Dynarr_add (dst, LEADING_BYTE_JAPANESE_JISX0208); + Dynarr_add (dst, 34 + 128); + Dynarr_add (dst, 46 + 128); + } +} + +static unsigned long +mule_char_to_ucs4 (Lisp_Object charset, + unsigned char h, unsigned char l) +{ + Lisp_Object code + = Fget_char_table (make_char (MAKE_CHAR (charset, h & 127, l & 127)), + mule_to_ucs_table); + + if (INTP (code)) + { + return XINT (code); + } + else if ( (XCHARSET_DIMENSION (charset) == 2) && + (XCHARSET_CHARS (charset) == 94) ) + { + unsigned char final = XCHARSET_FINAL (charset); + + if ( ('@' <= final) && (final < 0x7f) ) + { + return 0xe00000 + (final - '@') * 94 * 94 + + ((h & 127) - 33) * 94 + (l & 127) - 33; + } + else + { + return '?'; + } + } + else + { + return '?'; + } +} + +static void +encode_ucs4 (Lisp_Object charset, + unsigned char h, unsigned char l, unsigned_char_dynarr *dst) +{ + unsigned long code = mule_char_to_ucs4 (charset, h, l); + Dynarr_add (dst, code >> 24); + Dynarr_add (dst, (code >> 16) & 255); + Dynarr_add (dst, (code >> 8) & 255); + Dynarr_add (dst, code & 255); +} + +static int +detect_coding_ucs4 (struct detection_state *st, CONST unsigned char *src, + unsigned int n) +{ + while (n--) + { + int c = *src++; + switch (st->ucs4.in_byte) + { + case 0: + if (c >= 128) + return 0; + else + st->ucs4.in_byte++; + break; + case 3: + st->ucs4.in_byte = 0; + break; + default: + st->ucs4.in_byte++; + } + } + return CODING_CATEGORY_UCS4_MASK; +} + +static void +decode_coding_ucs4 (Lstream *decoding, CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + + while (n--) + { + unsigned char c = *src++; + switch (flags) + { + case 0: + ch = c; + flags = 3; + break; + case 1: + decode_ucs4 ( ( ch << 8 ) | c, dst); + ch = 0; + flags = 0; + break; + default: + ch = ( ch << 8 ) | c; + flags--; + } + } + if (flags & CODING_STATE_END) + DECODE_OUTPUT_PARTIAL_CHAR (ch); + + str->flags = flags; + str->ch = ch; +} + +static void +encode_coding_ucs4 (Lstream *encoding, CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + unsigned char char_boundary = str->iso2022.current_char_boundary; + Lisp_Object charset = str->iso2022.current_charset; + +#ifdef ENABLE_COMPOSITE_CHARS + /* flags for handling composite chars. We do a little switcharoo + on the source while we're outputting the composite char. */ + unsigned int saved_n = 0; + CONST unsigned char *saved_src = NULL; + int in_composite = 0; + + back_to_square_n: +#endif + + while (n--) + { + unsigned char c = *src++; + + if (BYTE_ASCII_P (c)) + { /* Processing ASCII character */ + ch = 0; + encode_ucs4 (Vcharset_ascii, c, 0, dst); + char_boundary = 1; + } + else if (BUFBYTE_LEADING_BYTE_P (c) || BUFBYTE_LEADING_BYTE_P (ch)) + { /* Processing Leading Byte */ + ch = 0; + charset = CHARSET_BY_LEADING_BYTE (c); + if (LEADING_BYTE_PREFIX_P(c)) + ch = c; + char_boundary = 0; + } + else + { /* Processing Non-ASCII character */ + char_boundary = 1; + if (EQ (charset, Vcharset_control_1)) + { + encode_ucs4 (Vcharset_control_1, c, 0, dst); + } + else + { + switch (XCHARSET_REP_BYTES (charset)) + { + case 2: + encode_ucs4 (charset, c, 0, dst); + break; + case 3: + if (XCHARSET_PRIVATE_P (charset)) + { + encode_ucs4 (charset, c, 0, dst); + ch = 0; + } + else if (ch) + { +#ifdef ENABLE_COMPOSITE_CHARS + if (EQ (charset, Vcharset_composite)) + { + if (in_composite) + { + /* #### Bother! We don't know how to + handle this yet. */ + Dynarr_add (dst, 0); + Dynarr_add (dst, 0); + Dynarr_add (dst, 0); + Dynarr_add (dst, '~'); + } + else + { + Emchar emch = MAKE_CHAR (Vcharset_composite, + ch & 0x7F, c & 0x7F); + Lisp_Object lstr = composite_char_string (emch); + saved_n = n; + saved_src = src; + in_composite = 1; + src = XSTRING_DATA (lstr); + n = XSTRING_LENGTH (lstr); + } + } + else +#endif /* ENABLE_COMPOSITE_CHARS */ + { + encode_ucs4(charset, ch, c, dst); + } + ch = 0; + } + else + { + ch = c; + char_boundary = 0; + } + break; + case 4: + if (ch) + { + encode_ucs4 (charset, ch, c, dst); + ch = 0; + } + else + { + ch = c; + char_boundary = 0; + } + break; + default: + abort (); + } + } + } + } + +#ifdef ENABLE_COMPOSITE_CHARS + if (in_composite) + { + n = saved_n; + src = saved_src; + in_composite = 0; + goto back_to_square_n; /* Wheeeeeeeee ..... */ + } +#endif /* ENABLE_COMPOSITE_CHARS */ + + str->flags = flags; + str->ch = ch; + str->iso2022.current_char_boundary = char_boundary; + str->iso2022.current_charset = charset; + + /* Verbum caro factum est! */ +} + + +/************************************************************************/ +/* UTF-8 methods */ +/************************************************************************/ + +static int +detect_coding_utf8 (struct detection_state *st, CONST unsigned char *src, + unsigned int n) +{ + while (n--) + { + unsigned char c = *src++; + switch (st->utf8.in_byte) + { + case 0: + if (c == ISO_CODE_ESC || c == ISO_CODE_SI || c == ISO_CODE_SO) + return 0; + else if (c >= 0xfc) + st->utf8.in_byte = 5; + else if (c >= 0xf8) + st->utf8.in_byte = 4; + else if (c >= 0xf0) + st->utf8.in_byte = 3; + else if (c >= 0xe0) + st->utf8.in_byte = 2; + else if (c >= 0xc0) + st->utf8.in_byte = 1; + else if (c >= 0x80) + return 0; + break; + default: + if ((c & 0xc0) != 0x80) + return 0; + else + st->utf8.in_byte--; + } + } + return CODING_CATEGORY_UTF8_MASK; +} + +static void +decode_coding_utf8 (Lstream *decoding, CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + struct decoding_stream *str = DECODING_STREAM_DATA (decoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = str->eol_type; + + while (n--) + { + unsigned char c = *src++; + switch (flags) + { + case 0: + if ( c >= 0xfc ) + { + ch = c & 0x01; + flags = 5; + } + else if ( c >= 0xf8 ) + { + ch = c & 0x03; + flags = 4; + } + else if ( c >= 0xf0 ) + { + ch = c & 0x07; + flags = 3; + } + else if ( c >= 0xe0 ) + { + ch = c & 0x0f; + flags = 2; + } + else if ( c >= 0xc0 ) + { + ch = c & 0x1f; + flags = 1; + } + else + { + DECODE_HANDLE_EOL_TYPE (eol_type, c, flags, dst); + decode_ucs4 (c, dst); + } + break; + case 1: + ch = ( ch << 6 ) | ( c & 0x3f ); + decode_ucs4 (ch, dst); + ch = 0; + flags = 0; + break; + default: + ch = ( ch << 6 ) | ( c & 0x3f ); + flags--; + } + label_continue_loop:; + } + + if (flags & CODING_STATE_END) + DECODE_OUTPUT_PARTIAL_CHAR (ch); + + str->flags = flags; + str->ch = ch; +} + +static void +encode_utf8 (Lisp_Object charset, + unsigned char h, unsigned char l, unsigned_char_dynarr *dst) +{ + unsigned long code = mule_char_to_ucs4 (charset, h, l); + if ( code <= 0x7f ) + { + Dynarr_add (dst, code); + } + else if ( code <= 0x7ff ) + { + Dynarr_add (dst, (code >> 6) | 0xc0); + Dynarr_add (dst, (code & 0x3f) | 0x80); + } + else if ( code <= 0xffff ) + { + Dynarr_add (dst, (code >> 12) | 0xe0); + Dynarr_add (dst, ((code >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (code & 0x3f) | 0x80); + } + else if ( code <= 0x1fffff ) + { + Dynarr_add (dst, (code >> 18) | 0xf0); + Dynarr_add (dst, ((code >> 12) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (code & 0x3f) | 0x80); + } + else if ( code <= 0x3ffffff ) + { + Dynarr_add (dst, (code >> 24) | 0xf8); + Dynarr_add (dst, ((code >> 18) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 12) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (code & 0x3f) | 0x80); + } + else + { + Dynarr_add (dst, (code >> 30) | 0xfc); + Dynarr_add (dst, ((code >> 24) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 18) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 12) & 0x3f) | 0x80); + Dynarr_add (dst, ((code >> 6) & 0x3f) | 0x80); + Dynarr_add (dst, (code & 0x3f) | 0x80); + } +} + +static void +encode_coding_utf8 (Lstream *encoding, CONST unsigned char *src, + unsigned_char_dynarr *dst, unsigned int n) +{ + struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); + unsigned char char_boundary = str->iso2022.current_char_boundary; + Lisp_Object charset = str->iso2022.current_charset; + +#ifdef ENABLE_COMPOSITE_CHARS + /* flags for handling composite chars. We do a little switcharoo + on the source while we're outputting the composite char. */ + unsigned int saved_n = 0; + CONST unsigned char *saved_src = NULL; + int in_composite = 0; + + back_to_square_n: +#endif /* ENABLE_COMPOSITE_CHARS */ + + while (n--) + { + unsigned char c = *src++; + + if (BYTE_ASCII_P (c)) + { /* Processing ASCII character */ + ch = 0; + if (c == '\n') + { + if (eol_type != EOL_LF && eol_type != EOL_AUTODETECT) + Dynarr_add (dst, '\r'); + if (eol_type != EOL_CR) + Dynarr_add (dst, c); + } + else + encode_utf8 (Vcharset_ascii, c, 0, dst); + char_boundary = 1; + } + else if (BUFBYTE_LEADING_BYTE_P (c) || BUFBYTE_LEADING_BYTE_P (ch)) + { /* Processing Leading Byte */ + ch = 0; + charset = CHARSET_BY_LEADING_BYTE (c); + if (LEADING_BYTE_PREFIX_P(c)) + ch = c; + char_boundary = 0; + } + else + { /* Processing Non-ASCII character */ + char_boundary = 1; + if (EQ (charset, Vcharset_control_1)) + { + encode_utf8 (Vcharset_control_1, c, 0, dst); + } + else + { + switch (XCHARSET_REP_BYTES (charset)) + { + case 2: + encode_utf8 (charset, c, 0, dst); + break; + case 3: + if (XCHARSET_PRIVATE_P (charset)) + { + encode_utf8 (charset, c, 0, dst); + ch = 0; + } + else if (ch) + { +#ifdef ENABLE_COMPOSITE_CHARS + if (EQ (charset, Vcharset_composite)) + { + if (in_composite) + { + /* #### Bother! We don't know how to + handle this yet. */ + encode_utf8 (Vcharset_ascii, '~', 0, dst); + } + else + { + Emchar emch = MAKE_CHAR (Vcharset_composite, + ch & 0x7F, c & 0x7F); + Lisp_Object lstr = composite_char_string (emch); + saved_n = n; + saved_src = src; + in_composite = 1; + src = XSTRING_DATA (lstr); + n = XSTRING_LENGTH (lstr); + } + } + else +#endif /* ENABLE_COMPOSITE_CHARS */ + { + encode_utf8 (charset, ch, c, dst); + } + ch = 0; + } + else + { + ch = c; + char_boundary = 0; + } + break; + case 4: + if (ch) + { + encode_utf8 (charset, ch, c, dst); + ch = 0; + } + else + { + ch = c; + char_boundary = 0; + } + break; + default: + abort (); + } + } + } + } + +#ifdef ENABLE_COMPOSITE_CHARS + if (in_composite) + { + n = saved_n; + src = saved_src; + in_composite = 0; + goto back_to_square_n; /* Wheeeeeeeee ..... */ + } +#endif + + str->flags = flags; + str->ch = ch; + str->iso2022.current_char_boundary = char_boundary; + str->iso2022.current_charset = charset; + + /* Verbum caro factum est! */ +} + + +/************************************************************************/ /* ISO2022 methods */ /************************************************************************/ /* The following note describes the coding system ISO2022 briefly. - Since the intention of this note is to help understanding of the - programs in this file, some parts are NOT ACCURATE or OVERLY + Since the intention of this note is to help understand the + functions in this file, some parts are NOT ACCURATE or OVERLY SIMPLIFIED. For thorough understanding, please refer to the original document of ISO2022. ISO2022 provides many mechanisms to encode several character sets - in 7-bit and 8-bit environments. If one chooses 7-bit environment, - all text is encoded by codes of less than 128. This may make the - encoded text a little bit longer, but the text get more stability - to pass through several gateways (some of them strip off MSB). + in 7-bit and 8-bit environments. For 7-bit environments, all text + is encoded using bytes less than 128. This may make the encoded + text a little bit longer, but the text passes more easily through + several gateways, some of which strip off MSB (Most Signigant Bit). - There are two kind of character sets: control character set and + There are two kinds of character sets: control character set and graphic character set. The former contains control characters such as `newline' and `escape' to provide control functions (control - functions are provided also by escape sequence). The latter + functions are also provided by escape sequences). The latter contains graphic characters such as 'A' and '-'. Emacs recognizes two control character sets and many graphic character sets. - Graphic character sets are classified into one of four types, - according to the dimension and number of characters in the set: - TYPE94, TYPE96, TYPE94x94, and TYPE96x96. In addition, each - character set is assigned an identification byte, unique for each - type, called "final character" (denoted as hereafter). The - of each character set is decided by ECMA(*) when it is registered - in ISO. Code range of is 0x30..0x7F (0x30..0x3F are for - private use only). + Graphic character sets are classified into one of the following + four classes, according to the number of bytes (DIMENSION) and + number of characters in one dimension (CHARS) of the set: + - DIMENSION1_CHARS94 + - DIMENSION1_CHARS96 + - DIMENSION2_CHARS94 + - DIMENSION2_CHARS96 + + In addition, each character set is assigned an identification tag, + unique for each set, called "final character" (denoted as + hereafter). The of each character set is decided by ECMA(*) + when it is registered in ISO. The code range of is 0x30..0x7F + (0x30..0x3F are for private use only). Note (*): ECMA = European Computer Manufacturers Association Here are examples of graphic character set [NAME()]: - o TYPE94 -- ASCII('B'), right-half-of-JISX0201('I'), ... - o TYPE96 -- right-half-of-ISO8859-1('A'), ... - o TYPE94x94 -- GB2312('A'), JISX0208('B'), ... - o TYPE96x96 -- none for the moment + o DIMENSION1_CHARS94 -- ASCII('B'), right-half-of-JISX0201('I'), ... + o DIMENSION1_CHARS96 -- right-half-of-ISO8859-1('A'), ... + o DIMENSION2_CHARS94 -- GB2312('A'), JISX0208('B'), ... + o DIMENSION2_CHARS96 -- none for the moment - A code area (1byte=8bits) is divided into 4 areas, C0, GL, C1, and GR. + A code area (1 byte = 8 bits) is divided into 4 areas, C0, GL, C1, and GR. C0 [0x00..0x1F] -- control character plane 0 GL [0x20..0x7F] -- graphic character plane 0 C1 [0x80..0x9F] -- control character plane 1 @@ -3080,70 +3790,72 @@ Return the corresponding character code in Big5. these invocations and designations are omitted in encoded text. In a 7-bit environment, only GL can be used. - When a graphic character set of TYPE94 or TYPE94x94 is invoked to - GL, codes 0x20 and 0x7F of the GL area work as control characters - SPACE and DEL respectively, and code 0xA0 and 0xFF of GR area - should not be used. + When a graphic character set of CHARS94 is invoked to GL, codes + 0x20 and 0x7F of the GL area work as control characters SPACE and + DEL respectively, and codes 0xA0 and 0xFF of the GR area should not + be used. There are two ways of invocation: locking-shift and single-shift. With locking-shift, the invocation lasts until the next different - invocation, whereas with single-shift, the invocation works only - for the following character and doesn't affect locking-shift. - Invocations are done by the following control characters or escape - sequences. + invocation, whereas with single-shift, the invocation affects the + following character only and doesn't affect the locking-shift + state. Invocations are done by the following control characters or + escape sequences: ---------------------------------------------------------------------- abbrev function cntrl escape seq description ---------------------------------------------------------------------- SI/LS0 (shift-in) 0x0F none invoke G0 into GL SO/LS1 (shift-out) 0x0E none invoke G1 into GL - LS1R (locking-shift-1 right) none ESC '~' invoke G1 into GR LS2 (locking-shift-2) none ESC 'n' invoke G2 into GL - LS2R (locking-shift-2 right) none ESC '}' invoke G2 into GR LS3 (locking-shift-3) none ESC 'o' invoke G3 into GL - LS3R (locking-shift 3 right) none ESC '|' invoke G3 into GR + LS1R (locking-shift-1 right) none ESC '~' invoke G1 into GR (*) + LS2R (locking-shift-2 right) none ESC '}' invoke G2 into GR (*) + LS3R (locking-shift 3 right) none ESC '|' invoke G3 into GR (*) SS2 (single-shift-2) 0x8E ESC 'N' invoke G2 for one char SS3 (single-shift-3) 0x8F ESC 'O' invoke G3 for one char ---------------------------------------------------------------------- - The first four are for locking-shift. Control characters for these - functions are defined by macros ISO_CODE_XXX in `coding.h'. + (*) These are not used by any known coding system. + + Control characters for these functions are defined by macros + ISO_CODE_XXX in `coding.h'. - Designations are done by the following escape sequences. + Designations are done by the following escape sequences: ---------------------------------------------------------------------- escape sequence description ---------------------------------------------------------------------- - ESC '(' designate TYPE94 to G0 - ESC ')' designate TYPE94 to G1 - ESC '*' designate TYPE94 to G2 - ESC '+' designate TYPE94 to G3 - ESC ',' designate TYPE96 to G0 (*) - ESC '-' designate TYPE96 to G1 - ESC '.' designate TYPE96 to G2 - ESC '/' designate TYPE96 to G3 - ESC '$' '(' designate TYPE94x94 to G0 (**) - ESC '$' ')' designate TYPE94x94 to G1 - ESC '$' '*' designate TYPE94x94 to G2 - ESC '$' '+' designate TYPE94x94 to G3 - ESC '$' ',' designate TYPE96x96 to G0 (*) - ESC '$' '-' designate TYPE96x96 to G1 - ESC '$' '.' designate TYPE96x96 to G2 - ESC '$' '/' designate TYPE96x96 to G3 + ESC '(' designate DIMENSION1_CHARS94 to G0 + ESC ')' designate DIMENSION1_CHARS94 to G1 + ESC '*' designate DIMENSION1_CHARS94 to G2 + ESC '+' designate DIMENSION1_CHARS94 to G3 + ESC ',' designate DIMENSION1_CHARS96 to G0 (*) + ESC '-' designate DIMENSION1_CHARS96 to G1 + ESC '.' designate DIMENSION1_CHARS96 to G2 + ESC '/' designate DIMENSION1_CHARS96 to G3 + ESC '$' '(' designate DIMENSION2_CHARS94 to G0 (**) + ESC '$' ')' designate DIMENSION2_CHARS94 to G1 + ESC '$' '*' designate DIMENSION2_CHARS94 to G2 + ESC '$' '+' designate DIMENSION2_CHARS94 to G3 + ESC '$' ',' designate DIMENSION2_CHARS96 to G0 (*) + ESC '$' '-' designate DIMENSION2_CHARS96 to G1 + ESC '$' '.' designate DIMENSION2_CHARS96 to G2 + ESC '$' '/' designate DIMENSION2_CHARS96 to G3 ---------------------------------------------------------------------- - In this list, "TYPE94" means a graphic character set of type TYPE94 - and final character , and etc. + + In this list, "DIMENSION1_CHARS94" means a graphic character set + of dimension 1, chars 94, and final character , etc... Note (*): Although these designations are not allowed in ISO2022, Emacs accepts them on decoding, and produces them on encoding - TYPE96 or TYPE96x96 character set in a coding system which is - characterized as 7-bit environment, non-locking-shift, and - non-single-shift. + CHARS96 character sets in a coding system which is characterized as + 7-bit environment, non-locking-shift, and non-single-shift. Note (**): If is '@', 'A', or 'B', the intermediate character - '(' can be omitted. We call this as "short-form" here after. + '(' can be omitted. We refer to this as "short-form" hereafter. Now you may notice that there are a lot of ways for encoding the same multilingual text in ISO2022. Actually, there exist many - coding systems such as Compound Text (used in X's inter client + coding systems such as Compound Text (used in X11's inter client communication, ISO-2022-JP (used in Japanese internet), ISO-2022-KR (used in Korean internet), EUC (Extended UNIX Code, used in Asian localized platforms), and all of these are variants of ISO2022. @@ -3152,19 +3864,19 @@ Return the corresponding character code in Big5. sequences: ISO6429's direction specification and Emacs' private sequence for specifying character composition. - ISO6429's direction specification takes the following format: + ISO6429's direction specification takes the following form: o CSI ']' -- end of the current direction o CSI '0' ']' -- end of the current direction o CSI '1' ']' -- start of left-to-right text o CSI '2' ']' -- start of right-to-left text The control character CSI (0x9B: control sequence introducer) is - abbreviated to the escape sequence ESC '[' in 7-bit environment. + abbreviated to the escape sequence ESC '[' in a 7-bit environment. - Character composition specification takes the following format: + Character composition specification takes the following form: o ESC '0' -- start character composition o ESC '1' -- end character composition - Since these are not standard escape sequences of any ISO, the use - of them for these meanings is restricted to Emacs only. */ + Since these are not standard escape sequences of any ISO standard, + their use with these meanings is restricted to Emacs only. */ static void reset_iso2022 (Lisp_Object coding_system, struct iso2022_decoder *iso) @@ -3188,8 +3900,10 @@ reset_iso2022 (Lisp_Object coding_system, struct iso2022_decoder *iso) iso->invalid_switch_dir = 0; iso->output_direction_sequence = 0; iso->output_literally = 0; +#ifdef ENABLE_COMPOSITE_CHARS if (iso->composite_chars) Dynarr_reset (iso->composite_chars); +#endif } static int @@ -3317,6 +4031,7 @@ parse_iso2022_esc (Lisp_Object codesys, struct iso2022_decoder *iso, reg = 3; half = 1; goto locking_shift; +#ifdef ENABLE_COMPOSITE_CHARS /**** composite ****/ case '0': @@ -3330,6 +4045,7 @@ parse_iso2022_esc (Lisp_Object codesys, struct iso2022_decoder *iso, *flags = (*flags & CODING_STATE_ISO2022_LOCK) & ~CODING_STATE_COMPOSITE; return 1; +#endif /* ENABLE_COMPOSITE_CHARS */ /**** directionality ****/ @@ -3713,7 +4429,7 @@ postprocess_iso2022_mask (int mask) need to handle the CSI differently. */ static void -restore_left_to_right_direction (struct Lisp_Coding_System *codesys, +restore_left_to_right_direction (Lisp_Coding_System *codesys, unsigned_char_dynarr *dst, unsigned int *flags, int internal_p) @@ -3744,7 +4460,7 @@ restore_left_to_right_direction (struct Lisp_Coding_System *codesys, need to handle the CSI differently. */ static void -ensure_correct_direction (int direction, struct Lisp_Coding_System *codesys, +ensure_correct_direction (int direction, Lisp_Coding_System *codesys, unsigned_char_dynarr *dst, unsigned int *flags, int internal_p) { @@ -3777,18 +4493,21 @@ static void decode_coding_iso2022 (Lstream *decoding, CONST unsigned char *src, unsigned_char_dynarr *dst, unsigned int n) { - unsigned int flags, ch; - enum eol_type eol_type; struct decoding_stream *str = DECODING_STREAM_DATA (decoding); - Lisp_Object coding_system; + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = str->eol_type; +#ifdef ENABLE_COMPOSITE_CHARS unsigned_char_dynarr *real_dst = dst; +#endif + Lisp_Object coding_system; - CODING_STREAM_DECOMPOSE (str, flags, ch); - eol_type = str->eol_type; XSETCODING_SYSTEM (coding_system, str->codesys); +#ifdef ENABLE_COMPOSITE_CHARS if (flags & CODING_STATE_COMPOSITE) dst = str->iso2022.composite_chars; +#endif /* ENABLE_COMPOSITE_CHARS */ while (n--) { @@ -3802,6 +4521,7 @@ decode_coding_iso2022 (Lstream *decoding, CONST unsigned char *src, { switch (str->iso2022.esc) { +#ifdef ENABLE_COMPOSITE_CHARS case ISO_ESC_START_COMPOSITE: if (str->iso2022.composite_chars) Dynarr_reset (str->iso2022.composite_chars); @@ -3820,6 +4540,7 @@ decode_coding_iso2022 (Lstream *decoding, CONST unsigned char *src, Dynarr_add_many (dst, comstr, len); break; } +#endif /* ENABLE_COMPOSITE_CHARS */ case ISO_ESC_LITERAL: DECODE_ADD_BINARY_CHAR (c, dst); @@ -3997,7 +4718,8 @@ decode_coding_iso2022 (Lstream *decoding, CONST unsigned char *src, if (flags & CODING_STATE_END) DECODE_OUTPUT_PARTIAL_CHAR (ch); - CODING_STREAM_COMPOSE (str, flags, ch); + str->flags = flags; + str->ch = ch; } @@ -4009,7 +4731,8 @@ static void iso2022_designate (Lisp_Object charset, unsigned char reg, struct encoding_stream *str, unsigned_char_dynarr *dst) { - CONST char *inter94 = "()*+", *inter96= ",-./"; + static CONST char inter94[] = "()*+"; + static CONST char inter96[] = ",-./"; unsigned int type; unsigned char final; Lisp_Object old_charset = str->iso2022.charset[reg]; @@ -4097,28 +4820,31 @@ encode_coding_iso2022 (Lstream *encoding, CONST unsigned char *src, unsigned_char_dynarr *dst, unsigned int n) { unsigned char charmask, c; - unsigned int flags, ch; - enum eol_type eol_type; unsigned char char_boundary; struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); - struct Lisp_Coding_System *codesys = str->codesys; + unsigned int flags = str->flags; + unsigned int ch = str->ch; + Lisp_Coding_System *codesys = str->codesys; + eol_type_t eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); int i; Lisp_Object charset; int half; +#ifdef ENABLE_COMPOSITE_CHARS /* flags for handling composite chars. We do a little switcharoo on the source while we're outputting the composite char. */ unsigned int saved_n = 0; CONST unsigned char *saved_src = NULL; int in_composite = 0; +#endif /* ENABLE_COMPOSITE_CHARS */ - CODING_STREAM_DECOMPOSE (str, flags, ch); - eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); char_boundary = str->iso2022.current_char_boundary; charset = str->iso2022.current_charset; half = str->iso2022.current_half; +#ifdef ENABLE_COMPOSITE_CHARS back_to_square_n: +#endif while (n--) { c = *src++; @@ -4177,7 +4903,10 @@ encode_coding_iso2022 (Lstream *encoding, CONST unsigned char *src, if (LEADING_BYTE_PREFIX_P(c)) ch = c; else if (!EQ (charset, Vcharset_control_1) - && !EQ (charset, Vcharset_composite)) +#ifdef ENABLE_COMPOSITE_CHARS + && !EQ (charset, Vcharset_composite) +#endif + ) { int reg; @@ -4297,6 +5026,7 @@ encode_coding_iso2022 (Lstream *encoding, CONST unsigned char *src, } else if (ch) { +#ifdef ENABLE_COMPOSITE_CHARS if (EQ (charset, Vcharset_composite)) { if (in_composite) @@ -4320,6 +5050,7 @@ encode_coding_iso2022 (Lstream *encoding, CONST unsigned char *src, } } else +#endif /* ENABLE_COMPOSITE_CHARS */ { Dynarr_add (dst, ch & charmask); Dynarr_add (dst, c & charmask); @@ -4352,6 +5083,7 @@ encode_coding_iso2022 (Lstream *encoding, CONST unsigned char *src, } } +#ifdef ENABLE_COMPOSITE_CHARS if (in_composite) { n = saved_n; @@ -4361,6 +5093,7 @@ encode_coding_iso2022 (Lstream *encoding, CONST unsigned char *src, Dynarr_add (dst, '1'); /* end composing */ goto back_to_square_n; /* Wheeeeeeeee ..... */ } +#endif /* ENABLE_COMPOSITE_CHARS */ if (char_boundary && flags & CODING_STATE_END) { @@ -4374,7 +5107,8 @@ encode_coding_iso2022 (Lstream *encoding, CONST unsigned char *src, } } - CODING_STREAM_COMPOSE (str, flags, ch); + str->flags = flags; + str->ch = ch; str->iso2022.current_char_boundary = char_boundary; str->iso2022.current_charset = charset; str->iso2022.current_half = half; @@ -4395,12 +5129,10 @@ decode_coding_no_conversion (Lstream *decoding, CONST unsigned char *src, unsigned_char_dynarr *dst, unsigned int n) { unsigned char c; - unsigned int flags, ch; - enum eol_type eol_type; struct decoding_stream *str = DECODING_STREAM_DATA (decoding); - - CODING_STREAM_DECOMPOSE (str, flags, ch); - eol_type = str->eol_type; + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = str->eol_type; while (n--) { @@ -4413,7 +5145,8 @@ decode_coding_no_conversion (Lstream *decoding, CONST unsigned char *src, DECODE_HANDLE_END_OF_CONVERSION (flags, ch, dst); - CODING_STREAM_COMPOSE (str, flags, ch); + str->flags = flags; + str->ch = ch; } static void @@ -4422,11 +5155,9 @@ encode_coding_no_conversion (Lstream *encoding, CONST unsigned char *src, { unsigned char c; struct encoding_stream *str = ENCODING_STREAM_DATA (encoding); - unsigned int flags, ch; - enum eol_type eol_type; - - CODING_STREAM_DECOMPOSE (str, flags, ch); - eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); + unsigned int flags = str->flags; + unsigned int ch = str->ch; + eol_type_t eol_type = CODING_SYSTEM_EOL_TYPE (str->codesys); while (n--) { @@ -4468,7 +5199,8 @@ encode_coding_no_conversion (Lstream *encoding, CONST unsigned char *src, } } - CODING_STREAM_COMPOSE (str, flags, ch); + str->flags = flags; + str->ch = ch; } @@ -4670,12 +5402,18 @@ syms_of_mule_coding (void) DEFSUBR (Fencode_shift_jis_char); DEFSUBR (Fdecode_big5_char); DEFSUBR (Fencode_big5_char); + DEFSUBR (Fset_ucs_char); + DEFSUBR (Fucs_char); + DEFSUBR (Fset_char_ucs); + DEFSUBR (Fchar_ucs); #endif /* MULE */ defsymbol (&Qcoding_system_p, "coding-system-p"); defsymbol (&Qno_conversion, "no-conversion"); #ifdef MULE defsymbol (&Qbig5, "big5"); defsymbol (&Qshift_jis, "shift-jis"); + defsymbol (&Qucs4, "ucs-4"); + defsymbol (&Qutf8, "utf-8"); defsymbol (&Qccl, "ccl"); defsymbol (&Qiso2022, "iso2022"); #endif /* MULE */ @@ -4719,6 +5457,10 @@ syms_of_mule_coding (void) "shift-jis"); defsymbol (&coding_category_symbol[CODING_CATEGORY_BIG5], "big5"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_UCS4], + "ucs-4"); + defsymbol (&coding_category_symbol[CODING_CATEGORY_UTF8], + "utf-8"); defsymbol (&coding_category_symbol[CODING_CATEGORY_ISO_7], "iso-7"); defsymbol (&coding_category_symbol[CODING_CATEGORY_ISO_8_DESIGNATE], @@ -4872,4 +5614,15 @@ complex_vars_of_mule_coding (void) /* Need this for bootstrapping */ coding_category_system[CODING_CATEGORY_NO_CONVERSION] = Fget_coding_system (Qno_conversion); + +#ifdef MULE + { + unsigned int i; + + for (i = 0; i < 65536; i++) + ucs_to_mule_table[i] = Qnil; + } + staticpro (&mule_to_ucs_table); + mule_to_ucs_table = Fmake_char_table(Qgeneric); +#endif /* MULE */ } diff --git a/src/file-coding.h b/src/file-coding.h index a29e3ec..38d591b 100644 --- a/src/file-coding.h +++ b/src/file-coding.h @@ -42,6 +42,8 @@ enum coding_system_type CODESYS_ISO2022, /* Any ISO2022-compliant coding system. Includes JIS, EUC, CTEXT */ CODESYS_BIG5, /* BIG5 (used for Taiwanese). */ + CODESYS_UCS4, /* ISO 10646 UCS-4 */ + CODESYS_UTF8, /* ISO 10646 UTF-8 */ CODESYS_CCL, /* Converter written in CCL. */ #endif CODESYS_NO_CONVERSION /* "No conversion"; used for binary files. @@ -61,6 +63,7 @@ enum eol_type EOL_CRLF, EOL_CR }; +typedef enum eol_type eol_type_t; #ifdef MULE typedef struct charset_conversion_spec charset_conversion_spec; @@ -131,6 +134,7 @@ struct Lisp_Coding_System } ccl; #endif }; +typedef struct Lisp_Coding_System Lisp_Coding_System; DECLARE_LRECORD (coding_system, struct Lisp_Coding_System); #define XCODING_SYSTEM(x) XRECORD (x, coding_system, struct Lisp_Coding_System) @@ -245,6 +249,7 @@ EXFUN (Fset_coding_category_system, 2); EXFUN (Fset_coding_priority_list, 1); EXFUN (Fsubsidiary_coding_system, 2); +extern Lisp_Object Qucs4, Qutf8; extern Lisp_Object Qbig5, Qbuffer_file_coding_system, Qccl, Qcharset_g0; extern Lisp_Object Qcharset_g1, Qcharset_g2, Qcharset_g3, Qcoding_system_error; extern Lisp_Object Qcoding_system_p, Qcr, Qcrlf, Qctext, Qdecode, Qencode; @@ -305,20 +310,26 @@ extern Lisp_Object Vterminal_coding_system; CODING_STATE_SS2 overrides; but this probably indicates an error in the text encoding. */ +#ifdef ENABLE_COMPOSITE_CHARS #define CODING_STATE_COMPOSITE (1 << 8) /* If set, we're currently processing a composite character (i.e. a character constructed by overstriking two or more characters). */ +#endif /* ENABLE_COMPOSITE_CHARS */ /* CODING_STATE_ISO2022_LOCK is the mask of flags that remain on until explicitly turned off when in the ISO2022 encoder/decoder. Other flags are turned off at the end of processing each character or escape sequence. */ +#ifdef ENABLE_COMPOSITE_CHARS # define CODING_STATE_ISO2022_LOCK \ (CODING_STATE_END | CODING_STATE_COMPOSITE | CODING_STATE_R2L) -#define CODING_STATE_BIG5_LOCK \ - CODING_STATE_END +#else +# define CODING_STATE_ISO2022_LOCK (CODING_STATE_END | CODING_STATE_R2L) +#endif + +#define CODING_STATE_BIG5_LOCK CODING_STATE_END /* Flags indicating what we've seen so far when parsing an ISO2022 escape sequence. */ @@ -361,16 +372,15 @@ enum iso_esc_flag starts a directionality-control sequence. The next character must be 0, 1, 2, or ]. */ - ISO_ESC_5_11_0, /* We've seen 0x9B 0. The next - character must be ]. */ - ISO_ESC_5_11_1, /* We've seen 0x9B 1. The next - character must be ]. */ - ISO_ESC_5_11_2, /* We've seen 0x9B 2. The next - character must be ]. */ + ISO_ESC_5_11_0, /* We've seen 0x9B 0. The next character must be ]. */ + ISO_ESC_5_11_1, /* We've seen 0x9B 1. The next character must be ]. */ + ISO_ESC_5_11_2, /* We've seen 0x9B 2. The next character must be ]. */ /* Full sequences. */ +#ifdef ENABLE_COMPOSITE_CHARS ISO_ESC_START_COMPOSITE, /* Private usage for START COMPOSING */ - ISO_ESC_END_COMPOSITE, /* Private usage for END COMPOSING */ + ISO_ESC_END_COMPOSITE, /* Private usage for END COMPOSING */ +#endif /* ENABLE_COMPOSITE_CHARS */ ISO_ESC_SINGLE_SHIFT, /* We've seen a complete single-shift sequence. */ ISO_ESC_LOCKING_SHIFT,/* We've seen a complete locking-shift sequence. */ ISO_ESC_DESIGNATE, /* We've seen a complete designation sequence. */ @@ -393,21 +403,6 @@ enum iso_esc_flag #define ISO_CODE_CSI 0x9B /* control-sequence-introduce */ #endif /* MULE */ -/* Macros to access an encoding stream or decoding stream */ - -#define CODING_STREAM_DECOMPOSE(str, flags, ch) \ -do { \ - flags = (str)->flags; \ - ch = (str)->ch; \ -} while (0) - -#define CODING_STREAM_COMPOSE(str, flags, ch) \ -do { \ - (str)->flags = flags; \ - (str)->ch = ch; \ -} while (0) - - /* For detecting the encoding of text */ enum coding_category_type { @@ -426,6 +421,8 @@ enum coding_category_type two-dimension characters in the upper half. */ CODING_CATEGORY_ISO_LOCK_SHIFT, /* ISO2022 system using locking shift */ CODING_CATEGORY_BIG5, + CODING_CATEGORY_UCS4, + CODING_CATEGORY_UTF8, #endif /* MULE */ CODING_CATEGORY_NO_CONVERSION }; @@ -447,6 +444,10 @@ enum coding_category_type (1 << CODING_CATEGORY_ISO_LOCK_SHIFT) #define CODING_CATEGORY_BIG5_MASK \ (1 << CODING_CATEGORY_BIG5) +#define CODING_CATEGORY_UCS4_MASK \ + (1 << CODING_CATEGORY_UCS4) +#define CODING_CATEGORY_UTF8_MASK \ + (1 << CODING_CATEGORY_UTF8) #endif #define CODING_CATEGORY_NO_CONVERSION_MASK \ (1 << CODING_CATEGORY_NO_CONVERSION) @@ -505,7 +506,9 @@ void determine_real_coding_system (Lstream *stream, Lisp_Object *codesys_in_out, #ifndef MULE #define MIN_LEADING_BYTE 0x80 /* These need special treatment in a string and/or character */ +#ifdef ENABLE_COMPOSITE_CHARS #define LEADING_BYTE_COMPOSITE 0x80 /* for a composite character */ +#endif #define LEADING_BYTE_CONTROL_1 0x8F /* represent normal 80-9F */ #define LEADING_BYTE_LATIN_ISO8859_1 0x81 /* Right half of ISO 8859-1 */ #define BYTE_C1_P(c) ((unsigned int) ((unsigned int) (c) - 0x80) < 0x20) diff --git a/src/fns.c b/src/fns.c index c9d19f6..c1fa079 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3562,11 +3562,6 @@ base64_encode_1 (Lstream *istream, Bufbyte *to, int line_break) *e++ = base64_value_to_char[0x3f & c]; } - /* Complete last partial line. */ - if (line_break) - if (counter > 0) - *e++ = '\n'; - return e - to; } #undef ADVANCE_INPUT @@ -3755,10 +3750,10 @@ into shorter lines. return make_int (encoded_length); } -DEFUN ("base64-encode-string", Fbase64_encode_string, 1, 1, 0, /* +DEFUN ("base64-encode-string", Fbase64_encode_string, 1, 2, 0, /* Base64 encode STRING and return the result. */ - (string)) + (string, no_line_break)) { Charcount allength, length; Bytind encoded_length; @@ -3769,11 +3764,13 @@ Base64 encode STRING and return the result. CHECK_STRING (string); length = XSTRING_CHAR_LENGTH (string); - allength = length + length/3 + 1 + 6; + allength = length + length/3 + 1; + allength += allength / MIME_LINE_LENGTH + 1 + 6; input = make_lisp_string_input_stream (string, 0, -1); XMALLOC_OR_ALLOCA (encoded, allength, Bufbyte); - encoded_length = base64_encode_1 (XLSTREAM (input), encoded, 0); + encoded_length = base64_encode_1 (XLSTREAM (input), encoded, + NILP (no_line_break)); if (encoded_length > allength) abort (); Lstream_delete (XLSTREAM (input)); diff --git a/src/frame-x.c b/src/frame-x.c index a5d62c6..40a75f7 100644 --- a/src/frame-x.c +++ b/src/frame-x.c @@ -2623,6 +2623,8 @@ x_focus_on_frame (struct frame *f) static void x_delete_frame (struct frame *f) { + Display *dpy; + #ifndef HAVE_SESSION if (FRAME_X_TOP_LEVEL_FRAME_P (f)) x_wm_maybe_move_wm_command (f); @@ -2633,6 +2635,7 @@ x_delete_frame (struct frame *f) #endif /* HAVE_CDE */ assert (FRAME_X_SHELL_WIDGET (f) != 0); + dpy = XtDisplay (FRAME_X_SHELL_WIDGET (f)); #ifdef EXTERNAL_WIDGET expect_x_error (XtDisplay (FRAME_X_SHELL_WIDGET (f))); @@ -2647,7 +2650,7 @@ x_delete_frame (struct frame *f) XtDestroyWidget (FRAME_X_SHELL_WIDGET (f)); /* make sure the windows are really gone! */ /* ### Is this REALLY necessary? */ - XFlush (XtDisplay (FRAME_X_SHELL_WIDGET (f))); + XFlush (dpy); #endif /* EXTERNAL_WIDGET */ FRAME_X_SHELL_WIDGET (f) = 0; diff --git a/src/free-hook.c b/src/free-hook.c index af1df69..cac4a86 100644 --- a/src/free-hook.c +++ b/src/free-hook.c @@ -418,7 +418,8 @@ void *(*__realloc_hook)(void *, size_t) = check_realloc; /* Note: There is no more input blocking in XEmacs */ typedef enum { block_type, unblock_type, totally_type, - gcpro1_type, gcpro2_type, gcpro3_type, gcpro4_type, ungcpro_type + gcpro1_type, gcpro2_type, gcpro3_type, gcpro4_type, gcpro5_type, + ungcpro_type } blocktype; struct block_input_history_struct @@ -431,7 +432,7 @@ struct block_input_history_struct typedef struct block_input_history_struct block_input_history; -#endif +#endif /* DEBUG_INPUT_BLOCKING || DEBUG_GCPRO */ #ifdef DEBUG_INPUT_BLOCKING @@ -469,7 +470,7 @@ note_block (char *file, int line, blocktype type) blhistptr = 0; } -#endif +#endif /* DEBUG_INPUT_BLOCKING */ #ifdef DEBUG_GCPRO @@ -481,8 +482,6 @@ block_input_history gcprohist[GCPROHISTLIMIT]; static void log_gcpro (char *file, int line, struct gcpro *value, blocktype type) { - FRAME start_frame; - if (type == ungcpro_type) { if (value == gcprolist) goto OK; @@ -569,6 +568,9 @@ debug_ungcpro (char *file, int line, struct gcpro *gcpro1) gcprolist = gcpro1->next; } + +/* To be called from the debugger */ +void show_gcprohist (void); void show_gcprohist (void) { @@ -591,4 +593,4 @@ show_gcprohist (void) fflush (stdout); } -#endif +#endif /* DEBUG_GCPRO */ diff --git a/src/glyphs-msw.c b/src/glyphs-msw.c index 70b948a..e4d6a16 100644 --- a/src/glyphs-msw.c +++ b/src/glyphs-msw.c @@ -686,6 +686,7 @@ extract_xpm_color_names (Lisp_Object device, COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (XCDR (cons))); GET_C_STRING_OS_DATA_ALLOCA (XCAR (cons), colortbl[j].name); + colortbl[j].name = xstrdup (colortbl[j].name); /* mustn't lose this when we return */ free_cons (XCONS (cons)); cons = results; results = XCDR (results); @@ -884,7 +885,13 @@ mswindows_xpm_instantiate (Lisp_Object image_instance, } if (color_symbols) - xfree(color_symbols); + { + while (nsymbols--) + { + xfree (color_symbols[nsymbols].name); + } + xfree(color_symbols); + } /* build a bitmap from the eimage */ if (!(bmp_info=convert_EImage_to_DIBitmap (device, width, height, eimage, diff --git a/src/glyphs.h b/src/glyphs.h index 8535ab4..12f6098 100644 --- a/src/glyphs.h +++ b/src/glyphs.h @@ -127,23 +127,23 @@ struct image_instantiator_methods /***** Calling an image-instantiator method *****/ -#define HAS_IIFORMAT_METH_P(mstruc, m) ((mstruc)->m##_method) +#define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0) #define IIFORMAT_METH(mstruc, m, args) (((mstruc)->m##_method) args) /* Call a void-returning specifier method, if it exists */ -#define MAYBE_IIFORMAT_METH(mstruc, m, args) \ -if (mstruc) \ -do { \ - struct image_instantiator_methods *maybe_iiformat_meth_mstruc = (mstruc); \ - if (HAS_IIFORMAT_METH_P (maybe_iiformat_meth_mstruc, m)) \ - IIFORMAT_METH (maybe_iiformat_meth_mstruc, m, args); \ +#define MAYBE_IIFORMAT_METH(mstruc, m, args) \ +do { \ + struct image_instantiator_methods *MIM_mstruc = (mstruc); \ + if (MIM_mstruc && HAS_IIFORMAT_METH_P (MIM_mstruc, m)) \ + IIFORMAT_METH (MIM_mstruc, m, args); \ } while (0) -#define MAYBE_IIFORMAT_DEVMETH(device, mstruc, m, args) \ -do { \ - struct image_instantiator_methods *_mstruc = decode_ii_device (device, mstruc); \ - if (_mstruc) \ - MAYBE_IIFORMAT_METH(_mstruc, m, args); \ +#define MAYBE_IIFORMAT_DEVMETH(device, mstruc, m, args) \ +do { \ + struct image_instantiator_methods *MID_mstruc = \ + decode_ii_device (device, mstruc); \ + if (MID_mstruc) \ + MAYBE_IIFORMAT_METH(MID_mstruc, m, args); \ } while (0) diff --git a/src/menubar-msw.c b/src/menubar-msw.c index ff707cb..c56dc36 100644 --- a/src/menubar-msw.c +++ b/src/menubar-msw.c @@ -143,7 +143,7 @@ displayable_menu_item (struct gui_item* pgui_item, int bar_p) if (ll+2 >= MAX_MENUITEM_LENGTH) signal_simple_error ("Menu item produces too long displayable string", pgui_item->name); - memmove (ptr+1, ptr, ll-(ptr-buf)); + memmove (ptr+1, ptr, (ll-(ptr-buf))+1); ll++; ptr+=2; } diff --git a/src/mule-charset.c b/src/mule-charset.c index 9c5499b..96b01bc 100644 --- a/src/mule-charset.c +++ b/src/mule-charset.c @@ -58,6 +58,8 @@ Lisp_Object Vcharset_chinese_big5_2; Lisp_Object Vcharset_chinese_cns11643_1; Lisp_Object Vcharset_chinese_cns11643_2; Lisp_Object Vcharset_korean_ksc5601; + +#ifdef ENABLE_COMPOSITE_CHARS Lisp_Object Vcharset_composite; /* Hash tables for composite chars. One maps string representing @@ -66,15 +68,17 @@ Lisp_Object Vcharset_composite; Lisp_Object Vcomposite_char_char2string_hash_table; Lisp_Object Vcomposite_char_string2char_hash_table; +static int composite_char_row_next; +static int composite_char_col_next; + +#endif /* ENABLE_COMPOSITE_CHARS */ + /* Table of charsets indexed by leading byte. */ Lisp_Object charset_by_leading_byte[128]; /* Table of charsets indexed by type/final-byte/direction. */ Lisp_Object charset_by_attributes[4][128][2]; -static int composite_char_row_next; -static int composite_char_col_next; - /* Table of number of bytes in the string representation of a character indexed by the first byte of that representation. @@ -278,6 +282,7 @@ non_ascii_valid_char_p (Emchar ch) if (f2 < 0x20 || f3 < 0x20) return 0; +#ifdef ENABLE_COMPOSITE_CHARS if (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE == LEADING_BYTE_COMPOSITE) { if (UNBOUNDP (Fgethash (make_int (ch), @@ -286,6 +291,7 @@ non_ascii_valid_char_p (Emchar ch) return 0; return 1; } +#endif /* ENABLE_COMPOSITE_CHARS */ if (f2 != 0x20 && f2 != 0x7F && f3 != 0x20 && f3 != 0x7F) return 1; @@ -1066,6 +1072,7 @@ N defaults to 0 if omitted. } +#ifdef ENABLE_COMPOSITE_CHARS /************************************************************************/ /* composite character functions */ /************************************************************************/ @@ -1111,7 +1118,7 @@ composite_char_string (Emchar ch) return str; } -DEFUN ("make-composite-char", Fmake_composite_char, 1, 1, 0, /* +xxDEFUN ("make-composite-char", Fmake_composite_char, 1, 1, 0, /* Convert a string into a single composite character. The character is the result of overstriking all the characters in the string. @@ -1123,7 +1130,7 @@ the string. XSTRING_LENGTH (string))); } -DEFUN ("composite-char-string", Fcomposite_char_string, 1, 1, 0, /* +xxDEFUN ("composite-char-string", Fcomposite_char_string, 1, 1, 0, /* Return a string of the characters comprising a composite character. */ (ch)) @@ -1136,6 +1143,7 @@ Return a string of the characters comprising a composite character. signal_simple_error ("Must be composite char", ch); return composite_char_string (emch); } +#endif /* ENABLE_COMPOSITE_CHARS */ /************************************************************************/ @@ -1165,8 +1173,10 @@ syms_of_mule_charset (void) DEFSUBR (Fchar_charset); DEFSUBR (Fchar_octet); +#ifdef ENABLE_COMPOSITE_CHARS DEFSUBR (Fmake_composite_char); DEFSUBR (Fcomposite_char_string); +#endif defsymbol (&Qcharsetp, "charsetp"); defsymbol (&Qregistry, "registry"); @@ -1396,6 +1406,8 @@ complex_vars_of_mule_charset (void) CHARSET_LEFT_TO_RIGHT, build_string ("KS C5601 (Hangul and Korean Hanja)"), build_string ("ksc5601")); + +#ifdef ENABLE_COMPOSITE_CHARS /* #### For simplicity, we put composite chars into a 96x96 charset. This is going to lead to problems because you can run out of room, esp. as we don't yet recycle numbers. */ @@ -1415,5 +1427,6 @@ complex_vars_of_mule_charset (void) make_lisp_hash_table (500, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); staticpro (&Vcomposite_char_string2char_hash_table); staticpro (&Vcomposite_char_char2string_hash_table); +#endif /* ENABLE_COMPOSITE_CHARS */ } diff --git a/src/mule-charset.h b/src/mule-charset.h index ee7dcc2..b9faed8 100644 --- a/src/mule-charset.h +++ b/src/mule-charset.h @@ -327,6 +327,8 @@ Boston, MA 02111-1307, USA. */ #define MIN_LEADING_BYTE 0x80 /* These need special treatment in a string and/or character */ #define LEADING_BYTE_ASCII 0x8E /* Omitted in a buffer */ +#ifdef ENABLE_COMPOSITE_CHARS +#endif #define LEADING_BYTE_COMPOSITE 0x80 /* for a composite character */ #define LEADING_BYTE_CONTROL_1 0x8F /* represent normal 80-9F */ @@ -676,7 +678,14 @@ CHAR_LEADING_BYTE (Emchar c) else if (c < MIN_CHAR_COMPOSITION) return CHAR_FIELD1 (c) + FIELD1_TO_PRIVATE_LEADING_BYTE; else - return LEADING_BYTE_COMPOSITE; + { +#ifdef ENABLE_COMPOSITE_CHARS + return LEADING_BYTE_COMPOSITE; +#else + abort(); + return 0; +#endif /* ENABLE_COMPOSITE_CHARS */ + } } #define CHAR_CHARSET(c) CHARSET_BY_LEADING_BYTE (CHAR_LEADING_BYTE (c)) @@ -697,8 +706,10 @@ MAKE_CHAR (Lisp_Object charset, int c1, int c2) return c1; else if (EQ (charset, Vcharset_control_1)) return c1 | 0x80; +#ifdef ENABLE_COMPOSITE_CHARS else if (EQ (charset, Vcharset_composite)) return (0x1F << 14) | ((c1) << 7) | (c2); +#endif else if (XCHARSET_DIMENSION (charset) == 1) return ((XCHARSET_LEADING_BYTE (charset) - FIELD2_TO_OFFICIAL_LEADING_BYTE) << 7) | (c1); @@ -738,12 +749,14 @@ breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2) +#ifdef ENABLE_COMPOSITE_CHARS /************************************************************************/ /* Composite characters */ /************************************************************************/ Emchar lookup_composite_char (Bufbyte *str, int len); Lisp_Object composite_char_string (Emchar ch); +#endif /* ENABLE_COMPOSITE_CHARS */ /************************************************************************/ diff --git a/src/opaque.c b/src/opaque.c index d15bac5..c93805a 100644 --- a/src/opaque.c +++ b/src/opaque.c @@ -56,8 +56,9 @@ Lisp_Object Vopaque_ptr_free_list; static Lisp_Object mark_opaque (Lisp_Object obj, void (*markobj) (Lisp_Object)) { - Lisp_Opaque *p = XOPAQUE (obj); - Lisp_Object size_or_chain = p->size_or_chain; + Lisp_Opaque *p = XOPAQUE (obj); + /* Egcs 1.1.1 sometimes crashes on INTP (p->size_or_chain) */ + Lisp_Object size_or_chain = p->size_or_chain; #ifdef ERROR_CHECK_GC if (!in_opaque_list_marking) /* size is non-int for objects on an opaque free list. We sure @@ -81,10 +82,12 @@ static void print_opaque (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) { CONST Lisp_Opaque *p = XOPAQUE (obj); + /* Egcs 1.1.1 sometimes crashes on INTP (p->size_or_chain) */ + Lisp_Object size_or_chain = p->size_or_chain; char buf[200]; char size_buf[50]; - if (INTP (p->size_or_chain)) + if (INTP (size_or_chain)) sprintf (size_buf, "size=%lu", (unsigned long) OPAQUE_SIZE (p)); else sprintf (size_buf, "freed"); @@ -98,8 +101,10 @@ static size_t sizeof_opaque (CONST void *header) { CONST Lisp_Opaque *p = (CONST Lisp_Opaque *) header; + /* Egcs 1.1.1 sometimes crashes on INTP (p->size_or_chain) */ + Lisp_Object size_or_chain = p->size_or_chain; return offsetof (Lisp_Opaque, data) - + (GC_INTP (p->size_or_chain) ? XINT (p->size_or_chain) : 0); + + (GC_INTP (size_or_chain) ? XINT (size_or_chain) : 0); } /* Return an opaque object of size SIZE. @@ -133,14 +138,21 @@ make_opaque (size_t size, CONST void *data) static int equal_opaque (Lisp_Object obj1, Lisp_Object obj2, int depth) { - size_t size; #ifdef DEBUG_XEMACS - assert (!XOPAQUE_MARKFUN (obj1) && !XOPAQUE_MARKFUN (obj2)); - assert (INTP (XOPAQUE (obj1)->size_or_chain)); - assert (INTP (XOPAQUE (obj2)->size_or_chain)); + { + /* Egcs 1.1.1 sometimes crashes on INTP (p->size_or_chain) */ + Lisp_Object size_or_chain_1 = XOPAQUE (obj1)->size_or_chain; + Lisp_Object size_or_chain_2 = XOPAQUE (obj2)->size_or_chain; + assert (INTP (size_or_chain_1)); + assert (INTP (size_or_chain_2)); + assert (!XOPAQUE_MARKFUN (obj1) && !XOPAQUE_MARKFUN (obj2)); + } #endif - return ((size = XOPAQUE_SIZE (obj1)) == XOPAQUE_SIZE (obj2) && - !memcmp (XOPAQUE_DATA (obj1), XOPAQUE_DATA (obj2), size)); + { + size_t size; + return ((size = XOPAQUE_SIZE (obj1)) == XOPAQUE_SIZE (obj2) && + !memcmp (XOPAQUE_DATA (obj1), XOPAQUE_DATA (obj2), size)); + } } /* This will not work correctly for opaques with subobjects! */ @@ -149,11 +161,15 @@ static unsigned long hash_opaque (Lisp_Object obj, int depth) { #ifdef DEBUG_XEMACS - assert (!XOPAQUE_MARKFUN (obj)); - assert (INTP (XOPAQUE (obj)->size_or_chain)); + { + /* Egcs 1.1.1 sometimes crashes on INTP (p->size_or_chain) */ + Lisp_Object size_or_chain = XOPAQUE (obj)->size_or_chain; + assert (INTP (size_or_chain)); + assert (!XOPAQUE_MARKFUN (obj)); + } #endif if (XOPAQUE_SIZE (obj) == sizeof (unsigned long)) - return *((unsigned long *) XOPAQUE_DATA(obj)); + return *((unsigned long *) XOPAQUE_DATA (obj)); else return memory_hash (XOPAQUE_DATA (obj), XOPAQUE_SIZE (obj)); } @@ -223,7 +239,11 @@ free_managed_opaque (Lisp_Object opaque_list, Lisp_Object opaque) Lisp_Opaque_List *li = XOPAQUE_LIST (opaque_list); #ifdef ERROR_CHECK_GC - assert (INTP (XOPAQUE (opaque)->size_or_chain)); + { + /* Egcs 1.1.1 sometimes crashes on INTP (p->size_or_chain) */ + Lisp_Object size_or_chain = XOPAQUE (opaque)->size_or_chain; + assert (INTP (size_or_chain)); + } #endif XOPAQUE (opaque)->size_or_chain = li->free; li->free = opaque; diff --git a/src/print.c b/src/print.c index a32b249..663e3c4 100644 --- a/src/print.c +++ b/src/print.c @@ -1461,9 +1461,9 @@ the output also will be logged to this file. if (DEVICE_TTY_P (XDEVICE (device))) file = 0; else if (!NILP (stdout_p)) - file = CONSOLE_STREAM_DATA (con)->outfd; + file = CONSOLE_STREAM_DATA (con)->out; else - file = CONSOLE_STREAM_DATA (con)->errfd; + file = CONSOLE_STREAM_DATA (con)->err; } if (STRINGP (char_or_string)) diff --git a/src/sound.c b/src/sound.c index 764e147..170efbd 100644 --- a/src/sound.c +++ b/src/sound.c @@ -69,7 +69,7 @@ DEFUN ("play-sound-file", Fplay_sound_file, 1, 3, "fSound file name: ", /* Play the named sound file on DEVICE's speaker at the specified volume \(0-100, default specified by the `bell-volume' variable). On Unix machines the sound file must be in the Sun/NeXT U-LAW format -except under Linux where WAV files are also supported. On Microsoft +except under Linux where WAV files are also supported. On Microsoft Windows the sound file must be in WAV format. DEVICE defaults to the selected device. */ @@ -326,14 +326,12 @@ Return t if DEVICE is able to play sound. Defaults to selected device. */ (device)) { - struct device *d = decode_device(device); - #ifdef HAVE_NAS_SOUND - if (DEVICE_CONNECTED_TO_NAS_P (d)) + if (DEVICE_CONNECTED_TO_NAS_P (decode_device (device))) return Qt; #endif #ifdef HAVE_NATIVE_SOUND - if (DEVICE_ON_CONSOLE_P (d)) + if (DEVICE_ON_CONSOLE_P (decode_device (device))) return Qt; #endif return Qnil; diff --git a/src/sysdep.c b/src/sysdep.c index a24221d..528665f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1904,7 +1904,7 @@ reset_one_device (struct device *d) else #endif if (DEVICE_STREAM_P (d)) - fflush (CONSOLE_STREAM_DATA (XCONSOLE (DEVICE_CONSOLE (d)))->outfd); + fflush (CONSOLE_STREAM_DATA (XCONSOLE (DEVICE_CONSOLE (d)))->out); #if defined(SIGIO) && !defined(BROKEN_SIGIO) if (!DEVICE_STREAM_P (d)) { diff --git a/src/systime.h b/src/systime.h index 666c8c7..40c559b 100644 --- a/src/systime.h +++ b/src/systime.h @@ -34,6 +34,13 @@ Boston, MA 02111-1307, USA. */ #endif #endif +/* select() is supposed to be (Unix98) defined in sys/time.h, + but FreeBSD and Irix 5 put it in unistd.h instead. + If we have it, including it can't hurt. */ +#ifdef HAVE_UNISTD_H +#include +#endif + #if defined(WINDOWSNT) && defined(HAVE_X_WINDOWS) /* Provides gettimeofday etc */ #include diff --git a/tests/ChangeLog b/tests/ChangeLog index a975fc5..5e76e0a 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +1999-03-12 XEmacs Build Bot + + * XEmacs 21.2.13 is released + 1999-03-05 XEmacs Build Bot * XEmacs 21.2.12 is released