Mercurial > hg > xemacs-beta
comparison src/unicode.c @ 2500:3d8143fc88e1
[xemacs-hg @ 2005-01-24 23:33:30 by ben]
get working with VC7
config.inc.samp: Declare OPTIONAL_LIBRARY_DIR as root of library directories.
Redo all graphics library defaults to mirror the versions and
directories in the current binary aux distribution on xemacs
web site. Enable TIFF and COMPFACE by default since you can
now compile with them and binary libs are provided.
xemacs.mak: Put our own directories first in case of conflict (e.g. config.h
in compface).
xemacs.mak: Use MSVCRT to avoid link problems.
s/windowsnt.h:
bytecode.c, print.c: Add casts to avoid warning.
compiler.h: Add MSC_VERSION and include definitions of DOESNT_RETURN and
friends here, like for GCC. Need different definitions for VC7
and VC6.
s/windowsnt.h: Remove stuff moved to compiler.h. Disable warning 4646 ("function
declared with __declspec(noreturn) has non-void return type")
on VC7 since lots of Lisp primitives trigger this and there is
no easy way to kludge around the warning.
glyphs-eimage.c: Some really nasty hacks to allow TIFF and JPEG to both be compiled.
#### The better solution is to move the TIFF and JPEG code to
different files.
glyphs-msw.c: Define __STDC__ to avoid problems with compface.h.
intl-auto-encap-win32.c, intl-auto-encap-win32.h, intl-encap-win32.c, syswindows.h: Those wankers at Microsoft cannot leave well enough alone.
Various functions change parameter types semi-randomly between
VC6 and VC7, so we need to include our own versions that
can handle both kinds with appropriate casting.
EmacsFrame.c, EmacsShell-sub.c, EmacsShell.c, alloc.c, alloca.c, buffer.c, bytecode.c, charset.h, chartab.c, cm.c, console-stream.c, console.c, data.c, debug.h, device-msw.c, device-tty.c, device-x.c, doprnt.c, dumper.c, dynarr.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, free-hook.c, gccache-gtk.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-x.c, glyphs.c, gtk-glue.c, gutter.c, input-method-xlib.c, insdel.c, intl-win32.c, keymap.c, lisp.h, lread.c, lstream.c, macros.c, malloc.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, mule-coding.c, native-gtk-toolbar.c, number.c, objects-msw.c, objects.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, regex.c, scrollbar-gtk.c, scrollbar-x.c, search.c, select-x.c, signal.c, specifier.c, specifier.h, strftime.c, sunplay.c, symbols.c, sysdep.c, sysproc.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, ui-gtk.c, unexnt.c, unicode.c, win32.c, window.c, xgccache.c, s/windowsnt.h: abort() -> ABORT(). Eliminate preprocessor games with abort()
since it creates huge problems in VC7, solvable only by including
massive amounts of files in every compile (and not worth it).
author | ben |
---|---|
date | Mon, 24 Jan 2005 23:34:34 +0000 |
parents | ecf1ebac70d8 |
children | 9f70af3ac939 |
comparison
equal
deleted
inserted
replaced
2499:4c5ee4d2e921 | 2500:3d8143fc88e1 |
---|---|
174 something evil and unpredictable? Signaling an error is OK: for | 174 something evil and unpredictable? Signaling an error is OK: for |
175 all national standards, the national to Unicode map is an inclusion | 175 all national standards, the national to Unicode map is an inclusion |
176 (1-to-1). Any character set that does not behave that way is | 176 (1-to-1). Any character set that does not behave that way is |
177 broken according to the Unicode standard. | 177 broken according to the Unicode standard. |
178 | 178 |
179 Answer: You will get an abort(), since the purpose of the sledgehammer | 179 Answer: You will get an ABORT(), since the purpose of the sledgehammer |
180 routines is self-checking. The above problem with non-1-to-1 mapping | 180 routines is self-checking. The above problem with non-1-to-1 mapping |
181 occurs in the Big5 tables, as provided by the Unicode Consortium. */ | 181 occurs in the Big5 tables, as provided by the Unicode Consortium. */ |
182 | 182 |
183 /* #define SLEDGEHAMMER_CHECK_UNICODE */ | 183 /* #define SLEDGEHAMMER_CHECK_UNICODE */ |
184 | 184 |
404 short ****newtab = xnew_array (short ***, 256); | 404 short ****newtab = xnew_array (short ***, 256); |
405 memcpy (newtab, from_unicode_blank_4, 256 * sizeof (short ***)); | 405 memcpy (newtab, from_unicode_blank_4, 256 * sizeof (short ***)); |
406 return newtab; | 406 return newtab; |
407 } | 407 } |
408 default: | 408 default: |
409 abort (); | 409 ABORT (); |
410 return 0; | 410 return 0; |
411 } | 411 } |
412 } | 412 } |
413 | 413 |
414 /* Allocate and blank the tables. | 414 /* Allocate and blank the tables. |
700 (codetop << 8) + i); | 700 (codetop << 8) + i); |
701 } | 701 } |
702 break; | 702 break; |
703 } | 703 } |
704 default: | 704 default: |
705 abort (); | 705 ABORT (); |
706 } | 706 } |
707 } | 707 } |
708 | 708 |
709 static void | 709 static void |
710 sledgehammer_check_to_table (Lisp_Object charset, void *table, int level, | 710 sledgehammer_check_to_table (Lisp_Object charset, void *table, int level, |
747 { | 747 { |
748 case 1: val = ((short *) frtab)[u1]; break; | 748 case 1: val = ((short *) frtab)[u1]; break; |
749 case 2: val = ((short **) frtab)[u2][u1]; break; | 749 case 2: val = ((short **) frtab)[u2][u1]; break; |
750 case 3: val = ((short ***) frtab)[u3][u2][u1]; break; | 750 case 3: val = ((short ***) frtab)[u3][u2][u1]; break; |
751 case 4: val = ((short ****) frtab)[u4][u3][u2][u1]; break; | 751 case 4: val = ((short ****) frtab)[u4][u3][u2][u1]; break; |
752 default: abort (); | 752 default: ABORT (); |
753 } | 753 } |
754 | 754 |
755 ch = make_ichar (charset, val >> 8, val & 0xFF); | 755 ch = make_ichar (charset, val >> 8, val & 0xFF); |
756 assert (ch == this_ch); | 756 assert (ch == this_ch); |
757 | 757 |
770 frtab = ((short **) frtab)[u2]; | 770 frtab = ((short **) frtab)[u2]; |
771 /* fall through */ | 771 /* fall through */ |
772 case 1: | 772 case 1: |
773 assert_not_any_blank_table (frtab); | 773 assert_not_any_blank_table (frtab); |
774 break; | 774 break; |
775 default: abort (); | 775 default: ABORT (); |
776 } | 776 } |
777 } | 777 } |
778 } | 778 } |
779 break; | 779 break; |
780 } | 780 } |
794 sledgehammer_check_to_table (charset, tab[i], 1, i); | 794 sledgehammer_check_to_table (charset, tab[i], 1, i); |
795 } | 795 } |
796 break; | 796 break; |
797 } | 797 } |
798 default: | 798 default: |
799 abort (); | 799 ABORT (); |
800 } | 800 } |
801 } | 801 } |
802 | 802 |
803 static void | 803 static void |
804 sledgehammer_check_unicode_tables (Lisp_Object charset) | 804 sledgehammer_check_unicode_tables (Lisp_Object charset) |
915 ((short ***) table)[0] = (short **) old_table; | 915 ((short ***) table)[0] = (short **) old_table; |
916 break; | 916 break; |
917 case 4: | 917 case 4: |
918 ((short ****) table)[0] = (short ***) old_table; | 918 ((short ****) table)[0] = (short ***) old_table; |
919 break; | 919 break; |
920 default: abort (); | 920 default: ABORT (); |
921 } | 921 } |
922 } | 922 } |
923 } | 923 } |
924 | 924 |
925 charset_levels = code_levels; | 925 charset_levels = code_levels; |
951 if (((short **) table)[u2] == from_unicode_blank_1) | 951 if (((short **) table)[u2] == from_unicode_blank_1) |
952 ((short **) table)[u2] = | 952 ((short **) table)[u2] = |
953 ((short *) create_new_from_unicode_table (1)); | 953 ((short *) create_new_from_unicode_table (1)); |
954 table = ((short **) table)[u2]; | 954 table = ((short **) table)[u2]; |
955 break; | 955 break; |
956 default: abort (); | 956 default: ABORT (); |
957 } | 957 } |
958 } | 958 } |
959 } | 959 } |
960 | 960 |
961 /* Finally, set the character */ | 961 /* Finally, set the character */ |
966 { | 966 { |
967 case 1: ((short *) table)[u1] = (c1 << 8) + c2; break; | 967 case 1: ((short *) table)[u1] = (c1 << 8) + c2; break; |
968 case 2: ((short **) table)[u2][u1] = (c1 << 8) + c2; break; | 968 case 2: ((short **) table)[u2][u1] = (c1 << 8) + c2; break; |
969 case 3: ((short ***) table)[u3][u2][u1] = (c1 << 8) + c2; break; | 969 case 3: ((short ***) table)[u3][u2][u1] = (c1 << 8) + c2; break; |
970 case 4: ((short ****) table)[u4][u3][u2][u1] = (c1 << 8) + c2; break; | 970 case 4: ((short ****) table)[u4][u3][u2][u1] = (c1 << 8) + c2; break; |
971 default: abort (); | 971 default: ABORT (); |
972 } | 972 } |
973 } | 973 } |
974 } | 974 } |
975 | 975 |
976 #ifdef SLEDGEHAMMER_CHECK_UNICODE | 976 #ifdef SLEDGEHAMMER_CHECK_UNICODE |
1029 { | 1029 { |
1030 case 1: retval = ((short *) table)[u1]; break; | 1030 case 1: retval = ((short *) table)[u1]; break; |
1031 case 2: retval = ((short **) table)[u2][u1]; break; | 1031 case 2: retval = ((short **) table)[u2][u1]; break; |
1032 case 3: retval = ((short ***) table)[u3][u2][u1]; break; | 1032 case 3: retval = ((short ***) table)[u3][u2][u1]; break; |
1033 case 4: retval = ((short ****) table)[u4][u3][u2][u1]; break; | 1033 case 4: retval = ((short ****) table)[u4][u3][u2][u1]; break; |
1034 default: abort (); retval = 0; | 1034 default: ABORT (); retval = 0; |
1035 } | 1035 } |
1036 | 1036 |
1037 if (retval != -1) | 1037 if (retval != -1) |
1038 return make_ichar (charset, retval >> 8, retval & 0xFF); | 1038 return make_ichar (charset, retval >> 8, retval & 0xFF); |
1039 } | 1039 } |
1494 case CHARSET_TYPE_96: l1 = 32; h1 = 127; l2 = 0; h2 = 0; break; | 1494 case CHARSET_TYPE_96: l1 = 32; h1 = 127; l2 = 0; h2 = 0; break; |
1495 case CHARSET_TYPE_94X94: l1 = 33; h1 = 126; l2 = 33; h2 = 126; | 1495 case CHARSET_TYPE_94X94: l1 = 33; h1 = 126; l2 = 33; h2 = 126; |
1496 break; | 1496 break; |
1497 case CHARSET_TYPE_96X96: l1 = 32; h1 = 127; l2 = 32; h2 = 127; | 1497 case CHARSET_TYPE_96X96: l1 = 32; h1 = 127; l2 = 32; h2 = 127; |
1498 break; | 1498 break; |
1499 default: abort (); l1 = 0; h1 = 0; l2 = 0; h2 = 0; | 1499 default: ABORT (); l1 = 0; h1 = 0; l2 = 0; h2 = 0; |
1500 } | 1500 } |
1501 | 1501 |
1502 if (cp1high < l2 || cp1high > h2 || cp1low < l1 || cp1low > h1) | 1502 if (cp1high < l2 || cp1high > h2 || cp1low < l1 || cp1low > h1) |
1503 goto out_of_range; | 1503 goto out_of_range; |
1504 | 1504 |
1686 Dynarr_add (dst, (unsigned char) (((code >> 6) & 0x3f) | 0x80)); | 1686 Dynarr_add (dst, (unsigned char) (((code >> 6) & 0x3f) | 0x80)); |
1687 Dynarr_add (dst, (unsigned char) ((code & 0x3f) | 0x80)); | 1687 Dynarr_add (dst, (unsigned char) ((code & 0x3f) | 0x80)); |
1688 } | 1688 } |
1689 break; | 1689 break; |
1690 | 1690 |
1691 case UNICODE_UTF_7: abort (); | 1691 case UNICODE_UTF_7: ABORT (); |
1692 | 1692 |
1693 default: abort (); | 1693 default: ABORT (); |
1694 } | 1694 } |
1695 } | 1695 } |
1696 | 1696 |
1697 static void | 1697 static void |
1698 encode_unicode_char (Lisp_Object USED_IF_MULE (charset), int h, | 1698 encode_unicode_char (Lisp_Object USED_IF_MULE (charset), int h, |
1827 decode_unicode_char (tempch, dst, data, ignore_bom); | 1827 decode_unicode_char (tempch, dst, data, ignore_bom); |
1828 } | 1828 } |
1829 break; | 1829 break; |
1830 | 1830 |
1831 case UNICODE_UTF_7: | 1831 case UNICODE_UTF_7: |
1832 abort (); | 1832 ABORT (); |
1833 break; | 1833 break; |
1834 | 1834 |
1835 default: abort (); | 1835 default: ABORT (); |
1836 } | 1836 } |
1837 | 1837 |
1838 } | 1838 } |
1839 if (str->eof) | 1839 if (str->eof) |
1840 DECODE_OUTPUT_PARTIAL_CHAR (ch, dst); | 1840 DECODE_OUTPUT_PARTIAL_CHAR (ch, dst); |
1957 ch = c; | 1957 ch = c; |
1958 char_boundary = 0; | 1958 char_boundary = 0; |
1959 } | 1959 } |
1960 break; | 1960 break; |
1961 default: | 1961 default: |
1962 abort (); | 1962 ABORT (); |
1963 } | 1963 } |
1964 } | 1964 } |
1965 } | 1965 } |
1966 #endif /* MULE */ | 1966 #endif /* MULE */ |
1967 } | 1967 } |
2342 { | 2342 { |
2343 case UNICODE_UTF_16: return Qutf_16; | 2343 case UNICODE_UTF_16: return Qutf_16; |
2344 case UNICODE_UTF_8: return Qutf_8; | 2344 case UNICODE_UTF_8: return Qutf_8; |
2345 case UNICODE_UTF_7: return Qutf_7; | 2345 case UNICODE_UTF_7: return Qutf_7; |
2346 case UNICODE_UCS_4: return Qucs_4; | 2346 case UNICODE_UCS_4: return Qucs_4; |
2347 default: abort (); | 2347 default: ABORT (); |
2348 } | 2348 } |
2349 } | 2349 } |
2350 else if (EQ (prop, Qlittle_endian)) | 2350 else if (EQ (prop, Qlittle_endian)) |
2351 return XCODING_SYSTEM_UNICODE_LITTLE_ENDIAN (coding_system) ? Qt : Qnil; | 2351 return XCODING_SYSTEM_UNICODE_LITTLE_ENDIAN (coding_system) ? Qt : Qnil; |
2352 else if (EQ (prop, Qneed_bom)) | 2352 else if (EQ (prop, Qneed_bom)) |