Mercurial > hg > xemacs-beta
comparison src/mule-coding.c @ 826:6728e641994e
[xemacs-hg @ 2002-05-05 11:30:15 by ben]
syntax cache, 8-bit-format, lots of code cleanup
README.packages: Update info about --package-path.
i.c: Create an inheritable event and pass it on to XEmacs, so that ^C
can be handled properly. Intercept ^C and signal the event.
"Stop Build" in VC++ now works.
bytecomp-runtime.el: Doc string changes.
compat.el: Some attempts to redo this to
make it truly useful and fix the "multiple versions interacting
with each other" problem. Not yet done. Currently doesn't work.
files.el: Use with-obsolete-variable to avoid warnings in new revert-buffer code.
xemacs.mak: Split up CFLAGS into a version without flags specifying the C
library. The problem seems to be that minitar depends on zlib,
which depends specifically on libc.lib, not on any of the other C
libraries. Unless you compile with libc.lib, you get errors --
specifically, no _errno in the other libraries, which must make it
something other than an int. (#### But this doesn't seem to obtain
in XEmacs, which also uses zlib, and can be linked with any of the
C libraries. Maybe zlib is used differently and doesn't need
errno, or maybe XEmacs provides an int errno; ... I don't
understand.
Makefile.in.in: Fix so that packages are around when testing.
abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.h, console-stream.c, console-x.c, console.c, console.h, data.c, device-msw.c, device.c, device.h, dialog-msw.c, dialog-x.c, dired-msw.c, dired.c, doc.c, doprnt.c, dumper.c, editfns.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, events.h, extents.c, extents.h, faces.c, file-coding.c, file-coding.h, fileio.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, frame.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-msw.h, glyphs-x.c, glyphs.c, glyphs.h, gui-msw.c, gui-x.c, gui.h, gutter.h, hash.h, indent.c, insdel.c, intl-win32.c, intl.c, keymap.c, 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-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, nas.c, objects-msw.c, objects-x.c, opaque.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, process.h, profile.c, rangetab.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, regex.h, scrollbar-msw.c, search.c, select-x.c, specifier.c, specifier.h, symbols.c, symsinit.h, syntax.c, syntax.h, syswindows.h, tests.c, text.c, text.h, tooltalk.c, ui-byhand.c, ui-gtk.c, unicode.c, win32.c, window.c: Another big Ben patch.
-- FUNCTIONALITY CHANGES:
add partial support for 8-bit-fixed, 16-bit-fixed, and
32-bit-fixed formats. not quite done yet. (in particular, needs
functions to actually convert the buffer.) NOTE: lots of changes
to regex.c here. also, many new *_fmt() inline funs that take an
Internal_Format argument.
redo syntax cache code. make the cache per-buffer; keep the cache
valid across calls to functions that use it. also keep it valid
across insertions/deletions and extent changes, as much as is
possible. eliminate the junky regex-reentrancy code by passing in
the relevant lisp info to the regex routines as local vars.
add general mechanism in extents code for signalling extent changes.
fix numerous problems with the case-table implementation; yoshiki
never properly transferred many algorithms from old-style to
new-style case tables.
redo char tables to support a default argument, so that mapping
only occurs over changed args. change many chartab functions to
accept Lisp_Object instead of Lisp_Char_Table *.
comment out the code in font-lock.c by default, because
font-lock.el no longer uses it. we should consider eliminating it
entirely.
Don't output bell as ^G in console-stream when not a TTY.
add -mswindows-termination-handle to interface with i.c, so we can
properly kill a build.
add more error-checking to buffer/string macros.
add some additional buffer_or_string_() funs.
-- INTERFACE CHANGES AFFECTING MORE CODE:
switch the arguments of write_c_string and friends to be
consistent with write_fmt_string, which must have printcharfun
first.
change BI_* macros to BYTE_* for increased clarity; similarly for
bi_* local vars.
change VOID_TO_LISP to be a one-argument function. eliminate
no-longer-needed CVOID_TO_LISP.
-- char/string macro changes:
rename MAKE_CHAR() to make_emchar() for slightly less confusion
with make_char(). (The former generates an Emchar, the latter a
Lisp object. Conceivably we should rename make_char() -> wrap_char()
and similarly for make_int(), make_float().)
Similar changes for other *CHAR* macros -- we now consistently use
names with `emchar' whenever we are working with Emchars. Any
remaining name with just `char' always refers to a Lisp object.
rename macros with XSTRING_* to string_* except for those that
reference actual fields in the Lisp_String object, following
conventions used elsewhere.
rename set_string_{data,length} macros (the only ones to work with
a Lisp_String_* instead of a Lisp_Object) to set_lispstringp_*
to make the difference clear.
try to be consistent about caps vs. lowercase in macro/inline-fun
names for chars and such, which wasn't the case before. we now
reserve caps either for XFOO_ macros that reference object fields
(e.g. XSTRING_DATA) or for things that have non-function semantics,
e.g. directly modifying an arg (BREAKUP_EMCHAR) or evaluating an
arg (any arg) more than once. otherwise, use lowercase.
here is a summary of most of the macros/inline funs changed by all
of the above changes:
BYTE_*_P -> byte_*_p
XSTRING_BYTE -> string_byte
set_string_data/length -> set_lispstringp_data/length
XSTRING_CHAR_LENGTH -> string_char_length
XSTRING_CHAR -> string_emchar
INTBYTE_FIRST_BYTE_P -> intbyte_first_byte_p
INTBYTE_LEADING_BYTE_P -> intbyte_leading_byte_p
charptr_copy_char -> charptr_copy_emchar
LEADING_BYTE_* -> leading_byte_*
CHAR_* -> EMCHAR_*
*_CHAR_* -> *_EMCHAR_*
*_CHAR -> *_EMCHAR
CHARSET_BY_ -> charset_by_*
BYTE_SHIFT_JIS* -> byte_shift_jis*
BYTE_BIG5* -> byte_big5*
REP_BYTES_BY_FIRST_BYTE -> rep_bytes_by_first_byte
char_to_unicode -> emchar_to_unicode
valid_char_p -> valid_emchar_p
Change intbyte_strcmp -> qxestrcmp_c (duplicated functionality).
-- INTERFACE CHANGES AFFECTING LESS CODE:
use DECLARE_INLINE_HEADER in various places.
remove '#ifdef emacs' from XEmacs-only files.
eliminate CHAR_TABLE_VALUE(), which duplicated the functionality
of get_char_table().
add BUFFER_TEXT_LOOP to simplify iterations over buffer text.
define typedefs for signed and unsigned types of fixed sizes
(INT_32_BIT, UINT_32_BIT, etc.).
create ALIGN_FOR_TYPE as a higher-level interface onto ALIGN_SIZE;
fix code to use it.
add charptr_emchar_len to return the text length of the character
pointed to by a ptr; use it in place of
charcount_to_bytecount(..., 1). add emchar_len to return the text
length of a given character.
add types Bytexpos and Charxpos to generalize Bytebpos/Bytecount
and Charbpos/Charcount, in code (particularly, the extents code
and redisplay code) that works with either kind of index. rename
redisplay struct params with names such as `charbpos' to
e.g. `charpos' when they are e.g. a Charxpos, not a Charbpos.
eliminate xxDEFUN in place of DEFUN; no longer necessary with
changes awhile back to doc.c.
split up big ugly combined list of EXFUNs in lisp.h on a
file-by-file basis, since other prototypes are similarly split.
rewrite some "*_UNSAFE" macros as inline funs and eliminate the
_UNSAFE suffix.
move most string code from lisp.h to text.h; the string code and
text.h code is now intertwined in such a fashion that they need
to be in the same place and partially interleaved. (you can't
create forward references for inline funs)
automated/lisp-tests.el, automated/symbol-tests.el, automated/test-harness.el: Fix test harness to output FAIL messages to stderr when in
batch mode.
Fix up some problems in lisp-tests/symbol-tests that were
causing spurious failures.
author | ben |
---|---|
date | Sun, 05 May 2002 11:33:57 +0000 |
parents | a5954632b187 |
children | 5d09ddada9ae |
comparison
equal
deleted
inserted
replaced
825:eb3bc15a6e0f | 826:6728e641994e |
---|---|
74 | 74 |
75 */ | 75 */ |
76 | 76 |
77 /* Is this the first byte of a Shift-JIS two-byte char? */ | 77 /* Is this the first byte of a Shift-JIS two-byte char? */ |
78 | 78 |
79 #define BYTE_SHIFT_JIS_TWO_BYTE_1_P(c) \ | 79 inline static int |
80 (((c) >= 0x81 && (c) <= 0x9F) || ((c) >= 0xE0 && (c) <= 0xEF)) | 80 byte_shift_jis_two_byte_1_p (int c) |
81 { | |
82 return (c >= 0x81 && c <= 0x9F) || (c >= 0xE0 && c <= 0xEF); | |
83 } | |
81 | 84 |
82 /* Is this the second byte of a Shift-JIS two-byte char? */ | 85 /* Is this the second byte of a Shift-JIS two-byte char? */ |
83 | 86 |
84 #define BYTE_SHIFT_JIS_TWO_BYTE_2_P(c) \ | 87 inline static int |
85 (((c) >= 0x40 && (c) <= 0x7E) || ((c) >= 0x80 && (c) <= 0xFC)) | 88 byte_shift_jis_two_byte_2_p (int c) |
86 | 89 { |
87 #define BYTE_SHIFT_JIS_KATAKANA_P(c) \ | 90 return (c >= 0x40 && c <= 0x7E) || (c >= 0x80 && c <= 0xFC); |
88 ((c) >= 0xA1 && (c) <= 0xDF) | 91 } |
92 | |
93 inline static int | |
94 byte_shift_jis_katakana_p (int c) | |
95 { | |
96 return c >= 0xA1 && c <= 0xDF; | |
97 } | |
89 | 98 |
90 /* Convert Shift-JIS data to internal format. */ | 99 /* Convert Shift-JIS data to internal format. */ |
91 | 100 |
92 static Bytecount | 101 static Bytecount |
93 shift_jis_convert (struct coding_stream *str, const UExtbyte *src, | 102 shift_jis_convert (struct coding_stream *str, const UExtbyte *src, |
103 UExtbyte c = *src++; | 112 UExtbyte c = *src++; |
104 | 113 |
105 if (ch) | 114 if (ch) |
106 { | 115 { |
107 /* Previous character was first byte of Shift-JIS Kanji char. */ | 116 /* Previous character was first byte of Shift-JIS Kanji char. */ |
108 if (BYTE_SHIFT_JIS_TWO_BYTE_2_P (c)) | 117 if (byte_shift_jis_two_byte_2_p (c)) |
109 { | 118 { |
110 Intbyte e1, e2; | 119 Intbyte e1, e2; |
111 | 120 |
112 Dynarr_add (dst, LEADING_BYTE_JAPANESE_JISX0208); | 121 Dynarr_add (dst, LEADING_BYTE_JAPANESE_JISX0208); |
113 DECODE_SHIFT_JIS (ch, c, e1, e2); | 122 DECODE_SHIFT_JIS (ch, c, e1, e2); |
121 } | 130 } |
122 ch = 0; | 131 ch = 0; |
123 } | 132 } |
124 else | 133 else |
125 { | 134 { |
126 if (BYTE_SHIFT_JIS_TWO_BYTE_1_P (c)) | 135 if (byte_shift_jis_two_byte_1_p (c)) |
127 ch = c; | 136 ch = c; |
128 else if (BYTE_SHIFT_JIS_KATAKANA_P (c)) | 137 else if (byte_shift_jis_katakana_p (c)) |
129 { | 138 { |
130 Dynarr_add (dst, LEADING_BYTE_KATAKANA_JISX0201); | 139 Dynarr_add (dst, LEADING_BYTE_KATAKANA_JISX0201); |
131 Dynarr_add (dst, c); | 140 Dynarr_add (dst, c); |
132 } | 141 } |
133 else | 142 else |
141 else | 150 else |
142 { | 151 { |
143 while (n--) | 152 while (n--) |
144 { | 153 { |
145 Intbyte c = *src++; | 154 Intbyte c = *src++; |
146 if (BYTE_ASCII_P (c)) | 155 if (byte_ascii_p (c)) |
147 { | 156 { |
148 Dynarr_add (dst, c); | 157 Dynarr_add (dst, c); |
149 ch = 0; | 158 ch = 0; |
150 } | 159 } |
151 else if (INTBYTE_LEADING_BYTE_P (c)) | 160 else if (intbyte_leading_byte_p (c)) |
152 ch = (c == LEADING_BYTE_KATAKANA_JISX0201 || | 161 ch = (c == LEADING_BYTE_KATAKANA_JISX0201 || |
153 c == LEADING_BYTE_JAPANESE_JISX0208_1978 || | 162 c == LEADING_BYTE_JAPANESE_JISX0208_1978 || |
154 c == LEADING_BYTE_JAPANESE_JISX0208) ? c : 0; | 163 c == LEADING_BYTE_JAPANESE_JISX0208) ? c : 0; |
155 else if (ch) | 164 else if (ch) |
156 { | 165 { |
191 CHECK_CONS (code); | 200 CHECK_CONS (code); |
192 CHECK_INT (XCAR (code)); | 201 CHECK_INT (XCAR (code)); |
193 CHECK_INT (XCDR (code)); | 202 CHECK_INT (XCDR (code)); |
194 s1 = XINT (XCAR (code)); | 203 s1 = XINT (XCAR (code)); |
195 s2 = XINT (XCDR (code)); | 204 s2 = XINT (XCDR (code)); |
196 if (BYTE_SHIFT_JIS_TWO_BYTE_1_P (s1) && | 205 if (byte_shift_jis_two_byte_1_p (s1) && |
197 BYTE_SHIFT_JIS_TWO_BYTE_2_P (s2)) | 206 byte_shift_jis_two_byte_2_p (s2)) |
198 { | 207 { |
199 DECODE_SHIFT_JIS (s1, s2, c1, c2); | 208 DECODE_SHIFT_JIS (s1, s2, c1, c2); |
200 return make_char (MAKE_CHAR (Vcharset_japanese_jisx0208, | 209 return make_char (make_emchar (Vcharset_japanese_jisx0208, |
201 c1 & 0x7F, c2 & 0x7F)); | 210 c1 & 0x7F, c2 & 0x7F)); |
202 } | 211 } |
203 else | 212 else |
204 return Qnil; | 213 return Qnil; |
205 } | 214 } |
212 { | 221 { |
213 Lisp_Object charset; | 222 Lisp_Object charset; |
214 int c1, c2, s1, s2; | 223 int c1, c2, s1, s2; |
215 | 224 |
216 CHECK_CHAR_COERCE_INT (character); | 225 CHECK_CHAR_COERCE_INT (character); |
217 BREAKUP_CHAR (XCHAR (character), charset, c1, c2); | 226 BREAKUP_EMCHAR (XCHAR (character), charset, c1, c2); |
218 if (EQ (charset, Vcharset_japanese_jisx0208)) | 227 if (EQ (charset, Vcharset_japanese_jisx0208)) |
219 { | 228 { |
220 ENCODE_SHIFT_JIS (c1 | 0x80, c2 | 0x80, s1, s2); | 229 ENCODE_SHIFT_JIS (c1 | 0x80, c2 | 0x80, s1, s2); |
221 return Fcons (make_int (s1), make_int (s2)); | 230 return Fcons (make_int (s1), make_int (s2)); |
222 } | 231 } |
334 charset. So, in XEmacs, Big5 is divided into two: `charset-big5-1' | 343 charset. So, in XEmacs, Big5 is divided into two: `charset-big5-1' |
335 and `charset-big5-2'. Both <type>s are DIMENSION2_CHARS94. The former | 344 and `charset-big5-2'. Both <type>s are DIMENSION2_CHARS94. The former |
336 contains frequently used characters and the latter contains less | 345 contains frequently used characters and the latter contains less |
337 frequently used characters. */ | 346 frequently used characters. */ |
338 | 347 |
339 #define BYTE_BIG5_TWO_BYTE_1_P(c) \ | 348 inline static int |
340 ((c) >= 0xA1 && (c) <= 0xFE) | 349 byte_big5_two_byte_1_p (int c) |
350 { | |
351 return c >= 0xA1 && c <= 0xFE; | |
352 } | |
341 | 353 |
342 /* Is this the second byte of a Shift-JIS two-byte char? */ | 354 /* Is this the second byte of a Shift-JIS two-byte char? */ |
343 | 355 |
344 #define BYTE_BIG5_TWO_BYTE_2_P(c) \ | 356 inline static int |
345 (((c) >= 0x40 && (c) <= 0x7E) || ((c) >= 0xA1 && (c) <= 0xFE)) | 357 byte_big5_two_byte_2_p (int c) |
358 { | |
359 return (c >= 0x40 && c <= 0x7E) || (c >= 0xA1 && c <= 0xFE); | |
360 } | |
346 | 361 |
347 /* Number of Big5 characters which have the same code in 1st byte. */ | 362 /* Number of Big5 characters which have the same code in 1st byte. */ |
348 | 363 |
349 #define BIG5_SAME_ROW (0xFF - 0xA1 + 0x7F - 0x40) | 364 #define BIG5_SAME_ROW (0xFF - 0xA1 + 0x7F - 0x40) |
350 | 365 |
432 { | 447 { |
433 UExtbyte c = *src++; | 448 UExtbyte c = *src++; |
434 if (ch) | 449 if (ch) |
435 { | 450 { |
436 /* Previous character was first byte of Big5 char. */ | 451 /* Previous character was first byte of Big5 char. */ |
437 if (BYTE_BIG5_TWO_BYTE_2_P (c)) | 452 if (byte_big5_two_byte_2_p (c)) |
438 { | 453 { |
439 Intbyte b1, b2, b3; | 454 Intbyte b1, b2, b3; |
440 DECODE_BIG5 (ch, c, b1, b2, b3); | 455 DECODE_BIG5 (ch, c, b1, b2, b3); |
441 Dynarr_add (dst, b1); | 456 Dynarr_add (dst, b1); |
442 Dynarr_add (dst, b2); | 457 Dynarr_add (dst, b2); |
449 } | 464 } |
450 ch = 0; | 465 ch = 0; |
451 } | 466 } |
452 else | 467 else |
453 { | 468 { |
454 if (BYTE_BIG5_TWO_BYTE_1_P (c)) | 469 if (byte_big5_two_byte_1_p (c)) |
455 ch = c; | 470 ch = c; |
456 else | 471 else |
457 DECODE_ADD_BINARY_CHAR (c, dst); | 472 DECODE_ADD_BINARY_CHAR (c, dst); |
458 } | 473 } |
459 } | 474 } |
464 else | 479 else |
465 { | 480 { |
466 while (n--) | 481 while (n--) |
467 { | 482 { |
468 Intbyte c = *src++; | 483 Intbyte c = *src++; |
469 if (BYTE_ASCII_P (c)) | 484 if (byte_ascii_p (c)) |
470 { | 485 { |
471 /* ASCII. */ | 486 /* ASCII. */ |
472 Dynarr_add (dst, c); | 487 Dynarr_add (dst, c); |
473 } | 488 } |
474 else if (INTBYTE_LEADING_BYTE_P (c)) | 489 else if (intbyte_leading_byte_p (c)) |
475 { | 490 { |
476 if (c == LEADING_BYTE_CHINESE_BIG5_1 || | 491 if (c == LEADING_BYTE_CHINESE_BIG5_1 || |
477 c == LEADING_BYTE_CHINESE_BIG5_2) | 492 c == LEADING_BYTE_CHINESE_BIG5_2) |
478 { | 493 { |
479 /* A recognized leading byte. */ | 494 /* A recognized leading byte. */ |
508 } | 523 } |
509 | 524 |
510 Emchar | 525 Emchar |
511 decode_big5_char (int b1, int b2) | 526 decode_big5_char (int b1, int b2) |
512 { | 527 { |
513 if (BYTE_BIG5_TWO_BYTE_1_P (b1) && | 528 if (byte_big5_two_byte_1_p (b1) && |
514 BYTE_BIG5_TWO_BYTE_2_P (b2)) | 529 byte_big5_two_byte_2_p (b2)) |
515 { | 530 { |
516 int leading_byte; | 531 int leading_byte; |
517 Lisp_Object charset; | 532 Lisp_Object charset; |
518 int c1, c2; | 533 int c1, c2; |
519 | 534 |
520 DECODE_BIG5 (b1, b2, leading_byte, c1, c2); | 535 DECODE_BIG5 (b1, b2, leading_byte, c1, c2); |
521 charset = CHARSET_BY_LEADING_BYTE (leading_byte); | 536 charset = charset_by_leading_byte (leading_byte); |
522 return MAKE_CHAR (charset, c1 & 0x7F, c2 & 0x7F); | 537 return make_emchar (charset, c1 & 0x7F, c2 & 0x7F); |
523 } | 538 } |
524 else | 539 else |
525 return -1; | 540 return -1; |
526 } | 541 } |
527 | 542 |
559 { | 574 { |
560 Lisp_Object charset; | 575 Lisp_Object charset; |
561 int c1, c2, b1, b2; | 576 int c1, c2, b1, b2; |
562 | 577 |
563 CHECK_CHAR_COERCE_INT (character); | 578 CHECK_CHAR_COERCE_INT (character); |
564 BREAKUP_CHAR (XCHAR (character), charset, c1, c2); | 579 BREAKUP_EMCHAR (XCHAR (character), charset, c1, c2); |
565 if (EQ (charset, Vcharset_chinese_big5_1) || | 580 if (EQ (charset, Vcharset_chinese_big5_1) || |
566 EQ (charset, Vcharset_chinese_big5_2)) | 581 EQ (charset, Vcharset_chinese_big5_2)) |
567 { | 582 { |
568 ENCODE_BIG5 (XCHARSET_LEADING_BYTE (charset), c1 | 0x80, c2 | 0x80, | 583 ENCODE_BIG5 (XCHARSET_LEADING_BYTE (charset), c1 | 0x80, c2 | 0x80, |
569 b1, b2); | 584 b1, b2); |
1208 } | 1223 } |
1209 | 1224 |
1210 static Lisp_Object | 1225 static Lisp_Object |
1211 charset_by_attributes_or_create_one (int type, Intbyte final, int dir) | 1226 charset_by_attributes_or_create_one (int type, Intbyte final, int dir) |
1212 { | 1227 { |
1213 Lisp_Object charset = CHARSET_BY_ATTRIBUTES (type, final, dir); | 1228 Lisp_Object charset = charset_by_attributes (type, final, dir); |
1214 | 1229 |
1215 if (NILP (charset)) | 1230 if (NILP (charset)) |
1216 { | 1231 { |
1217 int chars, dim; | 1232 int chars, dim; |
1218 | 1233 |
1799 #else | 1814 #else |
1800 case ISO_ESC_START_COMPOSITE: | 1815 case ISO_ESC_START_COMPOSITE: |
1801 { | 1816 { |
1802 Intbyte comstr[MAX_EMCHAR_LEN]; | 1817 Intbyte comstr[MAX_EMCHAR_LEN]; |
1803 Bytecount len; | 1818 Bytecount len; |
1804 Emchar emch = MAKE_CHAR (Vcharset_composite, c - '0' + ' ', | 1819 Emchar emch = make_emchar (Vcharset_composite, c - '0' + ' ', |
1805 0); | 1820 0); |
1806 len = set_charptr_emchar (comstr, emch); | 1821 len = set_charptr_emchar (comstr, emch); |
1807 Dynarr_add_many (dst, comstr, len); | 1822 Dynarr_add_many (dst, comstr, len); |
1808 break; | 1823 break; |
1809 } | 1824 } |
1843 DECODE_ADD_BINARY_CHAR (c, dst); | 1858 DECODE_ADD_BINARY_CHAR (c, dst); |
1844 } | 1859 } |
1845 } | 1860 } |
1846 ch = 0; | 1861 ch = 0; |
1847 } | 1862 } |
1848 else if (BYTE_C0_P (c) || BYTE_C1_P (c)) | 1863 else if (byte_c0_p (c) || byte_c1_p (c)) |
1849 { /* Control characters */ | 1864 { /* Control characters */ |
1850 | 1865 |
1851 /***** Error-handling *****/ | 1866 /***** Error-handling *****/ |
1852 | 1867 |
1853 /* If we were in the middle of a character, dump out the | 1868 /* If we were in the middle of a character, dump out the |
1883 int reg; | 1898 int reg; |
1884 | 1899 |
1885 /* Now determine the charset. */ | 1900 /* Now determine the charset. */ |
1886 reg = ((flags & ISO_STATE_SS2) ? 2 | 1901 reg = ((flags & ISO_STATE_SS2) ? 2 |
1887 : (flags & ISO_STATE_SS3) ? 3 | 1902 : (flags & ISO_STATE_SS3) ? 3 |
1888 : !BYTE_ASCII_P (c) ? data->register_right | 1903 : !byte_ascii_p (c) ? data->register_right |
1889 : data->register_left); | 1904 : data->register_left); |
1890 charset = data->charset[reg]; | 1905 charset = data->charset[reg]; |
1891 | 1906 |
1892 /* Error checking: */ | 1907 /* Error checking: */ |
1893 if (! CHARSETP (charset) | 1908 if (! CHARSETP (charset) |
2119 #endif | 2134 #endif |
2120 while (n--) | 2135 while (n--) |
2121 { | 2136 { |
2122 c = *src++; | 2137 c = *src++; |
2123 | 2138 |
2124 if (BYTE_ASCII_P (c)) | 2139 if (byte_ascii_p (c)) |
2125 { /* Processing ASCII character */ | 2140 { /* Processing ASCII character */ |
2126 ch = 0; | 2141 ch = 0; |
2127 | 2142 |
2128 restore_left_to_right_direction (codesys, dst, &flags, 0); | 2143 restore_left_to_right_direction (codesys, dst, &flags, 0); |
2129 | 2144 |
2167 Dynarr_add (dst, ISO_CODE_ESC); | 2182 Dynarr_add (dst, ISO_CODE_ESC); |
2168 Dynarr_add (dst, c); | 2183 Dynarr_add (dst, c); |
2169 char_boundary = 1; | 2184 char_boundary = 1; |
2170 } | 2185 } |
2171 | 2186 |
2172 else if (INTBYTE_LEADING_BYTE_P (c) || INTBYTE_LEADING_BYTE_P (ch)) | 2187 else if (intbyte_leading_byte_p (c) || intbyte_leading_byte_p (ch)) |
2173 { /* Processing Leading Byte */ | 2188 { /* Processing Leading Byte */ |
2174 ch = 0; | 2189 ch = 0; |
2175 charset = CHARSET_BY_LEADING_BYTE (c); | 2190 charset = charset_by_leading_byte (c); |
2176 if (LEADING_BYTE_PREFIX_P (c)) | 2191 if (leading_byte_prefix_p (c)) |
2177 ch = c; | 2192 ch = c; |
2178 else if (!EQ (charset, Vcharset_control_1) | 2193 else if (!EQ (charset, Vcharset_control_1) |
2179 && !EQ (charset, Vcharset_composite)) | 2194 && !EQ (charset, Vcharset_composite)) |
2180 { | 2195 { |
2181 int reg; | 2196 int reg; |
2316 handle this yet. */ | 2331 handle this yet. */ |
2317 Dynarr_add (dst, '~'); | 2332 Dynarr_add (dst, '~'); |
2318 } | 2333 } |
2319 else | 2334 else |
2320 { | 2335 { |
2321 Emchar emch = MAKE_CHAR (Vcharset_composite, | 2336 Emchar emch = make_emchar (Vcharset_composite, |
2322 ch & 0x7F, c & 0x7F); | 2337 ch & 0x7F, c & 0x7F); |
2323 Lisp_Object lstr = composite_char_string (emch); | 2338 Lisp_Object lstr = composite_char_string (emch); |
2324 saved_n = n; | 2339 saved_n = n; |
2325 saved_src = src; | 2340 saved_src = src; |
2326 in_composite = 1; | 2341 in_composite = 1; |
2648 static void | 2663 static void |
2649 iso2022_print (Lisp_Object cs, Lisp_Object printcharfun, int escapeflag) | 2664 iso2022_print (Lisp_Object cs, Lisp_Object printcharfun, int escapeflag) |
2650 { | 2665 { |
2651 int i; | 2666 int i; |
2652 | 2667 |
2653 write_c_string ("(", printcharfun); | 2668 write_c_string (printcharfun, "("); |
2654 for (i = 0; i < 4; i++) | 2669 for (i = 0; i < 4; i++) |
2655 { | 2670 { |
2656 Lisp_Object charset = coding_system_charset (cs, i); | 2671 Lisp_Object charset = coding_system_charset (cs, i); |
2657 if (i > 0) | 2672 if (i > 0) |
2658 write_c_string (", ", printcharfun); | 2673 write_c_string (printcharfun, ", "); |
2659 write_fmt_string (printcharfun, "g%d=", i); | 2674 write_fmt_string (printcharfun, "g%d=", i); |
2660 print_internal (CHARSETP (charset) ? XCHARSET_NAME (charset) : charset, printcharfun, 0); | 2675 print_internal (CHARSETP (charset) ? XCHARSET_NAME (charset) : charset, printcharfun, 0); |
2661 if (XCODING_SYSTEM_ISO2022_FORCE_CHARSET_ON_OUTPUT (cs, i)) | 2676 if (XCODING_SYSTEM_ISO2022_FORCE_CHARSET_ON_OUTPUT (cs, i)) |
2662 write_c_string ("(force)", printcharfun); | 2677 write_c_string (printcharfun, "(force)"); |
2663 } | 2678 } |
2664 | 2679 |
2665 #define FROB(prop) \ | 2680 #define FROB(prop) \ |
2666 if (!NILP (iso2022_getprop (cs, prop))) \ | 2681 if (!NILP (iso2022_getprop (cs, prop))) \ |
2667 { \ | 2682 { \ |
2689 (XCODING_SYSTEM_ISO2022_OUTPUT_CONV (cs), 1); | 2704 (XCODING_SYSTEM_ISO2022_OUTPUT_CONV (cs), 1); |
2690 if (!NILP (val)) | 2705 if (!NILP (val)) |
2691 { | 2706 { |
2692 write_fmt_string_lisp (printcharfun, ", output-charset-conversion=%s", 1, val); | 2707 write_fmt_string_lisp (printcharfun, ", output-charset-conversion=%s", 1, val); |
2693 } | 2708 } |
2694 write_c_string (")", printcharfun); | 2709 write_c_string (printcharfun, ")"); |
2695 } | 2710 } |
2696 } | 2711 } |
2697 | 2712 |
2698 | 2713 |
2699 /************************************************************************/ | 2714 /************************************************************************/ |
2783 } | 2798 } |
2784 data->high_byte_count = 0; | 2799 data->high_byte_count = 0; |
2785 data->saw_single_shift_just_now = 0; | 2800 data->saw_single_shift_just_now = 0; |
2786 } | 2801 } |
2787 if (!(data->flags & ISO_STATE_ESCAPE) | 2802 if (!(data->flags & ISO_STATE_ESCAPE) |
2788 && (BYTE_C0_P (c) || BYTE_C1_P (c))) | 2803 && (byte_c0_p (c) || byte_c1_p (c))) |
2789 { /* control chars */ | 2804 { /* control chars */ |
2790 switch (c) | 2805 switch (c) |
2791 { | 2806 { |
2792 /* Allow and ignore control characters that you might | 2807 /* Allow and ignore control characters that you might |
2793 reasonably see in a text file */ | 2808 reasonably see in a text file */ |
2805 default: | 2820 default: |
2806 break; | 2821 break; |
2807 } | 2822 } |
2808 } | 2823 } |
2809 | 2824 |
2810 if ((data->flags & ISO_STATE_ESCAPE) || BYTE_C0_P (c) | 2825 if ((data->flags & ISO_STATE_ESCAPE) || byte_c0_p (c) |
2811 || BYTE_C1_P (c)) | 2826 || byte_c1_p (c)) |
2812 { | 2827 { |
2813 switch (parse_iso2022_esc (Qnil, data->iso, c, | 2828 switch (parse_iso2022_esc (Qnil, data->iso, c, |
2814 &data->flags, 0)) | 2829 &data->flags, 0)) |
2815 { | 2830 { |
2816 case 1: /* done */ | 2831 case 1: /* done */ |