comparison src/file-coding.c @ 793:e38acbeb1cae

[xemacs-hg @ 2002-03-29 04:46:17 by ben] lots o' fixes etc/ChangeLog: New file. Separated out all entries for etc/ into their own ChangeLog. Includes entries for the following files: etc/BABYL, etc/BETA, etc/CHARSETS, etc/DISTRIB, etc/Emacs.ad, etc/FTP, etc/GNUS-NEWS, etc/GOATS, etc/HELLO, etc/INSTALL, etc/MACHINES, etc/MAILINGLISTS, etc/MSDOS, etc/MYTHOLOGY, etc/NEWS, etc/OXYMORONS, etc/PACKAGES, etc/README, etc/TUTORIAL, etc/TUTORIAL.de, etc/TUTORIAL.ja, etc/TUTORIAL.ko, etc/TUTORIAL.se, etc/aliases.ksh, etc/altrasoft-logo.xpm, etc/check_cygwin_setup.sh, etc/custom/example-themes/europe-theme.el, etc/custom/example-themes/ex-custom-file, etc/custom/example-themes/example-theme.el, etc/e/eterm.ti, etc/edt-user.doc, etc/enriched.doc, etc/etags.1, etc/gnuserv.1, etc/gnuserv.README, etc/package-index.LATEST.gpg, etc/package-index.LATEST.pgp, etc/photos/jan.png, etc/recycle.xpm, etc/refcard.tex, etc/sample.Xdefaults, etc/sample.emacs, etc/sgml/CATALOG, etc/sgml/HTML32.dtd, etc/skk/SKK.tut.E, etc/smilies/Face_ase.xbm, etc/smilies/Face_ase2.xbm, etc/smilies/Face_ase3.xbm, etc/smilies/Face_smile.xbm, etc/smilies/Face_weep.xbm, etc/sounds, etc/toolbar, etc/toolbar/workshop-cap-up.xpm, etc/xemacs-ja.1, etc/xemacs.1, etc/yow.lines, etc\BETA, etc\NEWS, etc\README, etc\TUTORIAL, etc\TUTORIAL.de, etc\check_cygwin_setup.sh, etc\sample.init.el, etc\unicode\README, etc\unicode\mule-ucs\*, etc\unicode\other\* unicode/unicode-consortium/8859-16.TXT: New file. mule/english.el: Define this charset now, since a bug was fixed that formerly prevented it. mule/ethio-util.el: Fix compile errors involving Unicode `characters', which should be integers. Makefile.in.in: Always include gui.c, to fix compile error when TTY-only. EmacsFrame.c, abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, bytecode.h, callint.c, callproc.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.c, console-msw.h, console-tty.c, console-x.c, console-x.h, console.c, console.h, data.c, database.c, device-gtk.c, device-msw.c, device-x.c, device.c, device.h, dialog-msw.c, doc.c, doprnt.c, dumper.c, dynarr.c, editfns.c, eldap.c, eldap.h, elhash.c, elhash.h, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, events.h, extents.c, extents.h, faces.c, faces.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, free-hook.c, general-slots.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gtk-xemacs.c, gui-msw.c, gui-x.c, gui-x.h, gui.c, gui.h, gutter.c, gutter.h, indent.c, input-method-xlib.c, insdel.c, keymap.c, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-canna.c, mule-ccl.c, mule-charset.c, mule-wnnfns.c, native-gtk-toolbar.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, opaque.c, opaque.h, postgresql.c, postgresql.h, print.c, process-unix.c, process.c, process.h, rangetab.c, rangetab.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, search.c, select-gtk.c, select-x.c, sound.c, specifier.c, specifier.h, strftime.c, symbols.c, symeval.h, syntax.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, toolbar.h, tooltalk.c, tooltalk.h, ui-gtk.c, ui-gtk.h, undo.c, vm-limit.c, window.c, window.h: Eliminate XSETFOO. Replace all usages with wrap_foo(). Make symbol->name a Lisp_Object, not Lisp_String *. Eliminate nearly all uses of Lisp_String * in favor of Lisp_Object, and correct macros so most of them favor Lisp_Object. Create new error-behavior ERROR_ME_DEBUG_WARN -- output warnings, but at level `debug' (usually ignored). Use it when instantiating specifiers, so problems can be debugged. Move log-warning-minimum-level into C so that we can optimize ERROR_ME_DEBUG_WARN. Fix warning levels consistent with new definitions. Add default_ and parent fields to char table; not yet implemented. New fun Dynarr_verify(); use for further error checking on Dynarrs. Rearrange code at top of lisp.h in conjunction with dynarr changes. Fix eifree(). Use Eistrings in various places (format_event_object(), where_is_to_char(), and callers thereof) to avoid fixed-size strings buffers. New fun write_eistring(). Reindent and fix GPM code to follow standards. Set default MS Windows font to Lucida Console (same size as Courier New but less interline spacing, so more lines fit). Increase default frame size on Windows to 50 lines. (If that's too big for the workspace, the frame will be shrunk as necessary.) Fix problem with text files with no newlines (). (Change `convert-eol' coding system to use `nil' for autodetect, consistent with make-coding-system.) Correct compile warnings in vm-limit.c. Fix handling of reverse-direction charsets to avoid errors when opening (e.g.) mule-ucs/lisp/reldata/uiso8859-6.el. Recode some object printing methods to use write_fmt_string() instead of a fixed buffer and sprintf. Turn on display of png comments as warnings (level `info'), now that they're unobtrusive. Revamped the sound documentation. Fixed bug in redisplay w.r.t. hscroll/truncation/continuation glyphs causing jumping up and down of the lines, since they're bigger than the line size. (It was seen most obviously when there's a horizontal scroll bar, e.g. do C-h a glyph or something like that.) The problem was that the glyph-contrib-p setting on glyphs was ignored even if it was set properly, which it wasn't until now.
author ben
date Fri, 29 Mar 2002 04:49:13 +0000
parents 2923009caf47
children a5954632b187
comparison
equal deleted inserted replaced
792:4e83fdb13eb9 793:e38acbeb1cae
1016 1016
1017 /* kludge */ 1017 /* kludge */
1018 static void 1018 static void
1019 setup_eol_coding_systems (Lisp_Object codesys) 1019 setup_eol_coding_systems (Lisp_Object codesys)
1020 { 1020 {
1021 int len = string_length (XSYMBOL (XCODING_SYSTEM_NAME (codesys))->name); 1021 int len = XSTRING_LENGTH (XSYMBOL (XCODING_SYSTEM_NAME (codesys))->name);
1022 Intbyte *codesys_name = (Intbyte *) alloca (len + 7); 1022 Intbyte *codesys_name = (Intbyte *) alloca (len + 7);
1023 int mlen = -1; 1023 int mlen = -1;
1024 Intbyte *codesys_mnemonic = 0; 1024 Intbyte *codesys_mnemonic = 0;
1025 Lisp_Object codesys_name_sym, sub_codesys; 1025 Lisp_Object codesys_name_sym, sub_codesys;
1026 int i; 1026 int i;
1027 1027
1028 memcpy (codesys_name, 1028 memcpy (codesys_name,
1029 string_data (XSYMBOL (XCODING_SYSTEM_NAME (codesys))->name), len); 1029 XSTRING_DATA (XSYMBOL (XCODING_SYSTEM_NAME (codesys))->name), len);
1030 1030
1031 if (STRINGP (XCODING_SYSTEM_MNEMONIC (codesys))) 1031 if (STRINGP (XCODING_SYSTEM_MNEMONIC (codesys)))
1032 { 1032 {
1033 mlen = XSTRING_LENGTH (XCODING_SYSTEM_MNEMONIC (codesys)); 1033 mlen = XSTRING_LENGTH (XCODING_SYSTEM_MNEMONIC (codesys));
1034 codesys_mnemonic = (Intbyte *) alloca (mlen + 7); 1034 codesys_mnemonic = (Intbyte *) alloca (mlen + 7);
1175 invalid_operation ("Cannot redefine existing coding system", 1175 invalid_operation ("Cannot redefine existing coding system",
1176 name_or_existing); 1176 name_or_existing);
1177 1177
1178 cs = allocate_coding_system (meths, meths->extra_data_size, 1178 cs = allocate_coding_system (meths, meths->extra_data_size,
1179 name_or_existing); 1179 name_or_existing);
1180 XSETCODING_SYSTEM (csobj, cs); 1180 csobj = wrap_coding_system (cs);
1181 1181
1182 cs->internal_p = !!prefix; 1182 cs->internal_p = !!prefix;
1183 1183
1184 if (NILP (description)) 1184 if (NILP (description))
1185 description = build_string (""); 1185 description = build_string ("");
1455 1455
1456 1456
1457 The following additional property is recognized if TYPE is 'convert-eol: 1457 The following additional property is recognized if TYPE is 'convert-eol:
1458 1458
1459 'subtype 1459 'subtype
1460 One of `lf', `crlf', `cr' or `autodetect'. When decoding, the 1460 One of `lf', `crlf', `cr' or nil (for autodetection). When decoding,
1461 corresponding sequence will be converted to LF. When encoding, the 1461 the corresponding sequence will be converted to LF. When encoding,
1462 opposite happens. This coding system converts characters to 1462 the opposite happens. This coding system converts characters to
1463 characters. 1463 characters.
1464 1464
1465 1465
1466 1466
1467 The following additional properties are recognized if TYPE is 'iso2022: 1467 The following additional properties are recognized if TYPE is 'iso2022:
1643 old_coding_system = Fget_coding_system (old_coding_system); 1643 old_coding_system = Fget_coding_system (old_coding_system);
1644 new_coding_system = 1644 new_coding_system =
1645 UNBOUNDP (new_name) ? Qnil : Ffind_coding_system (new_name); 1645 UNBOUNDP (new_name) ? Qnil : Ffind_coding_system (new_name);
1646 if (NILP (new_coding_system)) 1646 if (NILP (new_coding_system))
1647 { 1647 {
1648 XSETCODING_SYSTEM 1648 new_coding_system =
1649 (new_coding_system, 1649 wrap_coding_system
1650 allocate_coding_system 1650 (allocate_coding_system
1651 (XCODING_SYSTEM (old_coding_system)->methods, 1651 (XCODING_SYSTEM (old_coding_system)->methods,
1652 XCODING_SYSTEM (old_coding_system)->methods->extra_data_size, 1652 XCODING_SYSTEM (old_coding_system)->methods->extra_data_size,
1653 new_name)); 1653 new_name));
1654 if (!UNBOUNDP (new_name)) 1654 if (!UNBOUNDP (new_name))
1655 Fputhash (new_name, new_coding_system, Vcoding_system_hash_table); 1655 Fputhash (new_name, new_coding_system, Vcoding_system_hash_table);
1656 } 1656 }
1657 else if (XCODING_SYSTEM (old_coding_system)->methods != 1657 else if (XCODING_SYSTEM (old_coding_system)->methods !=
1658 XCODING_SYSTEM (new_coding_system)->methods) 1658 XCODING_SYSTEM (new_coding_system)->methods)
2304 make_coding_stream_1 (Lstream *stream, Lisp_Object codesys, 2304 make_coding_stream_1 (Lstream *stream, Lisp_Object codesys,
2305 const char *mode, enum encode_decode direction) 2305 const char *mode, enum encode_decode direction)
2306 { 2306 {
2307 Lstream *lstr = Lstream_new (lstream_coding, mode); 2307 Lstream *lstr = Lstream_new (lstream_coding, mode);
2308 struct coding_stream *str = CODING_STREAM_DATA (lstr); 2308 struct coding_stream *str = CODING_STREAM_DATA (lstr);
2309 Lisp_Object obj;
2310 2309
2311 codesys = Fget_coding_system (codesys); 2310 codesys = Fget_coding_system (codesys);
2312 xzero (*str); 2311 xzero (*str);
2313 str->codesys = Qnil; 2312 str->codesys = Qnil;
2314 str->orig_codesys = Qnil; 2313 str->orig_codesys = Qnil;
2316 str->other_end = stream; 2315 str->other_end = stream;
2317 str->convert_to = Dynarr_new (unsigned_char); 2316 str->convert_to = Dynarr_new (unsigned_char);
2318 str->convert_from = Dynarr_new (unsigned_char); 2317 str->convert_from = Dynarr_new (unsigned_char);
2319 str->direction = direction; 2318 str->direction = direction;
2320 set_coding_stream_coding_system (lstr, codesys); 2319 set_coding_stream_coding_system (lstr, codesys);
2321 XSETLSTREAM (obj, lstr); 2320 return wrap_lstream (lstr);
2322 return obj;
2323 } 2321 }
2324 2322
2325 Lisp_Object 2323 Lisp_Object
2326 make_coding_input_stream (Lstream *stream, Lisp_Object codesys, 2324 make_coding_input_stream (Lstream *stream, Lisp_Object codesys,
2327 enum encode_decode direction) 2325 enum encode_decode direction)
2959 different EOL types itself if it does line-oriented type processing. 2957 different EOL types itself if it does line-oriented type processing.
2960 This is unavoidable because we don't know whether the output of the 2958 This is unavoidable because we don't know whether the output of the
2961 main encoding routine is ASCII compatible (Unicode is definitely not, 2959 main encoding routine is ASCII compatible (Unicode is definitely not,
2962 for example). 2960 for example).
2963 2961
2964 There is one parameter: `subtype', either `cr', `lf', `crlf', or `autodetect'. 2962 There is one parameter: `subtype', either `cr', `lf', `crlf', or nil.
2965 */ 2963 */
2966 2964
2967 DEFINE_CODING_SYSTEM_TYPE (convert_eol); 2965 DEFINE_CODING_SYSTEM_TYPE (convert_eol);
2968 2966
2969 struct convert_eol_coding_system 2967 struct convert_eol_coding_system
2994 2992
2995 write_fmt_string (printcharfun, "(%s)", 2993 write_fmt_string (printcharfun, "(%s)",
2996 data->subtype == EOL_LF ? "lf" : 2994 data->subtype == EOL_LF ? "lf" :
2997 data->subtype == EOL_CRLF ? "crlf" : 2995 data->subtype == EOL_CRLF ? "crlf" :
2998 data->subtype == EOL_CR ? "cr" : 2996 data->subtype == EOL_CR ? "cr" :
2999 data->subtype == EOL_AUTODETECT ? "autodetect" : 2997 data->subtype == EOL_AUTODETECT ? "nil" :
3000 (abort(), "")); 2998 (abort(), ""));
3001 } 2999 }
3002 3000
3003 static enum source_sink_type 3001 static enum source_sink_type
3004 convert_eol_conversion_end_type (Lisp_Object codesys) 3002 convert_eol_conversion_end_type (Lisp_Object codesys)
3020 data->subtype = EOL_LF; 3018 data->subtype = EOL_LF;
3021 else if (EQ (value, Qcrlf) /* || EQ (value, Qdos) */) 3019 else if (EQ (value, Qcrlf) /* || EQ (value, Qdos) */)
3022 data->subtype = EOL_CRLF; 3020 data->subtype = EOL_CRLF;
3023 else if (EQ (value, Qcr) /* || EQ (value, Qmac) */) 3021 else if (EQ (value, Qcr) /* || EQ (value, Qmac) */)
3024 data->subtype = EOL_CR; 3022 data->subtype = EOL_CR;
3025 else if (EQ (value, Qautodetect) /* || EQ (value, Qmac) */) 3023 else if (EQ (value, Qnil))
3026 data->subtype = EOL_AUTODETECT; 3024 data->subtype = EOL_AUTODETECT;
3027 else invalid_constant ("Unrecognized eol type", value); 3025 else invalid_constant ("Unrecognized eol type", value);
3028 } 3026 }
3029 else 3027 else
3030 return 0; 3028 return 0;
3042 switch (data->subtype) 3040 switch (data->subtype)
3043 { 3041 {
3044 case EOL_LF: return Qlf; 3042 case EOL_LF: return Qlf;
3045 case EOL_CRLF: return Qcrlf; 3043 case EOL_CRLF: return Qcrlf;
3046 case EOL_CR: return Qcr; 3044 case EOL_CR: return Qcr;
3047 case EOL_AUTODETECT: return Qautodetect; 3045 case EOL_AUTODETECT: return Qnil;
3048 default: abort (); 3046 default: abort ();
3049 } 3047 }
3050 } 3048 }
3051 3049
3052 return Qunbound; 3050 return Qunbound;
3662 retval = (get_coding_system_for_text_file 3660 retval = (get_coding_system_for_text_file
3663 (coding_category_system[cat], 0)); 3661 (coding_category_system[cat], 0));
3664 if (likelihood < DET_AS_LIKELY_AS_UNLIKELY) 3662 if (likelihood < DET_AS_LIKELY_AS_UNLIKELY)
3665 warn_when_safe_lispobj 3663 warn_when_safe_lispobj
3666 (intern ("detection"), 3664 (intern ("detection"),
3667 Qerror, 3665 Qwarning,
3668 emacs_sprintf_string_lisp 3666 emacs_sprintf_string_lisp
3669 ( 3667 (
3670 "Detected coding %s is unlikely to be correct (likelihood == `%s')", 3668 "Detected coding %s is unlikely to be correct (likelihood == `%s')",
3671 Qnil, 2, XCODING_SYSTEM_NAME (retval), 3669 Qnil, 2, XCODING_SYSTEM_NAME (retval),
3672 detection_result_number_to_symbol 3670 detection_result_number_to_symbol
4795 build_msg_string ("Autodetect EOL type"), 4793 build_msg_string ("Autodetect EOL type"),
4796 nconc2 (list6 (Qdocumentation, 4794 nconc2 (list6 (Qdocumentation,
4797 build_msg_string ( 4795 build_msg_string (
4798 "Autodetect the end-of-line type."), 4796 "Autodetect the end-of-line type."),
4799 Qmnemonic, build_string ("Auto-EOL"), 4797 Qmnemonic, build_string ("Auto-EOL"),
4800 Qsubtype, Qautodetect), 4798 Qsubtype, Qnil),
4801 /* VERY IMPORTANT! Tell make-coding-system not to generate 4799 /* VERY IMPORTANT! Tell make-coding-system not to generate
4802 subsidiaries -- it needs the coding systems we're creating 4800 subsidiaries -- it needs the coding systems we're creating
4803 to do so! */ 4801 to do so! */
4804 list2 (Qeol_type, Qlf))); 4802 list2 (Qeol_type, Qlf)));
4805 4803