From: Miles Bader Date: Mon, 9 Jul 2007 08:00:55 +0000 (+0000) Subject: Merge from emacs--devo--0 X-Git-Tag: emacs-pretest-23.0.90~8295^2~380 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1011c48763982d02797a7058556d29f639f6efca;p=emacs.git Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 803-805) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-227 --- 1011c48763982d02797a7058556d29f639f6efca diff --cc configure index 7a44b81a3ca,c91f6431e04..2b767f3dc5e --- a/configure +++ b/configure @@@ -1345,10 -1338,8 +1346,10 @@@ Optional Packages --with-xpm use -lXpm for displaying XPM images --with-jpeg use -ljpeg for displaying JPEG images --with-tiff use -ltiff for displaying TIFF images - --with-gif use -lungif (or -lgif) for displaying GIF images + --with-gif use -lgif (or -lungif) for displaying GIF images --with-png use -lpng for displaying PNG images + --with-freetype use -lfreetype for local fonts support + --with-xft use -lXft for anti aliased fonts --with-gpm use -lgpm for mouse support on a GNU/Linux console --with-gtk use GTK (same as --with-x-toolkit=gtk) --with-pkg-config-prog Path to pkg-config to use for finding GTK diff --cc configure.in index 1b8bcc8880e,81b7afb481e..5fc3e584d5f --- a/configure.in +++ b/configure.in @@@ -105,13 -105,9 +105,13 @@@ AC_ARG_WITH(jpeg AC_ARG_WITH(tiff, [ --with-tiff use -ltiff for displaying TIFF images]) AC_ARG_WITH(gif, - [ --with-gif use -lungif (or -lgif) for displaying GIF images]) + [ --with-gif use -lgif (or -lungif) for displaying GIF images]) AC_ARG_WITH(png, [ --with-png use -lpng for displaying PNG images]) +AC_ARG_WITH(freetype, +[ --with-freetype use -lfreetype for local fonts support]) +AC_ARG_WITH(xft, +[ --with-xft use -lXft for anti aliased fonts]) AC_ARG_WITH(gpm, [ --with-gpm use -lgpm for mouse support on a GNU/Linux console]) AC_ARG_WITH(gtk, diff --cc etc/ChangeLog index 49028bdf691,f735a2df019..b88e98af123 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@@ -1,3 -1,23 +1,19 @@@ -2007-07-08 Michael Albinus - - * NEWS: `file-remote-p' has a new optional parameter CONNECTED. - + 2007-07-07 Michael Albinus + + * NEWS: New function `start-file-process'. + + 2007-07-02 Carsten Dominik + + * orgcard.tex: Version 5.01 + + 2007-06-27 Michael Albinus + + * NEWS: `dired-call-process' has been removed. + + 2007-06-20 Glenn Morris + + * NEWS: configure prefers libgif over libungif. + 2007-06-14 Nick Roberts * NEWS: Mention mouse highlighting in a GNU/Linux console. diff --cc etc/NEWS index e5b078114d5,290fe0f6c7b..8006fa427ed --- a/etc/NEWS +++ b/etc/NEWS @@@ -91,6 -121,16 +121,11 @@@ Use this instead of "~/.emacs.d" ** The new function `image-refresh' refreshes all images associated with a given image specification. + +++ + ** The new function `start-file-process is similar to `start-process', + but obeys file handlers. The file handler is chosen based on + `default-directory'. + -+++ -** `file-remote-p' has a new optional parameter CONNECTED. -With this paramter passed non-nil, it is checked whether a remote -connection has been established already. - * New Packages for Lisp Programming in Emacs 23.1 diff --cc lisp/ChangeLog index 649b37c4494,25ed4c24e31..dfea40b56ba --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@@ -1,9 -1,162 +1,118 @@@ -2007-07-08 Katsumi Yamaoka - - * cus-start.el (file-coding-system-alist): Fix custom type. - -2007-07-08 Stefan Monnier - - * vc-cvs.el (vc-cvs-revert): Use vc-default-revert. - (vc-cvs-checkout): Remove last arg now unused; simplify. - --2007-07-08 Chong Yidong - - * longlines.el (longlines-wrap-region): Avoid marking buffer as - modified. - (longlines-auto-wrap, longlines-window-change-function): - Remove unnecessary calls to set-buffer-modified-p. - -2007-07-08 Michael Albinus - - * files.el (file-remote-p): Introduce optional parameter CONNECTED. - - * net/tramp.el: - * net/tramp-ftp.el: - * net/tramp-smb.el: - * net/tramp-uu.el: - * net/trampver.el: Migrate to Tramp 2.1. - - * net/tramp-cache.el: - * net/tramp-fish.el: - * net/tramp-gw.el: New Tramp packages. - - * net/tramp-util.el: - * net/tramp-vc.el: Removed. - - * net/ange-ftp.el: Add ange-ftp property to 'start-file-process - (ange-ftp-file-remote-p): Handle optional parameter CONNECTED. - - * net/rcompile.el (remote-compile): Handle Tramp 2.1 arguments. - - * progmodes/compile.el (compilation-start): Redefine - `start-process' temporarily when `default-directory' is remote. - Remove case of synchronous compilation, this won't happen ever. - (compilation-setup): Make local variable `comint-file-name-prefix' - for remote compilation. - + 2007-07-08 Martin Rudalics - * longlines.el (longlines-wrap-region): Avoid marking buffer as - modified. - (longlines-auto-wrap, longlines-window-change-function): Remove - unnecessary calls to set-buffer-modified-p. + * novice.el (disabled-command-function): Fit window to buffer to + make last line visible. + Reported by Stephen Berman . + + * mouse.el (mouse-drag-track): Reset transient-mark-mode to nil + when handling the terminating event. + + 2007-07-07 Jay Belanger + + * calc/calc.el (math-read-number-simple): Remove leading 0s. + (math-bignum-digit-length): Change to optimal value. + + * calc/calc-bin.el (math-bignum-logb-digit-size) + (math-bignum-digit-power-of-two): Evaluate when compiled. + + * calc/calc-comb.el (math-small-factorial-table) + (math-init-random-base,math-prime-test): Remove unnecessary calls + to `math-read-number-simple'. + + * calc/calc-ext.el (math-approx-pi,math-approx-sqrt-e) + (math-approx-gamma-const): Add docstrings. + + * calc/calc-forms.el (math-julian-date-beginning) + (math-julian-date-beginning-int) New constants. + (math-format-date-part,math-parse-standard-date,calcFunc-julian): + Use the new constants. + + * calc/calc-funcs.el (math-gammap1-raw): Add docstring. + + * calc/calc-math.el (math-approx-ln-10,math-approx-ln-2): Add docstrings. + + 2007-07-07 Tom Tromey + + * vc.el (vc-annotate): Jump to line and output message only after the + process is really all done. + + 2007-07-07 Stefan Monnier + + * vc.el (vc-exec-after): Don't move point from the sentinel. + Forcefully read all the remaining text in the pipe upon process exit. + (vc-annotate-display-autoscale, vc-annotate-lines): + Don't stop at the first unrecognized line. + (vc-annotate-display-select): Run autoscale after the process is done + since it depends on the whole result. + + 2007-07-07 Eli Zaretskii + + * term/w32-win.el (menu-bar-open): New function. + Bind to it. + + 2007-07-07 Michael Albinus + + * simple.el (start-file-process): New defun. + + 2007-07-07 Stefan Monnier + + * files.el (find-file-confirm-nonexistent-file): Rename from + find-file-confirm-inexistent-file. Update users. + + * emacs-lisp/autoload.el (autoload-find-destination): Understand a new + format of autoload block where the file's time-stamp is replaced by its + MD5 checksum. + (autoload-generate-file-autoloads): Use MD5 checksum instead of + time-stamp for secondary autoloads files. + (update-directory-autoloads): Remove duplicate entries. + Use time-less-p for time-stamps, as done in autoload-find-destination. + + 2007-07-07 Jay Belanger + + * calc/calc.el (math-read-number): Replace number by variable. + (math-read-number-simple): Properly parse small integers. + + 2007-07-07 Dan Nicolaescu + + * vc.el: Fix doc for the checkout function. + + 2007-07-06 Dan Nicolaescu + + * vc-hg.el (vc-hg-root): New function. + (vc-hg-registered): Use it. + (vc-hg-diff-tree): New defalias. + (vc-hg-responsible-p): Likewise. + (vc-hg-checkout): Comment out, not needed. + (vc-hg-delete-file, vc-hg-rename-file, vc-hg-could-register) + (vc-hg-find-version, vc-hg-next-version): New functions. + + 2007-07-06 Andreas Schwab + + * emacs-lisp/lisp-mode.el (eval-last-sexp): Avoid introducing any + dynamic bindings around the evaluation of the expression. + Reported by Jay Belanger . + + 2007-07-06 Stefan Monnier + + * autorevert.el (auto-revert-tail-handler): Use inhibit-read-only. + Run before-revert-hook. Suggested by Denis Bueno . + Use run-hooks rather than run-mode-hooks. + + 2007-07-05 Jay Belanger + + * calc/calc-comb.el (math-random-digit): Rename to + `math-random-three-digit-number'. + (math-random-digits): Don't depend on representation of integer. + + * calc/calc-bin.el (math-bignum-logb-digit-size) + (math-bignum-digit-power-of-two): New constants. + (math-and-bignum,math-or-bignum,math-xor-bignum,math-diff-bignum) + (math-not-bignum,math-clip-bignum): Use the constants + `math-bignum-digit-power-of-two' and `math-bignum-logb-digit-size' + instead of their values. + (math-clip): Use math-small-integer-size instead of its value. + + * calc/calc.el (math-add-bignum): Replace number by constant. 2007-07-05 Chong Yidong diff --cc lisp/net/ange-ftp.el index ec76279c642,3fa75102b32..898f9a23515 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@@ -4360,7 -4367,10 +4360,7 @@@ NEWNAME should be the name to give the ;; This returns nil for any file name as argument. (put 'vc-registered 'ange-ftp 'null) - (put 'dired-call-process 'ange-ftp 'ange-ftp-dired-call-process) -;; We can handle process-file in a restricted way (just for chown). -;; Nothing possible for start-file-process. + (put 'process-file 'ange-ftp 'ange-ftp-process-file) -(put 'start-file-process 'ange-ftp 'ignore) (put 'shell-command 'ange-ftp 'ange-ftp-shell-command) ;;; Define ways of getting at unmodified Emacs primitives, diff --cc lispref/ChangeLog index 20006d9eea7,d7295bd64b1..5c25f0945a9 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@@ -1,3 -1,42 +1,37 @@@ -2007-07-08 Michael Albinus - - * files.texi (Magic File Names): Introduce optional parameter - CONNECTED for `file-remote-p'. - + 2007-07-07 Michael Albinus + - * processes.texi (Asynchronous Processes): ++ * process.texi (Asynchronous Processes): + * files.texi (Magic File Names): Add `start-file-process'. + + 2007-06-27 Richard Stallman + + * files.texi (Format Conversion Piecemeal): Clarify + `after-insert-file-functions' calling convention. + + 2007-06-27 Michael Albinus + + * files.texi (Magic File Names): Remove `dired-call-process'. Add + `process-file'. + + 2007-06-27 Kenichi Handa + + * text.texi (Special Properties): Fix description about + `compostion' property. + + 2007-06-26 Kenichi Handa + + * nonascii.texi (Default Coding Systems): Document about the + return value `undecided'. + + 2007-06-25 David Kastrup + + * keymaps.texi (Active Keymaps): Document new POSITION argument of + `current-active-maps'. + + 2007-06-24 Karl Berry + + * elisp.texi, vol1.texi, vol2.texi: new Back-Cover Text. + 2007-06-15 Juanma Barranquero * display.texi (Overlay Arrow): Doc fix. diff --cc man/ChangeLog index e216f6ab7c3,e185cd51f7b..ad2d3b889f2 --- a/man/ChangeLog +++ b/man/ChangeLog @@@ -1,3 -1,34 +1,29 @@@ -2007-07-08 Michael Albinus - - * tramp.texi: - * trampver.texi: Migrate to Tramp 2.1. - + 2007-07-02 Carsten Dominik + + * org.texi (Properties): New chapter. + + 2007-06-24 Karl Berry + + * emacs.texi: new Back-Cover Text. + + 2007-06-20 Jay Belanger + + * calc.texi:Change ifinfo to ifnottex (as appropriate) throughout. + (About This Manual): Remove redundant information. + (Getting Started): Mention author. + (Basic Arithmetic, Customizing Calc): Make description of the + variable `calc-multiplication-has-precedence' match its new effect. + + 2007-06-19 Jay Belanger + + * calc.texi (Basic Arithmetic, Customizing Calc): Mention + the variable `calc-multiplication-has-precedence'. + + 2007-06-19 Carsten Dominik + + * org.texi (Tag): Section swapped with node Timestamps. + (Formula syntax for Lisp): Document new `L' flag. + 2007-06-06 Andreas Seltenreich * gnus.texi (Misc Group Stuff, Summary Buffer) diff --cc nt/configure.bat index 123da0b21cd,9c97f179a90..3979065ab96 --- a/nt/configure.bat +++ b/nt/configure.bat @@@ -119,12 -118,11 +119,12 @@@ echo. --no-opt disabl echo. --no-cygwin use -mno-cygwin option with GCC echo. --cflags FLAG pass FLAG to compiler echo. --ldflags FLAG pass FLAG to compiler when linking - echo. --without-png do not use libpng even if it is installed - echo. --without-jpeg do not use jpeg-6b even if it is installed - echo. --without-gif do not use libungif even if it is installed - echo. --without-tiff do not use libtiff even if it is installed - echo. --without-xpm do not use libXpm even if it is installed + echo. --without-png do not use libpng + echo. --without-jpeg do not use jpeg-6b + echo. --without-gif do not use giflib or libungif + echo. --without-tiff do not use libtiff + echo. --without-xpm do not use libXpm +echo. --enable-font-backend build with font backend support goto end rem ---------------------------------------------------------------------- :setprefix diff --cc src/ChangeLog index 8d9793287bd,b87b05f8e27..05bb5c9e74a --- a/src/ChangeLog +++ b/src/ChangeLog @@@ -1,43 -1,124 +1,164 @@@ +2007-06-29 Stefan Monnier + + * fns.c (weak_hash_tables): Rename from Vweak_hash_tables and change + its type. + (make_hash_table, copy_hash_table, sweep_weak_hash_tables, init_fns): + Update to the new type of weak_hash_tables and next_weak. + + * lisp.h (struct Lisp_Hash_Table): Change next_weak from Lisp_Object to + a plain C pointer to Lisp_Hash_Table. + + * lisp.h (XGCTYPE, GC_HASH_TABLE_P, GC_NILP, GC_NUMBERP, GC_NATNUMP) + (GC_INTEGERP, GC_SYMBOLP, GC_MISCP, GC_VECTORLIKEP, GC_STRINGP) + (GC_CONSP, GC_FLOATP, GC_VECTORP, GC_OVERLAYP, GC_MARKERP) + (GC_INTFWDP, GC_BOOLFWDP, GC_OBJFWDP, GC_BUFFER_OBJFWDP) + (GC_BUFFER_LOCAL_VALUEP, GC_SOME_BUFFER_LOCAL_VALUEP) + (GC_KBOARD_OBJFWDP, GC_PSEUDOVECTORP, GC_WINDOW_CONFIGURATIONP) + (GC_PROCESSP, GC_WINDOWP, GC_SUBRP, GC_COMPILEDP, GC_BUFFERP) + (GC_SUB_CHAR_TABLE_P, GC_CHAR_TABLE_P, GC_BOOL_VECTOR_P, GC_FRAMEP) + (GC_EQ): Remove since they've been identical to their non-GC_ + alter-egos ever since the markbit was eradicated. + + * src/alloc.c: + * src/buffer.c: + * src/buffer.h: + * src/data.c: + * src/fileio.c: + * src/filelock.c: + * src/fns.c: + * src/frame.h: + * src/lisp.h: + * src/macterm.c: + * src/print.c: + * src/process.c: + * src/w32fns.c: + * src/w32menu.c: + * src/w32term.c: + * src/xfns.c: + * src/xmenu.c: + * src/xterm.c: Replace uses of GC_* macros with the non-GC_ versions. + + 2007-07-01 Stefan Monnier + + * minibuf.c (Fcompleting_read): New value `confirm-only' + for `require-match'. + + 2007-06-28 Stefan Monnier + + * fileio.c (Fdo_auto_save): Revert last patch installed unwillingly as + part of the 2007-06-27 change to syms_of_fileio. + + 2007-06-28 YAMAMOTO Mitsuharu + + * macterm.c [USE_MAC_TSM] (mac_handle_text_input_event): + Check WINDOWP before using XWINDOW. Consolidate return statements. + + 2007-06-27 Richard Stallman + + * fileio.c (syms_of_fileio) : Doc fix. + + 2007-06-27 Juanma Barranquero + + * buffer.c (syms_of_buffer) : Fix typo in docstring. + + 2007-06-26 YAMAMOTO Mitsuharu + + * gmalloc.c [HAVE_GTK_AND_PTHREAD]: Check this after including config.h. + (_aligned_blocks_mutex) [USE_PTHREAD]: New variable. + (LOCK_ALIGNED_BLOCKS, UNLOCK_ALIGNED_BLOCKS): New macros. + (_free_internal, memalign): Use them. + (_malloc_mutex, _aligned_blocks_mutex) [USE_PTHREAD]: + Initialize to PTHREAD_MUTEX_INITIALIZER. + (malloc_initialize_1) [USE_PTHREAD]: Don't use recursive mutex. + (morecore_nolock): Rename from morecore. All uses changed. + Use only nolock versions of internal allocation functions. + (_malloc_internal_nolock, _realloc_internal_nolock) + (_free_internal_nolock): New functions created from + _malloc_internal, _realloc_internal, and _free_internal. + (_malloc_internal, _realloc_internal, _free_internal): Use them. + Copy hook value to automatic variable before its use. + (memalign): Copy hook value to automatic variable before its use. + + 2007-06-26 Kenichi Handa + + * coding.c (Ffind_operation_coding_system): Docstring improved. + (syms_of_coding): Docstring of `file-coding-system-alist' improved. + + 2007-06-25 David Kastrup + + * keymap.c (Fcurrent_active_maps): Add `position' argument. + (Fwhere_is_internal): Adjust call to `current-active-maps' to + cater for additional parameter. + + * keymap.h: Adjust number of parameters to `current-active-maps'. + + * doc.c (Fsubstitute_command_keys): Adjust call of + `current-active-maps'. + + 2007-06-25 David Kastrup + + * callint.c (Fcall_interactively): Make the parsing of interactive + specs somewhat more readable. + + 2007-06-23 YAMAMOTO Mitsuharu + + * macterm.c (x_draw_fringe_bitmap) [MAC_OSX]: Extend fringe background + to scroll bar gap also when bitmap fills fringe. Draw only foreground + if extended background has already been filled. + + 2007-06-22 YAMAMOTO Mitsuharu + + * macgui.h (USE_CG_DRAWING): Don't require USE_ATSUI. + (USE_MAC_TOOLBAR): Require USE_CG_DRAWING. + + * macmenu.c (mac_dialog_modal_filter, Fx_popup_dialog) [MAC_OSX]: + Put special treatment for Fmessage_box, Fyes_or_no_p, and Fy_or_n_p + in #if 0 as it is not compatible with y-or-n-p-with-timeout. + (timer_check) [TARGET_API_MAC_CARBON]: Add extern. + [TARGET_API_MAC_CARBON] (mac_handle_dialog_event): Use QuitEventLoop + instead of QuitAppModalLoopForWindow. Consolidate QuitEventLoop calls. + (pop_down_dialog) [TARGET_API_MAC_CARBON]: New function. + [TARGET_API_MAC_CARBON] (create_and_show_dialog): Use it for unwind. + Run timers during dialog popup. + (Fmenu_or_popup_active_p) [TARGET_API_MAC_CARBON]: Use popup_activated. + + 2007-06-21 Jason Rumney + + * image.c (convert_mono_to_color_image): Swap fore and background. + + 2007-06-20 Jason Rumney + + * w32bdf.c (w32_BDF_to_x_font): Unmap memory when finished. + (w32_free_bdf_font): Unmap memory not handle. + + 2007-06-20 Sam Steingold + + * gmalloc.c (__morecore): Fix the declaration to comply with the + definition. + + 2007-06-20 Juanma Barranquero + + * w32term.c (w32_delete_display): Remove leftover declaration. + (w32_define_cursor, w32_initialize): Make static. + + * w32.c (_wsa_errlist): Fix typo in error message. + (init_environment): Ignore any environment variable from the + registry having a null value. + + 2007-06-20 Glenn Morris + + * Makefile.in (LIBGIF): Default to -lgif. + + 2007-06-17 Jason Rumney + + * w32menu.c (add_menu_item): Don't use multibyte string functions on + unicode strings. + + 2007-06-16 Juanma Barranquero + + * xdisp.c (syms_of_xdisp) : + Fix typo in docstring. + 2007-06-16 Eli Zaretskii * w32menu.c (add_menu_item): Escape `&' characters in menu items diff --cc src/coding.c index e7ff19f3929,122bb50f972..e4ecbf50f62 --- a/src/coding.c +++ b/src/coding.c @@@ -8373,696 -7447,137 +8373,698 @@@ The first argument OPERATION specifies For process I/O, `call-process', `call-process-region', or `start-process'. For network I/O, `open-network-stream'. -The remaining arguments should be the same arguments that were passed -to the primitive. Depending on which primitive, one of those arguments -is selected as the TARGET. For example, if OPERATION does file I/O, -whichever argument specifies the file name is TARGET. +The remaining arguments should be the same arguments that were passed +to the primitive. Depending on which primitive, one of those arguments +is selected as the TARGET. For example, if OPERATION does file I/O, +whichever argument specifies the file name is TARGET. + +TARGET has a meaning which depends on OPERATION: + For file I/O, TARGET is a file name (except for the special case below). + For process I/O, TARGET is a process name. + For network I/O, TARGET is a service name or a port number + +This function looks up what specified for TARGET in, +`file-coding-system-alist', `process-coding-system-alist', +or `network-coding-system-alist' depending on OPERATION. +They may specify a coding system, a cons of coding systems, +or a function symbol to call. +In the last case, we call the function with one argument, +which is a list of all the arguments given to this function. ++If the function can't decide a coding system, it can return ++`undecided' so that the normal code-detection is performed. + +If OPERATION is `insert-file-contents', the argument corresponding to +TARGET may be a cons (FILENAME . BUFFER). In that case, FILENAME is a +file name to look up, and BUFFER is a buffer that contains the file's +contents (not yet decoded). If `file-coding-system-alist' specifies a +function to call for FILENAME, that function should examine the +contents of BUFFER instead of reading the file. + +usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) + (nargs, args) + int nargs; + Lisp_Object *args; +{ + Lisp_Object operation, target_idx, target, val; + register Lisp_Object chain; + + if (nargs < 2) + error ("Too few arguments"); + operation = args[0]; + if (!SYMBOLP (operation) + || !INTEGERP (target_idx = Fget (operation, Qtarget_idx))) + error ("Invalid first arguement"); + if (nargs < 1 + XINT (target_idx)) + error ("Too few arguments for operation: %s", + SDATA (SYMBOL_NAME (operation))); + target = args[XINT (target_idx) + 1]; + if (!(STRINGP (target) + || (EQ (operation, Qinsert_file_contents) && CONSP (target) + && STRINGP (XCAR (target)) && BUFFERP (XCDR (target))) + || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) + error ("Invalid %dth argument", XINT (target_idx) + 1); + if (CONSP (target)) + target = XCAR (target); + + chain = ((EQ (operation, Qinsert_file_contents) + || EQ (operation, Qwrite_region)) + ? Vfile_coding_system_alist + : (EQ (operation, Qopen_network_stream) + ? Vnetwork_coding_system_alist + : Vprocess_coding_system_alist)); + if (NILP (chain)) + return Qnil; + + for (; CONSP (chain); chain = XCDR (chain)) + { + Lisp_Object elt; + + elt = XCAR (chain); + if (CONSP (elt) + && ((STRINGP (target) + && STRINGP (XCAR (elt)) + && fast_string_match (XCAR (elt), target) >= 0) + || (INTEGERP (target) && EQ (target, XCAR (elt))))) + { + val = XCDR (elt); + /* Here, if VAL is both a valid coding system and a valid + function symbol, we return VAL as a coding system. */ + if (CONSP (val)) + return val; + if (! SYMBOLP (val)) + return Qnil; + if (! NILP (Fcoding_system_p (val))) + return Fcons (val, val); + if (! NILP (Ffboundp (val))) + { + /* We use call1 rather than safe_call1 + so as to get bug reports about functions called here + which don't handle the current interface. */ + val = call1 (val, Flist (nargs, args)); + if (CONSP (val)) + return val; + if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val))) + return Fcons (val, val); + } + return Qnil; + } + } + return Qnil; +} + +DEFUN ("set-coding-system-priority", Fset_coding_system_priority, + Sset_coding_system_priority, 0, MANY, 0, + doc: /* Assign higher priority to the coding systems given as arguments. +If multiple coding systems belongs to the same category, +all but the first one are ignored. + +usage: (set-coding-system-priority ...) */) + (nargs, args) + int nargs; + Lisp_Object *args; +{ + int i, j; + int changed[coding_category_max]; + enum coding_category priorities[coding_category_max]; + + bzero (changed, sizeof changed); + + for (i = j = 0; i < nargs; i++) + { + enum coding_category category; + Lisp_Object spec, attrs; + + CHECK_CODING_SYSTEM_GET_SPEC (args[i], spec); + attrs = AREF (spec, 0); + category = XINT (CODING_ATTR_CATEGORY (attrs)); + if (changed[category]) + /* Ignore this coding system because a coding system of the + same category already had a higher priority. */ + continue; + changed[category] = 1; + priorities[j++] = category; + if (coding_categories[category].id >= 0 + && ! EQ (args[i], CODING_ID_NAME (coding_categories[category].id))) + setup_coding_system (args[i], &coding_categories[category]); + Fset (AREF (Vcoding_category_table, category), args[i]); + } + + /* Now we have decided top J priorities. Reflect the order of the + original priorities to the remaining priorities. */ + + for (i = j, j = 0; i < coding_category_max; i++, j++) + { + while (j < coding_category_max + && changed[coding_priorities[j]]) + j++; + if (j == coding_category_max) + abort (); + priorities[i] = coding_priorities[j]; + } + + bcopy (priorities, coding_priorities, sizeof priorities); + + /* Update `coding-category-list'. */ + Vcoding_category_list = Qnil; + for (i = coding_category_max - 1; i >= 0; i--) + Vcoding_category_list + = Fcons (AREF (Vcoding_category_table, priorities[i]), + Vcoding_category_list); + + return Qnil; +} + +DEFUN ("coding-system-priority-list", Fcoding_system_priority_list, + Scoding_system_priority_list, 0, 1, 0, + doc: /* Return a list of coding systems ordered by their priorities. +HIGHESTP non-nil means just return the highest priority one. */) + (highestp) + Lisp_Object highestp; +{ + int i; + Lisp_Object val; + + for (i = 0, val = Qnil; i < coding_category_max; i++) + { + enum coding_category category = coding_priorities[i]; + int id = coding_categories[category].id; + Lisp_Object attrs; + + if (id < 0) + continue; + attrs = CODING_ID_ATTRS (id); + if (! NILP (highestp)) + return CODING_ATTR_BASE_NAME (attrs); + val = Fcons (CODING_ATTR_BASE_NAME (attrs), val); + } + return Fnreverse (val); +} + +static char *suffixes[] = { "-unix", "-dos", "-mac" }; + +static Lisp_Object +make_subsidiaries (base) + Lisp_Object base; +{ + Lisp_Object subsidiaries; + int base_name_len = SBYTES (SYMBOL_NAME (base)); + char *buf = (char *) alloca (base_name_len + 6); + int i; + + bcopy (SDATA (SYMBOL_NAME (base)), buf, base_name_len); + subsidiaries = Fmake_vector (make_number (3), Qnil); + for (i = 0; i < 3; i++) + { + bcopy (suffixes[i], buf + base_name_len, strlen (suffixes[i]) + 1); + ASET (subsidiaries, i, intern (buf)); + } + return subsidiaries; +} + + +DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal, + Sdefine_coding_system_internal, coding_arg_max, MANY, 0, + doc: /* For internal use only. +usage: (define-coding-system-internal ...) */) + (nargs, args) + int nargs; + Lisp_Object *args; +{ + Lisp_Object name; + Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */ + Lisp_Object attrs; /* Vector of attributes. */ + Lisp_Object eol_type; + Lisp_Object aliases; + Lisp_Object coding_type, charset_list, safe_charsets; + enum coding_category category; + Lisp_Object tail, val; + int max_charset_id = 0; + int i; + + if (nargs < coding_arg_max) + goto short_args; + + attrs = Fmake_vector (make_number (coding_attr_last_index), Qnil); + + name = args[coding_arg_name]; + CHECK_SYMBOL (name); + CODING_ATTR_BASE_NAME (attrs) = name; + + val = args[coding_arg_mnemonic]; + if (! STRINGP (val)) + CHECK_CHARACTER (val); + CODING_ATTR_MNEMONIC (attrs) = val; + + coding_type = args[coding_arg_coding_type]; + CHECK_SYMBOL (coding_type); + CODING_ATTR_TYPE (attrs) = coding_type; + + charset_list = args[coding_arg_charset_list]; + if (SYMBOLP (charset_list)) + { + if (EQ (charset_list, Qiso_2022)) + { + if (! EQ (coding_type, Qiso_2022)) + error ("Invalid charset-list"); + charset_list = Viso_2022_charset_list; + } + else if (EQ (charset_list, Qemacs_mule)) + { + if (! EQ (coding_type, Qemacs_mule)) + error ("Invalid charset-list"); + charset_list = Vemacs_mule_charset_list; + } + for (tail = charset_list; CONSP (tail); tail = XCDR (tail)) + if (max_charset_id < XFASTINT (XCAR (tail))) + max_charset_id = XFASTINT (XCAR (tail)); + } + else + { + charset_list = Fcopy_sequence (charset_list); + for (tail = charset_list; !NILP (tail); tail = Fcdr (tail)) + { + struct charset *charset; + + val = Fcar (tail); + CHECK_CHARSET_GET_CHARSET (val, charset); + if (EQ (coding_type, Qiso_2022) + ? CHARSET_ISO_FINAL (charset) < 0 + : EQ (coding_type, Qemacs_mule) + ? CHARSET_EMACS_MULE_ID (charset) < 0 + : 0) + error ("Can't handle charset `%s'", + SDATA (SYMBOL_NAME (CHARSET_NAME (charset)))); + + XSETCAR (tail, make_number (charset->id)); + if (max_charset_id < charset->id) + max_charset_id = charset->id; + } + } + CODING_ATTR_CHARSET_LIST (attrs) = charset_list; + + safe_charsets = Fmake_string (make_number (max_charset_id + 1), + make_number (255)); + for (tail = charset_list; CONSP (tail); tail = XCDR (tail)) + SSET (safe_charsets, XFASTINT (XCAR (tail)), 0); + CODING_ATTR_SAFE_CHARSETS (attrs) = safe_charsets; + + CODING_ATTR_ASCII_COMPAT (attrs) = args[coding_arg_ascii_compatible_p]; + + val = args[coding_arg_decode_translation_table]; + if (! CHAR_TABLE_P (val) && ! CONSP (val)) + CHECK_SYMBOL (val); + CODING_ATTR_DECODE_TBL (attrs) = val; + + val = args[coding_arg_encode_translation_table]; + if (! CHAR_TABLE_P (val) && ! CONSP (val)) + CHECK_SYMBOL (val); + CODING_ATTR_ENCODE_TBL (attrs) = val; + + val = args[coding_arg_post_read_conversion]; + CHECK_SYMBOL (val); + CODING_ATTR_POST_READ (attrs) = val; + + val = args[coding_arg_pre_write_conversion]; + CHECK_SYMBOL (val); + CODING_ATTR_PRE_WRITE (attrs) = val; + + val = args[coding_arg_default_char]; + if (NILP (val)) + CODING_ATTR_DEFAULT_CHAR (attrs) = make_number (' '); + else + { + CHECK_CHARACTER (val); + CODING_ATTR_DEFAULT_CHAR (attrs) = val; + } + + val = args[coding_arg_for_unibyte]; + CODING_ATTR_FOR_UNIBYTE (attrs) = NILP (val) ? Qnil : Qt; + + val = args[coding_arg_plist]; + CHECK_LIST (val); + CODING_ATTR_PLIST (attrs) = val; + + if (EQ (coding_type, Qcharset)) + { + /* Generate a lisp vector of 256 elements. Each element is nil, + integer, or a list of charset IDs. + + If Nth element is nil, the byte code N is invalid in this + coding system. + + If Nth element is a number NUM, N is the first byte of a + charset whose ID is NUM. + + If Nth element is a list of charset IDs, N is the first byte + of one of them. The list is sorted by dimensions of the + charsets. A charset of smaller dimension comes firtst. */ + val = Fmake_vector (make_number (256), Qnil); + + for (tail = charset_list; CONSP (tail); tail = XCDR (tail)) + { + struct charset *charset = CHARSET_FROM_ID (XFASTINT (XCAR (tail))); + int dim = CHARSET_DIMENSION (charset); + int idx = (dim - 1) * 4; + + if (CHARSET_ASCII_COMPATIBLE_P (charset)) + CODING_ATTR_ASCII_COMPAT (attrs) = Qt; + + for (i = charset->code_space[idx]; + i <= charset->code_space[idx + 1]; i++) + { + Lisp_Object tmp, tmp2; + int dim2; + + tmp = AREF (val, i); + if (NILP (tmp)) + tmp = XCAR (tail); + else if (NUMBERP (tmp)) + { + dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFASTINT (tmp))); + if (dim < dim2) + tmp = Fcons (XCAR (tail), Fcons (tmp, Qnil)); + else + tmp = Fcons (tmp, Fcons (XCAR (tail), Qnil)); + } + else + { + for (tmp2 = tmp; CONSP (tmp2); tmp2 = XCDR (tmp2)) + { + dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFASTINT (XCAR (tmp2)))); + if (dim < dim2) + break; + } + if (NILP (tmp2)) + tmp = nconc2 (tmp, Fcons (XCAR (tail), Qnil)); + else + { + XSETCDR (tmp2, Fcons (XCAR (tmp2), XCDR (tmp2))); + XSETCAR (tmp2, XCAR (tail)); + } + } + ASET (val, i, tmp); + } + } + ASET (attrs, coding_attr_charset_valids, val); + category = coding_category_charset; + } + else if (EQ (coding_type, Qccl)) + { + Lisp_Object valids; + + if (nargs < coding_arg_ccl_max) + goto short_args; + + val = args[coding_arg_ccl_decoder]; + CHECK_CCL_PROGRAM (val); + if (VECTORP (val)) + val = Fcopy_sequence (val); + ASET (attrs, coding_attr_ccl_decoder, val); + + val = args[coding_arg_ccl_encoder]; + CHECK_CCL_PROGRAM (val); + if (VECTORP (val)) + val = Fcopy_sequence (val); + ASET (attrs, coding_attr_ccl_encoder, val); -TARGET has a meaning which depends on OPERATION: - For file I/O, TARGET is a file name (except for the special case below). - For process I/O, TARGET is a process name. - For network I/O, TARGET is a service name or a port number + val = args[coding_arg_ccl_valids]; + valids = Fmake_string (make_number (256), make_number (0)); + for (tail = val; !NILP (tail); tail = Fcdr (tail)) + { + int from, to; -This function looks up what specified for TARGET in, -`file-coding-system-alist', `process-coding-system-alist', -or `network-coding-system-alist' depending on OPERATION. -They may specify a coding system, a cons of coding systems, -or a function symbol to call. -In the last case, we call the function with one argument, -which is a list of all the arguments given to this function. -If the function can't decide a coding system, it can return -`undecided' so that the normal code-detection is performed. + val = Fcar (tail); + if (INTEGERP (val)) + { + from = to = XINT (val); + if (from < 0 || from > 255) + args_out_of_range_3 (val, make_number (0), make_number (255)); + } + else + { + CHECK_CONS (val); + CHECK_NATNUM_CAR (val); + CHECK_NATNUM_CDR (val); + from = XINT (XCAR (val)); + if (from > 255) + args_out_of_range_3 (XCAR (val), + make_number (0), make_number (255)); + to = XINT (XCDR (val)); + if (to < from || to > 255) + args_out_of_range_3 (XCDR (val), + XCAR (val), make_number (255)); + } + for (i = from; i <= to; i++) + SSET (valids, i, 1); + } + ASET (attrs, coding_attr_ccl_valids, valids); -If OPERATION is `insert-file-contents', the argument corresponding to -TARGET may be a cons (FILENAME . BUFFER). In that case, FILENAME is a -file name to look up, and BUFFER is a buffer that contains the file's -contents (not yet decoded). If `file-coding-system-alist' specifies a -function to call for FILENAME, that function should examine the -contents of BUFFER instead of reading the file. + category = coding_category_ccl; + } + else if (EQ (coding_type, Qutf_16)) + { + Lisp_Object bom, endian; -usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) - (nargs, args) - int nargs; - Lisp_Object *args; -{ - Lisp_Object operation, target_idx, target, val; - register Lisp_Object chain; + CODING_ATTR_ASCII_COMPAT (attrs) = Qnil; - if (nargs < 2) - error ("Too few arguments"); - operation = args[0]; - if (!SYMBOLP (operation) - || !INTEGERP (target_idx = Fget (operation, Qtarget_idx))) - error ("Invalid first argument"); - if (nargs < 1 + XINT (target_idx)) - error ("Too few arguments for operation: %s", - SDATA (SYMBOL_NAME (operation))); - /* For write-region, if the 6th argument (i.e. VISIT, the 5th - argument to write-region) is string, it must be treated as a - target file name. */ - if (EQ (operation, Qwrite_region) - && nargs > 5 - && STRINGP (args[5])) - target_idx = make_number (4); - target = args[XINT (target_idx) + 1]; - if (!(STRINGP (target) - || (EQ (operation, Qinsert_file_contents) && CONSP (target) - && STRINGP (XCAR (target)) && BUFFERP (XCDR (target))) - || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) - error ("Invalid argument %d", XINT (target_idx) + 1); - if (CONSP (target)) - target = XCAR (target); + if (nargs < coding_arg_utf16_max) + goto short_args; - chain = ((EQ (operation, Qinsert_file_contents) - || EQ (operation, Qwrite_region)) - ? Vfile_coding_system_alist - : (EQ (operation, Qopen_network_stream) - ? Vnetwork_coding_system_alist - : Vprocess_coding_system_alist)); - if (NILP (chain)) - return Qnil; + bom = args[coding_arg_utf16_bom]; + if (! NILP (bom) && ! EQ (bom, Qt)) + { + CHECK_CONS (bom); + val = XCAR (bom); + CHECK_CODING_SYSTEM (val); + val = XCDR (bom); + CHECK_CODING_SYSTEM (val); + } + ASET (attrs, coding_attr_utf_16_bom, bom); + + endian = args[coding_arg_utf16_endian]; + CHECK_SYMBOL (endian); + if (NILP (endian)) + endian = Qbig; + else if (! EQ (endian, Qbig) && ! EQ (endian, Qlittle)) + error ("Invalid endian: %s", SDATA (SYMBOL_NAME (endian))); + ASET (attrs, coding_attr_utf_16_endian, endian); + + category = (CONSP (bom) + ? coding_category_utf_16_auto + : NILP (bom) + ? (EQ (endian, Qbig) + ? coding_category_utf_16_be_nosig + : coding_category_utf_16_le_nosig) + : (EQ (endian, Qbig) + ? coding_category_utf_16_be + : coding_category_utf_16_le)); + } + else if (EQ (coding_type, Qiso_2022)) + { + Lisp_Object initial, reg_usage, request, flags; + int i; - for (; CONSP (chain); chain = XCDR (chain)) - { - Lisp_Object elt; - elt = XCAR (chain); + if (nargs < coding_arg_iso2022_max) + goto short_args; - if (CONSP (elt) - && ((STRINGP (target) - && STRINGP (XCAR (elt)) - && fast_string_match (XCAR (elt), target) >= 0) - || (INTEGERP (target) && EQ (target, XCAR (elt))))) + initial = Fcopy_sequence (args[coding_arg_iso2022_initial]); + CHECK_VECTOR (initial); + for (i = 0; i < 4; i++) { - val = XCDR (elt); - /* Here, if VAL is both a valid coding system and a valid - function symbol, we return VAL as a coding system. */ - if (CONSP (val)) - return val; - if (! SYMBOLP (val)) - return Qnil; - if (! NILP (Fcoding_system_p (val))) - return Fcons (val, val); - if (! NILP (Ffboundp (val))) + val = Faref (initial, make_number (i)); + if (! NILP (val)) { - /* We use call1 rather than safe_call1 - so as to get bug reports about functions called here - which don't handle the current interface. */ - val = call1 (val, Flist (nargs, args)); - if (CONSP (val)) - return val; - if (SYMBOLP (val) && ! NILP (Fcoding_system_p (val))) - return Fcons (val, val); + struct charset *charset; + + CHECK_CHARSET_GET_CHARSET (val, charset); + ASET (initial, i, make_number (CHARSET_ID (charset))); + if (i == 0 && CHARSET_ASCII_COMPATIBLE_P (charset)) + CODING_ATTR_ASCII_COMPAT (attrs) = Qt; } - return Qnil; + else + ASET (initial, i, make_number (-1)); } - } - return Qnil; -} -DEFUN ("update-coding-systems-internal", Fupdate_coding_systems_internal, - Supdate_coding_systems_internal, 0, 0, 0, - doc: /* Update internal database for ISO2022 and CCL based coding systems. -When values of any coding categories are changed, you must -call this function. */) - () -{ - int i; + reg_usage = args[coding_arg_iso2022_reg_usage]; + CHECK_CONS (reg_usage); + CHECK_NUMBER_CAR (reg_usage); + CHECK_NUMBER_CDR (reg_usage); + + request = Fcopy_sequence (args[coding_arg_iso2022_request]); + for (tail = request; ! NILP (tail); tail = Fcdr (tail)) + { + int id; + Lisp_Object tmp; + + val = Fcar (tail); + CHECK_CONS (val); + tmp = XCAR (val); + CHECK_CHARSET_GET_ID (tmp, id); + CHECK_NATNUM_CDR (val); + if (XINT (XCDR (val)) >= 4) + error ("Invalid graphic register number: %d", XINT (XCDR (val))); + XSETCAR (val, make_number (id)); + } - for (i = CODING_CATEGORY_IDX_EMACS_MULE; i < CODING_CATEGORY_IDX_MAX; i++) + flags = args[coding_arg_iso2022_flags]; + CHECK_NATNUM (flags); + i = XINT (flags); + if (EQ (args[coding_arg_charset_list], Qiso_2022)) + flags = make_number (i | CODING_ISO_FLAG_FULL_SUPPORT); + + ASET (attrs, coding_attr_iso_initial, initial); + ASET (attrs, coding_attr_iso_usage, reg_usage); + ASET (attrs, coding_attr_iso_request, request); + ASET (attrs, coding_attr_iso_flags, flags); + setup_iso_safe_charsets (attrs); + + if (i & CODING_ISO_FLAG_SEVEN_BITS) + category = ((i & (CODING_ISO_FLAG_LOCKING_SHIFT + | CODING_ISO_FLAG_SINGLE_SHIFT)) + ? coding_category_iso_7_else + : EQ (args[coding_arg_charset_list], Qiso_2022) + ? coding_category_iso_7 + : coding_category_iso_7_tight); + else + { + int id = XINT (AREF (initial, 1)); + + category = (((i & CODING_ISO_FLAG_LOCKING_SHIFT) + || EQ (args[coding_arg_charset_list], Qiso_2022) + || id < 0) + ? coding_category_iso_8_else + : (CHARSET_DIMENSION (CHARSET_FROM_ID (id)) == 1) + ? coding_category_iso_8_1 + : coding_category_iso_8_2); + } + if (category != coding_category_iso_8_1 + && category != coding_category_iso_8_2) + CODING_ATTR_ASCII_COMPAT (attrs) = Qnil; + } + else if (EQ (coding_type, Qemacs_mule)) { - Lisp_Object val; + if (EQ (args[coding_arg_charset_list], Qemacs_mule)) + ASET (attrs, coding_attr_emacs_mule_full, Qt); + CODING_ATTR_ASCII_COMPAT (attrs) = Qt; + category = coding_category_emacs_mule; + } + else if (EQ (coding_type, Qshift_jis)) + { + + struct charset *charset; - val = SYMBOL_VALUE (XVECTOR (Vcoding_category_table)->contents[i]); - if (!NILP (val)) + if (XINT (Flength (charset_list)) != 3 + && XINT (Flength (charset_list)) != 4) + error ("There should be three or four charsets"); + + charset = CHARSET_FROM_ID (XINT (XCAR (charset_list))); + if (CHARSET_DIMENSION (charset) != 1) + error ("Dimension of charset %s is not one", + SDATA (SYMBOL_NAME (CHARSET_NAME (charset)))); + if (CHARSET_ASCII_COMPATIBLE_P (charset)) + CODING_ATTR_ASCII_COMPAT (attrs) = Qt; + + charset_list = XCDR (charset_list); + charset = CHARSET_FROM_ID (XINT (XCAR (charset_list))); + if (CHARSET_DIMENSION (charset) != 1) + error ("Dimension of charset %s is not one", + SDATA (SYMBOL_NAME (CHARSET_NAME (charset)))); + + charset_list = XCDR (charset_list); + charset = CHARSET_FROM_ID (XINT (XCAR (charset_list))); + if (CHARSET_DIMENSION (charset) != 2) + error ("Dimension of charset %s is not two", + SDATA (SYMBOL_NAME (CHARSET_NAME (charset)))); + + charset_list = XCDR (charset_list); + if (! NILP (charset_list)) { - if (! coding_system_table[i]) - coding_system_table[i] = ((struct coding_system *) - xmalloc (sizeof (struct coding_system))); - setup_coding_system (val, coding_system_table[i]); + charset = CHARSET_FROM_ID (XINT (XCAR (charset_list))); + if (CHARSET_DIMENSION (charset) != 2) + error ("Dimension of charset %s is not two", + SDATA (SYMBOL_NAME (CHARSET_NAME (charset)))); } - else if (coding_system_table[i]) + + category = coding_category_sjis; + Vsjis_coding_system = name; + } + else if (EQ (coding_type, Qbig5)) + { + struct charset *charset; + + if (XINT (Flength (charset_list)) != 2) + error ("There should be just two charsets"); + + charset = CHARSET_FROM_ID (XINT (XCAR (charset_list))); + if (CHARSET_DIMENSION (charset) != 1) + error ("Dimension of charset %s is not one", + SDATA (SYMBOL_NAME (CHARSET_NAME (charset)))); + if (CHARSET_ASCII_COMPATIBLE_P (charset)) + CODING_ATTR_ASCII_COMPAT (attrs) = Qt; + + charset_list = XCDR (charset_list); + charset = CHARSET_FROM_ID (XINT (XCAR (charset_list))); + if (CHARSET_DIMENSION (charset) != 2) + error ("Dimension of charset %s is not two", + SDATA (SYMBOL_NAME (CHARSET_NAME (charset)))); + + category = coding_category_big5; + Vbig5_coding_system = name; + } + else if (EQ (coding_type, Qraw_text)) + { + category = coding_category_raw_text; + CODING_ATTR_ASCII_COMPAT (attrs) = Qt; + } + else if (EQ (coding_type, Qutf_8)) + { + category = coding_category_utf_8; + CODING_ATTR_ASCII_COMPAT (attrs) = Qt; + } + else if (EQ (coding_type, Qundecided)) + category = coding_category_undecided; + else + error ("Invalid coding system type: %s", + SDATA (SYMBOL_NAME (coding_type))); + + CODING_ATTR_CATEGORY (attrs) = make_number (category); + CODING_ATTR_PLIST (attrs) + = Fcons (QCcategory, Fcons (AREF (Vcoding_category_table, category), + CODING_ATTR_PLIST (attrs))); + CODING_ATTR_PLIST (attrs) + = Fcons (QCascii_compatible_p, + Fcons (CODING_ATTR_ASCII_COMPAT (attrs), + CODING_ATTR_PLIST (attrs))); + + eol_type = args[coding_arg_eol_type]; + if (! NILP (eol_type) + && ! EQ (eol_type, Qunix) + && ! EQ (eol_type, Qdos) + && ! EQ (eol_type, Qmac)) + error ("Invalid eol-type"); + + aliases = Fcons (name, Qnil); + + if (NILP (eol_type)) + { + eol_type = make_subsidiaries (name); + for (i = 0; i < 3; i++) { - xfree (coding_system_table[i]); - coding_system_table[i] = NULL; + Lisp_Object this_spec, this_name, this_aliases, this_eol_type; + + this_name = AREF (eol_type, i); + this_aliases = Fcons (this_name, Qnil); + this_eol_type = (i == 0 ? Qunix : i == 1 ? Qdos : Qmac); + this_spec = Fmake_vector (make_number (3), attrs); + ASET (this_spec, 1, this_aliases); + ASET (this_spec, 2, this_eol_type); + Fputhash (this_name, this_spec, Vcoding_system_hash_table); + Vcoding_system_list = Fcons (this_name, Vcoding_system_list); + val = Fassoc (Fsymbol_name (this_name), Vcoding_system_alist); + if (NILP (val)) + Vcoding_system_alist + = Fcons (Fcons (Fsymbol_name (this_name), Qnil), + Vcoding_system_alist); } }