diff options
author | rsc <devnull@localhost> | 2005-12-26 04:47:21 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-12-26 04:47:21 +0000 |
commit | 35d26aa32167e84326cdb745c0e906393b8de71d (patch) | |
tree | 3e28abd7941806a3da1d09d2b226716ab3eb5abe /src/cmd/tcs | |
parent | 74f9b0c62cfe49a5e49380a2cf6eb99f762a8d76 (diff) | |
download | plan9port-35d26aa32167e84326cdb745c0e906393b8de71d.tar.gz plan9port-35d26aa32167e84326cdb745c0e906393b8de71d.tar.bz2 plan9port-35d26aa32167e84326cdb745c0e906393b8de71d.zip |
add EILSEQ for mac
Diffstat (limited to 'src/cmd/tcs')
-rw-r--r-- | src/cmd/tcs/conv.h | 2 | ||||
-rw-r--r-- | src/cmd/tcs/mkfile | 1 | ||||
-rw-r--r-- | src/cmd/tcs/tcs.c | 102 | ||||
-rw-r--r-- | src/cmd/tcs/utf.c | 4 |
4 files changed, 76 insertions, 33 deletions
diff --git a/src/cmd/tcs/conv.h b/src/cmd/tcs/conv.h index b8b75439..fc35a105 100644 --- a/src/cmd/tcs/conv.h +++ b/src/cmd/tcs/conv.h @@ -11,6 +11,8 @@ void gb_in(int fd, long *notused, struct convert *out); void gb_out(Rune *base, int n, long *notused); void uksc_in(int fd, long *notused, struct convert *out); void uksc_out(Rune *base, int n, long *notused); +void html_in(int fd, long *notused, struct convert *out); +void html_out(Rune *base, int n, long *notused); #define emit(x) *(*r)++ = (x) #define NRUNE 65536 diff --git a/src/cmd/tcs/mkfile b/src/cmd/tcs/mkfile index 3d12279e..fc1ce5ab 100644 --- a/src/cmd/tcs/mkfile +++ b/src/cmd/tcs/mkfile @@ -6,6 +6,7 @@ OFILES=tcs.$O\ conv_big5.$O\ conv_gb.$O\ conv_ksc.$O\ + html.$O\ utf.$O\ kuten208.$O\ gb.$O\ diff --git a/src/cmd/tcs/tcs.c b/src/cmd/tcs/tcs.c index c8d0bbbc..e50e1dfb 100644 --- a/src/cmd/tcs/tcs.c +++ b/src/cmd/tcs/tcs.c @@ -972,6 +972,41 @@ long tabnextstep[256] = /* From mduerst@ifi.unizh.ch (Martin J. Du"rst) */ 0x0142, 0x00F8, 0x0153, 0x00DF, 0x00FE, 0x00FF, 0xFFFF, 0xFFFF }; +long tabcp1250[256] = { /* From Microsoft */ +0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, +0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, +0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, +0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, +0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, +0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, +0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, +0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, +0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, +0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, +0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, +0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, +0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, +0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, +0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, +0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, +0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021, +0xFFFD, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, +0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, +0xFFFD, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, +0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, +0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B, +0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, +0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, +0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, +0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, +0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, +0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, +0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, +0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, +0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, +0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9, +}; + long tab8859_15[256] = /* from anyrhine@cs.helsinki.fi (Aki Nyrhinen) */ { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, @@ -995,14 +1030,7 @@ long tab8859_15[256] = /* from anyrhine@cs.helsinki.fi (Aki Nyrhinen) */ struct convert convert[] = { /* if two entries have the same name, put the from one first */ - { "utf", "FSS-UTF a.k.a. UTF-8", From|Func, 0, (Fnptr)utf_in }, - { "utf", "FSS-UTF a.k.a. UTF-8", Func, 0, (Fnptr)utf_out }, - { "utf1", "UTF-1 (ISO 10646 Annex A)", From|Func, 0, (Fnptr)isoutf_in }, - { "utf1", "UTF-1 (ISO 10646 Annex A)", Func, 0, (Fnptr)isoutf_out }, - { "microsoft", "microsoft", Table, (void *)microsoft }, - { "ascii", "7-bit ASCII", Table, (void *)tabascii }, { "8859-1", "Latin-1 (Western and Northern Europe including Italian)", Table, (void *)tab8859_1 }, - { "latin1", "ISO 8859-1", Table, (void *)tab8859_1 }, { "8859-2", "Latin-2 (Eastern Europe except Turkey and the Baltic countries)", Table, (void *)tab8859_2 }, { "8859-3", "Latin-3 (Mediterranean, South Africa, Esperanto)", Table, (void *)tab8859_3 }, { "8859-4", "Latin-4 (Scandinavia and the Baltic countries; obsolete)", Table, (void *)tab8859_4 }, @@ -1013,41 +1041,51 @@ struct convert convert[] = { "8859-9", "Latin-5 (Turkey, Western Europe except Icelandic and Faroese)", Table, (void *)tab8859_9 }, { "8859-10", "Latin-6 (Northern Europe)", Table, (void *)tab8859_10 }, { "8859-15", "Latin-9 (Western Europe)", Table, (void *)tab8859_15 }, - { "koi8", "KOI-8 (GOST 19769-74)", Table, (void *)tabkoi8 }, - { "ucode", "Russian U-code", Table, (void *)tabucode }, - { "cp866", "Russian MS-DOS encoding (CP 866)", Table, (void *)tab866 }, + { "ascii", "7-bit ASCII", Table, (void *)tabascii }, + { "atari", "ATARI-ST character set", Table, (void *)tabatari }, { "av", "Alternativnyj Variant", Table, (void *)tabav }, - { "cp1251", "Russian MS-DOS encoding (CP 1251)", Table, (void *)tabcp1251 }, - { "ov", "Osnovnoj Variant", Table, (void *)tabov }, - { "sf1", "ISO-646: Finnish/Swedish SF-1 variant", Table, (void *)tabsf1 }, - { "sf2", "ISO-646: Finnish/Swedish SF-2 variant (recommended)", Table, (void *)tabsf2 }, - { "jis", "guesses at the JIS encoding", From|Func, 0, (Fnptr)jis_in }, - { "jis-kanji", "ISO 2022-JP", From|Func, 0, (Fnptr)jisjis_in }, - { "jis-kanji", "ISO 2022-JP", Func, 0, (Fnptr)jisjis_out }, - { "ujis", "EUC-JX: JIS 0208", From|Func, 0, (Fnptr)ujis_in }, - { "ujis", "EUC-JX: JIS 0208", Func, 0, (Fnptr)ujis_out }, - { "ms-kanji", "Microsoft, or Shift-JIS", From|Func, 0, (Fnptr)msjis_in }, - { "ms-kanji", "Microsoft, or Shift-JIS", Func, 0, (Fnptr)msjis_out }, { "big5", "Big 5 (HKU)", From|Func, 0, (Fnptr)big5_in }, { "big5", "Big 5 (HKU)", Func, 0, (Fnptr)big5_out }, - { "gb", "GB2312-80", From|Func, 0, (Fnptr)gb_in }, - { "gb", "GB2312-80", Func, 0, (Fnptr)gb_out }, + { "cp866", "Microsoft Code Page 866 (Russian)", Table, (void *)tab866 }, + { "cp1250", "Microsoft Code Page 1250 (Central Europe)", Table, (void *)tabcp1250 }, + { "cp1251", "Microsoft Code Page 1251 (Cyrillic)", Table, (void *)tabcp1251 }, + { "ebcdic", "EBCDIC", Table, (void *)tabebcdic }, /* 6f is recommended bad map */ { "euc-k", "Korean EUC: ASCII+KS C 5601 1987", From|Func, 0, (Fnptr)uksc_in }, { "euc-k", "Korean EUC: ASCII+KS C 5601 1987", Func, 0, (Fnptr)uksc_out }, - { "tis", "Thai+ASCII (TIS 620-1986)", Table, (void *)tabtis620 }, - { "viet1", "Vietnamese VSCII-1 (1993)", Table, (void *)tabviet1 }, - { "viet2", "Vietnamese VSCII-2 (1993)", Table, (void *)tabviet2 }, - { "viscii", "Vietnamese VISCII 1.1 (1992)", Table, (void *)tabviscii }, - { "msdos", "IBM PC: CP 437", Table, (void *)tabmsdos }, - { "msdos2", "IBM PC: CP 437 with graphics in C0", Table, (void *)tabmsdos2 }, - { "ps2", "IBM PS/2: CP 850 (Multilingual)", Table, (void *)tabps2 }, + { "gb", "GB2312-80", From|Func, 0, (Fnptr)gb_in }, + { "gb", "GB2312-80", Func, 0, (Fnptr)gb_out }, + { "html", "HTML", From|Func, 0, (Fnptr)html_in }, + { "html", "HTML", Func, 0, (Fnptr)html_out }, + { "jis", "guesses at the JIS encoding", From|Func, 0, (Fnptr)jis_in }, + { "jis-kanji", "ISO 2022-JP", From|Func, 0, (Fnptr)jisjis_in }, + { "jis-kanji", "ISO 2022-JP", Func, 0, (Fnptr)jisjis_out }, + { "koi8", "KOI-8 (GOST 19769-74)", Table, (void *)tabkoi8 }, + { "latin1", "ISO 8859-1", Table, (void *)tab8859_1 }, { "macrom", "Macintosh Standard Roman character set", Table, (void *)tabMacRoman }, + { "microsoft", "microsoft", Table, (void *)microsoft }, + { "msdos2", "IBM PC: CP 437 with graphics in C0", Table, (void *)tabmsdos2 }, + { "msdos", "IBM PC: CP 437", Table, (void *)tabmsdos }, + { "ms-kanji", "Microsoft, or Shift-JIS", From|Func, 0, (Fnptr)msjis_in }, + { "ms-kanji", "Microsoft, or Shift-JIS", Func, 0, (Fnptr)msjis_out }, { "next", "NEXTSTEP character set", Table, (void *)tabnextstep }, - { "atari", "ATARI-ST character set", Table, (void *)tabatari }, + { "ov", "Osnovnoj Variant", Table, (void *)tabov }, + { "ps2", "IBM PS/2: CP 850 (Multilingual)", Table, (void *)tabps2 }, + { "sf1", "ISO-646: Finnish/Swedish SF-1 variant", Table, (void *)tabsf1 }, + { "sf2", "ISO-646: Finnish/Swedish SF-2 variant (recommended)", Table, (void *)tabsf2 }, + { "tis", "Thai+ASCII (TIS 620-1986)", Table, (void *)tabtis620 }, + { "ucode", "Russian U-code", Table, (void *)tabucode }, + { "ujis", "EUC-JX: JIS 0208", From|Func, 0, (Fnptr)ujis_in }, + { "ujis", "EUC-JX: JIS 0208", Func, 0, (Fnptr)ujis_out }, { "unicode", "Unicode 1.1", From|Func, 0, (Fnptr)unicode_in }, { "unicode", "Unicode 1.1", Func, 0, (Fnptr)unicode_out }, - { "ebcdic", "EBCDIC", Table, (void *)tabebcdic }, /* 6f is recommended bad map */ + { "utf1", "UTF-1 (ISO 10646 Annex A)", From|Func, 0, (Fnptr)isoutf_in }, + { "utf1", "UTF-1 (ISO 10646 Annex A)", Func, 0, (Fnptr)isoutf_out }, + { "utf", "FSS-UTF a.k.a. UTF-8", From|Func, 0, (Fnptr)utf_in }, + { "utf", "FSS-UTF a.k.a. UTF-8", Func, 0, (Fnptr)utf_out }, { "utf-l2", "from", From|Func, 0, (Fnptr)utf_in }, { "utf-l2", "to", Func, 0, (Fnptr)utf_out }, + { "viet1", "Vietnamese VSCII-1 (1993)", Table, (void *)tabviet1 }, + { "viet2", "Vietnamese VSCII-2 (1993)", Table, (void *)tabviet2 }, + { "viscii", "Vietnamese VISCII 1.1 (1992)", Table, (void *)tabviscii }, { 0 }, }; diff --git a/src/cmd/tcs/utf.c b/src/cmd/tcs/utf.c index e6635887..9aad892b 100644 --- a/src/cmd/tcs/utf.c +++ b/src/cmd/tcs/utf.c @@ -6,7 +6,6 @@ #include <errno.h> #else extern int errno; -#define EILSEQ 123 #endif #else #include <sys/types.h> @@ -18,6 +17,9 @@ extern int errno; #include "plan9.h" #endif #include "hdr.h" +#ifndef EILSEQ +#define EILSEQ 9998 +#endif /* the our_* routines are implementations for the corresponding library |