├── GPL.txt ├── README ├── build └── README ├── hello.sample ├── hello.sample.gif ├── index.html ├── lv.1 ├── lv.hlp ├── relnote.html └── src ├── Makefile.dos ├── Makefile.in ├── ascii.h ├── attr.h ├── begin.h ├── big5.c ├── big5.h ├── big5.map ├── big5.rev ├── big5cns.map ├── big5cns.pl ├── boolean.h ├── command.c ├── command.h ├── conf.c ├── conf.h ├── config.guess ├── config.sub ├── configure ├── configure.in ├── console.c ├── console.h ├── conv.c ├── conv.h ├── ctable.c ├── ctable.h ├── ctable_e.h ├── ctable_t.h ├── d2u.pl ├── d2uall.sh ├── decode.c ├── decode.h ├── dfa.c ├── dfa.h ├── display.c ├── display.h ├── encode.c ├── encode.h ├── escape.c ├── escape.h ├── eucjapan.c ├── eucjapan.h ├── fetch.c ├── fetch.h ├── file.c ├── file.h ├── find.c ├── find.h ├── gb2312.map ├── gb2312.rev ├── guess.c ├── guess.h ├── guesslocale.c ├── guesslocale.h ├── hz.c ├── hz.h ├── ichar.h ├── import.h ├── install-sh ├── iso2022.c ├── iso2022.h ├── iso2cn.c ├── iso2cn.h ├── iso2jp.c ├── iso2jp.h ├── iso2kr.c ├── iso2kr.h ├── iso8859.c ├── iso8859.h ├── iso885910.map ├── iso885910.rev ├── iso885911.map ├── iso885911.rev ├── iso885913.map ├── iso885913.rev ├── iso885914.map ├── iso885914.rev ├── iso885915.map ├── iso885915.rev ├── iso885916.map ├── iso885916.rev ├── iso88592.map ├── iso88592.rev ├── iso88593.map ├── iso88593.rev ├── iso88594.map ├── iso88594.rev ├── iso88595.map ├── iso88595.rev ├── iso88596.map ├── iso88596.rev ├── iso88597.map ├── iso88597.rev ├── iso88598.map ├── iso88598.rev ├── iso88599.map ├── iso88599.rev ├── istr.c ├── istr.h ├── itable.c ├── itable.h ├── itable_e.h ├── itable_t.h ├── jis.map ├── jis0208.rev ├── jis0212.rev ├── kana.c ├── kana.h ├── keybind.h ├── ksc5601.map ├── ksc5601.rev ├── lv.c ├── map8859.pl ├── mapbig5.pl ├── mapgb.pl ├── mapjis.pl ├── mapksc.pl ├── nfa.c ├── nfa.h ├── position.h ├── raw.c ├── raw.h ├── re.c ├── re.h ├── rev0208.pl ├── rev0212.pl ├── rev8859.pl ├── revbig5.pl ├── revgb.pl ├── revksc.pl ├── screen.c ├── screen.h ├── shiftjis.c ├── shiftjis.h ├── str.h ├── stream.c ├── stream.h ├── unimap.c ├── unimap.h ├── unirev.c ├── unirev.h ├── utf.c ├── utf.h ├── uty.c ├── uty.h ├── version.c └── version.h /README: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------ 2 | 3 | Documentation of lv is provided on the web. See the following URL: 4 | 5 | http://www.ff.iij4u.or.jp/~nrt/lv/ 6 | 7 | ------------------------------------------------------------------------------ 8 | 9 | All rights reserved. Copyright (C) 1996-2004 by NARITA Tomio. 10 | 11 | This program is free software; you can redistribute it and/or modify 12 | it under the terms of the GNU General Public License as published by 13 | the Free Software Foundation; either version 2 of the License, or 14 | (at your option) any later version. 15 | 16 | This program is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU General Public License for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with this program; if not, write to the Free Software 23 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | 25 | See also GNU General Public License Version 2, included in this 26 | archive as GPL.txt. 27 | 28 | ------------------------------------------------------------------------------ 29 | 30 | INSTALLATION: 31 | 32 | 0) Expand lv archive, using gunzip/tar. 33 | 1) Change your working directory to ``(extracted sub directory)/build''. 34 | 2) Execute ``../src/configure'' to configure compiler flags. 35 | 3) Launch ``make''. 36 | 4) Then, launch ``make install'' as root. 37 | 38 | ------------------------------------------------------------------------------ 39 | NARITA Tomio 40 | email: nrt@ff.iij4u.or.jp 41 | Homepage: http://www.ff.iij4u.or.jp/~nrt/ 42 | -------------------------------------------------------------------------------- /build/README: -------------------------------------------------------------------------------- 1 | INSTALLATION: 2 | 3 | 1. ../src/configure 4 | 2. make 5 | 3. make install # as root 6 | 7 | -------------------------------------------------------------------------------- /hello.sample: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattn/lv-windows/2d98741558a4106ea349333ac5c2fc5f4766e8f1/hello.sample -------------------------------------------------------------------------------- /hello.sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattn/lv-windows/2d98741558a4106ea349333ac5c2fc5f4766e8f1/hello.sample.gif -------------------------------------------------------------------------------- /src/Makefile.dos: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | # Makefile for lv executable 3 | # target: all, clean 4 | ######################################################################## 5 | 6 | # MSDOS 7 | CC = lcc 8 | CFLAGS = -I. -DMSDOS -DRETSIGTYPE=void -cu 9 | LIB = -k-s1000 -m 10 | 11 | ######################################################################## 12 | # You don't have to change the following. 13 | ######################################################################## 14 | 15 | all: lv.exe 16 | 17 | OBJS = itable.obj ctable.obj \ 18 | uty.obj istr.obj stream.obj file.obj guess.obj \ 19 | decode.obj encode.obj escape.obj iso2022.obj \ 20 | iso8859.obj iso2cn.obj iso2jp.obj iso2kr.obj kana.obj \ 21 | eucjapan.obj shiftjis.obj big5.obj hz.obj raw.obj \ 22 | fetch.obj screen.obj command.obj display.obj \ 23 | find.obj re.obj nfa.obj dfa.obj \ 24 | conv.obj version.obj conf.obj lv.obj console.obj 25 | 26 | lv.exe: $(OBJS) 27 | $(CC) @${ -o $@ $(OBJS) $(LIB) } 28 | 29 | # 30 | # cleaning 31 | # 32 | 33 | clean: 34 | rm -f lv.exe *.obj 35 | -------------------------------------------------------------------------------- /src/ascii.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ascii.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: ascii.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ASCII_H__ 9 | #define __ASCII_H__ 10 | 11 | #define NUL 0x00 /* C-@ */ 12 | #define SOH 0x01 /* C-a */ 13 | #define STX 0x02 /* C-b */ 14 | #define ETX 0x03 /* C-c */ 15 | #define EOT 0x04 /* C-d */ 16 | #define ENQ 0x05 /* C-e */ 17 | #define ACK 0x06 /* C-f */ 18 | #define BEL 0x07 /* C-g */ 19 | #define BS 0x08 /* C-h */ 20 | #define HT 0x09 /* C-i */ 21 | #define LF 0x0a /* C-j */ 22 | #define VT 0x0b /* C-k */ 23 | #define FF 0x0c /* C-l */ 24 | #define CR 0x0d /* C-m */ 25 | #define SO 0x0e /* C-n */ 26 | #define SI 0x0f /* C-o */ 27 | #define DLE 0x10 /* C-p */ 28 | #define DC1 0x11 /* C-q */ 29 | #define DC2 0x12 /* C-r */ 30 | #define DC3 0x13 /* C-s */ 31 | #define DC4 0x14 /* C-t */ 32 | #define NAK 0x15 /* C-u */ 33 | #define SYN 0x16 /* C-v */ 34 | #define ETB 0x17 /* C-w */ 35 | #define CAN 0x18 /* C-x */ 36 | #define EM 0x19 /* C-y */ 37 | #define SUB 0x1a /* C-z */ 38 | #define ESC 0x1b /* C-[ */ 39 | #define FS 0x1c /* C-\ */ 40 | #define GS 0x1d /* C-] */ 41 | #define RS 0x1e /* C-^ */ 42 | #define US 0x1f /* C-_ */ 43 | 44 | #define SP 0x20 45 | #define DEL 0x7f 46 | 47 | #define LS0 0x0f 48 | #define LS1 0x0e 49 | 50 | #define SS2 0x8e 51 | #define SS3 0x8f 52 | 53 | #endif /* __ASCII_H__ */ 54 | -------------------------------------------------------------------------------- /src/attr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * attr.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: attr.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ATTR_H__ 9 | #define __ATTR_H__ 10 | 11 | #define ATTR_NULL 0x00 12 | 13 | #define ATTR_COLOR 0x07 14 | #define ATTR_COLOR_R 0x01 15 | #define ATTR_COLOR_B 0x02 16 | #define ATTR_COLOR_G 0x04 17 | 18 | #define ATTR_HILIGHT 0x08 19 | #define ATTR_UNDERLINE 0x10 20 | #define ATTR_BLINK 0x20 21 | #define ATTR_REVERSE 0x40 22 | 23 | #define ATTR_STANDOUT 0x80 /* INTERNAL USE */ 24 | 25 | #endif /* __ATTR_H__ */ 26 | -------------------------------------------------------------------------------- /src/begin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * begin.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: begin.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __BEGIN_H__ 9 | #define __BEGIN_H__ 10 | 11 | #include 12 | #include 13 | 14 | #ifdef public 15 | #undef public 16 | #endif /* public */ 17 | 18 | #define public 19 | 20 | #endif /* __BEGIN_H__ */ 21 | -------------------------------------------------------------------------------- /src/big5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * big5.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: big5.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __BIG5_H__ 9 | #define __BIG5_H__ 10 | 11 | #include 12 | #include 13 | 14 | public ic_t BIG5toCNS( ic_t big5, byte *cset ); 15 | public ic_t CNStoBIG5( ic_t cns, byte *cset ); 16 | 17 | public void ConvertCNStoBIG5( i_str_t *istr ); 18 | public void ConvertBIG5toCNS( i_str_t *istr ); 19 | 20 | public void DecodeBig5( state_t *state, byte codingSystem ); 21 | 22 | public void EncodeBig5( i_str_t *istr, int head, int tail, 23 | byte codingSystem, boolean_t binary ); 24 | 25 | #endif /* __BIG5_H__ */ 26 | -------------------------------------------------------------------------------- /src/big5cns.map: -------------------------------------------------------------------------------- 1 | private codes_t big5Level1ToCnsPlane1[ 25 ] = { /* range */ 2 | { 0xA140, 0x2121 }, 3 | { 0xA1F6, 0x2258 }, 4 | { 0xA1F7, 0x2257 }, 5 | { 0xA1F8, 0x2259 }, 6 | { 0xA2AF, 0x2421 }, 7 | { 0xA3C0, 0x4221 }, 8 | { 0xa3e1, 0x0000 }, 9 | { 0xA440, 0x4421 }, 10 | { 0xACFE, 0x5753 }, 11 | { 0xacff, 0x0000 }, 12 | { 0xAD40, 0x5323 }, 13 | { 0xAFD0, 0x5754 }, 14 | { 0xBBC8, 0x6B51 }, 15 | { 0xBE52, 0x6B50 }, 16 | { 0xBE53, 0x6F5C }, 17 | { 0xC1AB, 0x7536 }, 18 | { 0xC2CB, 0x7535 }, 19 | { 0xC2CC, 0x7737 }, 20 | { 0xC361, 0x782E }, 21 | { 0xC3B9, 0x7865 }, 22 | { 0xC3BA, 0x7864 }, 23 | { 0xC3BB, 0x7866 }, 24 | { 0xC456, 0x782D }, 25 | { 0xC457, 0x7962 }, 26 | { 0xc67f, 0x0000 } 27 | }; 28 | 29 | private codes_t cnsPlane1ToBig5Level1[ 26 ] = { /* range */ 30 | { 0x2121, 0xA140 }, 31 | { 0x2257, 0xA1F7 }, 32 | { 0x2258, 0xA1F6 }, 33 | { 0x2259, 0xA1F8 }, 34 | { 0x234f, 0x0000 }, 35 | { 0x2421, 0xA2AF }, 36 | { 0x2571, 0x0000 }, 37 | { 0x4221, 0xA3C0 }, 38 | { 0x4242, 0x0000 }, 39 | { 0x4421, 0xA440 }, 40 | { 0x5323, 0xAD40 }, 41 | { 0x5753, 0xACFE }, 42 | { 0x5754, 0xAFD0 }, 43 | { 0x6B50, 0xBE52 }, 44 | { 0x6B51, 0xBBC8 }, 45 | { 0x6F5C, 0xBE53 }, 46 | { 0x7535, 0xC2CB }, 47 | { 0x7536, 0xC1AB }, 48 | { 0x7737, 0xC2CC }, 49 | { 0x782D, 0xC456 }, 50 | { 0x782E, 0xC361 }, 51 | { 0x7864, 0xC3BA }, 52 | { 0x7865, 0xC3B9 }, 53 | { 0x7866, 0xC3BB }, 54 | { 0x7962, 0xC457 }, 55 | { 0x7d4c, 0x0000 } 56 | }; 57 | 58 | private codes_t big5Level2ToCnsPlane2[ 48 ] = { /* range */ 59 | { 0xC940, 0x2121 }, 60 | { 0xc94a, 0x0000 }, 61 | { 0xC94B, 0x212B }, 62 | { 0xC96C, 0x214D }, 63 | { 0xC9BE, 0x214C }, 64 | { 0xC9BF, 0x217D }, 65 | { 0xC9ED, 0x224E }, 66 | { 0xCAF7, 0x224D }, 67 | { 0xCAF8, 0x2439 }, 68 | { 0xD77A, 0x3F6A }, 69 | { 0xD77B, 0x387E }, 70 | { 0xDBA7, 0x3F6B }, 71 | { 0xDDFC, 0x4176 }, 72 | { 0xDDFD, 0x4424 }, 73 | { 0xE8A3, 0x554C }, 74 | { 0xE976, 0x5723 }, 75 | { 0xEB5B, 0x5A29 }, 76 | { 0xEBF1, 0x554B }, 77 | { 0xEBF2, 0x5B3F }, 78 | { 0xECDE, 0x5722 }, 79 | { 0xECDF, 0x5C6A }, 80 | { 0xEDAA, 0x5D75 }, 81 | { 0xEEEB, 0x642F }, 82 | { 0xEEEC, 0x6039 }, 83 | { 0xF056, 0x5D74 }, 84 | { 0xF057, 0x6243 }, 85 | { 0xF0CB, 0x5A28 }, 86 | { 0xF0CC, 0x6337 }, 87 | { 0xF163, 0x6430 }, 88 | { 0xF16B, 0x6761 }, 89 | { 0xF16C, 0x6438 }, 90 | { 0xF268, 0x6934 }, 91 | { 0xF269, 0x6573 }, 92 | { 0xF2C3, 0x664E }, 93 | { 0xF375, 0x6762 }, 94 | { 0xF466, 0x6935 }, 95 | { 0xF4B5, 0x664D }, 96 | { 0xF4B6, 0x6962 }, 97 | { 0xF4FD, 0x6A4C }, 98 | { 0xF663, 0x6A4B }, 99 | { 0xF664, 0x6C52 }, 100 | { 0xF977, 0x7167 }, 101 | { 0xF9C4, 0x7166 }, 102 | { 0xF9C5, 0x7234 }, 103 | { 0xF9C6, 0x7240 }, 104 | { 0xF9C7, 0x7235 }, 105 | { 0xF9D2, 0x7241 }, 106 | { 0xf9d6, 0x0000 } 107 | }; 108 | 109 | private codes_t cnsPlane2ToBig5Level2[ 49 ] = { /* range */ 110 | { 0x2121, 0xC940 }, 111 | { 0x212B, 0xC94B }, 112 | { 0x214C, 0xC9BE }, 113 | { 0x214D, 0xC96C }, 114 | { 0x217D, 0xC9BF }, 115 | { 0x224D, 0xCAF7 }, 116 | { 0x224E, 0xC9ED }, 117 | { 0x2439, 0xCAF8 }, 118 | { 0x387E, 0xD77B }, 119 | { 0x3F6A, 0xD77A }, 120 | { 0x3F6B, 0xDBA7 }, 121 | { 0x4424, 0x0000 }, 122 | { 0x4176, 0xDDFC }, 123 | { 0x4177, 0x0000 }, 124 | { 0x4424, 0xDDFD }, 125 | { 0x554B, 0xEBF1 }, 126 | { 0x554C, 0xE8A3 }, 127 | { 0x5722, 0xECDE }, 128 | { 0x5723, 0xE976 }, 129 | { 0x5A28, 0xF0CB }, 130 | { 0x5A29, 0xEB5B }, 131 | { 0x5B3F, 0xEBF2 }, 132 | { 0x5C6A, 0xECDF }, 133 | { 0x5D74, 0xF056 }, 134 | { 0x5D75, 0xEDAA }, 135 | { 0x6039, 0xEEEC }, 136 | { 0x6243, 0xF057 }, 137 | { 0x6337, 0xF0CC }, 138 | { 0x642F, 0xEEEB }, 139 | { 0x6430, 0xF163 }, 140 | { 0x6438, 0xF16C }, 141 | { 0x6573, 0xF269 }, 142 | { 0x664D, 0xF4B5 }, 143 | { 0x664E, 0xF2C3 }, 144 | { 0x6761, 0xF16B }, 145 | { 0x6762, 0xF375 }, 146 | { 0x6934, 0xF268 }, 147 | { 0x6935, 0xF466 }, 148 | { 0x6962, 0xF4B6 }, 149 | { 0x6A4B, 0xF663 }, 150 | { 0x6A4C, 0xF4FD }, 151 | { 0x6C52, 0xF664 }, 152 | { 0x7166, 0xF9C4 }, 153 | { 0x7167, 0xF977 }, 154 | { 0x7234, 0xF9C5 }, 155 | { 0x7235, 0xF9C7 }, 156 | { 0x7240, 0xF9C6 }, 157 | { 0x7241, 0xF9D2 }, 158 | { 0x7245, 0x0000 } 159 | }; 160 | 161 | -------------------------------------------------------------------------------- /src/boolean.h: -------------------------------------------------------------------------------- 1 | /* 2 | * boolean.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: boolean.h,v 1.4 2004/01/05 07:25:29 nrt Exp $ 6 | */ 7 | 8 | #ifndef __BOOLEAN_H__ 9 | #define __BOOLEAN_H__ 10 | 11 | #ifndef FALSE 12 | #define FALSE 0 13 | #endif 14 | 15 | #ifndef TRUE 16 | #define TRUE 1 17 | #endif 18 | 19 | #ifndef boolean_t 20 | #define boolean_t int 21 | #endif 22 | 23 | #endif /* __BOOLEAN_H__ */ 24 | -------------------------------------------------------------------------------- /src/command.h: -------------------------------------------------------------------------------- 1 | /* 2 | * command.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: command.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __COMMAND_H__ 9 | #define __COMMAND_H__ 10 | 11 | #include 12 | 13 | public byte *editor_program; 14 | 15 | public boolean_t CommandInit(); 16 | public void Command( file_t *file, byte **optional ); 17 | 18 | #endif /* __COMMAND_H__ */ 19 | -------------------------------------------------------------------------------- /src/conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * conf.h 3 | * 4 | * All rights reserved. Copyright (C) 1998 by NARITA Tomio 5 | * $Id: conf.h,v 1.4 2003/11/13 03:30:49 nrt Exp $ 6 | */ 7 | 8 | #ifndef __CONF_H__ 9 | #define __CONF_H__ 10 | 11 | #include 12 | 13 | typedef struct { 14 | byte **file; 15 | stream_t *st; 16 | int width; 17 | int height; 18 | boolean_t options; 19 | byte inputCodingSystem; 20 | byte outputCodingSystem; 21 | byte keyboardCodingSystem; 22 | byte pathnameCodingSystem; 23 | byte defaultCodingSystem; 24 | boolean_t keyCodingSystemVirgin; 25 | byte *pattern; 26 | } conf_t; 27 | 28 | public void ConfInit( byte **argv ); 29 | public void Conf( conf_t *conf, byte **argv ); 30 | public byte *ConfFilename( conf_t *conf ); 31 | 32 | #endif /* __CONF_H__ */ 33 | -------------------------------------------------------------------------------- /src/configure.in: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script. 2 | AC_INIT(ascii.h) 3 | 4 | dnl Checks for programs. 5 | AC_PROG_LN_S 6 | AC_PROG_CC 7 | AC_PROG_INSTALL 8 | AC_PROG_CPP 9 | AC_PROG_MAKE_SET 10 | AC_PATH_PROGS(PERL, perl perl4 perl5) 11 | 12 | AC_MSG_CHECKING(if --enable-purify is specified) 13 | AC_SUBST(PURIFY) 14 | PURIFY= 15 | AC_ARG_ENABLE(purify, 16 | [ --enable-purify enables checks by purify], 17 | [AC_MSG_RESULT(yes) 18 | AC_PATH_PROGS(PURIFY, purify, "") 19 | if test "$PURIFY" != ""; then 20 | PURIFY="$PURIFY purecov" 21 | fi], 22 | [AC_MSG_RESULT(no)]) 23 | 24 | dnl Checks for libraries. 25 | AC_DEFINE(UNIX) 26 | AC_DEFINE(TERMCAP) 27 | AC_CHECK_LIB(terminfo, tgetstr,, [AC_CHECK_LIB(termcap, tgetstr,, [AC_CHECK_LIB(ncurses, tgetstr,, [AC_CHECK_LIB(curses, tgetstr)])])]) 28 | 29 | dnl Checks for header files. 30 | AC_HEADER_STDC 31 | AC_HEADER_SYS_WAIT 32 | AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h termio.h unistd.h termios.h locale.h) 33 | 34 | dnl Checks for typedefs, structures, and compiler characteristics. 35 | 36 | dnl Checks for library functions. 37 | AC_CHECK_FUNCS(sigvec tgetnum setlocale) 38 | AC_FUNC_GETPGRP 39 | AC_PROG_GCC_TRADITIONAL 40 | AC_TYPE_SIGNAL 41 | 42 | dnl From Bruno Haible. 43 | 44 | AC_DEFUN([AM_LANGINFO_CODESET], 45 | [ 46 | AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, 47 | [AC_TRY_LINK([#include ], 48 | [char* cs = nl_langinfo(CODESET);], 49 | am_cv_langinfo_codeset=yes, 50 | am_cv_langinfo_codeset=no) 51 | ]) 52 | if test $am_cv_langinfo_codeset = yes; then 53 | AC_DEFINE(HAVE_LANGINFO_CODESET, 1, 54 | [Define if you have and nl_langinfo(CODESET).]) 55 | fi 56 | ]) 57 | 58 | AM_LANGINFO_CODESET 59 | 60 | dnl AC_OUTPUT(Makefile src/Makefile) 61 | AC_OUTPUT(Makefile) 62 | -------------------------------------------------------------------------------- /src/console.h: -------------------------------------------------------------------------------- 1 | /* 2 | * console.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: console.h,v 1.4 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __CONSOLE_H__ 9 | #define __CONSOLE_H__ 10 | 11 | #include 12 | #include 13 | 14 | public int WIDTH, HEIGHT; /* one based */ 15 | 16 | public boolean_t allow_ansi_esc; 17 | public boolean_t no_scroll; 18 | 19 | public boolean_t allow_interrupt; 20 | public boolean_t kb_interrupted; 21 | public boolean_t window_changed; 22 | 23 | public byte *ansi_standout; 24 | public byte *ansi_reverse; 25 | public byte *ansi_blink; 26 | public byte *ansi_underline; 27 | public byte *ansi_hilight; 28 | 29 | public byte *cur_left; 30 | public byte *cur_right; 31 | public byte *cur_up; 32 | public byte *cur_down; 33 | public byte *cur_ppage; 34 | public byte *cur_npage; 35 | 36 | public void ConsoleInit(); 37 | public void ConsoleResetAnsiSequence(); 38 | 39 | public void ConsoleTermInit(); 40 | public void ConsoleSetUp(); 41 | public void ConsoleSetDown(); 42 | 43 | public void ConsoleShellEscape(); 44 | public void ConsoleReturnToProgram(); 45 | 46 | public void ConsoleGetWindowSize(); 47 | 48 | public void ConsoleSuspend(); 49 | 50 | public void ConsoleEnableInterrupt(); 51 | public void ConsoleDisableInterrupt(); 52 | 53 | public int ConsolePrint( byte i ); 54 | 55 | public void ConsolePrints( byte *str ); 56 | public void ConsolePrintsStr( str_t *str, int length ); 57 | 58 | public void ConsoleFlush(); 59 | 60 | public int ConsoleGetChar(); 61 | 62 | public void ConsoleSetCur( int x, int y ); /* zero based */ 63 | public void ConsoleOnCur(); 64 | public void ConsoleOffCur(); 65 | public void ConsoleGoAhead(); 66 | public void ConsoleClearScreen(); 67 | public void ConsoleClearRight(); 68 | public void ConsoleScrollUp(); 69 | public void ConsoleScrollDown(); 70 | public void ConsoleSetAttribute( byte attr ); 71 | 72 | #endif /* __CONSOLE_H__ */ 73 | -------------------------------------------------------------------------------- /src/conv.c: -------------------------------------------------------------------------------- 1 | /* 2 | * conv.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: conv.c,v 1.7 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | public boolean_t Conv( file_t *f, boolean_t showFileName ) 35 | { 36 | int len; 37 | boolean_t simple; 38 | long lineNumber = 0; 39 | boolean_t flagMatchedResult = FALSE; 40 | boolean_t flagMatched = FALSE; 41 | str_t *encoding_space = NULL; 42 | byte *str; 43 | i_str_t *istr = NULL; 44 | int i, gc_count = 0; 45 | 46 | for( f->eof = FALSE ; FALSE == f->eof ; ){ 47 | str = FileLoadLine( f, &len, &simple ); 48 | if( 0 == len ) 49 | return flagMatchedResult; 50 | 51 | if( NULL != istr ) 52 | IstrFree( istr ); 53 | 54 | if( ++gc_count > 64 ){ 55 | gc_count = 0; 56 | IstrFreeZone( ZONE_PAGE0 ); 57 | } 58 | 59 | if( TRUE == simple ) 60 | istr = DecodeSimple( IstrAlloc( ZONE_PAGE0, len + 1 ), 61 | str, &len ); 62 | else 63 | istr = Decode( IstrAlloc( ZONE_PAGE0, len + 1 ), 64 | f->inputCodingSystem, str, &len ); 65 | 66 | if( TRUE == grep_mode ){ 67 | lineNumber++; 68 | 69 | flagMatched = (*find_only_func)( istr ); 70 | 71 | if( TRUE == flagMatched ){ 72 | if( TRUE == grep_inverted ) 73 | flagMatched = FALSE; 74 | else { 75 | flagMatchedResult = TRUE; 76 | if( TRUE == showFileName ) 77 | printf( "%s:", f->fileName ); 78 | if( TRUE == line_number ) 79 | printf( "%ld:", lineNumber ); 80 | } 81 | } else { 82 | if( TRUE == grep_inverted ){ 83 | flagMatched = TRUE; 84 | flagMatchedResult = TRUE; 85 | if( TRUE == showFileName ) 86 | printf( "%s:", f->fileName ); 87 | if( TRUE == line_number ) 88 | printf( "%ld:", lineNumber ); 89 | } 90 | } 91 | } 92 | 93 | if( TRUE == flagMatched || FALSE == grep_mode ){ 94 | if( TRUE == simple ){ 95 | for( i = 0 ; i < len ; i++ ) 96 | putchar( str[ i ] ); 97 | } else { 98 | if( len > (STR_SIZE >> 2) ){ 99 | encode_length = (len << 2) + CODE_EXTRA_LEN; 100 | encoding_space = (str_t *)Malloc( encode_length * sizeof( str_t ) ); 101 | Encode( istr, 0, len, 102 | f->outputCodingSystem, TRUE, 103 | encoding_space, &encode_length ); 104 | for( len = 0 ; len < encode_length ; len++ ) 105 | putchar( 0xff & encoding_space[ len ] ); 106 | free( encoding_space ); 107 | } else { 108 | encode_length = CODE_SIZE; 109 | Encode( istr, 0, len, 110 | f->outputCodingSystem, TRUE, 111 | encode_str, &encode_length ); 112 | for( len = 0 ; len < encode_length ; len++ ) 113 | putchar( 0xff & encode_str[ len ] ); 114 | } 115 | } 116 | } 117 | } 118 | 119 | return flagMatchedResult; 120 | } 121 | -------------------------------------------------------------------------------- /src/conv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * conv.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: conv.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __CONV_H__ 9 | #define __CONV_H__ 10 | 11 | #include 12 | 13 | public boolean_t grep_mode; 14 | public boolean_t grep_inverted; 15 | public boolean_t line_number; 16 | 17 | public boolean_t Conv( file_t *f, boolean_t showFileName ); 18 | 19 | #endif /* __CONV_H__ */ 20 | -------------------------------------------------------------------------------- /src/ctable.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ctable.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: ctable.c,v 1.5 2004/01/05 07:23:29 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | /* 32 | * coding system table 33 | */ 34 | 35 | public c_table_t cTable[ C_TABLE_SIZE ] = { 36 | /* 37 | * Auto select: decoding on iso-2022-kr and encoding on iso-2022-jp 38 | */ 39 | { AUTOSELECT, FALSE, "AUTO", 40 | {{0, 1}, {ASCII, KSC5601, ASCII, ASCII}, 0, 0 } }, 41 | 42 | /* 43 | * 7bit 44 | */ 45 | { UTF_7, FALSE, "UTF-7", 46 | {{0, 1}, {ASCII, ASCII, ASCII, ASCII}, 0, 0 } }, 47 | { HZ_GB, FALSE, "HZ", 48 | {{0, 1}, {ASCII, GB2312, ASCII, ASCII}, 0, 0 } }, 49 | 50 | /* 51 | * EUC encoding 52 | */ 53 | { EUC_KOREA, FALSE, "EUC-KR", 54 | {{0, 1}, {ASCII, KSC5601, ASCII, ASCII}, 0, 0 } }, 55 | { EUC_JAPAN, FALSE, "EUC-JP", 56 | {{0, 1}, {ASCII, X0208, X0201KANA, X0212}, 0, 0 } }, 57 | { EUC_TAIWAN, FALSE, "EUC-TW", 58 | {{0, 1}, {ASCII, CNS_1, CNS_1, ASCII}, 0, 0 } }, 59 | { EUC_CHINA, FALSE, "EUC-CN", 60 | {{0, 1}, {ASCII, GB2312, ASCII, ASCII}, 0, 0 } }, 61 | 62 | /* 63 | * non iso-2022 encoding 64 | */ 65 | { BIG_FIVE, FALSE, "BIG5", 66 | {{0, 1}, {ASCII, ASCII, ASCII, ASCII}, 0, 0 } }, 67 | { SHIFT_JIS, FALSE, "SHIFT-JIS", 68 | {{0, 1}, {ASCII, X0201KANA, ASCII, ASCII}, 0, 0 } }, 69 | { UTF_8, FALSE, "UTF-8", 70 | {{0, 1}, {ASCII, ASCII, ASCII, ASCII}, 0, 0 } }, 71 | 72 | /* 73 | * ISO 2022 8bit encoding 74 | */ 75 | { ISO_8859_1, TRUE, "ISO-8859-1", 76 | {{0, 1}, {ASCII, ISO8859_1, ASCII, ASCII}, 0, 0 } }, 77 | { ISO_8859_2, TRUE, "ISO-8859-2", 78 | {{0, 1}, {ASCII, ISO8859_2, ASCII, ASCII}, 0, 0 } }, 79 | { ISO_8859_3, TRUE, "ISO-8859-3", 80 | {{0, 1}, {ASCII, ISO8859_3, ASCII, ASCII}, 0, 0 } }, 81 | { ISO_8859_4, TRUE, "ISO-8859-4", 82 | {{0, 1}, {ASCII, ISO8859_4, ASCII, ASCII}, 0, 0 } }, 83 | { ISO_8859_5, TRUE, "ISO-8859-5", 84 | {{0, 1}, {ASCII, ISO8859_5, ASCII, ASCII}, 0, 0 } }, 85 | { ISO_8859_6, TRUE, "ISO-8859-6", 86 | {{0, 1}, {ASCII, ISO8859_6, ASCII, ASCII}, 0, 0 } }, 87 | { ISO_8859_7, TRUE, "ISO-8859-7", 88 | {{0, 1}, {ASCII, ISO8859_7, ASCII, ASCII}, 0, 0 } }, 89 | { ISO_8859_8, TRUE, "ISO-8859-8", 90 | {{0, 1}, {ASCII, ISO8859_8, ASCII, ASCII}, 0, 0 } }, 91 | { ISO_8859_9, TRUE, "ISO-8859-9", 92 | {{0, 1}, {ASCII, ISO8859_9, ASCII, ASCII}, 0, 0 } }, 93 | { ISO_8859_10, TRUE, "ISO-8859-10", 94 | {{0, 1}, {ASCII, ISO8859_10, ASCII, ASCII}, 0, 0 } }, 95 | { ISO_8859_11, TRUE, "ISO-8859-11", 96 | {{0, 1}, {ASCII, ISO8859_11, ASCII, ASCII}, 0, 0 } }, 97 | { ISO_8859_13, TRUE, "ISO-8859-13", 98 | {{0, 1}, {ASCII, ISO8859_13, ASCII, ASCII}, 0, 0 } }, 99 | { ISO_8859_14, TRUE, "ISO-8859-14", 100 | {{0, 1}, {ASCII, ISO8859_14, ASCII, ASCII}, 0, 0 } }, 101 | { ISO_8859_15, TRUE, "ISO-8859-15", 102 | {{0, 1}, {ASCII, ISO8859_15, ASCII, ASCII}, 0, 0 } }, 103 | { ISO_8859_16, TRUE, "ISO-8859-16", 104 | {{0, 1}, {ASCII, ISO8859_16, ASCII, ASCII}, 0, 0 } }, 105 | 106 | /* 107 | * ISO 2022 7bit encoding 108 | */ 109 | { ISO_2022_CN, FALSE, "ISO-2022-CN", 110 | {{0, 1}, {ASCII, GB2312, ASCII, ASCII}, 0, 0 } }, 111 | { ISO_2022_JP, FALSE, "ISO-2022-JP", 112 | {{0, 3}, {ASCII, X0201KANA, X0201KANA, X0208}, 0, 0 } }, 113 | { ISO_2022_KR, FALSE, "ISO-2022-KR", 114 | {{0, 1}, {ASCII, KSC5601, ASCII, ASCII}, 0, 0 } }, 115 | 116 | /* 117 | * Raw encoding 118 | */ 119 | { RAW, FALSE, "RAW", 120 | {{0, 1}, {ASCII, ASCII, ASCII, ASCII}, 0, 0 } } 121 | }; 122 | 123 | public void CtableInit() 124 | { 125 | int i; 126 | 127 | for( i = 0 ; i < C_TABLE_SIZE ; i++ ) 128 | if( cTable[ i ].codingSystem != i ) 129 | fprintf( stderr, "lv: invalid charset table\n" ), exit( -1 ); 130 | } 131 | -------------------------------------------------------------------------------- /src/ctable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ctable.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: ctable.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __CTABLE_H__ 9 | #define __CTABLE_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #endif /* __CTABLE_H__ */ 16 | -------------------------------------------------------------------------------- /src/ctable_e.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ctable_e.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: ctable_e.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __CTABLE_E_H__ 9 | #define __CTABLE_E_H__ 10 | 11 | extern c_table_t cTable[]; 12 | 13 | #endif /* __CTABLE_E_H__ */ 14 | -------------------------------------------------------------------------------- /src/ctable_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ctable_t.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: ctable_t.h,v 1.4 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __CTABLE_T_H__ 9 | #define __CTABLE_T_H__ 10 | 11 | /* coding systems (byte) */ 12 | 13 | #define AUTOSELECT 0 /* pseudo coding system */ 14 | 15 | #define UTF_7 1 /* UTF-7 */ 16 | #define HZ_GB 2 /* HZ enabled euc-china */ 17 | 18 | #define EUC_KOREA 3 /* Extended unix code */ 19 | #define EUC_JAPAN 4 /* Extended unix code */ 20 | #define EUC_TAIWAN 5 /* Extended unix code */ 21 | #define EUC_CHINA 6 /* Extended unix code */ 22 | 23 | #define BIG_FIVE 7 /* big5 encoding */ 24 | #define SHIFT_JIS 8 /* shift-jis encoding */ 25 | 26 | #define UTF_8 9 /* UTF-8 */ 27 | 28 | #define ISO_8859_1 10 /* iso-2022-8bit-ss2 */ 29 | #define ISO_8859_2 11 /* iso-2022-8bit-ss2 */ 30 | #define ISO_8859_3 12 /* iso-2022-8bit-ss2 */ 31 | #define ISO_8859_4 13 /* iso-2022-8bit-ss2 */ 32 | #define ISO_8859_5 14 /* iso-2022-8bit-ss2 */ 33 | #define ISO_8859_6 15 /* iso-2022-8bit-ss2 */ 34 | #define ISO_8859_7 16 /* iso-2022-8bit-ss2 */ 35 | #define ISO_8859_8 17 /* iso-2022-8bit-ss2 */ 36 | #define ISO_8859_9 18 /* iso-2022-8bit-ss2 */ 37 | #define ISO_8859_10 19 /* iso-2022-8bit-ss2 */ 38 | #define ISO_8859_11 20 /* iso-2022-8bit-ss2 */ 39 | #define ISO_8859_13 21 /* iso-2022-8bit-ss2 */ 40 | #define ISO_8859_14 22 /* iso-2022-8bit-ss2 */ 41 | #define ISO_8859_15 23 /* iso-2022-8bit-ss2 */ 42 | #define ISO_8859_16 24 /* iso-2022-8bit-ss2 */ 43 | 44 | #define ISO_2022_CN 25 /* iso-2022-cn */ 45 | #define ISO_2022_JP 26 /* iso-2022-jp */ 46 | #define ISO_2022_KR 27 /* iso-2022-kr */ 47 | 48 | #define RAW 28 /* raw mode */ 49 | 50 | #define C_TABLE_SIZE 29 /* pseudo coding system */ 51 | 52 | #define GL 0 53 | #define GR 1 54 | 55 | #define G0 0 56 | #define G1 1 57 | #define G2 2 58 | #define G3 3 59 | 60 | typedef struct { 61 | byte gset[ 2 ]; 62 | byte cset[ 4 ]; 63 | byte sset; 64 | byte attr; 65 | } state_t; 66 | 67 | typedef struct { 68 | byte codingSystem; 69 | boolean_t bit8; 70 | byte *codingSystemName; 71 | state_t state; 72 | } c_table_t; 73 | 74 | public void CtableInit(); 75 | 76 | #endif /* __CTABLE_T_H__ */ 77 | -------------------------------------------------------------------------------- /src/d2u.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl -p 2 | s/\r\n/\n/g 3 | -------------------------------------------------------------------------------- /src/d2uall.sh: -------------------------------------------------------------------------------- 1 | #! /bin/csh 2 | foreach file ( *.c *.h lv.hlp Makefile* makefile* ) 3 | d2u.pl $file > /tmp/lvtmp 4 | cat /tmp/lvtmp > $file 5 | end 6 | -------------------------------------------------------------------------------- /src/decode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * decode.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: decode.h,v 1.5 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __DECODE_H__ 9 | #define __DECODE_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | /* 17 | * ISO2022 & ISO2375 style escape sequence 18 | */ 19 | 20 | #define IsIchar( c ) ( (c) >= 0x20 && (c) <= 0x2f ) 21 | #define IsFchar( c ) ( (c) >= 0x30 && (c) <= 0x7e ) 22 | 23 | #define IsKatakana( c ) \ 24 | ( (c) >= 0x21 && (c) <= 0x5f ) 25 | 26 | #define IsKatakanaByte( c ) \ 27 | ( (c) >= 0xa1 && (c) <= 0xdf ) 28 | 29 | #define IsShiftJisByte1( c ) \ 30 | ( ( (c) >= 0x81 && (c) <= 0x9f ) || ( (c) >= 0xe0 && (c) <= 0xfc ) ) 31 | 32 | #define IsShiftJisByte2( c ) \ 33 | ( ( (c) >= 0x40 && (c) <= 0x7e ) || ( (c) >= 0x80 && (c) <= 0xfc ) ) 34 | 35 | #define IsBig5Byte1( c ) \ 36 | ( ( (c) >= 0xa1 && (c) <= 0xfe ) ) 37 | 38 | #define IsBig5Byte2( c ) \ 39 | ( ( (c) >= 0x40 && (c) <= 0x7e ) || ( (c) >= 0xa1 && (c) <= 0xfe ) ) 40 | 41 | #define IsEucByte( c ) \ 42 | ( (c) >= 0xa1 && (c) <= 0xfe ) 43 | 44 | #define IsGLchar( c ) \ 45 | ( (c) >= SP && (c) <= DEL ) 46 | 47 | #define IsGRchar( c ) \ 48 | ( (c) >= 0xa0 && (c) <= 0xff ) 49 | 50 | #define IsGraphicChar94( c ) \ 51 | ( (c) > SP && (c) < DEL ) 52 | 53 | #define IsGraphicChar( cset, c ) \ 54 | ( TRUE == iTable[ (int)(cset) ].set94 ? \ 55 | ( (c) > SP && (c) < DEL ) : ( (c) >= SP && (c) <= DEL ) ) 56 | 57 | public int ISIDX, SIDX, SHIGH; 58 | public i_str_t *ISTR; 59 | public byte *STR; 60 | 61 | #define GetChar( c ) \ 62 | { \ 63 | if( SHIGH == SIDX ){ \ 64 | /* \ 65 | * BREAK for EXTERNAL LOOP \ 66 | */ \ 67 | break; \ 68 | } \ 69 | (c) = STR[ SIDX++ ]; \ 70 | } 71 | 72 | #define GetCharRet( c ) \ 73 | { \ 74 | if( SHIGH == SIDX ) \ 75 | return FALSE; \ 76 | (c) = STR[ SIDX++ ]; \ 77 | } 78 | 79 | #define IncStringIndex() \ 80 | { \ 81 | if( SHIGH != SIDX ){ \ 82 | SIDX++; \ 83 | } \ 84 | } 85 | 86 | #define DecodeAddChar( cset, s, attr ) \ 87 | { \ 88 | if( TRUE == iTable[ (int)(cset) ].multi ) \ 89 | DecodeAddIchar( (cset), MakeIchar( (s)[ 0 ], (s)[ 1 ] ), (attr) ); \ 90 | else \ 91 | DecodeAddIchar( (cset), (ic_t)(s)[ 0 ], (attr) ); \ 92 | } 93 | 94 | #define CSET( region ) (state->cset[ (int)state->gset[ (int)(region) ] ]) 95 | #define SSET (state->cset[ (int)state->sset ]) 96 | 97 | public boolean_t binary_decode; 98 | public boolean_t hz_detection; 99 | public int decoding_penalty; 100 | 101 | public void DecodeAddLineFeed( byte ch ); 102 | public void DecodeAddSpace( byte attr ); 103 | public void DecodeAddTab( byte attr ); 104 | public void DecodeAddControl( byte ch ); 105 | public void DecodeAddBs(); 106 | 107 | public void DecodeAddIchar( byte charset, ic_t ic, byte attr ); 108 | 109 | public boolean_t DecodeAddShifted( state_t *state, byte ch ); 110 | 111 | public i_str_t *DecodeSimple( i_str_t *istr, byte *str, int *shigh ); 112 | public i_str_t *Decode( i_str_t *istr, 113 | byte codingSystem, byte *str, int *shigh ); 114 | 115 | public void DecodeInit(); 116 | 117 | #endif /* __DECODE_H__ */ 118 | -------------------------------------------------------------------------------- /src/dfa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * dfa.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: dfa.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __DFA_H__ 9 | #define __DFA_H__ 10 | 11 | #include 12 | 13 | /*#define REGEXP_TEST*/ 14 | 15 | public boolean_t regexp_short_cut; 16 | public ic_t regexp_first_letter; 17 | 18 | public byte *ReMakeDFA( i_str_t *istr ); 19 | public boolean_t ReFreeDFA(); 20 | 21 | public boolean_t ReRun( i_str_t *istr, int *ptr ); 22 | 23 | public void ReShowNFA(); 24 | public void ReShowDFA(); 25 | 26 | #endif /* __DFA_H__ */ 27 | -------------------------------------------------------------------------------- /src/display.c: -------------------------------------------------------------------------------- 1 | /* 2 | * display.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: display.c,v 1.4 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /* 33 | * $B%Z!<%8FbMF$r%(%s%3!<%I$7$F2hLL$K=PNO$9$k(B. 34 | * 35 | * screen.c $B$G%m!<%I$7$?%Z!<%8FbMF$rI=<($9$k(B. 36 | * ($B$?$@$7(B, display.c $B$+$i$bF0E*$K%Z!<%8$r%a%b%j$K%m!<%I$7$F$$$k(B). 37 | */ 38 | 39 | #define ScreenGetTop( f, seg, blk, off, phy ) \ 40 | PositionGet( (f)->screen.top, (seg), (blk), (off), (phy) ) 41 | 42 | #define ScreenGetBot( f, seg, blk, off, phy ) \ 43 | PositionGet( (f)->screen.bot, (seg), (blk), (off), (phy) ) 44 | 45 | private void LineEncode( file_t *f, int blk, int off, int phy ) 46 | { 47 | line_t *line; 48 | int head, tail; 49 | 50 | line = &f->page[ blk ].line[ off ]; 51 | head = LineHead( line, phy ); 52 | tail = head + LineLength( line, phy ); 53 | 54 | encode_length = CODE_SIZE; 55 | Encode( line->istr, head, tail, 56 | f->outputCodingSystem, FALSE, 57 | encode_str, &encode_length ); 58 | } 59 | 60 | public void DisplayFull( file_t *f ) 61 | { 62 | int i; 63 | int seg, blk, off, phy; 64 | 65 | ConsoleOffCur(); 66 | 67 | ScreenGetTop( f, seg, blk, off, phy ); 68 | 69 | ConsoleClearScreen(); 70 | 71 | for( i = 0 ; i < f->screen.lines ; i++ ){ 72 | LineEncode( f, blk, off, phy ); 73 | if( 0 == i || TRUE == carefully_divide || 0 == phy ){ 74 | ConsoleSetCur( 0, i ); 75 | } 76 | ConsolePrintsStr( encode_str, encode_length ); 77 | PositionInc( f, seg, blk, off, phy ); 78 | } 79 | for( i = f->screen.lines ; i < f->height ; i++ ){ 80 | ConsoleSetCur( 0, i ); 81 | ConsolePrint( '~' ); 82 | } 83 | 84 | ConsoleOnCur(); 85 | 86 | f->dirty = FALSE; 87 | } 88 | 89 | public void DisplayTop( file_t *f, int arg ) 90 | { 91 | int seg, blk, off, phy; 92 | int i; 93 | 94 | if( TRUE == no_scroll || arg > f->height || f->screen.lines < f->height ){ 95 | DisplayFull( f ); 96 | return; 97 | } 98 | 99 | if( arg == f->height ){ 100 | if( FALSE == smooth_paging ){ 101 | DisplayFull( f ); 102 | return; 103 | } 104 | ScreenGetBot( f, seg, blk, off, phy ); 105 | } else { 106 | ScreenGetTop( f, seg, blk, off, phy ); 107 | for( i = 1 ; i < arg ; i++ ) 108 | PositionInc( f, seg, blk, off, phy ); 109 | } 110 | 111 | ConsoleOffCur(); 112 | 113 | for( i = 0 ; i < arg ; i++ ){ 114 | LineEncode( f, blk, off, phy ); 115 | ConsoleSetCur( 0, HEIGHT - 1 ); 116 | ConsoleClearRight(); 117 | ConsoleSetCur( 0, 0 ); 118 | ConsoleScrollDown(); 119 | ConsolePrintsStr( encode_str, encode_length ); 120 | PositionDec( f, seg, blk, off, phy ); 121 | } 122 | 123 | ConsoleOnCur(); 124 | } 125 | 126 | public void DisplayBot( file_t *f, int arg ) 127 | { 128 | int seg, blk, off, phy; 129 | int i; 130 | 131 | if( TRUE == no_scroll || arg > f->height || f->screen.lines < f->height ){ 132 | DisplayFull( f ); 133 | return; 134 | } 135 | 136 | if( arg == f->height ){ 137 | if( FALSE == smooth_paging ){ 138 | DisplayFull( f ); 139 | return; 140 | } 141 | ScreenGetTop( f, seg, blk, off, phy ); 142 | } else { 143 | ScreenGetBot( f, seg, blk, off, phy ); 144 | for( i = 1 ; i < arg ; i++ ) 145 | PositionDec( f, seg, blk, off, phy ); 146 | } 147 | 148 | ConsoleOffCur(); 149 | 150 | for( i = 0 ; i < arg ; i++ ){ 151 | LineEncode( f, blk, off, phy ); 152 | ConsoleSetCur( 0, 0 ); 153 | ConsoleScrollUp(); 154 | ConsoleSetCur( 0, f->height - 1 ); 155 | ConsoleClearRight(); 156 | ConsolePrintsStr( encode_str, encode_length ); 157 | PositionInc( f, seg, blk, off, phy ); 158 | } 159 | 160 | ConsoleOnCur(); 161 | } 162 | -------------------------------------------------------------------------------- /src/display.h: -------------------------------------------------------------------------------- 1 | /* 2 | * display.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: display.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __DISPLAY_H__ 9 | #define __DISPLAY_H__ 10 | 11 | #include 12 | 13 | public boolean_t smooth_paging; 14 | public boolean_t carefully_divide; 15 | 16 | public void DisplayFull( file_t *f ); 17 | public void DisplayTop( file_t *f, int arg ); 18 | public void DisplayBot( file_t *f, int arg ); 19 | 20 | #endif /* __DISPLAY_H__ */ 21 | -------------------------------------------------------------------------------- /src/encode.c: -------------------------------------------------------------------------------- 1 | /* 2 | * encode.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: encode.c,v 1.7 2004/01/05 07:23:29 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | typedef void (*encode_table_t)( i_str_t *, int, int, byte, boolean_t ); 41 | 42 | private encode_table_t encodeTable[ C_TABLE_SIZE ] = { 43 | EncodeISO2022jp, /* AUTOSELECT */ 44 | #ifndef MSDOS /* IF NOT DEFINED */ 45 | EncodeUTF7, /* UTF_7 */ 46 | #else /* MSDOS */ 47 | EncodeRaw, 48 | #endif /* MSDOS */ 49 | EncodeHz, /* HZ_GB */ 50 | EncodeEUCjp, /* EUC_KOREA */ 51 | EncodeEUCjp, /* EUC_JAPAN */ 52 | EncodeEUCjp, /* EUC_TAIWAN */ 53 | EncodeEUCjp, /* EUC_CHINA */ 54 | EncodeBig5, /* BIG_FIVE */ 55 | EncodeShiftJis, /* SHIFT_JIS */ 56 | #ifndef MSDOS /* IF NOT DEFINED */ 57 | EncodeUTF8, /* UTF_8 */ 58 | #else /* MSDOS */ 59 | EncodeRaw, 60 | #endif /* MSDOS */ 61 | EncodeISO8859, /* ISO_8859_1 */ 62 | EncodeISO8859, /* ISO_8859_2 */ 63 | EncodeISO8859, /* ISO_8859_3 */ 64 | EncodeISO8859, /* ISO_8859_4 */ 65 | EncodeISO8859, /* ISO_8859_5 */ 66 | EncodeISO8859, /* ISO_8859_6 */ 67 | EncodeISO8859, /* ISO_8859_7 */ 68 | EncodeISO8859, /* ISO_8859_8 */ 69 | EncodeISO8859, /* ISO_8859_9 */ 70 | EncodeISO8859, /* ISO_8859_10 */ 71 | EncodeISO8859, /* ISO_8859_11 */ 72 | EncodeISO8859, /* ISO_8859_13 */ 73 | EncodeISO8859, /* ISO_8859_14 */ 74 | EncodeISO8859, /* ISO_8859_15 */ 75 | EncodeISO8859, /* ISO_8859_16 */ 76 | EncodeISO2022cn, /* ISO_2022_CN */ 77 | EncodeISO2022jp, /* ISO_2022_JP */ 78 | EncodeISO2022kr, /* ISO_2022_KR */ 79 | EncodeRaw /* RAW */ 80 | }; 81 | 82 | #define HexChar( c ) ( (c) < 10 ? '0' + (c) : (c) + '7' ) 83 | 84 | public boolean_t EncodeAddPseudo( int attr, ic_t ic, byte cset, 85 | boolean_t binary ) 86 | { 87 | int i; 88 | byte c; 89 | 90 | if( LINE_FEED == cset ){ 91 | EncodeAddCharRet( attr, LF ); 92 | }else if( SPACE == cset ){ 93 | EncodeAddCharRet( attr, SP ); 94 | } else if( HTAB == cset ){ 95 | if( TRUE == binary ){ 96 | EncodeAddCharRet( attr, HT ); 97 | } else { 98 | for( i = 0 ; i < MakeByte1( ic ) ; i++ ) 99 | EncodeAddCharRet( attr, ' ' ); 100 | } 101 | } else if( CNTRL == cset ){ 102 | if( TRUE == binary ){ 103 | EncodeAddCharRet( attr, ic ); 104 | } else { 105 | c = MakeByte2( ic ); 106 | if( c < SP ){ 107 | EncodeAddCharRet( attr, '^' ); 108 | EncodeAddCharRet( attr, '@' + c ); 109 | } else if( c < DEL ){ 110 | EncodeAddCharRet( attr, c ); 111 | } else { 112 | EncodeAddCharRet( attr, '<' ); 113 | EncodeAddCharRet( attr, HexChar( ( 0xf0 & c ) >> 4 ) ); 114 | EncodeAddCharRet( attr, HexChar( ( 0x0f & c ) ) ); 115 | EncodeAddCharRet( attr, '>' ); 116 | } 117 | } 118 | } 119 | 120 | return TRUE; 121 | } 122 | 123 | public boolean_t EncodeAddInvalid( int attr, ic_t ic, byte cset ) 124 | { 125 | byte ch; 126 | 127 | if( TRUE == iTable[ (int)cset ].multi ){ 128 | ch = (byte)( 0x7f & MakeByte1( ic ) ); 129 | if( ch >= 0x20 && ch <= 0x7e ) 130 | EncodeAddCharRet( attr, ch ); 131 | if( 2 == IcharWidth( cset, ic ) ){ 132 | ch = (byte)( 0x7f & MakeByte2( ic ) ); 133 | if( ch >= 0x20 && ch <= 0x7e ) 134 | EncodeAddCharRet( attr, ch ); 135 | } 136 | } else { 137 | ch = (byte)( 0x7f & ic ); 138 | EncodeAddCharRet( attr, ch ); 139 | } 140 | 141 | return TRUE; 142 | } 143 | 144 | public void EncodeAddEscapeDollar( int attr ) 145 | { 146 | EncodeAddCharAbsolutely( attr, ESC ); 147 | EncodeAddCharAbsolutely( attr, '$' ); 148 | } 149 | 150 | public void EncodeAdd7bitSS2( int attr ) 151 | { 152 | EncodeAddCharAbsolutely( attr, ESC ); 153 | EncodeAddCharAbsolutely( attr, 'N' ); 154 | } 155 | 156 | public void EncodeAdd7bitSS3( int attr ) 157 | { 158 | EncodeAddCharAbsolutely( attr, ESC ); 159 | EncodeAddCharAbsolutely( attr, 'O' ); 160 | } 161 | 162 | public void Encode( i_str_t *istr, int head, int tail, 163 | byte codingSystem, boolean_t binary, 164 | str_t *code, int *length ) 165 | { 166 | CIDX = 0; 167 | 168 | CSTR = code; 169 | CHIGH = *length - CODE_EXTRA_LEN; 170 | 171 | (*encodeTable[ (int)codingSystem ])( istr, head, tail, 172 | codingSystem, binary ); 173 | 174 | CSTR[ CIDX ] = 0x00; 175 | 176 | *length = CIDX; 177 | } 178 | 179 | private byte encode_str_stripped[ CODE_SIZE ]; 180 | 181 | public byte *EncodeStripAttribute( str_t *str, int length ) 182 | { 183 | int i; 184 | byte *ptr; 185 | 186 | if( length > CODE_SIZE ) 187 | return NULL; 188 | 189 | ptr = encode_str_stripped; 190 | 191 | for( i = 0 ; i < length ; i++ ) 192 | *ptr++ = 0xff & str[ i ]; 193 | 194 | *ptr = 0x00; 195 | 196 | return encode_str_stripped; 197 | } 198 | -------------------------------------------------------------------------------- /src/encode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * encode.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: encode.h,v 1.5 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ENCODE_H__ 9 | #define __ENCODE_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #define CODE_EXTRA_LEN 16 17 | #define CODE_SIZE ( STR_SIZE + CODE_EXTRA_LEN ) 18 | 19 | public int CIDX; 20 | public int CHIGH; 21 | public str_t *CSTR; 22 | 23 | public int encode_length; 24 | public str_t encode_str[ CODE_SIZE ]; 25 | 26 | #define EncodeAddCharAbsolutely( a, c ) \ 27 | { \ 28 | CSTR[ CIDX++ ] = (a) | (c); \ 29 | } 30 | 31 | #define EncodeAddChar( a, c ) \ 32 | { \ 33 | CSTR[ CIDX++ ] = (a) | (c); \ 34 | if( CIDX >= CHIGH ) \ 35 | /* \ 36 | * BREAK for EXTERNAL LOOP \ 37 | */ \ 38 | break; \ 39 | } 40 | 41 | #define EncodeAddCharRet( a, c ) \ 42 | { \ 43 | CSTR[ CIDX++ ] = (a) | (c); \ 44 | if( CIDX >= CHIGH ) \ 45 | return FALSE; \ 46 | } 47 | 48 | public boolean_t EncodeAddPseudo( int attr, ic_t ic, byte cset, 49 | boolean_t binary ); 50 | public boolean_t EncodeAddInvalid( int attr, ic_t ic, byte cset ); 51 | 52 | public void EncodeAddEscapeDollar( int attr ); 53 | public void EncodeAdd7bitSS2( int attr ); 54 | public void EncodeAdd7bitSS3( int attr ); 55 | 56 | public void Encode( i_str_t *istr, int head, int tail, 57 | byte codingSystem, boolean_t binary, 58 | str_t *code, int *length ); 59 | 60 | public byte *EncodeStripAttribute( str_t *str, int length ); 61 | 62 | #endif /* __ENCODE_H__ */ 63 | -------------------------------------------------------------------------------- /src/escape.c: -------------------------------------------------------------------------------- 1 | /* 2 | * escape.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: escape.c,v 1.5 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | public boolean_t DecodeEscape( state_t *state ) 30 | { 31 | boolean_t multi; 32 | boolean_t set94 = TRUE; 33 | boolean_t omitted; 34 | boolean_t unknownSequence; 35 | byte charset, ic, ch, attr, color; 36 | int g = 0, index, arg; 37 | 38 | /* 39 | * escape sequence 40 | */ 41 | 42 | multi = FALSE; 43 | omitted = FALSE; 44 | unknownSequence = FALSE; 45 | 46 | GetCharRet( ch ); 47 | 48 | switch( ch ){ 49 | case '[': 50 | if( FALSE == allow_ansi_esc || TRUE == binary_decode ) 51 | break; 52 | 53 | /* 54 | * possibly, ANSI character attribute sequence 55 | */ 56 | 57 | index = SIDX; 58 | 59 | do { 60 | GetCharRet( ch ); 61 | if( !( ( ch >= '0' && ch <= '9' ) || ';' == ch ) ) 62 | break; 63 | } while( 'm' != ch ); 64 | 65 | SIDX = index; 66 | 67 | if( 'm' != ch ){ 68 | /* invalid ANSI sequence */ 69 | ch = '['; 70 | break; 71 | } 72 | 73 | arg = 0; 74 | attr = color = ATTR_NULL; 75 | do { 76 | GetCharRet( ch ); 77 | 78 | if( ch >= '0' && ch <= '9' ){ 79 | arg = 10 * arg + ch - '0'; 80 | } else if( ';' == ch || 'm' == ch ){ 81 | switch( arg ){ 82 | case 0: /* ignore it */ break; 83 | case 1: attr |= ATTR_HILIGHT; break; 84 | case 4: attr |= ATTR_UNDERLINE; break; 85 | case 5: attr |= ATTR_BLINK; break; 86 | case 7: attr |= ATTR_REVERSE; break; 87 | default: 88 | if( arg >= 30 && arg <= 37 ) 89 | color = (byte)( arg - 30 ); 90 | else if( arg >= 40 && arg <= 47 ){ 91 | color = (byte)( arg - 40 ); 92 | attr |= ATTR_REVERSE; 93 | } 94 | } 95 | arg = 0; 96 | } 97 | } while( 'm' != ch ); 98 | 99 | state->attr = attr | color; 100 | 101 | return TRUE; 102 | case ' ': /* announcer */ 103 | GetCharRet( ch ); 104 | /* 105 | * current implementation just ignores it. 106 | */ 107 | return TRUE; 108 | case '&': /* KOUSIN of registered charset */ 109 | GetCharRet( ch ); 110 | /* 111 | * current implementation just ignores it. 112 | */ 113 | return TRUE; 114 | case '~': /* LS1R */ state->gset[ GR ] = G1; return TRUE; 115 | case 'n': /* LS2 */ state->gset[ GL ] = G2; return TRUE; 116 | case '}': /* LS2R */ state->gset[ GR ] = G2; return TRUE; 117 | case 'o': /* LS3 */ state->gset[ GL ] = G3; return TRUE; 118 | case '|': /* LS3R */ state->gset[ GR ] = G3; return TRUE; 119 | case 'N': /* SS2 */ state->sset = G2; return TRUE; 120 | case 'O': /* SS3 */ state->sset = G3; return TRUE; 121 | } 122 | 123 | if( ch < SP || IsFchar( ch ) ){ 124 | /* 125 | * unknown ESC F sequence 126 | */ 127 | DecodeAddControl( ESC ); 128 | DecodeAddControl( ch ); 129 | return TRUE; 130 | } 131 | 132 | if( '$' == ch ){ 133 | multi = TRUE; 134 | GetCharRet( ch ); 135 | } 136 | 137 | ic = ch; 138 | if( ch >= '(' && ch <= '/' ){ 139 | switch( ch ){ 140 | case '(': set94 = TRUE; g = 0; break; 141 | case ')': set94 = TRUE; g = 1; break; 142 | case '*': set94 = TRUE; g = 2; break; 143 | case '+': set94 = TRUE; g = 3; break; 144 | case ',': set94 = FALSE; g = 0; break; /* MULE specific */ 145 | case '-': set94 = FALSE; g = 1; break; 146 | case '.': set94 = FALSE; g = 2; break; 147 | case '/': set94 = FALSE; g = 3; break; 148 | } 149 | } else { 150 | if( '@' == ch || 'A' == ch || 'B' == ch ){ 151 | set94 = TRUE; 152 | g = 0; 153 | omitted = TRUE; 154 | } else { 155 | unknownSequence = TRUE; 156 | } 157 | } 158 | 159 | if( FALSE == unknownSequence && FALSE == omitted ){ 160 | GetCharRet( ch ); 161 | } 162 | 163 | if( TRUE == unknownSequence 164 | || NOSET == (charset = ItableLookup( ch, multi, set94 )) ){ 165 | /* 166 | * unknown ESC I ... F sequence 167 | */ 168 | DecodeAddControl( ESC ); 169 | if( TRUE == multi ){ 170 | DecodeAddControl( '$' ); 171 | } 172 | DecodeAddControl( ic ); 173 | if( FALSE == unknownSequence && FALSE == omitted ){ 174 | DecodeAddControl( ch ); 175 | } else { 176 | ch = ic; 177 | } 178 | while( ! IsFchar( ch ) ){ 179 | GetCharRet( ch ); 180 | DecodeAddControl( ch ); 181 | } 182 | return TRUE; 183 | } 184 | 185 | if( TRUE == allow_unify ){ 186 | if( charset == X0201ROMAN ) 187 | charset = ASCII; 188 | else if( C6226 == charset ) 189 | charset = X0208; 190 | } 191 | 192 | state->cset[ g ] = charset; 193 | 194 | return TRUE; 195 | } 196 | -------------------------------------------------------------------------------- /src/escape.h: -------------------------------------------------------------------------------- 1 | /* 2 | * escape.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: escape.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ESCAPE_H__ 9 | #define __ESCAPE_H__ 10 | 11 | #include 12 | #include 13 | 14 | public boolean_t DecodeEscape( state_t *state ); 15 | 16 | #endif /* __ESCAPE_H__ */ 17 | -------------------------------------------------------------------------------- /src/eucjapan.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eucjapan.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: eucjapan.c,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | public void EncodeEUCjp( i_str_t *istr, int head, int tail, 31 | byte codingSystem, boolean_t binary ) 32 | { 33 | int idx, attr; 34 | ic_t ic; 35 | byte cset, g0, g1, g2, g3; 36 | 37 | g0 = cTable[ (int)codingSystem ].state.cset[ G0 ]; 38 | g1 = cTable[ (int)codingSystem ].state.cset[ G1 ]; 39 | g2 = cTable[ (int)codingSystem ].state.cset[ G2 ]; 40 | g3 = cTable[ (int)codingSystem ].state.cset[ G3 ]; 41 | 42 | for( idx = head ; idx < tail ; idx++ ){ 43 | cset = istr[ idx ].charset; 44 | ic = istr[ idx ].c; 45 | attr = (int)istr[ idx ].attr << 8; 46 | if( BIG5 == cset ) 47 | ic = BIG5toCNS( ic, &cset ); 48 | #ifndef MSDOS /* IF NOT DEFINED */ 49 | else if( UNICODE == cset ){ 50 | switch( codingSystem ){ 51 | case EUC_CHINA: ic = UNItoGB( ic, &cset ); break; 52 | case EUC_JAPAN: ic = UNItoJIS( ic, &cset ); break; 53 | case EUC_KOREA: ic = UNItoKSC( ic, &cset ); break; 54 | case EUC_TAIWAN:ic = UNItoCNS( ic, &cset ); break; 55 | default: ic = UNItoJIS( ic, &cset ); 56 | } 57 | } 58 | #endif /* MSDOS */ 59 | if( cset < PSEUDO ){ 60 | if( g0 == cset ){ 61 | if( TRUE == iTable[ (int)cset ].multi ){ 62 | EncodeAddChar( attr, MakeByte1( ic ) ); 63 | EncodeAddChar( attr, MakeByte2( ic ) ); 64 | } else { 65 | EncodeAddChar( attr, ic ); 66 | } 67 | continue; 68 | } else if( C6226 == cset && EUC_JAPAN == codingSystem ){ 69 | /* Japanese alternative g1 set */ 70 | } else if( g1 == cset ){ 71 | } else if( EUC_TAIWAN == codingSystem 72 | && ( cset >= CNS_2 && cset <= CNS_7 ) ){ 73 | EncodeAddChar( attr, SS2 ); 74 | EncodeAddChar( attr, ( cset - CNS_1 ) + 0xa1 ); 75 | } else if( g2 == cset ){ 76 | EncodeAddChar( attr, SS2 ); 77 | } else if( g3 == cset ){ 78 | EncodeAddChar( attr, SS3 ); 79 | } else { 80 | if( FALSE == EncodeAddInvalid( attr, ic, cset ) ) 81 | break; 82 | else 83 | continue; 84 | } 85 | if( TRUE == iTable[ (int)cset ].multi ){ 86 | EncodeAddChar( attr, 0x80 | MakeByte1( ic ) ); 87 | EncodeAddChar( attr, 0x80 | MakeByte2( ic ) ); 88 | } else { 89 | EncodeAddChar( attr, 0x80 | ic ); 90 | } 91 | } else if( FALSE == EncodeAddPseudo( attr, ic, cset, binary ) ){ 92 | break; 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/eucjapan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eucjapan.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: eucjapan.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __EUCJAPAN_H__ 9 | #define __EUCJAPAN_H__ 10 | 11 | #include 12 | 13 | public void EncodeEUCjp( i_str_t *istr, int head, int tail, 14 | byte codingSystem, boolean_t binary ); 15 | 16 | #endif /* __EUCJAPAN_H__ */ 17 | -------------------------------------------------------------------------------- /src/fetch.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fetch.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: fetch.c,v 1.7 2004/01/05 07:30:15 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #ifdef UNIX 27 | #include 28 | #endif /* UNIX */ 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | /* 38 | * $B8=:_$N%U%!%$%k%]%$%s%?$+$i(B 1$B9T$r%m!<%I$7(B, 39 | * $B%G%3!<%I$7$F(B (istr $B$KJQ49$7$F(B) $BJ*M}9T$K!X>v$_9~$_!Y(B, 40 | * $B%5!<%A$,@_Dj$5$l$F$$$l$P%5!<%A$ristr ) 61 | IstrFree( line->istr ); 62 | 63 | if( line->head ) 64 | free( line->head ); 65 | line->head = (head_t *)Malloc( sizeof( head_t ) * line_size ); 66 | 67 | if( TRUE == simple ){ 68 | line->istr = DecodeSimple( IstrAlloc( page, idx + 1 ), 69 | str, &idx ); 70 | FileFreeLine( f ); 71 | 72 | hptr = 0; 73 | w = f->width; 74 | width = idx; 75 | while( w < idx ){ 76 | if( hptr >= line_size - 1 ){ 77 | width = f->width; 78 | idx = w; 79 | line_truncated = TRUE; 80 | break; 81 | } 82 | line->head[ hptr ].width = f->width; 83 | line->head[ hptr++ ].ptr = w; 84 | width = idx - w; 85 | w += f->width; 86 | } 87 | } else { 88 | line->istr = Decode( IstrAlloc( page, idx + 1 ), 89 | f->inputCodingSystem, str, &idx ); 90 | FileFreeLine( f ); 91 | 92 | hptr = 0; 93 | width = 0; 94 | for( idx = 0 ; NOSET != line->istr[ idx ].charset ; idx++ ){ 95 | if( HTAB == line->istr[ idx ].charset ){ 96 | w = HTAB_WIDTH - width % HTAB_WIDTH; 97 | line->istr[ idx ].c &= 0x00ff; 98 | line->istr[ idx ].c |= ( w << 8 ); 99 | if( width + w == f->width ){ 100 | if( hptr >= line_size - 1 ){ 101 | idx++; 102 | line_truncated = TRUE; 103 | break; 104 | } 105 | line->head[ hptr ].width = width; 106 | line->head[ hptr++ ].ptr = idx + 1; 107 | width = 0; 108 | continue; 109 | } 110 | } else { 111 | w = IcharWidth( line->istr[ idx ].charset, line->istr[ idx ].c ); 112 | } 113 | if( width + w > f->width ){ 114 | if( hptr >= line_size - 1 ){ 115 | line_truncated = TRUE; 116 | break; 117 | } 118 | line->head[ hptr ].width = width; 119 | line->head[ hptr++ ].ptr = idx; 120 | width = w; 121 | } else { 122 | width += w; 123 | } 124 | } 125 | } 126 | 127 | line->head[ hptr ].width = width; 128 | line->head[ hptr++ ].ptr = idx; 129 | line->heads = hptr; 130 | 131 | line->head = (head_t *)realloc( line->head, sizeof( head_t ) * hptr ); 132 | if( NULL == line->head ){ 133 | fprintf( stderr, "lv: realloc() failed\n" ); 134 | exit( -1 ); 135 | } 136 | 137 | if( NULL != f->find.pattern ) 138 | (*find_func)( line ); 139 | 140 | return TRUE; 141 | } 142 | 143 | /* 144 | * $B;XDj$5$l$?%U%!%$%k%]%$%s%?$+$i(B 1$B%Z!<%8$r%m!<%I$9$k(B. 145 | * 146 | * $BFI$_=P$7Cf$K(B EOF $B$r8+$D$1$?$i(B, $B$=$3$G%Z!<%8$N%m!<%I$rCfCG$7(B, 147 | * $B9T?t$r%-%c%C%7%e$K3JG<$9$k(B. 148 | */ 149 | 150 | private void PageLoad( file_t *f, int block, long ptr ) 151 | { 152 | int i; 153 | 154 | if( fseek( f->fp, ptr, SEEK_SET ) ) 155 | perror( "PageLoad()" ), exit( -1 ); 156 | 157 | f->eof = FALSE; 158 | for( i = 0 ; i < LV_PAGE_SIZE ; i++ ){ 159 | if( TRUE == f->eof ) 160 | break; 161 | if( FALSE == LineDecode( f, block, &f->page[ block ].line[ i ] ) ) 162 | break; 163 | } 164 | 165 | f->page[ block ].lines = i; 166 | } 167 | 168 | /* 169 | * $B;XDj$7$?%Z!<%8$,%Z!<%8%-%c%C%7%eFb$K$"$k$3$H$rJ]>Z$9$k(B. 170 | * $B%Z!<%8%-%c%C%7%e$K$J$$>l9g(B, $B%U%!%$%k$+$i%-%c%C%7%e$X%m!<%I$7$J$*$9(B. 171 | */ 172 | 173 | public boolean_t FetchLine( file_t *f, unsigned int segment, int offset ) 174 | { 175 | int line, block; 176 | 177 | if( segment >= f->lastSegment ){ 178 | if( FALSE == FileStretch( f, segment ) ) 179 | return FALSE; 180 | } 181 | 182 | block = Block( segment ); 183 | 184 | if( FALSE == f->used[ block ] || segment != f->page[ block ].segment ){ 185 | if( TRUE == f->used[ block ] ){ 186 | for( line = 0 ; line < LV_PAGE_SIZE ; line++ ){ 187 | if( NULL != f->page[ block ].line[ line ].head ){ 188 | free( f->page[ block ].line[ line ].head ); 189 | f->page[ block ].line[ line ].head = NULL; 190 | } 191 | if( NULL != f->page[ block ].line[ line ].istr ){ 192 | IstrFree( f->page[ block ].line[ line ].istr ); 193 | f->page[ block ].line[ line ].istr = NULL; 194 | } 195 | } 196 | IstrFreeZone( block ); 197 | } 198 | PageLoad( f, block, f->slot[ Frame( segment ) ][ Slot( segment ) ] ); 199 | f->page[ block ].segment = segment; 200 | f->used[ block ] = TRUE; 201 | } 202 | 203 | if( f->page[ block ].lines <= offset ) 204 | return FALSE; 205 | 206 | return TRUE; 207 | } 208 | -------------------------------------------------------------------------------- /src/fetch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fetch.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: fetch.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __FETCH_H__ 9 | #define __FETCH_H__ 10 | 11 | #include 12 | 13 | public boolean_t line_truncated; 14 | 15 | #define LineHead( line, index ) \ 16 | ( 0 == (index) ? 0 : (line)->head[ (index)-1 ].ptr ) 17 | 18 | #define LineLength( line, index ) \ 19 | ( LineHead( (line), (index)+1 ) - LineHead( (line), (index) ) ) 20 | 21 | #define LineWidth( line, index ) \ 22 | ( (line)->head[ (index) ].width ) 23 | 24 | public boolean_t FetchLine( file_t *f, unsigned int segment, int offset ); 25 | 26 | #endif /* __FETCH_H__ */ 27 | -------------------------------------------------------------------------------- /src/file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * file.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: file.h,v 1.8 2004/01/05 07:30:15 nrt Exp $ 6 | */ 7 | 8 | #ifndef __FILE_H__ 9 | #define __FILE_H__ 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #define LV_PAGE_SIZE 32U /* lines per page */ 19 | 20 | #ifdef MSDOS 21 | #define BLOCK_SIZE 2 /* segments on memory */ 22 | #define SLOT_SIZE 1024U /* file location pointers */ 23 | #define FRAME_SIZE 2U 24 | #else 25 | #define BLOCK_SIZE 4 /* segments on memory */ 26 | #define SLOT_SIZE 16384U /* file location pointers */ 27 | #define FRAME_SIZE 4096U 28 | #endif /* MSDOS */ 29 | 30 | typedef struct { 31 | int ptr; 32 | int width; 33 | boolean_t hit; 34 | } head_t; 35 | 36 | typedef struct { 37 | i_str_t *istr; 38 | int heads; /* physical line number */ 39 | head_t *head; 40 | } line_t; 41 | 42 | typedef struct { 43 | unsigned int segment; 44 | int lines; /* logical line number */ 45 | line_t line[ LV_PAGE_SIZE ]; 46 | } page_t; 47 | 48 | typedef struct { 49 | unsigned int seg; 50 | int blk; 51 | int off; 52 | int phy; 53 | } position_t; 54 | 55 | typedef struct { 56 | position_t top; 57 | position_t bot; 58 | int lines; 59 | } screen_t; 60 | 61 | typedef struct { 62 | position_t pos; 63 | i_str_t *pattern; 64 | boolean_t first; 65 | boolean_t displayed; 66 | } find_t; 67 | 68 | typedef struct { 69 | byte *fileName; 70 | i_str_t *fileNameI18N; 71 | int fileNameLength; 72 | FILE *fp; 73 | FILE *sp; 74 | int pid; 75 | byte inputCodingSystem; 76 | byte outputCodingSystem; 77 | byte keyboardCodingSystem; 78 | byte pathnameCodingSystem; 79 | byte defaultCodingSystem; 80 | byte dummy; 81 | int width; 82 | int height; 83 | unsigned int lastSegment; 84 | unsigned int lastFrame; 85 | unsigned long totalLines; 86 | long lastPtr; 87 | boolean_t done; 88 | boolean_t eof; 89 | boolean_t top; 90 | boolean_t bottom; 91 | boolean_t truncated; 92 | boolean_t dirty; 93 | find_t find; 94 | screen_t screen; 95 | boolean_t used[ BLOCK_SIZE ]; 96 | page_t page[ BLOCK_SIZE ]; 97 | long *slot[ FRAME_SIZE ]; 98 | } file_t; 99 | 100 | #ifdef MSDOS 101 | #define line_t line_t far 102 | #define page_t page_t far 103 | #define file_t file_t far 104 | #else 105 | #ifndef far 106 | #define far 107 | #endif /* far */ 108 | #endif /* MSDOS */ 109 | 110 | #define Segment( line ) ( (line) / LV_PAGE_SIZE ) 111 | #define Offset( line ) ( (line) % LV_PAGE_SIZE ) 112 | #define Block( segment ) ( (segment) % BLOCK_SIZE ) 113 | #define Slot( segment ) ( (segment) % SLOT_SIZE ) 114 | #define Frame( segment ) ( (segment) / SLOT_SIZE ) 115 | 116 | public void FileFreeLine( file_t *f ); 117 | public byte *FileLoadLine( file_t *f, int *length, boolean_t *simple ); 118 | 119 | public file_t *FileAttach( byte *fileName, stream_t *st, 120 | int width, int height, 121 | byte inputCodingSystem, 122 | byte outputCodingSystem, 123 | byte keyboardCodingSystem, 124 | byte pathnameCodingSystem, 125 | byte defaultCodingSystem ); 126 | public void FilePreload( file_t *f ); 127 | 128 | public boolean_t FileFree( file_t *f ); 129 | public boolean_t FileDetach( file_t *f ); 130 | 131 | public boolean_t FileStretch( file_t *f, unsigned int target ); 132 | public boolean_t FileSeek( file_t *f, unsigned int segment ); 133 | 134 | public void FileRefresh( file_t *f ); 135 | public byte *FileStatus( file_t *f ); 136 | public byte *FileName( file_t *f ); 137 | 138 | public void FileInit(); 139 | 140 | #endif /* __FILE_H__ */ 141 | -------------------------------------------------------------------------------- /src/find.h: -------------------------------------------------------------------------------- 1 | /* 2 | * find.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: find.h,v 1.4 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __FIND_H__ 9 | #define __FIND_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | typedef ic_t (*tolower_func_t)( byte, ic_t ); 16 | public tolower_func_t to_lower_func; 17 | 18 | typedef boolean_t (*find_func_t)( line_t * ); 19 | public find_func_t find_func; 20 | 21 | typedef boolean_t (*find_continue_func_t)( i_str_t * ); 22 | public find_continue_func_t find_only_func; 23 | 24 | public boolean_t casefold_search; 25 | public boolean_t regexp_search; 26 | 27 | #define ToLower( cset, c ) \ 28 | ( FALSE == casefold_search ? (c) \ 29 | : ( 'Z' < (c) || 'A' > (c) || ASCII != (cset) ) ? (c) \ 30 | : (c) + 0x20 ) 31 | 32 | public void FindSetup(); 33 | 34 | public byte *FindResetPattern( file_t *f, i_str_t *istr ); 35 | public byte *FindSetPattern( file_t *f, i_str_t *istr ); 36 | public boolean_t FindClearPattern( file_t *f ); 37 | 38 | public int FindForward( file_t *f ); 39 | public int FindBackward( file_t *f ); 40 | 41 | #endif /* __FIND_H__ */ 42 | -------------------------------------------------------------------------------- /src/guess.h: -------------------------------------------------------------------------------- 1 | /* 2 | * guess.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: guess.h,v 1.5 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __GUESS_H__ 9 | #define __GUESS_H__ 10 | 11 | #include 12 | 13 | public boolean_t adjust_charset; 14 | 15 | public byte GuessCodingSystem( byte *str, int length, byte defaultEuc ); 16 | public byte GuessHz( byte *str, int length ); 17 | public void AdjustPatternCharset( byte inputCodingSystem, 18 | byte keyboardCodingSystem, 19 | byte defaultCodingSystem, 20 | i_str_t *istr ); 21 | 22 | #endif /* __GUESS_H__ */ 23 | -------------------------------------------------------------------------------- /src/guesslocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * guesslocale.h 3 | * 4 | * All rights reserved. Copyright (C) 2003 by Tomohiro KUBOTA 5 | * $Id: guesslocale.h,v 1.1 2003/11/06 06:53:52 nrt Exp $ 6 | */ 7 | 8 | #ifndef __GUESSLOCALE_H__ 9 | #define __GUESSLOCALE_H__ 10 | 11 | public byte LocaleCodingSystem( char *language ); 12 | public byte DetermineEUC( char *language, char defaultEuc ); 13 | public byte Determine8bit( char *language ); 14 | 15 | #endif /* __GUESSLOCALE_H__ */ 16 | -------------------------------------------------------------------------------- /src/hz.c: -------------------------------------------------------------------------------- 1 | /* 2 | * hz.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: hz.c,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | public void EncodeHz( i_str_t *istr, int head, int tail, 31 | byte codingSystem, boolean_t binary ) 32 | { 33 | int idx, attr; 34 | ic_t ic; 35 | byte cset; 36 | boolean_t asciiMode = TRUE; 37 | 38 | for( idx = head ; idx < tail ; idx++ ){ 39 | cset = istr[ idx ].charset; 40 | ic = istr[ idx ].c; 41 | attr = (int)istr[ idx ].attr << 8; 42 | if( BIG5 == cset ) 43 | ic = BIG5toCNS( ic, &cset ); 44 | #ifndef MSDOS /* IF NOT DEFINED */ 45 | else if( UNICODE == cset ) 46 | ic = UNItoGB( ic, &cset ); 47 | #endif /* MSDOS */ 48 | if( cset < PSEUDO ){ 49 | if( ASCII == cset ){ 50 | if( FALSE == asciiMode ){ 51 | asciiMode = TRUE; 52 | EncodeAddChar( attr, (ic_t)'~' ); 53 | EncodeAddChar( attr, (ic_t)'}' ); 54 | } 55 | EncodeAddChar( attr, ic ); 56 | if( (ic_t)'~' == ic ) 57 | EncodeAddChar( attr, (ic_t)'~' ); 58 | } else if( GB2312 == cset ){ 59 | if( TRUE == asciiMode ){ 60 | asciiMode = FALSE; 61 | EncodeAddChar( attr, '~' ); 62 | EncodeAddChar( attr, '{' ); 63 | } 64 | EncodeAddChar( attr, MakeByte1( ic ) ); 65 | EncodeAddChar( attr, MakeByte2( ic ) ); 66 | } else { 67 | if( FALSE == EncodeAddInvalid( attr, ic, cset ) ) 68 | break; 69 | } 70 | } else if( FALSE == EncodeAddPseudo( attr, ic, cset, binary ) ){ 71 | break; 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/hz.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hz.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: hz.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __HZ_H__ 9 | #define __HZ_H__ 10 | 11 | #include 12 | 13 | public void EncodeHz( i_str_t *istr, int head, int tail, 14 | byte codingSystem, boolean_t binary ); 15 | 16 | #endif /* __HZ_H__ */ 17 | -------------------------------------------------------------------------------- /src/ichar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ichar.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: ichar.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ICHAR_H__ 9 | #define __ICHAR_H__ 10 | 11 | /* 12 | * international character 13 | */ 14 | 15 | typedef unsigned short ic_t; 16 | 17 | #define ICHAR_WIDTH 2 18 | 19 | #define CNTRLWIDTH_SHORTFORM 1 /* 0x00 .. 0x1f */ 20 | #define CNTRLWIDTH_MIDDLEFORM 2 /* 0x20 .. 0x7e */ 21 | #define CNTRLWIDTH_LONGFORM 4 /* 0x7f .. 0xff */ 22 | 23 | #define HTAB_WIDTH 8 24 | #define HTAB_INTERNAL_WIDTH 2 25 | 26 | #define MakeByte1( ic ) ( (byte)( (ic) >> 8 ) ) 27 | #define MakeByte2( ic ) ( (byte)( 0x00ff & (ic) ) ) 28 | #define MakeIchar( c1, c2 ) ( ( (ic_t)(c1) << 8 ) | (ic_t)(c2) ) 29 | 30 | typedef struct { 31 | byte charset; 32 | byte attr; 33 | ic_t c; 34 | } i_str_t; 35 | 36 | #ifdef MSDOS 37 | #define i_str_t i_str_t far 38 | #else 39 | #ifndef far 40 | #define far 41 | #endif /* far */ 42 | #endif /* MSDOS */ 43 | 44 | #endif /* __ICHAR_H__ */ 45 | -------------------------------------------------------------------------------- /src/import.h: -------------------------------------------------------------------------------- 1 | /* 2 | * import.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: import.h,v 1.4 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __IMPORT_H__ 9 | #define __IMPORT_H__ 10 | 11 | #include 12 | 13 | #define public extern 14 | #define private static 15 | 16 | #define byte unsigned char 17 | 18 | #endif /* __IMPORT_H__ */ 19 | -------------------------------------------------------------------------------- /src/install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # install - install a program, script, or datafile 4 | # This comes from X11R5. 5 | # 6 | # Calling this script install-sh is preferred over install.sh, to prevent 7 | # `make' implicit rules from creating a file called install from it 8 | # when there is no Makefile. 9 | # 10 | # This script is compatible with the BSD install script, but was written 11 | # from scratch. 12 | # 13 | 14 | 15 | # set DOITPROG to echo to test this script 16 | 17 | # Don't use :- since 4.3BSD and earlier shells don't like it. 18 | doit="${DOITPROG-}" 19 | 20 | 21 | # put in absolute paths if you don't have them in your path; or use env. vars. 22 | 23 | mvprog="${MVPROG-mv}" 24 | cpprog="${CPPROG-cp}" 25 | chmodprog="${CHMODPROG-chmod}" 26 | chownprog="${CHOWNPROG-chown}" 27 | chgrpprog="${CHGRPPROG-chgrp}" 28 | stripprog="${STRIPPROG-strip}" 29 | rmprog="${RMPROG-rm}" 30 | mkdirprog="${MKDIRPROG-mkdir}" 31 | 32 | tranformbasename="" 33 | transform_arg="" 34 | instcmd="$mvprog" 35 | chmodcmd="$chmodprog 0755" 36 | chowncmd="" 37 | chgrpcmd="" 38 | stripcmd="" 39 | rmcmd="$rmprog -f" 40 | mvcmd="$mvprog" 41 | src="" 42 | dst="" 43 | dir_arg="" 44 | 45 | while [ x"$1" != x ]; do 46 | case $1 in 47 | -c) instcmd="$cpprog" 48 | shift 49 | continue;; 50 | 51 | -d) dir_arg=true 52 | shift 53 | continue;; 54 | 55 | -m) chmodcmd="$chmodprog $2" 56 | shift 57 | shift 58 | continue;; 59 | 60 | -o) chowncmd="$chownprog $2" 61 | shift 62 | shift 63 | continue;; 64 | 65 | -g) chgrpcmd="$chgrpprog $2" 66 | shift 67 | shift 68 | continue;; 69 | 70 | -s) stripcmd="$stripprog" 71 | shift 72 | continue;; 73 | 74 | -t=*) transformarg=`echo $1 | sed 's/-t=//'` 75 | shift 76 | continue;; 77 | 78 | -b=*) transformbasename=`echo $1 | sed 's/-b=//'` 79 | shift 80 | continue;; 81 | 82 | *) if [ x"$src" = x ] 83 | then 84 | src=$1 85 | else 86 | # this colon is to work around a 386BSD /bin/sh bug 87 | : 88 | dst=$1 89 | fi 90 | shift 91 | continue;; 92 | esac 93 | done 94 | 95 | if [ x"$src" = x ] 96 | then 97 | echo "install: no input file specified" 98 | exit 1 99 | else 100 | true 101 | fi 102 | 103 | if [ x"$dir_arg" != x ]; then 104 | dst=$src 105 | src="" 106 | 107 | if [ -d $dst ]; then 108 | instcmd=: 109 | else 110 | instcmd=mkdir 111 | fi 112 | else 113 | 114 | # Waiting for this to be detected by the "$instcmd $src $dsttmp" command 115 | # might cause directories to be created, which would be especially bad 116 | # if $src (and thus $dsttmp) contains '*'. 117 | 118 | if [ -f $src -o -d $src ] 119 | then 120 | true 121 | else 122 | echo "install: $src does not exist" 123 | exit 1 124 | fi 125 | 126 | if [ x"$dst" = x ] 127 | then 128 | echo "install: no destination specified" 129 | exit 1 130 | else 131 | true 132 | fi 133 | 134 | # If destination is a directory, append the input filename; if your system 135 | # does not like double slashes in filenames, you may need to add some logic 136 | 137 | if [ -d $dst ] 138 | then 139 | dst="$dst"/`basename $src` 140 | else 141 | true 142 | fi 143 | fi 144 | 145 | ## this sed command emulates the dirname command 146 | dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` 147 | 148 | # Make sure that the destination directory exists. 149 | # this part is taken from Noah Friedman's mkinstalldirs script 150 | 151 | # Skip lots of stat calls in the usual case. 152 | if [ ! -d "$dstdir" ]; then 153 | defaultIFS=' 154 | ' 155 | IFS="${IFS-${defaultIFS}}" 156 | 157 | oIFS="${IFS}" 158 | # Some sh's can't handle IFS=/ for some reason. 159 | IFS='%' 160 | set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` 161 | IFS="${oIFS}" 162 | 163 | pathcomp='' 164 | 165 | while [ $# -ne 0 ] ; do 166 | pathcomp="${pathcomp}${1}" 167 | shift 168 | 169 | if [ ! -d "${pathcomp}" ] ; 170 | then 171 | $mkdirprog "${pathcomp}" 172 | else 173 | true 174 | fi 175 | 176 | pathcomp="${pathcomp}/" 177 | done 178 | fi 179 | 180 | if [ x"$dir_arg" != x ] 181 | then 182 | $doit $instcmd $dst && 183 | 184 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && 185 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && 186 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && 187 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi 188 | else 189 | 190 | # If we're going to rename the final executable, determine the name now. 191 | 192 | if [ x"$transformarg" = x ] 193 | then 194 | dstfile=`basename $dst` 195 | else 196 | dstfile=`basename $dst $transformbasename | 197 | sed $transformarg`$transformbasename 198 | fi 199 | 200 | # don't allow the sed command to completely eliminate the filename 201 | 202 | if [ x"$dstfile" = x ] 203 | then 204 | dstfile=`basename $dst` 205 | else 206 | true 207 | fi 208 | 209 | # Make a temp file name in the proper directory. 210 | 211 | dsttmp=$dstdir/#inst.$$# 212 | 213 | # Move or copy the file name to the temp name 214 | 215 | $doit $instcmd $src $dsttmp && 216 | 217 | trap "rm -f ${dsttmp}" 0 && 218 | 219 | # and set any options; do chmod last to preserve setuid bits 220 | 221 | # If any of these fail, we abort the whole thing. If we want to 222 | # ignore errors from any of these, just make sure not to ignore 223 | # errors from the above "$doit $instcmd $src $dsttmp" command. 224 | 225 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && 226 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && 227 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && 228 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && 229 | 230 | # Now rename the file to the real destination. 231 | 232 | $doit $rmcmd -f $dstdir/$dstfile && 233 | $doit $mvcmd $dsttmp $dstdir/$dstfile 234 | 235 | fi && 236 | 237 | 238 | exit 0 239 | -------------------------------------------------------------------------------- /src/iso2022.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iso2022.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: iso2022.c,v 1.6 2004/01/05 07:23:29 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | public void DecodeISO2022( state_t *state, byte codingSystem ) 32 | { 33 | int region; 34 | byte charset, ch, rch; 35 | byte c[ ICHAR_WIDTH ]; 36 | 37 | for( ; ; ){ 38 | GetChar( ch ); 39 | if( ch < SP ){ 40 | if( ESC == ch ){ 41 | if( FALSE == DecodeEscape( state ) ) 42 | break; 43 | } else if( HT == ch ) 44 | DecodeAddTab( state->attr ); 45 | else if( SO == ch ) /* LS1 for 8bit */ 46 | state->gset[ GL ] = G1; 47 | else if( SI == ch ) /* LS0 for 8bit */ 48 | state->gset[ GL ] = G0; 49 | else if( BS == ch ) 50 | DecodeAddBs(); 51 | else if( EM == ch ) 52 | state->sset = G2; 53 | else 54 | DecodeAddControl( ch ); 55 | } else { 56 | if( '~' == ch && TRUE == hz_detection ){ 57 | switch( STR[ SIDX ] ){ 58 | case '~': 59 | if( ASCII == state->cset[ G0 ] ) 60 | IncStringIndex(); 61 | break; /* break for '~' itself.*/ 62 | case '{': 63 | if( ASCII == state->cset[ G0 ] ){ 64 | IncStringIndex(); 65 | state->cset[ G0 ] = GB2312; 66 | continue; 67 | } 68 | break; 69 | case '}': 70 | if( GB2312 == state->cset[ G0 ] ){ 71 | IncStringIndex(); 72 | state->cset[ G0 ] = ASCII; 73 | continue; 74 | } 75 | break; 76 | } 77 | } 78 | rch = ch; 79 | if( 0 != state->sset ){ 80 | /* 81 | * single shifted character 82 | */ 83 | if( EUC_TAIWAN == codingSystem && G2 == state->sset ){ 84 | charset = CNS_1 + ( ch - 0xa1 ); 85 | if( charset < CNS_1 || charset > CNS_7 ){ 86 | state->sset = 0; 87 | continue; 88 | } 89 | GetChar( ch ); 90 | } else { 91 | charset = SSET; 92 | } 93 | state->sset = 0; 94 | ch &= 0x7f; /* for EUC */ 95 | if( !IsGraphicChar( charset, ch ) ){ 96 | if( SP == ch ){ 97 | DecodeAddSpace( state->attr ); 98 | } else { 99 | DecodeAddControl( rch ); 100 | } 101 | continue; 102 | } 103 | c[ 0 ] = ch; 104 | if( TRUE == iTable[ (int)charset ].multi ){ 105 | GetChar( ch ); 106 | if( !IsGraphicChar( charset, ch & 0x7f ) ){ 107 | DecodeAddControl( rch ); 108 | DecodeAddControl( ch ); 109 | continue; 110 | } 111 | c[ 1 ] = ch & 0x7f; /* for EUC */ 112 | } 113 | } else { 114 | if( 0x80 & ch ){ 115 | if( SS2 == ch ){ 116 | state->sset = G2; 117 | continue; 118 | } else if( SS3 == ch ){ 119 | state->sset = G3; 120 | continue; 121 | } 122 | region = GR; 123 | ch &= 0x7f; 124 | } else { 125 | region = GL; 126 | } 127 | charset = CSET( region ); 128 | if( !IsGraphicChar( charset, ch ) ){ 129 | if( SP == ch ){ 130 | DecodeAddSpace( state->attr ); 131 | } else { 132 | DecodeAddControl( rch ); 133 | } 134 | continue; 135 | } 136 | c[ 0 ] = ch; 137 | if( TRUE == iTable[ (int)charset ].multi ){ 138 | GetChar( ch ); 139 | ch &= 0x7f; 140 | if( !IsGraphicChar( charset, ch ) ) 141 | continue; 142 | c[ 1 ] = ch; 143 | } 144 | } 145 | DecodeAddChar( charset, c, state->attr ); 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /src/iso2022.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iso2022.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: iso2022.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ISO2022_H__ 9 | #define __ISO2022_H__ 10 | 11 | #include 12 | #include 13 | 14 | public void DecodeISO2022( state_t *state, byte codingSystem ); 15 | 16 | #endif /* __ISO2022_H__ */ 17 | -------------------------------------------------------------------------------- /src/iso2cn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iso2cn.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: iso2cn.c,v 1.4 2004/01/05 07:23:29 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /* 33 | * iso-2022-cn, iso-2022-cn-ext 34 | * 35 | * G0: ASCII 36 | * G1: GB 2312-80, CNS 11643-1992 Plane 1, and ISO-IR-165 37 | * G2: CNS 11643-1992 Pane 2 38 | * G3: CNS 11643-1992 Pane 3, 4, 5, 6, 7 39 | */ 40 | 41 | public void EncodeISO2022cn( i_str_t *istr, int head, int tail, 42 | byte codingSystem, boolean_t binary ) 43 | { 44 | int idx, attr; 45 | ic_t ic; 46 | byte cset, gl, lastCsetG1, lastCsetG2, lastCsetG3, shiftState; 47 | boolean_t set94; 48 | 49 | attr = 0; 50 | gl = G0; 51 | lastCsetG1 = lastCsetG2 = lastCsetG3 = ASCII; 52 | shiftState = NUL; 53 | 54 | for( idx = head ; idx < tail ; idx++ ){ 55 | cset = istr[ idx ].charset; 56 | ic = istr[ idx ].c; 57 | attr = (int)istr[ idx ].attr << 8; 58 | if( BIG5 == cset ) 59 | ic = BIG5toCNS( ic, &cset ); 60 | #ifndef MSDOS /* IF NOT DEFINED */ 61 | else if( UNICODE == cset ) 62 | ic = UNItoChinese( ic, &cset ); 63 | #endif /* MSDOS */ 64 | set94 = iTable[ (int)cset ].set94; 65 | if( ASCII == cset || cset > PSEUDO ){ 66 | shiftState = NUL; 67 | if( gl != G0 ){ 68 | gl = G0; 69 | EncodeAddCharAbsolutely( attr, SI ); 70 | } 71 | } else if( CNS_1 == cset || GB2312 == cset || ISO_IR_165 == cset ){ 72 | shiftState = NUL; 73 | if( gl != G1 ){ 74 | gl = G1; 75 | EncodeAddCharAbsolutely( attr, SO ); 76 | } 77 | if( lastCsetG1 != cset ){ 78 | EncodeAddEscapeDollar( attr ); 79 | EncodeAddCharAbsolutely( attr, ')' ); 80 | EncodeAddCharAbsolutely( attr, iTable[ (int)cset ].fin ); 81 | } 82 | lastCsetG1 = cset; 83 | } else if( cset >= CNS_3 && cset <= CNS_7 ){ 84 | shiftState = SS3; 85 | if( lastCsetG3 != cset ){ 86 | EncodeAddEscapeDollar( attr ); 87 | EncodeAddCharAbsolutely( attr, '+' ); 88 | EncodeAddCharAbsolutely( attr, iTable[ (int)cset ].fin ); 89 | } 90 | lastCsetG3 = cset; 91 | } else { 92 | /* CNS_2 */ 93 | shiftState = SS2; 94 | if( lastCsetG2 != cset ){ 95 | EncodeAddCharAbsolutely( attr, ESC ); 96 | if( TRUE == iTable[ (int)cset ].multi ){ 97 | EncodeAddCharAbsolutely( attr, '$' ); 98 | } 99 | if( TRUE == set94 ){ 100 | EncodeAddCharAbsolutely( attr, '*' ); /* designate set94 to G2 */ 101 | } else { 102 | EncodeAddCharAbsolutely( attr, '.' ); /* designate set96 to G2 */ 103 | } 104 | EncodeAddCharAbsolutely( attr, iTable[ (int)cset ].fin ); 105 | } 106 | lastCsetG2 = cset; 107 | } 108 | if( cset < PSEUDO ){ 109 | switch( shiftState ){ 110 | case SS2: 111 | EncodeAdd7bitSS2( attr ); 112 | break; 113 | case SS3: 114 | EncodeAdd7bitSS3( attr ); 115 | break; 116 | } 117 | if( TRUE == iTable[ (int)cset ].multi ){ 118 | EncodeAddChar( attr, MakeByte1( ic ) ); 119 | EncodeAddChar( attr, MakeByte2( ic ) ); 120 | } else { 121 | EncodeAddChar( attr, ic ); 122 | } 123 | } else if( FALSE == EncodeAddPseudo( attr, ic, cset, binary ) ){ 124 | break; 125 | } 126 | } 127 | if( gl != G0 ){ 128 | EncodeAddCharAbsolutely( attr, SI ); 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/iso2cn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iso2cn.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: iso2cn.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ISO2CN_H__ 9 | #define __ISO2CN_H__ 10 | 11 | #include 12 | #include 13 | 14 | public void EncodeISO2022cn( i_str_t *istr, int head, int tail, 15 | byte codingSystem, boolean_t binary ); 16 | 17 | #endif /* __ISO2CN_H__ */ 18 | -------------------------------------------------------------------------------- /src/iso2jp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iso2jp.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: iso2jp.c,v 1.5 2004/01/05 07:23:29 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /* 33 | * iso-2022-jp 34 | * 35 | * all 94charsets use G0, and all 96charsets use G2 with single shift. 36 | */ 37 | public void EncodeISO2022jp( i_str_t *istr, int head, int tail, 38 | byte codingSystem, boolean_t binary ) 39 | { 40 | int idx, attr; 41 | ic_t ic; 42 | byte cset, lastCset, lastCsetG0, lastCsetG2; 43 | boolean_t lastSet94, set94, bit8 = FALSE; 44 | 45 | attr = 0; 46 | lastCset = lastCsetG0 = lastCsetG2 = ASCII; 47 | lastSet94 = TRUE; 48 | 49 | for( idx = head ; idx < tail ; idx++ ){ 50 | cset = istr[ idx ].charset; 51 | ic = istr[ idx ].c; 52 | attr = (int)istr[ idx ].attr << 8; 53 | if( BIG5 == cset ) 54 | ic = BIG5toCNS( ic, &cset ); 55 | #ifndef MSDOS /* IF NOT DEFINED */ 56 | else if( UNICODE == cset ) 57 | ic = UNItoJapanese( ic, &cset ); 58 | #endif /* MSDOS */ 59 | set94 = iTable[ (int)cset ].set94; 60 | if( lastSet94 != set94 ){ 61 | if( TRUE == set94 ){ 62 | lastCsetG2 = lastCset; 63 | lastCset = lastCsetG0; 64 | } else { 65 | lastCsetG0 = lastCset; 66 | lastCset = lastCsetG2; 67 | } 68 | } 69 | lastSet94 = set94; 70 | if( lastCset != cset ){ 71 | if( !( ( lastCset == ASCII && cset > PSEUDO ) 72 | || ( lastCset > PSEUDO && ASCII == cset ) 73 | || ( lastCset > PSEUDO && cset > PSEUDO ) ) ){ 74 | EncodeAddCharAbsolutely( attr, ESC ); 75 | if( TRUE == iTable[ (int)cset ].multi ){ 76 | EncodeAddCharAbsolutely( attr, '$' ); 77 | if( !( cset == X0208 || cset == C6226 || cset == GB2312 ) ){ 78 | if( TRUE == set94 ){ 79 | EncodeAddCharAbsolutely( attr, '(' ); 80 | } else { 81 | EncodeAddCharAbsolutely( attr, '.' ); 82 | } 83 | } 84 | } else { 85 | if( TRUE == set94 ){ 86 | EncodeAddCharAbsolutely( attr, '(' ); /* designate set94 to G0 */ 87 | } else { 88 | EncodeAddCharAbsolutely( attr, '.' ); /* designate set96 to G2 */ 89 | } 90 | } 91 | EncodeAddCharAbsolutely( attr, iTable[ (int)cset ].fin ); 92 | } 93 | } 94 | lastCset = cset; 95 | if( cset < PSEUDO ){ 96 | if( FALSE == set94 ){ 97 | if( TRUE == bit8 ){ 98 | EncodeAddChar( attr, SS2 ); 99 | } else { 100 | EncodeAdd7bitSS2( attr ); 101 | } 102 | } 103 | if( TRUE == iTable[ (int)cset ].multi ){ 104 | EncodeAddChar( attr, MakeByte1( ic ) ); 105 | EncodeAddChar( attr, MakeByte2( ic ) ); 106 | } else { 107 | EncodeAddChar( attr, ic ); 108 | } 109 | } else if( FALSE == EncodeAddPseudo( attr, ic, cset, binary ) ){ 110 | break; 111 | } 112 | } 113 | if( TRUE != lastSet94 ) 114 | lastCset = lastCsetG0; 115 | if( ASCII != lastCset && lastCset < PSEUDO ){ 116 | EncodeAddCharAbsolutely( attr, ESC ); 117 | EncodeAddCharAbsolutely( attr, '(' ); 118 | EncodeAddCharAbsolutely( attr, iTable[ ASCII ].fin ); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /src/iso2jp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iso2jp.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: iso2jp.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ISO2JP_H__ 9 | #define __ISO2JP_H__ 10 | 11 | #include 12 | #include 13 | 14 | public void EncodeISO2022jp( i_str_t *istr, int head, int tail, 15 | byte codingSystem, boolean_t binary ); 16 | 17 | #endif /* __ISO2JP_H__ */ 18 | -------------------------------------------------------------------------------- /src/iso2kr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iso2kr.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: iso2kr.c,v 1.4 2004/01/05 07:23:29 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /* 33 | * iso-2022-kr 34 | * 35 | * All charsets except ASCII use only G1 with locking shift. 36 | */ 37 | public void EncodeISO2022kr( i_str_t *istr, int head, int tail, 38 | byte codingSystem, boolean_t binary ) 39 | { 40 | int idx, attr; 41 | ic_t ic; 42 | byte cset, gl, lastCsetG1; 43 | boolean_t set94; 44 | 45 | attr = 0; 46 | gl = G0; 47 | lastCsetG1 = ASCII; 48 | 49 | for( idx = head ; idx < tail ; idx++ ){ 50 | cset = istr[ idx ].charset; 51 | attr = istr[ idx ].attr << 8; 52 | ic = istr[ idx ].c; 53 | if( BIG5 == cset ) 54 | ic = BIG5toCNS( ic, &cset ); 55 | #ifndef MSDOS /* IF NOT DEFINED */ 56 | else if( UNICODE == cset ) 57 | ic = UNItoKorean( ic, &cset ); 58 | #endif /* MSDOS */ 59 | set94 = iTable[ (int)cset ].set94; 60 | if( ASCII == cset || cset > PSEUDO ){ 61 | if( gl != G0 ){ 62 | gl = G0; 63 | EncodeAddCharAbsolutely( attr, SI ); 64 | } 65 | } else { 66 | if( gl != G1 ){ 67 | gl = G1; 68 | EncodeAddCharAbsolutely( attr, SO ); 69 | } 70 | if( lastCsetG1 != cset ){ 71 | EncodeAddCharAbsolutely( attr, ESC ); 72 | if( TRUE == iTable[ (int)cset ].multi ){ 73 | EncodeAddCharAbsolutely( attr, '$' ); 74 | } 75 | if( TRUE == set94 ){ 76 | EncodeAddCharAbsolutely( attr, ')' ); /* designate set94 to G1 */ 77 | } else { 78 | EncodeAddCharAbsolutely( attr, '-' ); /* designate set96 to G1 */ 79 | } 80 | EncodeAddCharAbsolutely( attr, iTable[ (int)cset ].fin ); 81 | } 82 | lastCsetG1 = cset; 83 | } 84 | if( cset < PSEUDO ){ 85 | if( TRUE == iTable[ (int)cset ].multi ){ 86 | EncodeAddChar( attr, MakeByte1( ic ) ); 87 | EncodeAddChar( attr, MakeByte2( ic ) ); 88 | } else { 89 | EncodeAddChar( attr, ic ); 90 | } 91 | } else if( FALSE == EncodeAddPseudo( attr, ic, cset, binary ) ){ 92 | break; 93 | } 94 | } 95 | if( gl != G0 ){ 96 | EncodeAddCharAbsolutely( attr, SI ); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/iso2kr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iso2kr.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: iso2kr.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ISO2KR_H__ 9 | #define __ISO2KR_H__ 10 | 11 | #include 12 | #include 13 | 14 | public void EncodeISO2022kr( i_str_t *istr, int head, int tail, 15 | byte codingSystem, boolean_t binary ); 16 | 17 | #endif /* __ISO2KR_H__ */ 18 | -------------------------------------------------------------------------------- /src/iso8859.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iso8859.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: iso8859.c,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | /* 32 | * iso-8859-* 33 | * 34 | * one pre-designated 8bit charset uses G1. 35 | */ 36 | public void EncodeISO8859( i_str_t *istr, int head, int tail, 37 | byte codingSystem, boolean_t binary ) 38 | { 39 | int idx, attr; 40 | ic_t ic; 41 | byte cset, csetG1 = ASCII; 42 | 43 | csetG1 = cTable[ (int)codingSystem ].state.cset[ G1 ]; 44 | 45 | for( idx = head ; idx < tail ; idx++ ){ 46 | cset = istr[ idx ].charset; 47 | ic = istr[ idx ].c; 48 | attr = (int)istr[ idx ].attr << 8; 49 | #ifndef MSDOS /* IF NOT DEFINED */ 50 | if( UNICODE == cset ) 51 | ic = UNItoISO8859( ic, &cset, codingSystem ); 52 | #endif /* MSDOS */ 53 | if( cset < PSEUDO ){ 54 | if( ASCII == cset ){ 55 | EncodeAddChar( attr, ic ); 56 | } else if( csetG1 == cset ){ 57 | EncodeAddChar( attr, 0x80 | ic ); 58 | } else { 59 | if( FALSE == EncodeAddInvalid( attr, ic, cset ) ) 60 | break; 61 | } 62 | } else if( FALSE == EncodeAddPseudo( attr, ic, cset, binary ) ){ 63 | break; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/iso8859.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iso8859.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: iso8859.h,v 1.2 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ISO8859_H__ 9 | #define __ISO8859_H__ 10 | 11 | #include 12 | #include 13 | 14 | public void EncodeISO8859( i_str_t *istr, int head, int tail, 15 | byte codingSystem, boolean_t binary ); 16 | 17 | #endif /* __ISO8859_H__ */ 18 | -------------------------------------------------------------------------------- /src/iso885910.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_10[ 96 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A7, 0x27 }, 4 | { 0x00AD, 0x2d }, 5 | { 0x00B0, 0x30 }, 6 | { 0x00B7, 0x37 }, 7 | { 0x00C1, 0x41 }, 8 | { 0x00C2, 0x42 }, 9 | { 0x00C3, 0x43 }, 10 | { 0x00C4, 0x44 }, 11 | { 0x00C5, 0x45 }, 12 | { 0x00C6, 0x46 }, 13 | { 0x00C9, 0x49 }, 14 | { 0x00CB, 0x4b }, 15 | { 0x00CD, 0x4d }, 16 | { 0x00CE, 0x4e }, 17 | { 0x00CF, 0x4f }, 18 | { 0x00D0, 0x50 }, 19 | { 0x00D3, 0x53 }, 20 | { 0x00D4, 0x54 }, 21 | { 0x00D5, 0x55 }, 22 | { 0x00D6, 0x56 }, 23 | { 0x00D8, 0x58 }, 24 | { 0x00DA, 0x5a }, 25 | { 0x00DB, 0x5b }, 26 | { 0x00DC, 0x5c }, 27 | { 0x00DD, 0x5d }, 28 | { 0x00DE, 0x5e }, 29 | { 0x00DF, 0x5f }, 30 | { 0x00E1, 0x61 }, 31 | { 0x00E2, 0x62 }, 32 | { 0x00E3, 0x63 }, 33 | { 0x00E4, 0x64 }, 34 | { 0x00E5, 0x65 }, 35 | { 0x00E6, 0x66 }, 36 | { 0x00E9, 0x69 }, 37 | { 0x00EB, 0x6b }, 38 | { 0x00ED, 0x6d }, 39 | { 0x00EE, 0x6e }, 40 | { 0x00EF, 0x6f }, 41 | { 0x00F0, 0x70 }, 42 | { 0x00F3, 0x73 }, 43 | { 0x00F4, 0x74 }, 44 | { 0x00F5, 0x75 }, 45 | { 0x00F6, 0x76 }, 46 | { 0x00F8, 0x78 }, 47 | { 0x00FA, 0x7a }, 48 | { 0x00FB, 0x7b }, 49 | { 0x00FC, 0x7c }, 50 | { 0x00FD, 0x7d }, 51 | { 0x00FE, 0x7e }, 52 | { 0x0100, 0x40 }, 53 | { 0x0101, 0x60 }, 54 | { 0x0104, 0x21 }, 55 | { 0x0105, 0x31 }, 56 | { 0x010C, 0x48 }, 57 | { 0x010D, 0x68 }, 58 | { 0x0110, 0x29 }, 59 | { 0x0111, 0x39 }, 60 | { 0x0112, 0x22 }, 61 | { 0x0113, 0x32 }, 62 | { 0x0116, 0x4c }, 63 | { 0x0117, 0x6c }, 64 | { 0x0118, 0x4a }, 65 | { 0x0119, 0x6a }, 66 | { 0x0122, 0x23 }, 67 | { 0x0123, 0x33 }, 68 | { 0x0128, 0x25 }, 69 | { 0x0129, 0x35 }, 70 | { 0x012A, 0x24 }, 71 | { 0x012B, 0x34 }, 72 | { 0x012E, 0x47 }, 73 | { 0x012F, 0x67 }, 74 | { 0x0136, 0x26 }, 75 | { 0x0137, 0x36 }, 76 | { 0x0138, 0x7f }, 77 | { 0x013B, 0x28 }, 78 | { 0x013C, 0x38 }, 79 | { 0x0145, 0x51 }, 80 | { 0x0146, 0x71 }, 81 | { 0x014A, 0x2f }, 82 | { 0x014B, 0x3f }, 83 | { 0x014C, 0x52 }, 84 | { 0x014D, 0x72 }, 85 | { 0x0160, 0x2a }, 86 | { 0x0161, 0x3a }, 87 | { 0x0166, 0x2b }, 88 | { 0x0167, 0x3b }, 89 | { 0x0168, 0x57 }, 90 | { 0x0169, 0x77 }, 91 | { 0x016A, 0x2e }, 92 | { 0x016B, 0x3e }, 93 | { 0x0172, 0x59 }, 94 | { 0x0173, 0x79 }, 95 | { 0x017D, 0x2c }, 96 | { 0x017E, 0x3c }, 97 | { 0x2015, 0x3d } 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso885910.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_10[ 96 ] = { 2 | 0x00A0, 3 | 0x0104, 4 | 0x0112, 5 | 0x0122, 6 | 0x012A, 7 | 0x0128, 8 | 0x0136, 9 | 0x00A7, 10 | 0x013B, 11 | 0x0110, 12 | 0x0160, 13 | 0x0166, 14 | 0x017D, 15 | 0x00AD, 16 | 0x016A, 17 | 0x014A, 18 | 0x00B0, 19 | 0x0105, 20 | 0x0113, 21 | 0x0123, 22 | 0x012B, 23 | 0x0129, 24 | 0x0137, 25 | 0x00B7, 26 | 0x013C, 27 | 0x0111, 28 | 0x0161, 29 | 0x0167, 30 | 0x017E, 31 | 0x2015, 32 | 0x016B, 33 | 0x014B, 34 | 0x0100, 35 | 0x00C1, 36 | 0x00C2, 37 | 0x00C3, 38 | 0x00C4, 39 | 0x00C5, 40 | 0x00C6, 41 | 0x012E, 42 | 0x010C, 43 | 0x00C9, 44 | 0x0118, 45 | 0x00CB, 46 | 0x0116, 47 | 0x00CD, 48 | 0x00CE, 49 | 0x00CF, 50 | 0x00D0, 51 | 0x0145, 52 | 0x014C, 53 | 0x00D3, 54 | 0x00D4, 55 | 0x00D5, 56 | 0x00D6, 57 | 0x0168, 58 | 0x00D8, 59 | 0x0172, 60 | 0x00DA, 61 | 0x00DB, 62 | 0x00DC, 63 | 0x00DD, 64 | 0x00DE, 65 | 0x00DF, 66 | 0x0101, 67 | 0x00E1, 68 | 0x00E2, 69 | 0x00E3, 70 | 0x00E4, 71 | 0x00E5, 72 | 0x00E6, 73 | 0x012F, 74 | 0x010D, 75 | 0x00E9, 76 | 0x0119, 77 | 0x00EB, 78 | 0x0117, 79 | 0x00ED, 80 | 0x00EE, 81 | 0x00EF, 82 | 0x00F0, 83 | 0x0146, 84 | 0x014D, 85 | 0x00F3, 86 | 0x00F4, 87 | 0x00F5, 88 | 0x00F6, 89 | 0x0169, 90 | 0x00F8, 91 | 0x0173, 92 | 0x00FA, 93 | 0x00FB, 94 | 0x00FC, 95 | 0x00FD, 96 | 0x00FE, 97 | 0x0138 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso885911.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_11[ 88 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x0E01, 0x21 }, 4 | { 0x0E02, 0x22 }, 5 | { 0x0E03, 0x23 }, 6 | { 0x0E04, 0x24 }, 7 | { 0x0E05, 0x25 }, 8 | { 0x0E06, 0x26 }, 9 | { 0x0E07, 0x27 }, 10 | { 0x0E08, 0x28 }, 11 | { 0x0E09, 0x29 }, 12 | { 0x0E0A, 0x2a }, 13 | { 0x0E0B, 0x2b }, 14 | { 0x0E0C, 0x2c }, 15 | { 0x0E0D, 0x2d }, 16 | { 0x0E0E, 0x2e }, 17 | { 0x0E0F, 0x2f }, 18 | { 0x0E10, 0x30 }, 19 | { 0x0E11, 0x31 }, 20 | { 0x0E12, 0x32 }, 21 | { 0x0E13, 0x33 }, 22 | { 0x0E14, 0x34 }, 23 | { 0x0E15, 0x35 }, 24 | { 0x0E16, 0x36 }, 25 | { 0x0E17, 0x37 }, 26 | { 0x0E18, 0x38 }, 27 | { 0x0E19, 0x39 }, 28 | { 0x0E1A, 0x3a }, 29 | { 0x0E1B, 0x3b }, 30 | { 0x0E1C, 0x3c }, 31 | { 0x0E1D, 0x3d }, 32 | { 0x0E1E, 0x3e }, 33 | { 0x0E1F, 0x3f }, 34 | { 0x0E20, 0x40 }, 35 | { 0x0E21, 0x41 }, 36 | { 0x0E22, 0x42 }, 37 | { 0x0E23, 0x43 }, 38 | { 0x0E24, 0x44 }, 39 | { 0x0E25, 0x45 }, 40 | { 0x0E26, 0x46 }, 41 | { 0x0E27, 0x47 }, 42 | { 0x0E28, 0x48 }, 43 | { 0x0E29, 0x49 }, 44 | { 0x0E2A, 0x4a }, 45 | { 0x0E2B, 0x4b }, 46 | { 0x0E2C, 0x4c }, 47 | { 0x0E2D, 0x4d }, 48 | { 0x0E2E, 0x4e }, 49 | { 0x0E2F, 0x4f }, 50 | { 0x0E30, 0x50 }, 51 | { 0x0E31, 0x51 }, 52 | { 0x0E32, 0x52 }, 53 | { 0x0E33, 0x53 }, 54 | { 0x0E34, 0x54 }, 55 | { 0x0E35, 0x55 }, 56 | { 0x0E36, 0x56 }, 57 | { 0x0E37, 0x57 }, 58 | { 0x0E38, 0x58 }, 59 | { 0x0E39, 0x59 }, 60 | { 0x0E3A, 0x5a }, 61 | { 0x0E3F, 0x5f }, 62 | { 0x0E40, 0x60 }, 63 | { 0x0E41, 0x61 }, 64 | { 0x0E42, 0x62 }, 65 | { 0x0E43, 0x63 }, 66 | { 0x0E44, 0x64 }, 67 | { 0x0E45, 0x65 }, 68 | { 0x0E46, 0x66 }, 69 | { 0x0E47, 0x67 }, 70 | { 0x0E48, 0x68 }, 71 | { 0x0E49, 0x69 }, 72 | { 0x0E4A, 0x6a }, 73 | { 0x0E4B, 0x6b }, 74 | { 0x0E4C, 0x6c }, 75 | { 0x0E4D, 0x6d }, 76 | { 0x0E4E, 0x6e }, 77 | { 0x0E4F, 0x6f }, 78 | { 0x0E50, 0x70 }, 79 | { 0x0E51, 0x71 }, 80 | { 0x0E52, 0x72 }, 81 | { 0x0E53, 0x73 }, 82 | { 0x0E54, 0x74 }, 83 | { 0x0E55, 0x75 }, 84 | { 0x0E56, 0x76 }, 85 | { 0x0E57, 0x77 }, 86 | { 0x0E58, 0x78 }, 87 | { 0x0E59, 0x79 }, 88 | { 0x0E5A, 0x7a }, 89 | { 0x0E5B, 0x7b } 90 | }; 91 | -------------------------------------------------------------------------------- /src/iso885911.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_11[ 96 ] = { 2 | 0x00A0, 3 | 0x0E01, 4 | 0x0E02, 5 | 0x0E03, 6 | 0x0E04, 7 | 0x0E05, 8 | 0x0E06, 9 | 0x0E07, 10 | 0x0E08, 11 | 0x0E09, 12 | 0x0E0A, 13 | 0x0E0B, 14 | 0x0E0C, 15 | 0x0E0D, 16 | 0x0E0E, 17 | 0x0E0F, 18 | 0x0E10, 19 | 0x0E11, 20 | 0x0E12, 21 | 0x0E13, 22 | 0x0E14, 23 | 0x0E15, 24 | 0x0E16, 25 | 0x0E17, 26 | 0x0E18, 27 | 0x0E19, 28 | 0x0E1A, 29 | 0x0E1B, 30 | 0x0E1C, 31 | 0x0E1D, 32 | 0x0E1E, 33 | 0x0E1F, 34 | 0x0E20, 35 | 0x0E21, 36 | 0x0E22, 37 | 0x0E23, 38 | 0x0E24, 39 | 0x0E25, 40 | 0x0E26, 41 | 0x0E27, 42 | 0x0E28, 43 | 0x0E29, 44 | 0x0E2A, 45 | 0x0E2B, 46 | 0x0E2C, 47 | 0x0E2D, 48 | 0x0E2E, 49 | 0x0E2F, 50 | 0x0E30, 51 | 0x0E31, 52 | 0x0E32, 53 | 0x0E33, 54 | 0x0E34, 55 | 0x0E35, 56 | 0x0E36, 57 | 0x0E37, 58 | 0x0E38, 59 | 0x0E39, 60 | 0x0E3A, 61 | 0x0000, 62 | 0x0000, 63 | 0x0000, 64 | 0x0000, 65 | 0x0E3F, 66 | 0x0E40, 67 | 0x0E41, 68 | 0x0E42, 69 | 0x0E43, 70 | 0x0E44, 71 | 0x0E45, 72 | 0x0E46, 73 | 0x0E47, 74 | 0x0E48, 75 | 0x0E49, 76 | 0x0E4A, 77 | 0x0E4B, 78 | 0x0E4C, 79 | 0x0E4D, 80 | 0x0E4E, 81 | 0x0E4F, 82 | 0x0E50, 83 | 0x0E51, 84 | 0x0E52, 85 | 0x0E53, 86 | 0x0E54, 87 | 0x0E55, 88 | 0x0E56, 89 | 0x0E57, 90 | 0x0E58, 91 | 0x0E59, 92 | 0x0E5A, 93 | 0x0E5B, 94 | 0x0000, 95 | 0x0000, 96 | 0x0000, 97 | 0x0000 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso885913.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_13[ 96 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A2, 0x22 }, 4 | { 0x00A3, 0x23 }, 5 | { 0x00A4, 0x24 }, 6 | { 0x00A6, 0x26 }, 7 | { 0x00A7, 0x27 }, 8 | { 0x00A9, 0x29 }, 9 | { 0x00AB, 0x2b }, 10 | { 0x00AC, 0x2c }, 11 | { 0x00AD, 0x2d }, 12 | { 0x00AE, 0x2e }, 13 | { 0x00B0, 0x30 }, 14 | { 0x00B1, 0x31 }, 15 | { 0x00B2, 0x32 }, 16 | { 0x00B3, 0x33 }, 17 | { 0x00B5, 0x35 }, 18 | { 0x00B6, 0x36 }, 19 | { 0x00B7, 0x37 }, 20 | { 0x00B9, 0x39 }, 21 | { 0x00BB, 0x3b }, 22 | { 0x00BC, 0x3c }, 23 | { 0x00BD, 0x3d }, 24 | { 0x00BE, 0x3e }, 25 | { 0x00C4, 0x44 }, 26 | { 0x00C5, 0x45 }, 27 | { 0x00C6, 0x2f }, 28 | { 0x00C9, 0x49 }, 29 | { 0x00D3, 0x53 }, 30 | { 0x00D5, 0x55 }, 31 | { 0x00D6, 0x56 }, 32 | { 0x00D7, 0x57 }, 33 | { 0x00D8, 0x28 }, 34 | { 0x00DC, 0x5c }, 35 | { 0x00DF, 0x5f }, 36 | { 0x00E4, 0x64 }, 37 | { 0x00E5, 0x65 }, 38 | { 0x00E6, 0x3f }, 39 | { 0x00E9, 0x69 }, 40 | { 0x00F3, 0x73 }, 41 | { 0x00F5, 0x75 }, 42 | { 0x00F6, 0x76 }, 43 | { 0x00F7, 0x77 }, 44 | { 0x00F8, 0x38 }, 45 | { 0x00FC, 0x7c }, 46 | { 0x0100, 0x42 }, 47 | { 0x0101, 0x62 }, 48 | { 0x0104, 0x40 }, 49 | { 0x0105, 0x60 }, 50 | { 0x0106, 0x43 }, 51 | { 0x0107, 0x63 }, 52 | { 0x010C, 0x48 }, 53 | { 0x010D, 0x68 }, 54 | { 0x0112, 0x47 }, 55 | { 0x0113, 0x67 }, 56 | { 0x0116, 0x4b }, 57 | { 0x0117, 0x6b }, 58 | { 0x0118, 0x46 }, 59 | { 0x0119, 0x66 }, 60 | { 0x0122, 0x4c }, 61 | { 0x0123, 0x6c }, 62 | { 0x012A, 0x4e }, 63 | { 0x012B, 0x6e }, 64 | { 0x012E, 0x41 }, 65 | { 0x012F, 0x61 }, 66 | { 0x0136, 0x4d }, 67 | { 0x0137, 0x6d }, 68 | { 0x013B, 0x4f }, 69 | { 0x013C, 0x6f }, 70 | { 0x0141, 0x59 }, 71 | { 0x0142, 0x79 }, 72 | { 0x0143, 0x51 }, 73 | { 0x0144, 0x71 }, 74 | { 0x0145, 0x52 }, 75 | { 0x0146, 0x72 }, 76 | { 0x014C, 0x54 }, 77 | { 0x014D, 0x74 }, 78 | { 0x0156, 0x2a }, 79 | { 0x0157, 0x3a }, 80 | { 0x015A, 0x5a }, 81 | { 0x015B, 0x7a }, 82 | { 0x0160, 0x50 }, 83 | { 0x0161, 0x70 }, 84 | { 0x016A, 0x5b }, 85 | { 0x016B, 0x7b }, 86 | { 0x0172, 0x58 }, 87 | { 0x0173, 0x78 }, 88 | { 0x0179, 0x4a }, 89 | { 0x017A, 0x6a }, 90 | { 0x017B, 0x5d }, 91 | { 0x017C, 0x7d }, 92 | { 0x017D, 0x5e }, 93 | { 0x017E, 0x7e }, 94 | { 0x2019, 0x7f }, 95 | { 0x201C, 0x34 }, 96 | { 0x201D, 0x21 }, 97 | { 0x201E, 0x25 } 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso885913.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_13[ 96 ] = { 2 | 0x00A0, 3 | 0x201D, 4 | 0x00A2, 5 | 0x00A3, 6 | 0x00A4, 7 | 0x201E, 8 | 0x00A6, 9 | 0x00A7, 10 | 0x00D8, 11 | 0x00A9, 12 | 0x0156, 13 | 0x00AB, 14 | 0x00AC, 15 | 0x00AD, 16 | 0x00AE, 17 | 0x00C6, 18 | 0x00B0, 19 | 0x00B1, 20 | 0x00B2, 21 | 0x00B3, 22 | 0x201C, 23 | 0x00B5, 24 | 0x00B6, 25 | 0x00B7, 26 | 0x00F8, 27 | 0x00B9, 28 | 0x0157, 29 | 0x00BB, 30 | 0x00BC, 31 | 0x00BD, 32 | 0x00BE, 33 | 0x00E6, 34 | 0x0104, 35 | 0x012E, 36 | 0x0100, 37 | 0x0106, 38 | 0x00C4, 39 | 0x00C5, 40 | 0x0118, 41 | 0x0112, 42 | 0x010C, 43 | 0x00C9, 44 | 0x0179, 45 | 0x0116, 46 | 0x0122, 47 | 0x0136, 48 | 0x012A, 49 | 0x013B, 50 | 0x0160, 51 | 0x0143, 52 | 0x0145, 53 | 0x00D3, 54 | 0x014C, 55 | 0x00D5, 56 | 0x00D6, 57 | 0x00D7, 58 | 0x0172, 59 | 0x0141, 60 | 0x015A, 61 | 0x016A, 62 | 0x00DC, 63 | 0x017B, 64 | 0x017D, 65 | 0x00DF, 66 | 0x0105, 67 | 0x012F, 68 | 0x0101, 69 | 0x0107, 70 | 0x00E4, 71 | 0x00E5, 72 | 0x0119, 73 | 0x0113, 74 | 0x010D, 75 | 0x00E9, 76 | 0x017A, 77 | 0x0117, 78 | 0x0123, 79 | 0x0137, 80 | 0x012B, 81 | 0x013C, 82 | 0x0161, 83 | 0x0144, 84 | 0x0146, 85 | 0x00F3, 86 | 0x014D, 87 | 0x00F5, 88 | 0x00F6, 89 | 0x00F7, 90 | 0x0173, 91 | 0x0142, 92 | 0x015B, 93 | 0x016B, 94 | 0x00FC, 95 | 0x017C, 96 | 0x017E, 97 | 0x2019 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso885914.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_14[ 96 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A3, 0x23 }, 4 | { 0x00A7, 0x27 }, 5 | { 0x00A9, 0x29 }, 6 | { 0x00AD, 0x2d }, 7 | { 0x00AE, 0x2e }, 8 | { 0x00B6, 0x36 }, 9 | { 0x00C0, 0x40 }, 10 | { 0x00C1, 0x41 }, 11 | { 0x00C2, 0x42 }, 12 | { 0x00C3, 0x43 }, 13 | { 0x00C4, 0x44 }, 14 | { 0x00C5, 0x45 }, 15 | { 0x00C6, 0x46 }, 16 | { 0x00C7, 0x47 }, 17 | { 0x00C8, 0x48 }, 18 | { 0x00C9, 0x49 }, 19 | { 0x00CA, 0x4a }, 20 | { 0x00CB, 0x4b }, 21 | { 0x00CC, 0x4c }, 22 | { 0x00CD, 0x4d }, 23 | { 0x00CE, 0x4e }, 24 | { 0x00CF, 0x4f }, 25 | { 0x00D1, 0x51 }, 26 | { 0x00D2, 0x52 }, 27 | { 0x00D3, 0x53 }, 28 | { 0x00D4, 0x54 }, 29 | { 0x00D5, 0x55 }, 30 | { 0x00D6, 0x56 }, 31 | { 0x00D8, 0x58 }, 32 | { 0x00D9, 0x59 }, 33 | { 0x00DA, 0x5a }, 34 | { 0x00DB, 0x5b }, 35 | { 0x00DC, 0x5c }, 36 | { 0x00DD, 0x5d }, 37 | { 0x00DF, 0x5f }, 38 | { 0x00E0, 0x60 }, 39 | { 0x00E1, 0x61 }, 40 | { 0x00E2, 0x62 }, 41 | { 0x00E3, 0x63 }, 42 | { 0x00E4, 0x64 }, 43 | { 0x00E5, 0x65 }, 44 | { 0x00E6, 0x66 }, 45 | { 0x00E7, 0x67 }, 46 | { 0x00E8, 0x68 }, 47 | { 0x00E9, 0x69 }, 48 | { 0x00EA, 0x6a }, 49 | { 0x00EB, 0x6b }, 50 | { 0x00EC, 0x6c }, 51 | { 0x00ED, 0x6d }, 52 | { 0x00EE, 0x6e }, 53 | { 0x00EF, 0x6f }, 54 | { 0x00F1, 0x71 }, 55 | { 0x00F2, 0x72 }, 56 | { 0x00F3, 0x73 }, 57 | { 0x00F4, 0x74 }, 58 | { 0x00F5, 0x75 }, 59 | { 0x00F6, 0x76 }, 60 | { 0x00F8, 0x78 }, 61 | { 0x00F9, 0x79 }, 62 | { 0x00FA, 0x7a }, 63 | { 0x00FB, 0x7b }, 64 | { 0x00FC, 0x7c }, 65 | { 0x00FD, 0x7d }, 66 | { 0x00FF, 0x7f }, 67 | { 0x010A, 0x24 }, 68 | { 0x010B, 0x25 }, 69 | { 0x0120, 0x32 }, 70 | { 0x0121, 0x33 }, 71 | { 0x0174, 0x50 }, 72 | { 0x0175, 0x70 }, 73 | { 0x0176, 0x5e }, 74 | { 0x0177, 0x7e }, 75 | { 0x0178, 0x2f }, 76 | { 0x1E02, 0x21 }, 77 | { 0x1E03, 0x22 }, 78 | { 0x1E0A, 0x26 }, 79 | { 0x1E0B, 0x2b }, 80 | { 0x1E1E, 0x30 }, 81 | { 0x1E1F, 0x31 }, 82 | { 0x1E40, 0x34 }, 83 | { 0x1E41, 0x35 }, 84 | { 0x1E56, 0x37 }, 85 | { 0x1E57, 0x39 }, 86 | { 0x1E60, 0x3b }, 87 | { 0x1E61, 0x3f }, 88 | { 0x1E6A, 0x57 }, 89 | { 0x1E6B, 0x77 }, 90 | { 0x1E80, 0x28 }, 91 | { 0x1E81, 0x38 }, 92 | { 0x1E82, 0x2a }, 93 | { 0x1E83, 0x3a }, 94 | { 0x1E84, 0x3d }, 95 | { 0x1E85, 0x3e }, 96 | { 0x1EF2, 0x2c }, 97 | { 0x1EF3, 0x3c } 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso885914.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_14[ 96 ] = { 2 | 0x00A0, 3 | 0x1E02, 4 | 0x1E03, 5 | 0x00A3, 6 | 0x010A, 7 | 0x010B, 8 | 0x1E0A, 9 | 0x00A7, 10 | 0x1E80, 11 | 0x00A9, 12 | 0x1E82, 13 | 0x1E0B, 14 | 0x1EF2, 15 | 0x00AD, 16 | 0x00AE, 17 | 0x0178, 18 | 0x1E1E, 19 | 0x1E1F, 20 | 0x0120, 21 | 0x0121, 22 | 0x1E40, 23 | 0x1E41, 24 | 0x00B6, 25 | 0x1E56, 26 | 0x1E81, 27 | 0x1E57, 28 | 0x1E83, 29 | 0x1E60, 30 | 0x1EF3, 31 | 0x1E84, 32 | 0x1E85, 33 | 0x1E61, 34 | 0x00C0, 35 | 0x00C1, 36 | 0x00C2, 37 | 0x00C3, 38 | 0x00C4, 39 | 0x00C5, 40 | 0x00C6, 41 | 0x00C7, 42 | 0x00C8, 43 | 0x00C9, 44 | 0x00CA, 45 | 0x00CB, 46 | 0x00CC, 47 | 0x00CD, 48 | 0x00CE, 49 | 0x00CF, 50 | 0x0174, 51 | 0x00D1, 52 | 0x00D2, 53 | 0x00D3, 54 | 0x00D4, 55 | 0x00D5, 56 | 0x00D6, 57 | 0x1E6A, 58 | 0x00D8, 59 | 0x00D9, 60 | 0x00DA, 61 | 0x00DB, 62 | 0x00DC, 63 | 0x00DD, 64 | 0x0176, 65 | 0x00DF, 66 | 0x00E0, 67 | 0x00E1, 68 | 0x00E2, 69 | 0x00E3, 70 | 0x00E4, 71 | 0x00E5, 72 | 0x00E6, 73 | 0x00E7, 74 | 0x00E8, 75 | 0x00E9, 76 | 0x00EA, 77 | 0x00EB, 78 | 0x00EC, 79 | 0x00ED, 80 | 0x00EE, 81 | 0x00EF, 82 | 0x0175, 83 | 0x00F1, 84 | 0x00F2, 85 | 0x00F3, 86 | 0x00F4, 87 | 0x00F5, 88 | 0x00F6, 89 | 0x1E6B, 90 | 0x00F8, 91 | 0x00F9, 92 | 0x00FA, 93 | 0x00FB, 94 | 0x00FC, 95 | 0x00FD, 96 | 0x0177, 97 | 0x00FF 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso885915.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_15[ 96 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A1, 0x21 }, 4 | { 0x00A2, 0x22 }, 5 | { 0x00A3, 0x23 }, 6 | { 0x00A5, 0x25 }, 7 | { 0x00A7, 0x27 }, 8 | { 0x00A9, 0x29 }, 9 | { 0x00AA, 0x2a }, 10 | { 0x00AB, 0x2b }, 11 | { 0x00AC, 0x2c }, 12 | { 0x00AD, 0x2d }, 13 | { 0x00AE, 0x2e }, 14 | { 0x00AF, 0x2f }, 15 | { 0x00B0, 0x30 }, 16 | { 0x00B1, 0x31 }, 17 | { 0x00B2, 0x32 }, 18 | { 0x00B3, 0x33 }, 19 | { 0x00B5, 0x35 }, 20 | { 0x00B6, 0x36 }, 21 | { 0x00B7, 0x37 }, 22 | { 0x00B9, 0x39 }, 23 | { 0x00BA, 0x3a }, 24 | { 0x00BB, 0x3b }, 25 | { 0x00BF, 0x3f }, 26 | { 0x00C0, 0x40 }, 27 | { 0x00C1, 0x41 }, 28 | { 0x00C2, 0x42 }, 29 | { 0x00C3, 0x43 }, 30 | { 0x00C4, 0x44 }, 31 | { 0x00C5, 0x45 }, 32 | { 0x00C6, 0x46 }, 33 | { 0x00C7, 0x47 }, 34 | { 0x00C8, 0x48 }, 35 | { 0x00C9, 0x49 }, 36 | { 0x00CA, 0x4a }, 37 | { 0x00CB, 0x4b }, 38 | { 0x00CC, 0x4c }, 39 | { 0x00CD, 0x4d }, 40 | { 0x00CE, 0x4e }, 41 | { 0x00CF, 0x4f }, 42 | { 0x00D0, 0x50 }, 43 | { 0x00D1, 0x51 }, 44 | { 0x00D2, 0x52 }, 45 | { 0x00D3, 0x53 }, 46 | { 0x00D4, 0x54 }, 47 | { 0x00D5, 0x55 }, 48 | { 0x00D6, 0x56 }, 49 | { 0x00D7, 0x57 }, 50 | { 0x00D8, 0x58 }, 51 | { 0x00D9, 0x59 }, 52 | { 0x00DA, 0x5a }, 53 | { 0x00DB, 0x5b }, 54 | { 0x00DC, 0x5c }, 55 | { 0x00DD, 0x5d }, 56 | { 0x00DE, 0x5e }, 57 | { 0x00DF, 0x5f }, 58 | { 0x00E0, 0x60 }, 59 | { 0x00E1, 0x61 }, 60 | { 0x00E2, 0x62 }, 61 | { 0x00E3, 0x63 }, 62 | { 0x00E4, 0x64 }, 63 | { 0x00E5, 0x65 }, 64 | { 0x00E6, 0x66 }, 65 | { 0x00E7, 0x67 }, 66 | { 0x00E8, 0x68 }, 67 | { 0x00E9, 0x69 }, 68 | { 0x00EA, 0x6a }, 69 | { 0x00EB, 0x6b }, 70 | { 0x00EC, 0x6c }, 71 | { 0x00ED, 0x6d }, 72 | { 0x00EE, 0x6e }, 73 | { 0x00EF, 0x6f }, 74 | { 0x00F0, 0x70 }, 75 | { 0x00F1, 0x71 }, 76 | { 0x00F2, 0x72 }, 77 | { 0x00F3, 0x73 }, 78 | { 0x00F4, 0x74 }, 79 | { 0x00F5, 0x75 }, 80 | { 0x00F6, 0x76 }, 81 | { 0x00F7, 0x77 }, 82 | { 0x00F8, 0x78 }, 83 | { 0x00F9, 0x79 }, 84 | { 0x00FA, 0x7a }, 85 | { 0x00FB, 0x7b }, 86 | { 0x00FC, 0x7c }, 87 | { 0x00FD, 0x7d }, 88 | { 0x00FE, 0x7e }, 89 | { 0x00FF, 0x7f }, 90 | { 0x0152, 0x3c }, 91 | { 0x0153, 0x3d }, 92 | { 0x0160, 0x26 }, 93 | { 0x0161, 0x28 }, 94 | { 0x0178, 0x3e }, 95 | { 0x017D, 0x34 }, 96 | { 0x017E, 0x38 }, 97 | { 0x20AC, 0x24 } 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso885915.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_15[ 96 ] = { 2 | 0x00A0, 3 | 0x00A1, 4 | 0x00A2, 5 | 0x00A3, 6 | 0x20AC, 7 | 0x00A5, 8 | 0x0160, 9 | 0x00A7, 10 | 0x0161, 11 | 0x00A9, 12 | 0x00AA, 13 | 0x00AB, 14 | 0x00AC, 15 | 0x00AD, 16 | 0x00AE, 17 | 0x00AF, 18 | 0x00B0, 19 | 0x00B1, 20 | 0x00B2, 21 | 0x00B3, 22 | 0x017D, 23 | 0x00B5, 24 | 0x00B6, 25 | 0x00B7, 26 | 0x017E, 27 | 0x00B9, 28 | 0x00BA, 29 | 0x00BB, 30 | 0x0152, 31 | 0x0153, 32 | 0x0178, 33 | 0x00BF, 34 | 0x00C0, 35 | 0x00C1, 36 | 0x00C2, 37 | 0x00C3, 38 | 0x00C4, 39 | 0x00C5, 40 | 0x00C6, 41 | 0x00C7, 42 | 0x00C8, 43 | 0x00C9, 44 | 0x00CA, 45 | 0x00CB, 46 | 0x00CC, 47 | 0x00CD, 48 | 0x00CE, 49 | 0x00CF, 50 | 0x00D0, 51 | 0x00D1, 52 | 0x00D2, 53 | 0x00D3, 54 | 0x00D4, 55 | 0x00D5, 56 | 0x00D6, 57 | 0x00D7, 58 | 0x00D8, 59 | 0x00D9, 60 | 0x00DA, 61 | 0x00DB, 62 | 0x00DC, 63 | 0x00DD, 64 | 0x00DE, 65 | 0x00DF, 66 | 0x00E0, 67 | 0x00E1, 68 | 0x00E2, 69 | 0x00E3, 70 | 0x00E4, 71 | 0x00E5, 72 | 0x00E6, 73 | 0x00E7, 74 | 0x00E8, 75 | 0x00E9, 76 | 0x00EA, 77 | 0x00EB, 78 | 0x00EC, 79 | 0x00ED, 80 | 0x00EE, 81 | 0x00EF, 82 | 0x00F0, 83 | 0x00F1, 84 | 0x00F2, 85 | 0x00F3, 86 | 0x00F4, 87 | 0x00F5, 88 | 0x00F6, 89 | 0x00F7, 90 | 0x00F8, 91 | 0x00F9, 92 | 0x00FA, 93 | 0x00FB, 94 | 0x00FC, 95 | 0x00FD, 96 | 0x00FE, 97 | 0x00FF 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso885916.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_16[ 96 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A7, 0x27 }, 4 | { 0x00A9, 0x29 }, 5 | { 0x00AB, 0x2b }, 6 | { 0x00AD, 0x2d }, 7 | { 0x00B0, 0x30 }, 8 | { 0x00B1, 0x31 }, 9 | { 0x00B6, 0x36 }, 10 | { 0x00B7, 0x37 }, 11 | { 0x00BB, 0x3b }, 12 | { 0x00C0, 0x40 }, 13 | { 0x00C1, 0x41 }, 14 | { 0x00C2, 0x42 }, 15 | { 0x00C4, 0x44 }, 16 | { 0x00C6, 0x46 }, 17 | { 0x00C7, 0x47 }, 18 | { 0x00C8, 0x48 }, 19 | { 0x00C9, 0x49 }, 20 | { 0x00CA, 0x4a }, 21 | { 0x00CB, 0x4b }, 22 | { 0x00CC, 0x4c }, 23 | { 0x00CD, 0x4d }, 24 | { 0x00CE, 0x4e }, 25 | { 0x00CF, 0x4f }, 26 | { 0x00D2, 0x52 }, 27 | { 0x00D3, 0x53 }, 28 | { 0x00D4, 0x54 }, 29 | { 0x00D6, 0x56 }, 30 | { 0x00D9, 0x59 }, 31 | { 0x00DA, 0x5a }, 32 | { 0x00DB, 0x5b }, 33 | { 0x00DC, 0x5c }, 34 | { 0x00DF, 0x5f }, 35 | { 0x00E0, 0x60 }, 36 | { 0x00E1, 0x61 }, 37 | { 0x00E2, 0x62 }, 38 | { 0x00E4, 0x64 }, 39 | { 0x00E6, 0x66 }, 40 | { 0x00E7, 0x67 }, 41 | { 0x00E8, 0x68 }, 42 | { 0x00E9, 0x69 }, 43 | { 0x00EA, 0x6a }, 44 | { 0x00EB, 0x6b }, 45 | { 0x00EC, 0x6c }, 46 | { 0x00ED, 0x6d }, 47 | { 0x00EE, 0x6e }, 48 | { 0x00EF, 0x6f }, 49 | { 0x00F2, 0x72 }, 50 | { 0x00F3, 0x73 }, 51 | { 0x00F4, 0x74 }, 52 | { 0x00F6, 0x76 }, 53 | { 0x00F9, 0x79 }, 54 | { 0x00FA, 0x7a }, 55 | { 0x00FB, 0x7b }, 56 | { 0x00FC, 0x7c }, 57 | { 0x00FF, 0x7f }, 58 | { 0x0102, 0x43 }, 59 | { 0x0103, 0x63 }, 60 | { 0x0104, 0x21 }, 61 | { 0x0105, 0x22 }, 62 | { 0x0106, 0x45 }, 63 | { 0x0107, 0x65 }, 64 | { 0x010C, 0x32 }, 65 | { 0x010D, 0x39 }, 66 | { 0x0110, 0x50 }, 67 | { 0x0111, 0x70 }, 68 | { 0x0118, 0x5d }, 69 | { 0x0119, 0x7d }, 70 | { 0x0141, 0x23 }, 71 | { 0x0142, 0x33 }, 72 | { 0x0143, 0x51 }, 73 | { 0x0144, 0x71 }, 74 | { 0x0150, 0x55 }, 75 | { 0x0151, 0x75 }, 76 | { 0x0152, 0x3c }, 77 | { 0x0153, 0x3d }, 78 | { 0x015A, 0x57 }, 79 | { 0x015B, 0x77 }, 80 | { 0x0160, 0x26 }, 81 | { 0x0161, 0x28 }, 82 | { 0x0170, 0x58 }, 83 | { 0x0171, 0x78 }, 84 | { 0x0178, 0x3e }, 85 | { 0x0179, 0x2c }, 86 | { 0x017A, 0x2e }, 87 | { 0x017B, 0x2f }, 88 | { 0x017C, 0x3f }, 89 | { 0x017D, 0x34 }, 90 | { 0x017E, 0x38 }, 91 | { 0x0218, 0x2a }, 92 | { 0x0219, 0x3a }, 93 | { 0x021A, 0x5e }, 94 | { 0x021B, 0x7e }, 95 | { 0x201D, 0x35 }, 96 | { 0x201E, 0x25 }, 97 | { 0x20AC, 0x24 } 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso885916.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_16[ 96 ] = { 2 | 0x00A0, 3 | 0x0104, 4 | 0x0105, 5 | 0x0141, 6 | 0x20AC, 7 | 0x201E, 8 | 0x0160, 9 | 0x00A7, 10 | 0x0161, 11 | 0x00A9, 12 | 0x0218, 13 | 0x00AB, 14 | 0x0179, 15 | 0x00AD, 16 | 0x017A, 17 | 0x017B, 18 | 0x00B0, 19 | 0x00B1, 20 | 0x010C, 21 | 0x0142, 22 | 0x017D, 23 | 0x201D, 24 | 0x00B6, 25 | 0x00B7, 26 | 0x017E, 27 | 0x010D, 28 | 0x0219, 29 | 0x00BB, 30 | 0x0152, 31 | 0x0153, 32 | 0x0178, 33 | 0x017C, 34 | 0x00C0, 35 | 0x00C1, 36 | 0x00C2, 37 | 0x0102, 38 | 0x00C4, 39 | 0x0106, 40 | 0x00C6, 41 | 0x00C7, 42 | 0x00C8, 43 | 0x00C9, 44 | 0x00CA, 45 | 0x00CB, 46 | 0x00CC, 47 | 0x00CD, 48 | 0x00CE, 49 | 0x00CF, 50 | 0x0110, 51 | 0x0143, 52 | 0x00D2, 53 | 0x00D3, 54 | 0x00D4, 55 | 0x0150, 56 | 0x00D6, 57 | 0x015A, 58 | 0x0170, 59 | 0x00D9, 60 | 0x00DA, 61 | 0x00DB, 62 | 0x00DC, 63 | 0x0118, 64 | 0x021A, 65 | 0x00DF, 66 | 0x00E0, 67 | 0x00E1, 68 | 0x00E2, 69 | 0x0103, 70 | 0x00E4, 71 | 0x0107, 72 | 0x00E6, 73 | 0x00E7, 74 | 0x00E8, 75 | 0x00E9, 76 | 0x00EA, 77 | 0x00EB, 78 | 0x00EC, 79 | 0x00ED, 80 | 0x00EE, 81 | 0x00EF, 82 | 0x0111, 83 | 0x0144, 84 | 0x00F2, 85 | 0x00F3, 86 | 0x00F4, 87 | 0x0151, 88 | 0x00F6, 89 | 0x015B, 90 | 0x0171, 91 | 0x00F9, 92 | 0x00FA, 93 | 0x00FB, 94 | 0x00FC, 95 | 0x0119, 96 | 0x021B, 97 | 0x00FF 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88592.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_2[ 96 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A4, 0x24 }, 4 | { 0x00A7, 0x27 }, 5 | { 0x00A8, 0x28 }, 6 | { 0x00AD, 0x2d }, 7 | { 0x00B0, 0x30 }, 8 | { 0x00B4, 0x34 }, 9 | { 0x00B8, 0x38 }, 10 | { 0x00C1, 0x41 }, 11 | { 0x00C2, 0x42 }, 12 | { 0x00C4, 0x44 }, 13 | { 0x00C7, 0x47 }, 14 | { 0x00C9, 0x49 }, 15 | { 0x00CB, 0x4b }, 16 | { 0x00CD, 0x4d }, 17 | { 0x00CE, 0x4e }, 18 | { 0x00D3, 0x53 }, 19 | { 0x00D4, 0x54 }, 20 | { 0x00D6, 0x56 }, 21 | { 0x00D7, 0x57 }, 22 | { 0x00DA, 0x5a }, 23 | { 0x00DC, 0x5c }, 24 | { 0x00DD, 0x5d }, 25 | { 0x00DF, 0x5f }, 26 | { 0x00E1, 0x61 }, 27 | { 0x00E2, 0x62 }, 28 | { 0x00E4, 0x64 }, 29 | { 0x00E7, 0x67 }, 30 | { 0x00E9, 0x69 }, 31 | { 0x00EB, 0x6b }, 32 | { 0x00ED, 0x6d }, 33 | { 0x00EE, 0x6e }, 34 | { 0x00F3, 0x73 }, 35 | { 0x00F4, 0x74 }, 36 | { 0x00F6, 0x76 }, 37 | { 0x00F7, 0x77 }, 38 | { 0x00FA, 0x7a }, 39 | { 0x00FC, 0x7c }, 40 | { 0x00FD, 0x7d }, 41 | { 0x0102, 0x43 }, 42 | { 0x0103, 0x63 }, 43 | { 0x0104, 0x21 }, 44 | { 0x0105, 0x31 }, 45 | { 0x0106, 0x46 }, 46 | { 0x0107, 0x66 }, 47 | { 0x010C, 0x48 }, 48 | { 0x010D, 0x68 }, 49 | { 0x010E, 0x4f }, 50 | { 0x010F, 0x6f }, 51 | { 0x0110, 0x50 }, 52 | { 0x0111, 0x70 }, 53 | { 0x0118, 0x4a }, 54 | { 0x0119, 0x6a }, 55 | { 0x011A, 0x4c }, 56 | { 0x011B, 0x6c }, 57 | { 0x0139, 0x45 }, 58 | { 0x013A, 0x65 }, 59 | { 0x013D, 0x25 }, 60 | { 0x013E, 0x35 }, 61 | { 0x0141, 0x23 }, 62 | { 0x0142, 0x33 }, 63 | { 0x0143, 0x51 }, 64 | { 0x0144, 0x71 }, 65 | { 0x0147, 0x52 }, 66 | { 0x0148, 0x72 }, 67 | { 0x0150, 0x55 }, 68 | { 0x0151, 0x75 }, 69 | { 0x0154, 0x40 }, 70 | { 0x0155, 0x60 }, 71 | { 0x0158, 0x58 }, 72 | { 0x0159, 0x78 }, 73 | { 0x015A, 0x26 }, 74 | { 0x015B, 0x36 }, 75 | { 0x015E, 0x2a }, 76 | { 0x015F, 0x3a }, 77 | { 0x0160, 0x29 }, 78 | { 0x0161, 0x39 }, 79 | { 0x0162, 0x5e }, 80 | { 0x0163, 0x7e }, 81 | { 0x0164, 0x2b }, 82 | { 0x0165, 0x3b }, 83 | { 0x016E, 0x59 }, 84 | { 0x016F, 0x79 }, 85 | { 0x0170, 0x5b }, 86 | { 0x0171, 0x7b }, 87 | { 0x0179, 0x2c }, 88 | { 0x017A, 0x3c }, 89 | { 0x017B, 0x2f }, 90 | { 0x017C, 0x3f }, 91 | { 0x017D, 0x2e }, 92 | { 0x017E, 0x3e }, 93 | { 0x02C7, 0x37 }, 94 | { 0x02D8, 0x22 }, 95 | { 0x02D9, 0x7f }, 96 | { 0x02DB, 0x32 }, 97 | { 0x02DD, 0x3d } 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88592.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_2[ 96 ] = { 2 | 0x00A0, 3 | 0x0104, 4 | 0x02D8, 5 | 0x0141, 6 | 0x00A4, 7 | 0x013D, 8 | 0x015A, 9 | 0x00A7, 10 | 0x00A8, 11 | 0x0160, 12 | 0x015E, 13 | 0x0164, 14 | 0x0179, 15 | 0x00AD, 16 | 0x017D, 17 | 0x017B, 18 | 0x00B0, 19 | 0x0105, 20 | 0x02DB, 21 | 0x0142, 22 | 0x00B4, 23 | 0x013E, 24 | 0x015B, 25 | 0x02C7, 26 | 0x00B8, 27 | 0x0161, 28 | 0x015F, 29 | 0x0165, 30 | 0x017A, 31 | 0x02DD, 32 | 0x017E, 33 | 0x017C, 34 | 0x0154, 35 | 0x00C1, 36 | 0x00C2, 37 | 0x0102, 38 | 0x00C4, 39 | 0x0139, 40 | 0x0106, 41 | 0x00C7, 42 | 0x010C, 43 | 0x00C9, 44 | 0x0118, 45 | 0x00CB, 46 | 0x011A, 47 | 0x00CD, 48 | 0x00CE, 49 | 0x010E, 50 | 0x0110, 51 | 0x0143, 52 | 0x0147, 53 | 0x00D3, 54 | 0x00D4, 55 | 0x0150, 56 | 0x00D6, 57 | 0x00D7, 58 | 0x0158, 59 | 0x016E, 60 | 0x00DA, 61 | 0x0170, 62 | 0x00DC, 63 | 0x00DD, 64 | 0x0162, 65 | 0x00DF, 66 | 0x0155, 67 | 0x00E1, 68 | 0x00E2, 69 | 0x0103, 70 | 0x00E4, 71 | 0x013A, 72 | 0x0107, 73 | 0x00E7, 74 | 0x010D, 75 | 0x00E9, 76 | 0x0119, 77 | 0x00EB, 78 | 0x011B, 79 | 0x00ED, 80 | 0x00EE, 81 | 0x010F, 82 | 0x0111, 83 | 0x0144, 84 | 0x0148, 85 | 0x00F3, 86 | 0x00F4, 87 | 0x0151, 88 | 0x00F6, 89 | 0x00F7, 90 | 0x0159, 91 | 0x016F, 92 | 0x00FA, 93 | 0x0171, 94 | 0x00FC, 95 | 0x00FD, 96 | 0x0163, 97 | 0x02D9 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88593.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_3[ 89 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A3, 0x23 }, 4 | { 0x00A4, 0x24 }, 5 | { 0x00A7, 0x27 }, 6 | { 0x00A8, 0x28 }, 7 | { 0x00AD, 0x2d }, 8 | { 0x00B0, 0x30 }, 9 | { 0x00B2, 0x32 }, 10 | { 0x00B3, 0x33 }, 11 | { 0x00B4, 0x34 }, 12 | { 0x00B5, 0x35 }, 13 | { 0x00B7, 0x37 }, 14 | { 0x00B8, 0x38 }, 15 | { 0x00BD, 0x3d }, 16 | { 0x00C0, 0x40 }, 17 | { 0x00C1, 0x41 }, 18 | { 0x00C2, 0x42 }, 19 | { 0x00C4, 0x44 }, 20 | { 0x00C7, 0x47 }, 21 | { 0x00C8, 0x48 }, 22 | { 0x00C9, 0x49 }, 23 | { 0x00CA, 0x4a }, 24 | { 0x00CB, 0x4b }, 25 | { 0x00CC, 0x4c }, 26 | { 0x00CD, 0x4d }, 27 | { 0x00CE, 0x4e }, 28 | { 0x00CF, 0x4f }, 29 | { 0x00D1, 0x51 }, 30 | { 0x00D2, 0x52 }, 31 | { 0x00D3, 0x53 }, 32 | { 0x00D4, 0x54 }, 33 | { 0x00D6, 0x56 }, 34 | { 0x00D7, 0x57 }, 35 | { 0x00D9, 0x59 }, 36 | { 0x00DA, 0x5a }, 37 | { 0x00DB, 0x5b }, 38 | { 0x00DC, 0x5c }, 39 | { 0x00DF, 0x5f }, 40 | { 0x00E0, 0x60 }, 41 | { 0x00E1, 0x61 }, 42 | { 0x00E2, 0x62 }, 43 | { 0x00E4, 0x64 }, 44 | { 0x00E7, 0x67 }, 45 | { 0x00E8, 0x68 }, 46 | { 0x00E9, 0x69 }, 47 | { 0x00EA, 0x6a }, 48 | { 0x00EB, 0x6b }, 49 | { 0x00EC, 0x6c }, 50 | { 0x00ED, 0x6d }, 51 | { 0x00EE, 0x6e }, 52 | { 0x00EF, 0x6f }, 53 | { 0x00F1, 0x71 }, 54 | { 0x00F2, 0x72 }, 55 | { 0x00F3, 0x73 }, 56 | { 0x00F4, 0x74 }, 57 | { 0x00F6, 0x76 }, 58 | { 0x00F7, 0x77 }, 59 | { 0x00F9, 0x79 }, 60 | { 0x00FA, 0x7a }, 61 | { 0x00FB, 0x7b }, 62 | { 0x00FC, 0x7c }, 63 | { 0x0108, 0x46 }, 64 | { 0x0109, 0x66 }, 65 | { 0x010A, 0x45 }, 66 | { 0x010B, 0x65 }, 67 | { 0x011C, 0x58 }, 68 | { 0x011D, 0x78 }, 69 | { 0x011E, 0x2b }, 70 | { 0x011F, 0x3b }, 71 | { 0x0120, 0x55 }, 72 | { 0x0121, 0x75 }, 73 | { 0x0124, 0x26 }, 74 | { 0x0125, 0x36 }, 75 | { 0x0126, 0x21 }, 76 | { 0x0127, 0x31 }, 77 | { 0x0130, 0x29 }, 78 | { 0x0131, 0x39 }, 79 | { 0x0134, 0x2c }, 80 | { 0x0135, 0x3c }, 81 | { 0x015C, 0x5e }, 82 | { 0x015D, 0x7e }, 83 | { 0x015E, 0x2a }, 84 | { 0x015F, 0x3a }, 85 | { 0x016C, 0x5d }, 86 | { 0x016D, 0x7d }, 87 | { 0x017B, 0x2f }, 88 | { 0x017C, 0x3f }, 89 | { 0x02D8, 0x22 }, 90 | { 0x02D9, 0x7f } 91 | }; 92 | -------------------------------------------------------------------------------- /src/iso88593.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_3[ 96 ] = { 2 | 0x00A0, 3 | 0x0126, 4 | 0x02D8, 5 | 0x00A3, 6 | 0x00A4, 7 | 0x0000, 8 | 0x0124, 9 | 0x00A7, 10 | 0x00A8, 11 | 0x0130, 12 | 0x015E, 13 | 0x011E, 14 | 0x0134, 15 | 0x00AD, 16 | 0x0000, 17 | 0x017B, 18 | 0x00B0, 19 | 0x0127, 20 | 0x00B2, 21 | 0x00B3, 22 | 0x00B4, 23 | 0x00B5, 24 | 0x0125, 25 | 0x00B7, 26 | 0x00B8, 27 | 0x0131, 28 | 0x015F, 29 | 0x011F, 30 | 0x0135, 31 | 0x00BD, 32 | 0x0000, 33 | 0x017C, 34 | 0x00C0, 35 | 0x00C1, 36 | 0x00C2, 37 | 0x0000, 38 | 0x00C4, 39 | 0x010A, 40 | 0x0108, 41 | 0x00C7, 42 | 0x00C8, 43 | 0x00C9, 44 | 0x00CA, 45 | 0x00CB, 46 | 0x00CC, 47 | 0x00CD, 48 | 0x00CE, 49 | 0x00CF, 50 | 0x0000, 51 | 0x00D1, 52 | 0x00D2, 53 | 0x00D3, 54 | 0x00D4, 55 | 0x0120, 56 | 0x00D6, 57 | 0x00D7, 58 | 0x011C, 59 | 0x00D9, 60 | 0x00DA, 61 | 0x00DB, 62 | 0x00DC, 63 | 0x016C, 64 | 0x015C, 65 | 0x00DF, 66 | 0x00E0, 67 | 0x00E1, 68 | 0x00E2, 69 | 0x0000, 70 | 0x00E4, 71 | 0x010B, 72 | 0x0109, 73 | 0x00E7, 74 | 0x00E8, 75 | 0x00E9, 76 | 0x00EA, 77 | 0x00EB, 78 | 0x00EC, 79 | 0x00ED, 80 | 0x00EE, 81 | 0x00EF, 82 | 0x0000, 83 | 0x00F1, 84 | 0x00F2, 85 | 0x00F3, 86 | 0x00F4, 87 | 0x0121, 88 | 0x00F6, 89 | 0x00F7, 90 | 0x011D, 91 | 0x00F9, 92 | 0x00FA, 93 | 0x00FB, 94 | 0x00FC, 95 | 0x016D, 96 | 0x015D, 97 | 0x02D9 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88594.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_4[ 96 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A4, 0x24 }, 4 | { 0x00A7, 0x27 }, 5 | { 0x00A8, 0x28 }, 6 | { 0x00AD, 0x2d }, 7 | { 0x00AF, 0x2f }, 8 | { 0x00B0, 0x30 }, 9 | { 0x00B4, 0x34 }, 10 | { 0x00B8, 0x38 }, 11 | { 0x00C1, 0x41 }, 12 | { 0x00C2, 0x42 }, 13 | { 0x00C3, 0x43 }, 14 | { 0x00C4, 0x44 }, 15 | { 0x00C5, 0x45 }, 16 | { 0x00C6, 0x46 }, 17 | { 0x00C9, 0x49 }, 18 | { 0x00CB, 0x4b }, 19 | { 0x00CD, 0x4d }, 20 | { 0x00CE, 0x4e }, 21 | { 0x00D4, 0x54 }, 22 | { 0x00D5, 0x55 }, 23 | { 0x00D6, 0x56 }, 24 | { 0x00D7, 0x57 }, 25 | { 0x00D8, 0x58 }, 26 | { 0x00DA, 0x5a }, 27 | { 0x00DB, 0x5b }, 28 | { 0x00DC, 0x5c }, 29 | { 0x00DF, 0x5f }, 30 | { 0x00E1, 0x61 }, 31 | { 0x00E2, 0x62 }, 32 | { 0x00E3, 0x63 }, 33 | { 0x00E4, 0x64 }, 34 | { 0x00E5, 0x65 }, 35 | { 0x00E6, 0x66 }, 36 | { 0x00E9, 0x69 }, 37 | { 0x00EB, 0x6b }, 38 | { 0x00ED, 0x6d }, 39 | { 0x00EE, 0x6e }, 40 | { 0x00F4, 0x74 }, 41 | { 0x00F5, 0x75 }, 42 | { 0x00F6, 0x76 }, 43 | { 0x00F7, 0x77 }, 44 | { 0x00F8, 0x78 }, 45 | { 0x00FA, 0x7a }, 46 | { 0x00FB, 0x7b }, 47 | { 0x00FC, 0x7c }, 48 | { 0x0100, 0x40 }, 49 | { 0x0101, 0x60 }, 50 | { 0x0104, 0x21 }, 51 | { 0x0105, 0x31 }, 52 | { 0x010C, 0x48 }, 53 | { 0x010D, 0x68 }, 54 | { 0x0110, 0x50 }, 55 | { 0x0111, 0x70 }, 56 | { 0x0112, 0x2a }, 57 | { 0x0113, 0x3a }, 58 | { 0x0116, 0x4c }, 59 | { 0x0117, 0x6c }, 60 | { 0x0118, 0x4a }, 61 | { 0x0119, 0x6a }, 62 | { 0x0122, 0x2b }, 63 | { 0x0123, 0x3b }, 64 | { 0x0128, 0x25 }, 65 | { 0x0129, 0x35 }, 66 | { 0x012A, 0x4f }, 67 | { 0x012B, 0x6f }, 68 | { 0x012E, 0x47 }, 69 | { 0x012F, 0x67 }, 70 | { 0x0136, 0x53 }, 71 | { 0x0137, 0x73 }, 72 | { 0x0138, 0x22 }, 73 | { 0x013B, 0x26 }, 74 | { 0x013C, 0x36 }, 75 | { 0x0145, 0x51 }, 76 | { 0x0146, 0x71 }, 77 | { 0x014A, 0x3d }, 78 | { 0x014B, 0x3f }, 79 | { 0x014C, 0x52 }, 80 | { 0x014D, 0x72 }, 81 | { 0x0156, 0x23 }, 82 | { 0x0157, 0x33 }, 83 | { 0x0160, 0x29 }, 84 | { 0x0161, 0x39 }, 85 | { 0x0166, 0x2c }, 86 | { 0x0167, 0x3c }, 87 | { 0x0168, 0x5d }, 88 | { 0x0169, 0x7d }, 89 | { 0x016A, 0x5e }, 90 | { 0x016B, 0x7e }, 91 | { 0x0172, 0x59 }, 92 | { 0x0173, 0x79 }, 93 | { 0x017D, 0x2e }, 94 | { 0x017E, 0x3e }, 95 | { 0x02C7, 0x37 }, 96 | { 0x02D9, 0x7f }, 97 | { 0x02DB, 0x32 } 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88594.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_4[ 96 ] = { 2 | 0x00A0, 3 | 0x0104, 4 | 0x0138, 5 | 0x0156, 6 | 0x00A4, 7 | 0x0128, 8 | 0x013B, 9 | 0x00A7, 10 | 0x00A8, 11 | 0x0160, 12 | 0x0112, 13 | 0x0122, 14 | 0x0166, 15 | 0x00AD, 16 | 0x017D, 17 | 0x00AF, 18 | 0x00B0, 19 | 0x0105, 20 | 0x02DB, 21 | 0x0157, 22 | 0x00B4, 23 | 0x0129, 24 | 0x013C, 25 | 0x02C7, 26 | 0x00B8, 27 | 0x0161, 28 | 0x0113, 29 | 0x0123, 30 | 0x0167, 31 | 0x014A, 32 | 0x017E, 33 | 0x014B, 34 | 0x0100, 35 | 0x00C1, 36 | 0x00C2, 37 | 0x00C3, 38 | 0x00C4, 39 | 0x00C5, 40 | 0x00C6, 41 | 0x012E, 42 | 0x010C, 43 | 0x00C9, 44 | 0x0118, 45 | 0x00CB, 46 | 0x0116, 47 | 0x00CD, 48 | 0x00CE, 49 | 0x012A, 50 | 0x0110, 51 | 0x0145, 52 | 0x014C, 53 | 0x0136, 54 | 0x00D4, 55 | 0x00D5, 56 | 0x00D6, 57 | 0x00D7, 58 | 0x00D8, 59 | 0x0172, 60 | 0x00DA, 61 | 0x00DB, 62 | 0x00DC, 63 | 0x0168, 64 | 0x016A, 65 | 0x00DF, 66 | 0x0101, 67 | 0x00E1, 68 | 0x00E2, 69 | 0x00E3, 70 | 0x00E4, 71 | 0x00E5, 72 | 0x00E6, 73 | 0x012F, 74 | 0x010D, 75 | 0x00E9, 76 | 0x0119, 77 | 0x00EB, 78 | 0x0117, 79 | 0x00ED, 80 | 0x00EE, 81 | 0x012B, 82 | 0x0111, 83 | 0x0146, 84 | 0x014D, 85 | 0x0137, 86 | 0x00F4, 87 | 0x00F5, 88 | 0x00F6, 89 | 0x00F7, 90 | 0x00F8, 91 | 0x0173, 92 | 0x00FA, 93 | 0x00FB, 94 | 0x00FC, 95 | 0x0169, 96 | 0x016B, 97 | 0x02D9 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88595.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_5[ 96 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A7, 0x7d }, 4 | { 0x00AD, 0x2d }, 5 | { 0x0401, 0x21 }, 6 | { 0x0402, 0x22 }, 7 | { 0x0403, 0x23 }, 8 | { 0x0404, 0x24 }, 9 | { 0x0405, 0x25 }, 10 | { 0x0406, 0x26 }, 11 | { 0x0407, 0x27 }, 12 | { 0x0408, 0x28 }, 13 | { 0x0409, 0x29 }, 14 | { 0x040A, 0x2a }, 15 | { 0x040B, 0x2b }, 16 | { 0x040C, 0x2c }, 17 | { 0x040E, 0x2e }, 18 | { 0x040F, 0x2f }, 19 | { 0x0410, 0x30 }, 20 | { 0x0411, 0x31 }, 21 | { 0x0412, 0x32 }, 22 | { 0x0413, 0x33 }, 23 | { 0x0414, 0x34 }, 24 | { 0x0415, 0x35 }, 25 | { 0x0416, 0x36 }, 26 | { 0x0417, 0x37 }, 27 | { 0x0418, 0x38 }, 28 | { 0x0419, 0x39 }, 29 | { 0x041A, 0x3a }, 30 | { 0x041B, 0x3b }, 31 | { 0x041C, 0x3c }, 32 | { 0x041D, 0x3d }, 33 | { 0x041E, 0x3e }, 34 | { 0x041F, 0x3f }, 35 | { 0x0420, 0x40 }, 36 | { 0x0421, 0x41 }, 37 | { 0x0422, 0x42 }, 38 | { 0x0423, 0x43 }, 39 | { 0x0424, 0x44 }, 40 | { 0x0425, 0x45 }, 41 | { 0x0426, 0x46 }, 42 | { 0x0427, 0x47 }, 43 | { 0x0428, 0x48 }, 44 | { 0x0429, 0x49 }, 45 | { 0x042A, 0x4a }, 46 | { 0x042B, 0x4b }, 47 | { 0x042C, 0x4c }, 48 | { 0x042D, 0x4d }, 49 | { 0x042E, 0x4e }, 50 | { 0x042F, 0x4f }, 51 | { 0x0430, 0x50 }, 52 | { 0x0431, 0x51 }, 53 | { 0x0432, 0x52 }, 54 | { 0x0433, 0x53 }, 55 | { 0x0434, 0x54 }, 56 | { 0x0435, 0x55 }, 57 | { 0x0436, 0x56 }, 58 | { 0x0437, 0x57 }, 59 | { 0x0438, 0x58 }, 60 | { 0x0439, 0x59 }, 61 | { 0x043A, 0x5a }, 62 | { 0x043B, 0x5b }, 63 | { 0x043C, 0x5c }, 64 | { 0x043D, 0x5d }, 65 | { 0x043E, 0x5e }, 66 | { 0x043F, 0x5f }, 67 | { 0x0440, 0x60 }, 68 | { 0x0441, 0x61 }, 69 | { 0x0442, 0x62 }, 70 | { 0x0443, 0x63 }, 71 | { 0x0444, 0x64 }, 72 | { 0x0445, 0x65 }, 73 | { 0x0446, 0x66 }, 74 | { 0x0447, 0x67 }, 75 | { 0x0448, 0x68 }, 76 | { 0x0449, 0x69 }, 77 | { 0x044A, 0x6a }, 78 | { 0x044B, 0x6b }, 79 | { 0x044C, 0x6c }, 80 | { 0x044D, 0x6d }, 81 | { 0x044E, 0x6e }, 82 | { 0x044F, 0x6f }, 83 | { 0x0451, 0x71 }, 84 | { 0x0452, 0x72 }, 85 | { 0x0453, 0x73 }, 86 | { 0x0454, 0x74 }, 87 | { 0x0455, 0x75 }, 88 | { 0x0456, 0x76 }, 89 | { 0x0457, 0x77 }, 90 | { 0x0458, 0x78 }, 91 | { 0x0459, 0x79 }, 92 | { 0x045A, 0x7a }, 93 | { 0x045B, 0x7b }, 94 | { 0x045C, 0x7c }, 95 | { 0x045E, 0x7e }, 96 | { 0x045F, 0x7f }, 97 | { 0x2116, 0x70 } 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88595.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_5[ 96 ] = { 2 | 0x00A0, 3 | 0x0401, 4 | 0x0402, 5 | 0x0403, 6 | 0x0404, 7 | 0x0405, 8 | 0x0406, 9 | 0x0407, 10 | 0x0408, 11 | 0x0409, 12 | 0x040A, 13 | 0x040B, 14 | 0x040C, 15 | 0x00AD, 16 | 0x040E, 17 | 0x040F, 18 | 0x0410, 19 | 0x0411, 20 | 0x0412, 21 | 0x0413, 22 | 0x0414, 23 | 0x0415, 24 | 0x0416, 25 | 0x0417, 26 | 0x0418, 27 | 0x0419, 28 | 0x041A, 29 | 0x041B, 30 | 0x041C, 31 | 0x041D, 32 | 0x041E, 33 | 0x041F, 34 | 0x0420, 35 | 0x0421, 36 | 0x0422, 37 | 0x0423, 38 | 0x0424, 39 | 0x0425, 40 | 0x0426, 41 | 0x0427, 42 | 0x0428, 43 | 0x0429, 44 | 0x042A, 45 | 0x042B, 46 | 0x042C, 47 | 0x042D, 48 | 0x042E, 49 | 0x042F, 50 | 0x0430, 51 | 0x0431, 52 | 0x0432, 53 | 0x0433, 54 | 0x0434, 55 | 0x0435, 56 | 0x0436, 57 | 0x0437, 58 | 0x0438, 59 | 0x0439, 60 | 0x043A, 61 | 0x043B, 62 | 0x043C, 63 | 0x043D, 64 | 0x043E, 65 | 0x043F, 66 | 0x0440, 67 | 0x0441, 68 | 0x0442, 69 | 0x0443, 70 | 0x0444, 71 | 0x0445, 72 | 0x0446, 73 | 0x0447, 74 | 0x0448, 75 | 0x0449, 76 | 0x044A, 77 | 0x044B, 78 | 0x044C, 79 | 0x044D, 80 | 0x044E, 81 | 0x044F, 82 | 0x2116, 83 | 0x0451, 84 | 0x0452, 85 | 0x0453, 86 | 0x0454, 87 | 0x0455, 88 | 0x0456, 89 | 0x0457, 90 | 0x0458, 91 | 0x0459, 92 | 0x045A, 93 | 0x045B, 94 | 0x045C, 95 | 0x00A7, 96 | 0x045E, 97 | 0x045F 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88596.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_6[ 51 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A4, 0x24 }, 4 | { 0x00AD, 0x2d }, 5 | { 0x060C, 0x2c }, 6 | { 0x061B, 0x3b }, 7 | { 0x061F, 0x3f }, 8 | { 0x0621, 0x41 }, 9 | { 0x0622, 0x42 }, 10 | { 0x0623, 0x43 }, 11 | { 0x0624, 0x44 }, 12 | { 0x0625, 0x45 }, 13 | { 0x0626, 0x46 }, 14 | { 0x0627, 0x47 }, 15 | { 0x0628, 0x48 }, 16 | { 0x0629, 0x49 }, 17 | { 0x062A, 0x4a }, 18 | { 0x062B, 0x4b }, 19 | { 0x062C, 0x4c }, 20 | { 0x062D, 0x4d }, 21 | { 0x062E, 0x4e }, 22 | { 0x062F, 0x4f }, 23 | { 0x0630, 0x50 }, 24 | { 0x0631, 0x51 }, 25 | { 0x0632, 0x52 }, 26 | { 0x0633, 0x53 }, 27 | { 0x0634, 0x54 }, 28 | { 0x0635, 0x55 }, 29 | { 0x0636, 0x56 }, 30 | { 0x0637, 0x57 }, 31 | { 0x0638, 0x58 }, 32 | { 0x0639, 0x59 }, 33 | { 0x063A, 0x5a }, 34 | { 0x0640, 0x60 }, 35 | { 0x0641, 0x61 }, 36 | { 0x0642, 0x62 }, 37 | { 0x0643, 0x63 }, 38 | { 0x0644, 0x64 }, 39 | { 0x0645, 0x65 }, 40 | { 0x0646, 0x66 }, 41 | { 0x0647, 0x67 }, 42 | { 0x0648, 0x68 }, 43 | { 0x0649, 0x69 }, 44 | { 0x064A, 0x6a }, 45 | { 0x064B, 0x6b }, 46 | { 0x064C, 0x6c }, 47 | { 0x064D, 0x6d }, 48 | { 0x064E, 0x6e }, 49 | { 0x064F, 0x6f }, 50 | { 0x0650, 0x70 }, 51 | { 0x0651, 0x71 }, 52 | { 0x0652, 0x72 } 53 | }; 54 | -------------------------------------------------------------------------------- /src/iso88596.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_6[ 96 ] = { 2 | 0x00A0, 3 | 0x0000, 4 | 0x0000, 5 | 0x0000, 6 | 0x00A4, 7 | 0x0000, 8 | 0x0000, 9 | 0x0000, 10 | 0x0000, 11 | 0x0000, 12 | 0x0000, 13 | 0x0000, 14 | 0x060C, 15 | 0x00AD, 16 | 0x0000, 17 | 0x0000, 18 | 0x0000, 19 | 0x0000, 20 | 0x0000, 21 | 0x0000, 22 | 0x0000, 23 | 0x0000, 24 | 0x0000, 25 | 0x0000, 26 | 0x0000, 27 | 0x0000, 28 | 0x0000, 29 | 0x061B, 30 | 0x0000, 31 | 0x0000, 32 | 0x0000, 33 | 0x061F, 34 | 0x0000, 35 | 0x0621, 36 | 0x0622, 37 | 0x0623, 38 | 0x0624, 39 | 0x0625, 40 | 0x0626, 41 | 0x0627, 42 | 0x0628, 43 | 0x0629, 44 | 0x062A, 45 | 0x062B, 46 | 0x062C, 47 | 0x062D, 48 | 0x062E, 49 | 0x062F, 50 | 0x0630, 51 | 0x0631, 52 | 0x0632, 53 | 0x0633, 54 | 0x0634, 55 | 0x0635, 56 | 0x0636, 57 | 0x0637, 58 | 0x0638, 59 | 0x0639, 60 | 0x063A, 61 | 0x0000, 62 | 0x0000, 63 | 0x0000, 64 | 0x0000, 65 | 0x0000, 66 | 0x0640, 67 | 0x0641, 68 | 0x0642, 69 | 0x0643, 70 | 0x0644, 71 | 0x0645, 72 | 0x0646, 73 | 0x0647, 74 | 0x0648, 75 | 0x0649, 76 | 0x064A, 77 | 0x064B, 78 | 0x064C, 79 | 0x064D, 80 | 0x064E, 81 | 0x064F, 82 | 0x0650, 83 | 0x0651, 84 | 0x0652, 85 | 0x0000, 86 | 0x0000, 87 | 0x0000, 88 | 0x0000, 89 | 0x0000, 90 | 0x0000, 91 | 0x0000, 92 | 0x0000, 93 | 0x0000, 94 | 0x0000, 95 | 0x0000, 96 | 0x0000, 97 | 0x0000 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88597.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_7[ 92 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A3, 0x23 }, 4 | { 0x00A6, 0x26 }, 5 | { 0x00A7, 0x27 }, 6 | { 0x00A8, 0x28 }, 7 | { 0x00A9, 0x29 }, 8 | { 0x00AB, 0x2b }, 9 | { 0x00AC, 0x2c }, 10 | { 0x00AD, 0x2d }, 11 | { 0x00B0, 0x30 }, 12 | { 0x00B1, 0x31 }, 13 | { 0x00B2, 0x32 }, 14 | { 0x00B3, 0x33 }, 15 | { 0x00B7, 0x37 }, 16 | { 0x00BB, 0x3b }, 17 | { 0x00BD, 0x3d }, 18 | { 0x02BC, 0x22 }, 19 | { 0x02BD, 0x21 }, 20 | { 0x0384, 0x34 }, 21 | { 0x0385, 0x35 }, 22 | { 0x0386, 0x36 }, 23 | { 0x0388, 0x38 }, 24 | { 0x0389, 0x39 }, 25 | { 0x038A, 0x3a }, 26 | { 0x038C, 0x3c }, 27 | { 0x038E, 0x3e }, 28 | { 0x038F, 0x3f }, 29 | { 0x0390, 0x40 }, 30 | { 0x0391, 0x41 }, 31 | { 0x0392, 0x42 }, 32 | { 0x0393, 0x43 }, 33 | { 0x0394, 0x44 }, 34 | { 0x0395, 0x45 }, 35 | { 0x0396, 0x46 }, 36 | { 0x0397, 0x47 }, 37 | { 0x0398, 0x48 }, 38 | { 0x0399, 0x49 }, 39 | { 0x039A, 0x4a }, 40 | { 0x039B, 0x4b }, 41 | { 0x039C, 0x4c }, 42 | { 0x039D, 0x4d }, 43 | { 0x039E, 0x4e }, 44 | { 0x039F, 0x4f }, 45 | { 0x03A0, 0x50 }, 46 | { 0x03A1, 0x51 }, 47 | { 0x03A3, 0x53 }, 48 | { 0x03A4, 0x54 }, 49 | { 0x03A5, 0x55 }, 50 | { 0x03A6, 0x56 }, 51 | { 0x03A7, 0x57 }, 52 | { 0x03A8, 0x58 }, 53 | { 0x03A9, 0x59 }, 54 | { 0x03AA, 0x5a }, 55 | { 0x03AB, 0x5b }, 56 | { 0x03AC, 0x5c }, 57 | { 0x03AD, 0x5d }, 58 | { 0x03AE, 0x5e }, 59 | { 0x03AF, 0x5f }, 60 | { 0x03B0, 0x60 }, 61 | { 0x03B1, 0x61 }, 62 | { 0x03B2, 0x62 }, 63 | { 0x03B3, 0x63 }, 64 | { 0x03B4, 0x64 }, 65 | { 0x03B5, 0x65 }, 66 | { 0x03B6, 0x66 }, 67 | { 0x03B7, 0x67 }, 68 | { 0x03B8, 0x68 }, 69 | { 0x03B9, 0x69 }, 70 | { 0x03BA, 0x6a }, 71 | { 0x03BB, 0x6b }, 72 | { 0x03BC, 0x6c }, 73 | { 0x03BD, 0x6d }, 74 | { 0x03BE, 0x6e }, 75 | { 0x03BF, 0x6f }, 76 | { 0x03C0, 0x70 }, 77 | { 0x03C1, 0x71 }, 78 | { 0x03C2, 0x72 }, 79 | { 0x03C3, 0x73 }, 80 | { 0x03C4, 0x74 }, 81 | { 0x03C5, 0x75 }, 82 | { 0x03C6, 0x76 }, 83 | { 0x03C7, 0x77 }, 84 | { 0x03C8, 0x78 }, 85 | { 0x03C9, 0x79 }, 86 | { 0x03CA, 0x7a }, 87 | { 0x03CB, 0x7b }, 88 | { 0x03CC, 0x7c }, 89 | { 0x03CD, 0x7d }, 90 | { 0x03CE, 0x7e }, 91 | { 0x2015, 0x2f }, 92 | { 0x2018, 0x21 }, 93 | { 0x2019, 0x22 } 94 | }; 95 | -------------------------------------------------------------------------------- /src/iso88597.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_7[ 96 ] = { 2 | 0x00A0, 3 | 0x2018, 4 | 0x2019, 5 | 0x00A3, 6 | 0x0000, 7 | 0x0000, 8 | 0x00A6, 9 | 0x00A7, 10 | 0x00A8, 11 | 0x00A9, 12 | 0x0000, 13 | 0x00AB, 14 | 0x00AC, 15 | 0x00AD, 16 | 0x0000, 17 | 0x2015, 18 | 0x00B0, 19 | 0x00B1, 20 | 0x00B2, 21 | 0x00B3, 22 | 0x0384, 23 | 0x0385, 24 | 0x0386, 25 | 0x00B7, 26 | 0x0388, 27 | 0x0389, 28 | 0x038A, 29 | 0x00BB, 30 | 0x038C, 31 | 0x00BD, 32 | 0x038E, 33 | 0x038F, 34 | 0x0390, 35 | 0x0391, 36 | 0x0392, 37 | 0x0393, 38 | 0x0394, 39 | 0x0395, 40 | 0x0396, 41 | 0x0397, 42 | 0x0398, 43 | 0x0399, 44 | 0x039A, 45 | 0x039B, 46 | 0x039C, 47 | 0x039D, 48 | 0x039E, 49 | 0x039F, 50 | 0x03A0, 51 | 0x03A1, 52 | 0x0000, 53 | 0x03A3, 54 | 0x03A4, 55 | 0x03A5, 56 | 0x03A6, 57 | 0x03A7, 58 | 0x03A8, 59 | 0x03A9, 60 | 0x03AA, 61 | 0x03AB, 62 | 0x03AC, 63 | 0x03AD, 64 | 0x03AE, 65 | 0x03AF, 66 | 0x03B0, 67 | 0x03B1, 68 | 0x03B2, 69 | 0x03B3, 70 | 0x03B4, 71 | 0x03B5, 72 | 0x03B6, 73 | 0x03B7, 74 | 0x03B8, 75 | 0x03B9, 76 | 0x03BA, 77 | 0x03BB, 78 | 0x03BC, 79 | 0x03BD, 80 | 0x03BE, 81 | 0x03BF, 82 | 0x03C0, 83 | 0x03C1, 84 | 0x03C2, 85 | 0x03C3, 86 | 0x03C4, 87 | 0x03C5, 88 | 0x03C6, 89 | 0x03C7, 90 | 0x03C8, 91 | 0x03C9, 92 | 0x03CA, 93 | 0x03CB, 94 | 0x03CC, 95 | 0x03CD, 96 | 0x03CE, 97 | 0x0000 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88598.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_8[ 58 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A2, 0x22 }, 4 | { 0x00A3, 0x23 }, 5 | { 0x00A4, 0x24 }, 6 | { 0x00A5, 0x25 }, 7 | { 0x00A6, 0x26 }, 8 | { 0x00A7, 0x27 }, 9 | { 0x00A8, 0x28 }, 10 | { 0x00A9, 0x29 }, 11 | { 0x00AB, 0x2b }, 12 | { 0x00AC, 0x2c }, 13 | { 0x00AD, 0x2d }, 14 | { 0x00AE, 0x2e }, 15 | { 0x00B0, 0x30 }, 16 | { 0x00B1, 0x31 }, 17 | { 0x00B2, 0x32 }, 18 | { 0x00B3, 0x33 }, 19 | { 0x00B4, 0x34 }, 20 | { 0x00B5, 0x35 }, 21 | { 0x00B6, 0x36 }, 22 | { 0x00B7, 0x37 }, 23 | { 0x00B8, 0x38 }, 24 | { 0x00B9, 0x39 }, 25 | { 0x00BB, 0x3b }, 26 | { 0x00BC, 0x3c }, 27 | { 0x00BD, 0x3d }, 28 | { 0x00BE, 0x3e }, 29 | { 0x00D7, 0x2a }, 30 | { 0x00F7, 0x3a }, 31 | { 0x05D0, 0x60 }, 32 | { 0x05D1, 0x61 }, 33 | { 0x05D2, 0x62 }, 34 | { 0x05D3, 0x63 }, 35 | { 0x05D4, 0x64 }, 36 | { 0x05D5, 0x65 }, 37 | { 0x05D6, 0x66 }, 38 | { 0x05D7, 0x67 }, 39 | { 0x05D8, 0x68 }, 40 | { 0x05D9, 0x69 }, 41 | { 0x05DA, 0x6a }, 42 | { 0x05DB, 0x6b }, 43 | { 0x05DC, 0x6c }, 44 | { 0x05DD, 0x6d }, 45 | { 0x05DE, 0x6e }, 46 | { 0x05DF, 0x6f }, 47 | { 0x05E0, 0x70 }, 48 | { 0x05E1, 0x71 }, 49 | { 0x05E2, 0x72 }, 50 | { 0x05E3, 0x73 }, 51 | { 0x05E4, 0x74 }, 52 | { 0x05E5, 0x75 }, 53 | { 0x05E6, 0x76 }, 54 | { 0x05E7, 0x77 }, 55 | { 0x05E8, 0x78 }, 56 | { 0x05E9, 0x79 }, 57 | { 0x05EA, 0x7a }, 58 | { 0x2017, 0x5f }, 59 | { 0x203E, 0x2f } 60 | }; 61 | -------------------------------------------------------------------------------- /src/iso88598.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_8[ 96 ] = { 2 | 0x00A0, 3 | 0x0000, 4 | 0x00A2, 5 | 0x00A3, 6 | 0x00A4, 7 | 0x00A5, 8 | 0x00A6, 9 | 0x00A7, 10 | 0x00A8, 11 | 0x00A9, 12 | 0x00D7, 13 | 0x00AB, 14 | 0x00AC, 15 | 0x00AD, 16 | 0x00AE, 17 | 0x203E, 18 | 0x00B0, 19 | 0x00B1, 20 | 0x00B2, 21 | 0x00B3, 22 | 0x00B4, 23 | 0x00B5, 24 | 0x00B6, 25 | 0x00B7, 26 | 0x00B8, 27 | 0x00B9, 28 | 0x00F7, 29 | 0x00BB, 30 | 0x00BC, 31 | 0x00BD, 32 | 0x00BE, 33 | 0x0000, 34 | 0x0000, 35 | 0x0000, 36 | 0x0000, 37 | 0x0000, 38 | 0x0000, 39 | 0x0000, 40 | 0x0000, 41 | 0x0000, 42 | 0x0000, 43 | 0x0000, 44 | 0x0000, 45 | 0x0000, 46 | 0x0000, 47 | 0x0000, 48 | 0x0000, 49 | 0x0000, 50 | 0x0000, 51 | 0x0000, 52 | 0x0000, 53 | 0x0000, 54 | 0x0000, 55 | 0x0000, 56 | 0x0000, 57 | 0x0000, 58 | 0x0000, 59 | 0x0000, 60 | 0x0000, 61 | 0x0000, 62 | 0x0000, 63 | 0x0000, 64 | 0x0000, 65 | 0x2017, 66 | 0x05D0, 67 | 0x05D1, 68 | 0x05D2, 69 | 0x05D3, 70 | 0x05D4, 71 | 0x05D5, 72 | 0x05D6, 73 | 0x05D7, 74 | 0x05D8, 75 | 0x05D9, 76 | 0x05DA, 77 | 0x05DB, 78 | 0x05DC, 79 | 0x05DD, 80 | 0x05DE, 81 | 0x05DF, 82 | 0x05E0, 83 | 0x05E1, 84 | 0x05E2, 85 | 0x05E3, 86 | 0x05E4, 87 | 0x05E5, 88 | 0x05E6, 89 | 0x05E7, 90 | 0x05E8, 91 | 0x05E9, 92 | 0x05EA, 93 | 0x0000, 94 | 0x0000, 95 | 0x0000, 96 | 0x0000, 97 | 0x0000 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88599.map: -------------------------------------------------------------------------------- 1 | private codes_t mapISO8859_9[ 96 ] = { 2 | { 0x00A0, 0x20 }, 3 | { 0x00A1, 0x21 }, 4 | { 0x00A2, 0x22 }, 5 | { 0x00A3, 0x23 }, 6 | { 0x00A4, 0x24 }, 7 | { 0x00A5, 0x25 }, 8 | { 0x00A6, 0x26 }, 9 | { 0x00A7, 0x27 }, 10 | { 0x00A8, 0x28 }, 11 | { 0x00A9, 0x29 }, 12 | { 0x00AA, 0x2a }, 13 | { 0x00AB, 0x2b }, 14 | { 0x00AC, 0x2c }, 15 | { 0x00AD, 0x2d }, 16 | { 0x00AE, 0x2e }, 17 | { 0x00AF, 0x2f }, 18 | { 0x00B0, 0x30 }, 19 | { 0x00B1, 0x31 }, 20 | { 0x00B2, 0x32 }, 21 | { 0x00B3, 0x33 }, 22 | { 0x00B4, 0x34 }, 23 | { 0x00B5, 0x35 }, 24 | { 0x00B6, 0x36 }, 25 | { 0x00B7, 0x37 }, 26 | { 0x00B8, 0x38 }, 27 | { 0x00B9, 0x39 }, 28 | { 0x00BA, 0x3a }, 29 | { 0x00BB, 0x3b }, 30 | { 0x00BC, 0x3c }, 31 | { 0x00BD, 0x3d }, 32 | { 0x00BE, 0x3e }, 33 | { 0x00BF, 0x3f }, 34 | { 0x00C0, 0x40 }, 35 | { 0x00C1, 0x41 }, 36 | { 0x00C2, 0x42 }, 37 | { 0x00C3, 0x43 }, 38 | { 0x00C4, 0x44 }, 39 | { 0x00C5, 0x45 }, 40 | { 0x00C6, 0x46 }, 41 | { 0x00C7, 0x47 }, 42 | { 0x00C8, 0x48 }, 43 | { 0x00C9, 0x49 }, 44 | { 0x00CA, 0x4a }, 45 | { 0x00CB, 0x4b }, 46 | { 0x00CC, 0x4c }, 47 | { 0x00CD, 0x4d }, 48 | { 0x00CE, 0x4e }, 49 | { 0x00CF, 0x4f }, 50 | { 0x00D1, 0x51 }, 51 | { 0x00D2, 0x52 }, 52 | { 0x00D3, 0x53 }, 53 | { 0x00D4, 0x54 }, 54 | { 0x00D5, 0x55 }, 55 | { 0x00D6, 0x56 }, 56 | { 0x00D7, 0x57 }, 57 | { 0x00D8, 0x58 }, 58 | { 0x00D9, 0x59 }, 59 | { 0x00DA, 0x5a }, 60 | { 0x00DB, 0x5b }, 61 | { 0x00DC, 0x5c }, 62 | { 0x00DF, 0x5f }, 63 | { 0x00E0, 0x60 }, 64 | { 0x00E1, 0x61 }, 65 | { 0x00E2, 0x62 }, 66 | { 0x00E3, 0x63 }, 67 | { 0x00E4, 0x64 }, 68 | { 0x00E5, 0x65 }, 69 | { 0x00E6, 0x66 }, 70 | { 0x00E7, 0x67 }, 71 | { 0x00E8, 0x68 }, 72 | { 0x00E9, 0x69 }, 73 | { 0x00EA, 0x6a }, 74 | { 0x00EB, 0x6b }, 75 | { 0x00EC, 0x6c }, 76 | { 0x00ED, 0x6d }, 77 | { 0x00EE, 0x6e }, 78 | { 0x00EF, 0x6f }, 79 | { 0x00F1, 0x71 }, 80 | { 0x00F2, 0x72 }, 81 | { 0x00F3, 0x73 }, 82 | { 0x00F4, 0x74 }, 83 | { 0x00F5, 0x75 }, 84 | { 0x00F6, 0x76 }, 85 | { 0x00F7, 0x77 }, 86 | { 0x00F8, 0x78 }, 87 | { 0x00F9, 0x79 }, 88 | { 0x00FA, 0x7a }, 89 | { 0x00FB, 0x7b }, 90 | { 0x00FC, 0x7c }, 91 | { 0x00FF, 0x7f }, 92 | { 0x011E, 0x50 }, 93 | { 0x011F, 0x70 }, 94 | { 0x0130, 0x5d }, 95 | { 0x0131, 0x7d }, 96 | { 0x015E, 0x5e }, 97 | { 0x015F, 0x7e } 98 | }; 99 | -------------------------------------------------------------------------------- /src/iso88599.rev: -------------------------------------------------------------------------------- 1 | private ic_t revISO8859_9[ 96 ] = { 2 | 0x00A0, 3 | 0x00A1, 4 | 0x00A2, 5 | 0x00A3, 6 | 0x00A4, 7 | 0x00A5, 8 | 0x00A6, 9 | 0x00A7, 10 | 0x00A8, 11 | 0x00A9, 12 | 0x00AA, 13 | 0x00AB, 14 | 0x00AC, 15 | 0x00AD, 16 | 0x00AE, 17 | 0x00AF, 18 | 0x00B0, 19 | 0x00B1, 20 | 0x00B2, 21 | 0x00B3, 22 | 0x00B4, 23 | 0x00B5, 24 | 0x00B6, 25 | 0x00B7, 26 | 0x00B8, 27 | 0x00B9, 28 | 0x00BA, 29 | 0x00BB, 30 | 0x00BC, 31 | 0x00BD, 32 | 0x00BE, 33 | 0x00BF, 34 | 0x00C0, 35 | 0x00C1, 36 | 0x00C2, 37 | 0x00C3, 38 | 0x00C4, 39 | 0x00C5, 40 | 0x00C6, 41 | 0x00C7, 42 | 0x00C8, 43 | 0x00C9, 44 | 0x00CA, 45 | 0x00CB, 46 | 0x00CC, 47 | 0x00CD, 48 | 0x00CE, 49 | 0x00CF, 50 | 0x011E, 51 | 0x00D1, 52 | 0x00D2, 53 | 0x00D3, 54 | 0x00D4, 55 | 0x00D5, 56 | 0x00D6, 57 | 0x00D7, 58 | 0x00D8, 59 | 0x00D9, 60 | 0x00DA, 61 | 0x00DB, 62 | 0x00DC, 63 | 0x0130, 64 | 0x015E, 65 | 0x00DF, 66 | 0x00E0, 67 | 0x00E1, 68 | 0x00E2, 69 | 0x00E3, 70 | 0x00E4, 71 | 0x00E5, 72 | 0x00E6, 73 | 0x00E7, 74 | 0x00E8, 75 | 0x00E9, 76 | 0x00EA, 77 | 0x00EB, 78 | 0x00EC, 79 | 0x00ED, 80 | 0x00EE, 81 | 0x00EF, 82 | 0x011F, 83 | 0x00F1, 84 | 0x00F2, 85 | 0x00F3, 86 | 0x00F4, 87 | 0x00F5, 88 | 0x00F6, 89 | 0x00F7, 90 | 0x00F8, 91 | 0x00F9, 92 | 0x00FA, 93 | 0x00FB, 94 | 0x00FC, 95 | 0x0131, 96 | 0x015F, 97 | 0x00FF 98 | }; 99 | -------------------------------------------------------------------------------- /src/istr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * istr.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: istr.h,v 1.4 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ISTR_H__ 9 | #define __ISTR_H__ 10 | 11 | #include 12 | 13 | #define ZONE_PAGE0 0 14 | #define ZONE_PAGE1 1 15 | 16 | #ifndef MSDOS /* if NOT defined */ 17 | #define ZONE_PAGE2 2 18 | #define ZONE_PAGE3 3 19 | #define ZONE_FREE 4 20 | #else 21 | #define ZONE_FREE 2 22 | #endif /* MSDOS */ 23 | 24 | #define ZONE_SIZE ( ZONE_FREE + 1 ) 25 | 26 | public int IstrWidth( i_str_t *istr ); 27 | 28 | public void IstrInit(); 29 | 30 | public i_str_t *IstrAlloc( int zone, int istrLength ); 31 | public void IstrFree( i_str_t *istr ); 32 | public void IstrFreeZone( int zone ); 33 | public void IstrFreeAll(); 34 | 35 | #endif /* __ISTR_H__ */ 36 | -------------------------------------------------------------------------------- /src/itable.c: -------------------------------------------------------------------------------- 1 | /* 2 | * itable.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: itable.c,v 1.6 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | /* 31 | * international character set table 32 | */ 33 | 34 | public i_table_t iTable[ I_TABLE_SIZE ] = { 35 | { ISO646_US, 'B', FALSE, SET94, 1, 1 }, 36 | { X0201ROMAN, 'J', FALSE, SET94, 1, 1 }, 37 | 38 | { X0201KANA, 'I', FALSE, SET94, 1, 1 }, 39 | 40 | { ISO8859_1, 'A', FALSE, SET96, 1, 1 }, 41 | { ISO8859_2, 'B', FALSE, SET96, 1, 1 }, 42 | { ISO8859_3, 'C', FALSE, SET96, 1, 1 }, 43 | { ISO8859_4, 'D', FALSE, SET96, 1, 1 }, 44 | { ISO8859_5, 'L', FALSE, SET96, 1, 1 }, 45 | { ISO8859_6, 'G', FALSE, SET96, 1, 1 }, 46 | { ISO8859_7, 'F', FALSE, SET96, 1, 1 }, 47 | { ISO8859_8, 'H', FALSE, SET96, 1, 1 }, 48 | { ISO8859_9, 'M', FALSE, SET96, 1, 1 }, 49 | { ISO8859_10, 'V', FALSE, SET96, 1, 1 }, 50 | { ISO8859_11, 'T', FALSE, SET96, 1, 1 }, 51 | { ISO8859_13, 'Y', FALSE, SET96, 1, 1 }, 52 | { ISO8859_14, '_', FALSE, SET96, 1, 1 }, 53 | { ISO8859_15, 'b', FALSE, SET96, 1, 1 }, 54 | { ISO8859_16, 'f', FALSE, SET96, 1, 1 }, 55 | 56 | { C6226, '@', TRUE, SET94, 2, 2 }, 57 | { GB2312, 'A', TRUE, SET94, 2, 2 }, 58 | { X0208, 'B', TRUE, SET94, 2, 2 }, 59 | { KSC5601, 'C', TRUE, SET94, 2, 2 }, 60 | { X0212, 'D', TRUE, SET94, 2, 2 }, 61 | { ISO_IR_165, 'E', TRUE, SET94, 2, 2 }, 62 | { CNS_1, 'G', TRUE, SET94, 2, 2 }, 63 | { CNS_2, 'H', TRUE, SET94, 2, 2 }, 64 | { CNS_3, 'I', TRUE, SET94, 2, 2 }, 65 | { CNS_4, 'J', TRUE, SET94, 2, 2 }, 66 | { CNS_5, 'K', TRUE, SET94, 2, 2 }, 67 | { CNS_6, 'L', TRUE, SET94, 2, 2 }, 68 | { CNS_7, 'M', TRUE, SET94, 2, 2 }, 69 | 70 | { X0213_1, 'O', TRUE, SET94, 2, 2 }, 71 | { X0213_2, 'P', TRUE, SET94, 2, 2 }, 72 | 73 | { BIG5, '0', TRUE, SET94, 2, 2 }, /* non-registered final char */ 74 | 75 | { UNICODE, '2', TRUE, SET94, 2, 2 }, 76 | 77 | { PSEUDO, 0, FALSE, SET94, 0, 0 }, /* pseudo-charset */ 78 | 79 | { SPACE, 'B', FALSE, SET94, 1, 1 }, 80 | { HTAB, 'B', FALSE, SET94, 1, 0 }, 81 | { CNTRL, 'B', FALSE, SET94, 1, 0 }, 82 | { LINE_FEED, 'B', FALSE, SET94, 1, 0 } 83 | }; 84 | 85 | #define I_TABLE_CACHE_SIZE 4 86 | 87 | private int iTableCacheIndex = 0; 88 | private boolean_t iTableCacheUsed[ I_TABLE_CACHE_SIZE ]; 89 | private i_table_t iTableCache[ I_TABLE_CACHE_SIZE ]; 90 | 91 | public void ItableInit() 92 | { 93 | int i; 94 | 95 | for( i = 0 ; i < I_TABLE_SIZE ; i++ ) 96 | if( iTable[ i ].charset != i ) 97 | fprintf( stderr, "lv: invalid ichar table\n" ), exit( -1 ); 98 | 99 | for( i = 0 ; i < I_TABLE_CACHE_SIZE ; i++ ) 100 | iTableCacheUsed[ i ] = FALSE; 101 | } 102 | 103 | public byte ItableLookup( byte fin, boolean_t multi, boolean_t set94 ) 104 | { 105 | int i; 106 | 107 | for( i = iTableCacheIndex ; i >= 0 ; i-- ){ 108 | if( TRUE == iTableCacheUsed[ i ] 109 | && multi == iTableCache[ i ].multi 110 | && set94 == iTableCache[ i ].set94 111 | && fin == iTableCache[ i ].fin ) 112 | return iTableCache[ i ].charset; 113 | } 114 | for( i = I_TABLE_CACHE_SIZE - 1 ; i > iTableCacheIndex ; i-- ){ 115 | if( TRUE == iTableCacheUsed[ i ] 116 | && multi == iTableCache[ i ].multi 117 | && set94 == iTableCache[ i ].set94 118 | && fin == iTableCache[ i ].fin ) 119 | return iTableCache[ i ].charset; 120 | } 121 | for( i = 0 ; i < PSEUDO ; i++ ){ 122 | if( multi == iTable[ i ].multi 123 | && set94 == iTable[ i ].set94 124 | && fin == iTable[ i ].fin ){ 125 | iTableCacheIndex++; 126 | if( iTableCacheIndex >= I_TABLE_CACHE_SIZE ) 127 | iTableCacheIndex = 0; 128 | iTableCache[ iTableCacheIndex ] = iTable[ i ]; 129 | iTableCacheUsed[ iTableCacheIndex ] = TRUE; 130 | 131 | return i; 132 | } 133 | } 134 | if( TRUE == allow_unify ){ 135 | if( FALSE == multi && TRUE == set94 ) 136 | return ASCII; 137 | } 138 | return NOSET; 139 | } 140 | 141 | public int IcharWidth( byte charset, ic_t c ) 142 | { 143 | if( charset < PSEUDO ){ 144 | switch( charset ){ 145 | case UNICODE: 146 | if( c < unicode_width_threshold ) 147 | return 1; 148 | else 149 | return 2; 150 | } 151 | } else { 152 | switch( charset ){ 153 | case HTAB: 154 | case CNTRL: 155 | return MakeByte1( c ); 156 | } 157 | } 158 | return iTable[ (int)charset ].width; 159 | } 160 | 161 | public int IstrWidth( i_str_t *istr ) 162 | { 163 | int i, w; 164 | 165 | w = 0; 166 | for( i = 0 ; NOSET != istr[ i ].charset ; i++ ) 167 | w += IcharWidth( istr[ i ].charset, istr[ i ].c ); 168 | 169 | return w; 170 | } 171 | -------------------------------------------------------------------------------- /src/itable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * itable.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: itable.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ITABLE_H__ 9 | #define __ITABLE_H__ 10 | 11 | #include 12 | #include 13 | 14 | #endif /* __ITABLE_H__ */ 15 | -------------------------------------------------------------------------------- /src/itable_e.h: -------------------------------------------------------------------------------- 1 | /* 2 | * itable_e.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: itable_e.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ITABLE_E_H__ 9 | #define __ITABLE_E_H__ 10 | 11 | extern i_table_t iTable[]; 12 | 13 | #endif /* __ITABLE_E_H__ */ 14 | -------------------------------------------------------------------------------- /src/itable_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * itable_t.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: itable_t.h,v 1.6 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __ITABLE_T_H__ 9 | #define __ITABLE_T_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | /* 16 | * character sets's name space (byte) 17 | */ 18 | 19 | #define ISO646_US 0 /* ISO 646 United states (ANSI X3.4-1968) */ 20 | #define X0201ROMAN 1 /* JIS X0201-1976 Japanese Roman */ 21 | 22 | #define X0201KANA 2 /* JIS X0201-1976 Japanese Katakana */ 23 | 24 | #define ISO8859_1 3 /* ISO 8859/1 Latin1 alphabet */ 25 | #define ISO8859_2 4 /* ISO 8859/2 Latin2 alphabet */ 26 | #define ISO8859_3 5 /* ISO 8859/3 Latin3 alphabet */ 27 | #define ISO8859_4 6 /* ISO 8859/4 Latin4 alphabet */ 28 | #define ISO8859_5 7 /* ISO 8859/5 Cyrillic alphabet */ 29 | #define ISO8859_6 8 /* ISO 8859/6 Arabic alphabet */ 30 | #define ISO8859_7 9 /* ISO 8859/7 Greek alphabet */ 31 | #define ISO8859_8 10 /* ISO 8859/8 Hebrew alphabet */ 32 | #define ISO8859_9 11 /* ISO 8859/9 Latin5 alphabet */ 33 | #define ISO8859_10 12 /* ISO 8859/10 Latin6 alphabet */ 34 | #define ISO8859_11 13 /* ISO 8859/13 Thai alphabet */ 35 | #define ISO8859_13 14 /* ISO 8859/13 Latin7 alphabet */ 36 | #define ISO8859_14 15 /* ISO 8859/14 Latin8 alphabet */ 37 | #define ISO8859_15 16 /* ISO 8859/15 Latin9 alphabet */ 38 | #define ISO8859_16 17 /* ISO 8859/16 Latin10 alphabet */ 39 | 40 | #define C6226 18 /* JIS C 6226-1978 Japanese kanji */ 41 | #define GB2312 19 /* GB 2312-80 Chinese kanji */ 42 | #define X0208 20 /* JIS X 0208-1983 Japanese kanji */ 43 | #define KSC5601 21 /* KS C 5601-1987 Korean graphic charset */ 44 | #define X0212 22 /* JIS X 0212-1990 Supplementary charset */ 45 | #define ISO_IR_165 23 /* ISO-IR-165 */ 46 | #define CNS_1 24 /* CNS 11643-1992 Plane 1 */ 47 | #define CNS_2 25 /* CNS 11643-1992 Plane 2 */ 48 | #define CNS_3 26 /* CNS 11643-1992 Plane 3 */ 49 | #define CNS_4 27 /* CNS 11643-1992 Plane 4 */ 50 | #define CNS_5 28 /* CNS 11643-1992 Plane 5 */ 51 | #define CNS_6 29 /* CNS 11643-1992 Plane 6 */ 52 | #define CNS_7 30 /* CNS 11643-1992 Plane 7 */ 53 | 54 | #define X0213_1 31 /* JIS X 0213-2000 Plane 1 */ 55 | #define X0213_2 32 /* JIS X 0213-2000 Plane 2 */ 56 | 57 | #define BIG5 33 /* Big5 Traditional Chinese */ 58 | 59 | #define UNICODE 34 /* Unicode */ 60 | 61 | #define PSEUDO 35 62 | 63 | #define SPACE 36 64 | #define HTAB 37 65 | #define CNTRL 38 66 | 67 | #define LINE_FEED 39 68 | 69 | #define I_TABLE_SIZE 40 70 | 71 | #define NOSET I_TABLE_SIZE 72 | 73 | #define ASCII ISO646_US 74 | 75 | /* 76 | * international charset table 77 | */ 78 | 79 | typedef struct { 80 | byte charset; 81 | byte fin; /* final character */ 82 | boolean_t multi; /* is multi bytes charset */ 83 | boolean_t set94; /* is 94 chars charset */ 84 | int length; /* code length for the charset */ 85 | int width; /* graphical width of each char */ 86 | } i_table_t; 87 | 88 | #define SET94 TRUE 89 | #define SET96 FALSE 90 | 91 | public boolean_t allow_unify; 92 | public ic_t unicode_width_threshold; 93 | 94 | public void ItableInit(); 95 | public byte ItableLookup( byte fin, boolean_t multi, boolean_t set94 ); 96 | 97 | public int IcharWidth( byte charset, ic_t c ); 98 | public int IstrWidth( i_str_t *istr ); 99 | 100 | #endif /* __ITABLE_T_H__ */ 101 | -------------------------------------------------------------------------------- /src/kana.c: -------------------------------------------------------------------------------- 1 | /* 2 | * kana.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: kana.c,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | private ic_t X0201toX0208[ 61 ] = { 29 | 0x2123, /* 0x21 */ 30 | 0x2156, 31 | 0x2157, 32 | 0x2122, 33 | 0x2126, 34 | 0x2572, 35 | 0x2521, 36 | 0x2523, 37 | 0x2525, 38 | 0x2527, 39 | 0x2529, 40 | 0x2563, 41 | 0x2565, 42 | 0x2567, 43 | 0x2543, 44 | 0x213c, /* 0x30 */ 45 | 0x2522, 46 | 0x2524, 47 | 0x2526, 48 | 0x2528, 49 | 0x252a, 50 | 0x252b, 51 | 0x252d, 52 | 0x252f, 53 | 0x2531, 54 | 0x2533, 55 | 0x2535, 56 | 0x2537, 57 | 0x2539, 58 | 0x253b, 59 | 0x253d, 60 | 0x253f, /* 0x40 */ 61 | 0x2541, 62 | 0x2544, 63 | 0x2546, 64 | 0x2548, 65 | 0x254a, 66 | 0x254b, 67 | 0x254c, 68 | 0x254d, 69 | 0x254e, 70 | 0x254f, 71 | 0x2552, 72 | 0x2555, 73 | 0x2558, 74 | 0x255b, 75 | 0x255e, 76 | 0x255f, /* 0x50 */ 77 | 0x2560, 78 | 0x2561, 79 | 0x2562, 80 | 0x2564, 81 | 0x2566, 82 | 0x2568, 83 | 0x2569, 84 | 0x256a, 85 | 0x256b, 86 | 0x256c, 87 | 0x256d, 88 | 0x256f, 89 | 0x2573 /* 0x5d */ 90 | }; 91 | 92 | #define IsU( c ) ( 0x2526U == (c) ) 93 | 94 | private boolean_t IsKaToHo( ic_t c ) 95 | { 96 | if( 0x255bU < c ){ /* higher than `HO' */ 97 | return FALSE; 98 | } else if( c <= 0x2541U ){ /* lower than `CHI' */ 99 | if( 0x252bU <= c ){ /* between `KA' and `CHI' */ 100 | c -= 0x252bU; 101 | if( 0 == c % 2 ) 102 | return TRUE; 103 | } 104 | } else { /* between `DI' and `HO' */ 105 | if( 0x254fU <= c ){ /* between `HA' and `HO' */ 106 | c -= 0x254fU; 107 | if( 0 == c % 3 ) 108 | return TRUE; 109 | } else if( 0x2544U <= c && c <= 0x2548U ){ /* between `TSU' and `TO' */ 110 | c -= 0x2544U; 111 | if( 0 == c % 2 ) 112 | return TRUE; 113 | } 114 | } 115 | 116 | return FALSE; 117 | } 118 | 119 | private boolean_t IsHaToHo( ic_t c ) 120 | { 121 | if( 0x255bU < c ){ /* higher than `HO' */ 122 | return FALSE; 123 | } else if( 0x254fU <= c ){ /* between `HA' and `HO' */ 124 | c -= 0x254fU; 125 | if( 0 == c % 3 ) 126 | return TRUE; 127 | } 128 | 129 | return FALSE; 130 | } 131 | 132 | public void KanaX0201toX0208() 133 | { 134 | int index; 135 | ic_t x0201; 136 | 137 | /* 138 | * Remember this function is called only when: 139 | * ISIDX > 0 and X0201KANA == ISTR[ ISIDX - 1 ].charset 140 | */ 141 | 142 | index = ISIDX - 1; 143 | x0201 = ISTR[ index ].c; 144 | 145 | if( x0201 >= 0x21 && x0201 <= 0x5d ){ 146 | ISTR[ index ].charset = X0208; 147 | ISTR[ index ].c = X0201toX0208[ x0201 - 0x21 ]; 148 | } else if( x0201 == 0x5e ){ 149 | /* katakana voiced sound mark */ 150 | if( ISIDX > 1 && X0208 == ISTR[ ISIDX - 2 ].charset ){ 151 | index--; 152 | if( IsU( ISTR[ index ].c ) ){ 153 | ISTR[ index ].c = 0x2574U; 154 | ISIDX--; 155 | return; 156 | } else if( IsKaToHo( ISTR[ index ].c ) ){ 157 | ISTR[ index ].c++; 158 | ISIDX--; 159 | return; 160 | } 161 | index++; 162 | } 163 | ISTR[ index ].charset = X0208; 164 | ISTR[ index ].c = 0x212bU; 165 | } else if( x0201 == 0x5f ){ 166 | /* katakana semi-voiced sound mark */ 167 | if( ISIDX > 1 && X0208 == ISTR[ ISIDX - 2 ].charset ){ 168 | index--; 169 | if( IsHaToHo( ISTR[ index ].c ) ){ 170 | ISTR[ index ].c += 2; 171 | ISIDX--; 172 | return; 173 | } 174 | index++; 175 | } 176 | ISTR[ index ].charset = X0208; 177 | ISTR[ index ].c = 0x212cU; 178 | } else { 179 | /* undefined region */ 180 | ISTR[ index ].charset = ASCII; 181 | ISTR[ index ].c = (ic_t)'?'; 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /src/kana.h: -------------------------------------------------------------------------------- 1 | /* 2 | * kana.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: kana.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __KANA_H__ 9 | #define __KANA_H__ 10 | 11 | #include 12 | 13 | public boolean_t kana_conv; 14 | 15 | public void KanaX0201toX0208(); 16 | 17 | #endif /* __KANA_H__ */ 18 | -------------------------------------------------------------------------------- /src/keybind.h: -------------------------------------------------------------------------------- 1 | /* 2 | * keybind.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: keybind.h,v 1.6 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __KEYBIND_H__ 9 | #define __KEYBIND_H__ 10 | 11 | typedef void (*key_table_t)( unsigned int ); 12 | 13 | private key_table_t keyTable[ 128 ] = { 14 | CommandNull, /* C-@ */ /* 0/0 */ 15 | CommandNull, /* C-a */ 16 | CommandPrevPage, /* C-b */ 17 | CommandNull, /* C-c */ 18 | CommandNextHalf, /* C-d */ 19 | CommandNextLine, /* C-e */ 20 | CommandNextPage, /* C-f */ 21 | CommandFileStatus, /* C-g */ 22 | CommandPrevLine, /* C-h */ 23 | CommandNull, /* C-i */ 24 | CommandNextLine, /* C-j */ 25 | CommandPrevLine, /* C-k */ 26 | CommandRedisplay, /* C-l */ 27 | CommandNextLine, /* C-m */ 28 | CommandNextLine, /* C-n */ 29 | CommandNull, /* C-o */ 30 | CommandPrevLine, /* C-p */ /* 1/0 */ 31 | CommandNull, /* C-q */ 32 | CommandRefresh, /* C-r */ 33 | CommandNull, /* C-s */ 34 | CommandToggleHz, /* C-t */ 35 | CommandPrevHalf, /* C-u */ 36 | CommandNextPage, /* C-v */ 37 | CommandNull, /* C-w */ 38 | CommandNull, /* C-x */ 39 | CommandPrevLine, /* C-y */ 40 | CommandShellEscape, /* C-z */ 41 | CommandCursor, /* C-[ */ 42 | CommandNull, /* C-\ */ 43 | CommandNull, /* C-] */ 44 | CommandNull, /* C-^ */ 45 | CommandNull, /* C-_ */ 46 | CommandNextPage, /* ' ' */ /* 2/0 */ 47 | CommandNull, /* '!' */ 48 | CommandNull, /* '"' */ 49 | CommandNull, /* '#' */ 50 | CommandNull, /* '$' */ 51 | CommandNull, /* '%' */ 52 | CommandNull, /* '&' */ 53 | CommandNull, /* ''' */ 54 | CommandNull, /* '(' */ 55 | CommandNull, /* ')' */ 56 | CommandNull, /* '*' */ 57 | CommandNull, /* '+' */ 58 | CommandNull, /* ',' */ 59 | CommandNull, /* '-' */ 60 | CommandNull, /* '.' */ 61 | CommandFindForward, /* '/' */ 62 | CommandNull, /* '0' */ /* 3/0 */ 63 | CommandNull, /* '1' */ 64 | CommandNull, /* '2' */ 65 | CommandNull, /* '3' */ 66 | CommandNull, /* '4' */ 67 | CommandNull, /* '5' */ 68 | CommandNull, /* '6' */ 69 | CommandNull, /* '7' */ 70 | CommandNull, /* '8' */ 71 | CommandNull, /* '9' */ 72 | CommandColon, /* ':' */ 73 | CommandNull, /* ';' */ 74 | CommandTopOfFile, /* '<' */ 75 | CommandFileStatus, /* '=' */ 76 | CommandBottomOfFile, /* '>' */ 77 | CommandFindBackward, /* '?' */ 78 | CommandNull, /* '@' */ /* 4/0 */ 79 | CommandNull, /* 'A' */ 80 | CommandNull, /* 'B' */ 81 | CommandNull, /* 'C' */ 82 | CommandNull, /* 'D' */ 83 | CommandNull, /* 'E' */ 84 | CommandPoll, /* 'F' */ 85 | CommandBottomOfFile, /* 'G' */ 86 | CommandPrevLine, /* 'H' */ 87 | CommandNull, /* 'I' */ 88 | CommandNull, /* 'J' */ 89 | CommandPrevPage, /* 'K' */ 90 | CommandNull, /* 'L' */ 91 | CommandNextPage, /* 'M' */ 92 | CommandRepeatBackward,/* 'N' */ 93 | CommandNull, /* 'O' */ 94 | CommandNextLine, /* 'P' */ /* 5/0 */ 95 | CommandQuit, /* 'Q' */ 96 | CommandReload, /* 'R' */ 97 | CommandNull, /* 'S' */ 98 | CommandReverseCset, /* 'T' */ 99 | CommandNull, /* 'U' */ 100 | CommandVersion, /* 'V' */ 101 | CommandNull, /* 'W' */ 102 | CommandNull, /* 'X' */ 103 | CommandNull, /* 'Y' */ 104 | CommandNull, /* 'Z' */ 105 | CommandNull, /* '[' */ 106 | CommandNull, /* '\' */ 107 | CommandNull, /* ']' */ 108 | CommandNull, /* '^' */ 109 | CommandNull, /* '_' */ 110 | CommandNull, /* '`' */ /* 6/0 */ 111 | CommandNull, /* 'a' */ 112 | CommandPrevPage, /* 'b' */ 113 | CommandNull, /* 'c' */ 114 | CommandNextHalf, /* 'd' */ 115 | CommandNextLine, /* 'e' */ 116 | CommandNextPage, /* 'f' */ 117 | CommandTopOfFile, /* 'g' */ 118 | CommandNull, /* 'h' */ 119 | CommandNull, /* 'i' */ 120 | CommandNextLine, /* 'j' */ 121 | CommandPrevLine, /* 'k' */ 122 | CommandNull, /* 'l' */ 123 | CommandNull, /* 'm' */ 124 | CommandRepeatForward, /* 'n' */ 125 | CommandNull, /* 'o' */ 126 | CommandPercent, /* 'p' */ /* 7/0 */ 127 | CommandQuit, /* 'q' */ 128 | CommandRefresh, /* 'r' */ 129 | #ifdef REGEXP_TEST 130 | CommandRegexpNFA, /* 's' */ 131 | CommandRegexpDFA, /* 't' */ 132 | #else 133 | CommandNull, /* 's' */ 134 | CommandToggleCset, /* 't' */ 135 | #endif /* REGEXP_TEST */ 136 | CommandPrevHalf, /* 'u' */ 137 | CommandEdit, /* 'v' */ 138 | CommandPrevLine, /* 'w' */ 139 | CommandNull, /* 'x' */ 140 | CommandPrevLine, /* 'y' */ 141 | CommandNull, /* 'z' */ 142 | CommandNull, /* '{' */ 143 | CommandNull, /* '|' */ 144 | CommandNull, /* '}' */ 145 | CommandNull, /* '~' */ 146 | CommandNull /* 7/15 */ 147 | }; 148 | 149 | #endif /* __KEYBIND_H__ */ 150 | -------------------------------------------------------------------------------- /src/map8859.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl 2 | 3 | # All rights reserved. Copyright (C) 1999 by NARITA Tomio. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | 10 | # 8859-2 11 | 12 | $file = "zcat 8859-2.TXT.gz |"; 13 | $set = "2"; 14 | 15 | for $i ( 0 .. $#ARGV ){ 16 | if( $ARGV[ $i ] eq "-i" ){ 17 | $file = $ARGV[ ++$i ]; 18 | } elsif( $ARGV[ $i ] eq "-s" ){ 19 | $set = $ARGV[ ++$i ]; 20 | } 21 | } 22 | 23 | open( FILE, $file ) || die( "cannot open $file" ); 24 | 25 | while( ){ 26 | chop; 27 | if( /^#/ ){ 28 | next; 29 | } 30 | ( $code, $uni, $rest ) = split; 31 | if( hex( $code ) >= 0x80 ){ 32 | $count++; 33 | $array{ $uni } = sprintf( "0x%02x", hex( $code ) & 0x7f ); 34 | } 35 | } 36 | 37 | close( FILE ); 38 | 39 | # output 40 | 41 | print "private codes_t mapISO8859_${set}[ $count ] = {\n"; 42 | 43 | for $index ( sort keys( %array ) ){ 44 | $code = $array{ $index }; 45 | $count--; 46 | if( $count == 0 ){ 47 | print " { $index, $code }\n"; 48 | } else { 49 | print " { $index, $code },\n"; 50 | } 51 | } 52 | 53 | print "};\n"; 54 | -------------------------------------------------------------------------------- /src/mapbig5.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl 2 | 3 | # All rights reserved. Copyright (C) 1999 by NARITA Tomio. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | 10 | # Unicode to Big five 11 | 12 | $file = "zcat BIG5.TXT.gz |"; 13 | 14 | for $i ( 0 .. $#ARGV ){ 15 | if( $ARGV[ $i ] eq "-i" ){ 16 | $file = $ARGV[ ++$i ]; 17 | } 18 | } 19 | 20 | open( FILE, $file ) || die( "cannot open $file" ); 21 | 22 | while( ){ 23 | chop; 24 | if( /^#/ ){ 25 | next; 26 | } 27 | ( $big5, $uni, $rest ) = split; 28 | if( $uni ne "0xFFFD" ){ 29 | if( $array{ $uni } ne "" ){ 30 | print STDERR "Warning: duplicate unicode: $uni\n"; 31 | next; 32 | } 33 | 34 | $count++; 35 | $array{ $uni } = $big5; 36 | } 37 | } 38 | 39 | print "private codes_t mapBIG5[ $count ] = {\n"; 40 | 41 | for $index ( sort keys( %array ) ){ 42 | $code = $array{ $index }; 43 | $count--; 44 | if( $count == 0 ){ 45 | print " { $index, $code }\n"; 46 | } else { 47 | print " { $index, $code },\n"; 48 | } 49 | } 50 | 51 | print "};\n"; 52 | -------------------------------------------------------------------------------- /src/mapgb.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl 2 | 3 | # All rights reserved. Copyright (C) 1999 by NARITA Tomio. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | 10 | # Unicode to GB2312 11 | 12 | $file = "zcat GB2312.TXT.gz |"; 13 | 14 | for $i ( 0 .. $#ARGV ){ 15 | if( $ARGV[ $i ] eq "-i" ){ 16 | $file = $ARGV[ ++$i ]; 17 | } 18 | } 19 | 20 | open( FILE, $file ) || die( "cannot open $file" ); 21 | 22 | while( ){ 23 | chop; 24 | if( /^#/ ){ 25 | next; 26 | } 27 | ( $gb, $uni, $rest ) = split; 28 | 29 | if( $array{ $uni } ne "" ){ 30 | print STDERR "Warning: duplicate character, uni:$uni\n"; 31 | next; 32 | } 33 | 34 | $count++; 35 | $array{ $uni } = $gb; 36 | } 37 | 38 | print "private codes_t mapGB2312[ $count ] = {\n"; 39 | 40 | for $index ( sort keys( %array ) ){ 41 | $code = $array{ $index }; 42 | $count--; 43 | if( $count == 0 ){ 44 | print " { $index, $code }\n"; 45 | } else { 46 | print " { $index, $code },\n"; 47 | } 48 | } 49 | 50 | print "};\n"; 51 | -------------------------------------------------------------------------------- /src/mapjis.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl 2 | 3 | # All rights reserved. Copyright (C) 1999 by NARITA Tomio. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | 10 | # Unicode to JIS X 0208 11 | 12 | $file = "zcat JIS0208.TXT.gz |"; 13 | 14 | open( FILE, $file ) || die( "cannot open $file" ); 15 | 16 | while( ){ 17 | chop; 18 | if( /^#/ ){ 19 | next; 20 | } 21 | ( $sjis, $jis, $uni, $rest ) = split; 22 | 23 | $count++; 24 | $array{ $uni } = pack( "A6A7", $jis, ", X0208" ); 25 | } 26 | 27 | close( FILE ); 28 | 29 | # JIS X 0212 30 | 31 | $file = "zcat JIS0212.TXT.gz |"; 32 | 33 | open( FILE, $file ) || die( "cannot open $file" ); 34 | 35 | while( ){ 36 | chop; 37 | if( /^#/ ){ 38 | next; 39 | } 40 | ( $jis, $uni, $rest ) = split; 41 | 42 | if( $array{ $uni } ne "" ){ 43 | print STDERR "Warning: duplicate character, uni:$uni, 0212:$jis\n"; 44 | next; 45 | } 46 | 47 | $count++; 48 | $array{ $uni } = pack( "A6A7", $jis, ", X0212" ); 49 | } 50 | 51 | close( FILE ); 52 | 53 | # Output 54 | 55 | print "private codes_cset_t mapJIS[ $count ] = {\n"; 56 | 57 | for $index ( sort keys( %array ) ){ 58 | $code = $array{ $index }; 59 | $count--; 60 | if( $count == 0 ){ 61 | print " { $index, $code }\n"; 62 | } else { 63 | print " { $index, $code },\n"; 64 | } 65 | } 66 | 67 | print "};\n"; 68 | -------------------------------------------------------------------------------- /src/mapksc.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl 2 | 3 | # All rights reserved. Copyright (C) 1999 by NARITA Tomio. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | 10 | # Unicode to KSC 5601-1987 11 | 12 | $file = "zcat KSX1001.TXT.gz |"; 13 | 14 | for $i ( 0 .. $#ARGV ){ 15 | if( $ARGV[ $i ] eq "-i" ){ 16 | $file = $ARGV[ ++$i ]; 17 | } 18 | } 19 | 20 | open( FILE, $file ) || die( "cannot open $file" ); 21 | 22 | while( ){ 23 | chop; 24 | if( /^#/ ){ 25 | next; 26 | } 27 | ( $ksc, $uni, $rest ) = split; 28 | $count++; 29 | $array{ $uni } = $ksc; 30 | } 31 | 32 | print "private codes_t mapKSC5601[ $count ] = {\n"; 33 | 34 | for $index ( sort keys( %array ) ){ 35 | $code = $array{ $index }; 36 | $count--; 37 | if( $count == 0 ){ 38 | print " { $index, $code }\n"; 39 | } else { 40 | print " { $index, $code },\n"; 41 | } 42 | } 43 | 44 | print "};\n"; 45 | -------------------------------------------------------------------------------- /src/nfa.c: -------------------------------------------------------------------------------- 1 | /* 2 | * nfa.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: nfa.c,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | private set_t *SetAlloc( re_t *re ) 34 | { 35 | set_t *set; 36 | 37 | set = (set_t *)Malloc( sizeof( set_t ) ); 38 | 39 | set->re = re; 40 | set->next = NULL; 41 | 42 | return set; 43 | } 44 | 45 | public void ReInclude( set_t **root, re_t *target ) 46 | { 47 | set_t *new, *ptr, *last, *res; 48 | 49 | if( NULL == target ) 50 | return; 51 | 52 | res = NULL; 53 | for( last = NULL, ptr = *root ; ptr ; last = ptr, ptr = ptr->next ){ 54 | if( ptr->re == target ){ 55 | res = ptr; 56 | break; 57 | } 58 | if( ptr->re->op < target->op ) 59 | break; 60 | } 61 | 62 | if( NULL == res ){ 63 | /* 64 | * insert new into root in descendent order 65 | */ 66 | new = SetAlloc( target ); 67 | 68 | if( NULL == last ){ 69 | new->next = *root; 70 | *root = new; 71 | } else { 72 | new->next = last->next; 73 | last->next = new; 74 | } 75 | } 76 | } 77 | 78 | public void SetInclude( set_t **root, set_t *target ) 79 | { 80 | set_t *set; 81 | 82 | for( set = target ; set ; set = set->next ) 83 | ReInclude( root, set->re ); 84 | } 85 | 86 | private int ReNullable( re_t *re ) 87 | { 88 | if( NULL == re ) 89 | return FALSE; 90 | 91 | if( OP_OR == re->op ) 92 | return ReNullable( re->left ) || ReNullable( re->right ); 93 | else if( OP_CAT == re->op ) 94 | return ReNullable( re->left ) && ReNullable( re->right ); 95 | else if( OP_CLOSURE == re->op || OP_QUESTION == re->op ) 96 | return TRUE; 97 | else 98 | return FALSE; 99 | } 100 | 101 | public set_t *ReFirstpos( re_t *re ) 102 | { 103 | set_t *set = NULL; 104 | 105 | if( NULL == re ) 106 | return NULL; 107 | 108 | if( NULL != re->firstpos ) 109 | return (set_t *)re->firstpos; 110 | 111 | if( OP_OR == re->op ){ 112 | SetInclude( (set_t **)&set, ReFirstpos( re->left ) ); 113 | SetInclude( (set_t **)&set, ReFirstpos( re->right ) ); 114 | } else if( OP_CAT == re->op ){ 115 | if( ReNullable( re->left ) ){ 116 | SetInclude( (set_t **)&set, ReFirstpos( re->left ) ); 117 | SetInclude( (set_t **)&set, ReFirstpos( re->right ) ); 118 | } else { 119 | SetInclude( (set_t **)&set, ReFirstpos( re->left ) ); 120 | } 121 | } else if( OP_CLOSURE == re->op || OP_QUESTION == re->op ){ 122 | SetInclude( (set_t **)&set, ReFirstpos( re->left ) ); 123 | } else 124 | set = SetAlloc( re ); 125 | 126 | re->firstpos = (void *)set; 127 | 128 | return set; 129 | } 130 | 131 | public set_t *ReLastpos( re_t *re ) 132 | { 133 | set_t *set = NULL; 134 | 135 | if( NULL == re ) 136 | return NULL; 137 | 138 | if( NULL != re->lastpos ) 139 | return (set_t *)re->lastpos; 140 | 141 | if( OP_OR == re->op ){ 142 | SetInclude( (set_t **)&set, ReLastpos( re->right ) ); 143 | SetInclude( (set_t **)&set, ReLastpos( re->left ) ); 144 | } else if( OP_CAT == re->op ){ 145 | if( ReNullable( re->right ) ){ 146 | SetInclude( (set_t **)&set, ReLastpos( re->right ) ); 147 | SetInclude( (set_t **)&set, ReLastpos( re->left ) ); 148 | } else { 149 | SetInclude( (set_t **)&set, ReLastpos( re->right ) ); 150 | } 151 | } else if( OP_CLOSURE == re->op || OP_QUESTION == re->op ){ 152 | SetInclude( (set_t **)&set, ReLastpos( re->left ) ); 153 | } else 154 | set = SetAlloc( re ); 155 | 156 | re->lastpos = (void *)set; 157 | 158 | return set; 159 | } 160 | 161 | public void ReFollowpos( re_t *re ) 162 | { 163 | set_t *set; 164 | 165 | if( NULL == re ) 166 | return; 167 | 168 | if( NULL != re->followpos ) 169 | return; 170 | 171 | if( OP_CAT == re->op ){ 172 | for( set = ReLastpos( re->left ) ; set ; set = set->next ) 173 | SetInclude( (set_t **)&set->re->followpos, ReFirstpos( re->right ) ); 174 | } else if( OP_CLOSURE == re->op ){ 175 | for( set = ReLastpos( re ) ; set ; set = set->next ) 176 | SetInclude( (set_t **)&set->re->followpos, ReFirstpos( re ) ); 177 | } else if( OP_QUESTION == re->op ){ 178 | /* nothing follows */ 179 | } 180 | } 181 | 182 | public void ReMakeFollowpos( re_t *re ) 183 | { 184 | if( NULL == re ) 185 | return; 186 | 187 | ReFirstpos( re->left ); 188 | ReFirstpos( re->right ); 189 | ReFirstpos( re ); 190 | 191 | ReLastpos( re->left ); 192 | ReLastpos( re->right ); 193 | ReLastpos( re ); 194 | 195 | ReMakeFollowpos( re->left ); 196 | ReMakeFollowpos( re->right ); 197 | ReFollowpos( re ); 198 | } 199 | -------------------------------------------------------------------------------- /src/nfa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * nfa.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: nfa.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __NFA_H__ 9 | #define __NFA_H__ 10 | 11 | #include 12 | 13 | public void ReInclude( set_t **root, re_t *target ); 14 | public void SetInclude( set_t **root, set_t *target ); 15 | public void ReMakeFollowpos( re_t *re ); 16 | 17 | public set_t *ReFirstpos( re_t *re ); 18 | public set_t *ReLastpos( re_t *re ); 19 | public void ReFollowpos( re_t *re ); 20 | 21 | #endif /* __NFA_H__ */ 22 | -------------------------------------------------------------------------------- /src/position.h: -------------------------------------------------------------------------------- 1 | /* 2 | * position.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: position.h,v 1.5 2004/01/05 07:30:15 nrt Exp $ 6 | */ 7 | 8 | #ifndef __POSITION_H__ 9 | #define __POSITION_H__ 10 | 11 | #include 12 | #include 13 | 14 | #define PositionGet( pos, s, b, o, p ) \ 15 | { \ 16 | (s) = (pos).seg; \ 17 | (b) = (pos).blk; \ 18 | (o) = (pos).off; \ 19 | (p) = (pos).phy; \ 20 | } 21 | 22 | #define PositionSet( pos, s, b, o, p ) \ 23 | { \ 24 | (pos).seg = (s); \ 25 | (pos).blk = (b); \ 26 | (pos).off = (o); \ 27 | (pos).phy = (p); \ 28 | } 29 | 30 | #define PositionAssign( toPos, fromPos ) \ 31 | { \ 32 | (toPos).seg = (fromPos).seg; \ 33 | (toPos).blk = (fromPos).blk; \ 34 | (toPos).off = (fromPos).off; \ 35 | (toPos).phy = (fromPos).phy; \ 36 | } 37 | 38 | #define PositionDec( f, seg, blk, off, phy ) \ 39 | { \ 40 | if( --(phy) < 0 ){ \ 41 | if( --(off) < 0 ){ \ 42 | if( (seg) == 0 ){ /* top of file */ \ 43 | (phy)++; \ 44 | (off)++; \ 45 | /* \ 46 | * BREAK for EXTERNAL FOR-LOOP \ 47 | */ \ 48 | break; \ 49 | } else { \ 50 | if( FALSE == FetchLine( (f), (seg) - 1, LV_PAGE_SIZE - 1 ) ){ \ 51 | /* \ 52 | * memory shortage? \ 53 | */ \ 54 | fprintf( stderr, "memory shortage?\n" ); \ 55 | FatalErrorOccurred(); \ 56 | } else { /* successfully loaded */ \ 57 | (seg)--; \ 58 | (blk) = Block( (seg) ); \ 59 | (off) = (f)->page[ (blk) ].lines - 1; \ 60 | } \ 61 | } \ 62 | } \ 63 | (phy) = (f)->page[ (blk) ].line[ (off) ].heads - 1; \ 64 | } \ 65 | } 66 | 67 | #define PositionInc( f, seg, blk, off, phy ) \ 68 | { \ 69 | if( ++(phy) >= (f)->page[ (blk) ].line[ (off) ].heads ){ \ 70 | if( ++(off) >= (f)->page[ (blk) ].lines ){ \ 71 | if( FALSE == FetchLine( (f), (seg) + 1, 0 ) ){ \ 72 | /* end of file */ \ 73 | (phy)--; \ 74 | (off)--; \ 75 | /* \ 76 | * BREAK for EXTERNAL FOR-LOOP \ 77 | */ \ 78 | break; \ 79 | } else { /* successfully loaded */ \ 80 | (seg)++; \ 81 | (blk) = Block( (seg) ); \ 82 | (off) = 0; \ 83 | } \ 84 | } \ 85 | (phy) = 0; \ 86 | } \ 87 | } 88 | 89 | #endif /* __POSITION_H__ */ 90 | -------------------------------------------------------------------------------- /src/raw.c: -------------------------------------------------------------------------------- 1 | /* 2 | * raw.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: raw.c,v 1.6 2004/01/05 07:23:29 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | public void DecodeRaw( state_t *state, byte codingSystem ) 32 | { 33 | byte ch, c[ ICHAR_WIDTH ]; 34 | 35 | for( ; ; ){ 36 | GetChar( ch ); 37 | if( SP == ch ){ 38 | DecodeAddSpace( 0 ); 39 | } else if( HT == ch ){ 40 | DecodeAddTab( 0 ); 41 | } else if( ch < SP || ch >= DEL ){ 42 | DecodeAddControl( ch ); 43 | } else { 44 | c[ 0 ] = ch; 45 | DecodeAddChar( ASCII, c, 0 ); 46 | } 47 | } 48 | } 49 | 50 | public void EncodeRaw( i_str_t *istr, int head, int tail, 51 | byte codingSystem, boolean_t binary ) 52 | { 53 | int idx, attr; 54 | ic_t ic; 55 | byte cset; 56 | 57 | for( idx = head ; idx < tail ; idx++ ){ 58 | cset = istr[ idx ].charset; 59 | ic = istr[ idx ].c; 60 | attr = (int)istr[ idx ].attr << 8; 61 | if( cset < PSEUDO ){ 62 | if( TRUE == iTable[ (int)cset ].multi ){ 63 | EncodeAddChar( attr, MakeByte1( ic ) ); 64 | if( 2 == IcharWidth( cset, ic ) ) 65 | EncodeAddChar( attr, MakeByte2( ic ) ); 66 | } else { 67 | EncodeAddChar( attr, ic ); 68 | } 69 | } else if( FALSE == EncodeAddPseudo( attr, ic, cset, binary ) ){ 70 | break; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/raw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * raw.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: raw.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __RAW_H__ 9 | #define __RAW_H__ 10 | 11 | #include 12 | 13 | public void DecodeRaw( state_t *state, byte codingSystem ); 14 | 15 | public void EncodeRaw( i_str_t *istr, int head, int tail, 16 | byte codingSystem, boolean_t binary ); 17 | 18 | #endif /* __RAW_H__ */ 19 | -------------------------------------------------------------------------------- /src/re.h: -------------------------------------------------------------------------------- 1 | /* 2 | * re.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: re.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __RE_H__ 9 | #define __RE_H__ 10 | 11 | #include 12 | 13 | /* 14 | * regular expression 15 | * 16 | * regexp = [ '^' ] [ '$' ] 17 | * exp = { '\|' } 18 | * exp1 = { } 19 | * exp2 = [ '*' | '?' | '+' ] 20 | * term = | '.' | '\1' | '\2' 21 | * | '\(' '\)' 22 | * | '[' [ '^' ] ']' 23 | * char = | '\' 24 | * charset = { } 25 | * charset1 = [ '-' ] 26 | */ 27 | 28 | #define OP_LEAF 0 29 | #define OP_SIMPLE_LEAF 1 30 | #define OP_HAT 2 31 | #define OP_DOLLAR 3 32 | #define OP_RANGE 4 33 | #define OP_COMPLEMENT 5 34 | #define OP_COMPRANGE 6 35 | #define OP_CATEGORY1 7 36 | #define OP_CATEGORY2 8 37 | #define OP_CATEGORY3 9 38 | #define OP_PERIOD 10 39 | #define OP_IGETA 11 40 | 41 | #define OP_LEAF_MAX 12 42 | 43 | #define OP_OR 12 44 | #define OP_CLOSURE 13 45 | #define OP_QUESTION 14 46 | #define OP_CAT 15 47 | 48 | /* 49 | * ic list 50 | */ 51 | 52 | typedef struct RE_T { 53 | int op; 54 | #ifdef MSDOS 55 | #undef i_str_t 56 | #endif /* MSDOS */ 57 | i_str_t *ic; 58 | #ifdef MSDOS 59 | #define i_str_t i_str_t far 60 | #endif /* MSDOS */ 61 | struct RE_T *left, *right; 62 | void *firstpos, *lastpos, *followpos; 63 | } re_t; 64 | 65 | typedef struct SET_T { 66 | re_t *re; 67 | struct SET_T *next; 68 | } set_t; 69 | 70 | public byte *reMessage; 71 | 72 | public void SetFreeAll( set_t *set ); 73 | public void ReFreeAll( re_t *re ); 74 | public re_t *ReMakeTree( i_str_t *istr ); 75 | 76 | #endif /* __RE_H__ */ 77 | -------------------------------------------------------------------------------- /src/rev0208.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl 2 | 3 | # All rights reserved. Copyright (C) 1999 by NARITA Tomio. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | 10 | # Unicode to JIS X 0208 11 | 12 | $file = "zcat JIS0208.TXT.gz |"; 13 | 14 | for $i ( 0 .. $#ARGV ){ 15 | if( $ARGV[ $i ] eq "-i" ){ 16 | $file = $ARGV[ ++$i ]; 17 | } 18 | } 19 | 20 | open( FILE, $file ) || die( "cannot open $file" ); 21 | 22 | while( ){ 23 | chop; 24 | if( /^#/ ){ 25 | next; 26 | } 27 | ( $sjis, $jis, $uni, $rest ) = split; 28 | 29 | $count++; 30 | $array{ $jis } = $uni; 31 | } 32 | 33 | close( FILE ); 34 | 35 | # Output 36 | 37 | print "private codes_t revJIS0208[ $count ] = {\n"; 38 | 39 | for $index ( sort keys( %array ) ){ 40 | $code = $array{ $index }; 41 | $count--; 42 | if( $count == 0 ){ 43 | print " { $index, $code }\n"; 44 | } else { 45 | print " { $index, $code },\n"; 46 | } 47 | } 48 | 49 | print "};\n"; 50 | -------------------------------------------------------------------------------- /src/rev0212.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl 2 | 3 | # All rights reserved. Copyright (C) 1999 by NARITA Tomio. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | 10 | # JIS X 0212 to Unicode 11 | 12 | $file = "zcat JIS0212.TXT.gz |"; 13 | 14 | for $i ( 0 .. $#ARGV ){ 15 | if( $ARGV[ $i ] eq "-i" ){ 16 | $file = $ARGV[ ++$i ]; 17 | } 18 | } 19 | 20 | open( FILE, $file ) || die( "cannot open $file" ); 21 | 22 | while( ){ 23 | chop; 24 | if( /^#/ ){ 25 | next; 26 | } 27 | ( $jis, $uni, $rest ) = split; 28 | 29 | $count++; 30 | $array{ $jis } = $uni; 31 | } 32 | 33 | close( FILE ); 34 | 35 | # Output 36 | 37 | print "private codes_t revJIS0212[ $count ] = {\n"; 38 | 39 | for $index ( sort keys( %array ) ){ 40 | $code = $array{ $index }; 41 | $count--; 42 | if( $count == 0 ){ 43 | print " { $index, $code }\n"; 44 | } else { 45 | print " { $index, $code },\n"; 46 | } 47 | } 48 | 49 | print "};\n"; 50 | -------------------------------------------------------------------------------- /src/rev8859.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl 2 | 3 | # All rights reserved. Copyright (C) 1999 by NARITA Tomio. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | 10 | # ISO 8859-* to Unicode 11 | 12 | $file = "zcat 8859-2.TXT.gz |"; 13 | $set = "2"; 14 | 15 | for $i ( 0 .. $#ARGV ){ 16 | if( $ARGV[ $i ] eq "-i" ){ 17 | $file = $ARGV[ ++$i ]; 18 | } elsif( $ARGV[ $i ] eq "-s" ){ 19 | $set = $ARGV[ ++$i ]; 20 | } 21 | } 22 | 23 | open( FILE, $file ) || die( "cannot open $file" ); 24 | 25 | for( $index = 0x20 ; $index < 0x80 ; $index++ ){ 26 | $array{$index} = "0x0000"; 27 | } 28 | 29 | while( ){ 30 | chop; 31 | if( /^#/ ){ 32 | next; 33 | } 34 | ( $code, $uni, $rest ) = split; 35 | if( hex( $code ) >= 0x80 ){ 36 | $count++; 37 | # $array{ sprintf( "0x%02x", hex( $code ) & 0x7f ) } = $uni; 38 | $array{ hex( $code ) & 0x7f } = $uni; 39 | } 40 | } 41 | 42 | close( FILE ); 43 | 44 | #print "private codes_t revISO8859_${set}[ $count ] = {\n"; 45 | print "private ic_t revISO8859_${set}[ 96 ] = {\n"; 46 | 47 | for( $index = 0x20 ; $index < 0x80 ; $index++ ){ 48 | if( 0x7f == $index ){ 49 | print " $array{$index}\n"; 50 | } else { 51 | print " $array{$index},\n"; 52 | } 53 | } 54 | 55 | #for $index ( sort keys( %array ) ){ 56 | # $code = $array{ $index }; 57 | # $count--; 58 | # if( $count == 0 ){ 59 | # print " { $index, $code }\n"; 60 | # } else { 61 | # print " { $index, $code },\n"; 62 | # } 63 | #} 64 | 65 | print "};\n"; 66 | -------------------------------------------------------------------------------- /src/revbig5.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl 2 | 3 | # All rights reserved. Copyright (C) 1999 by NARITA Tomio. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | 10 | # Big five to Unicode 11 | 12 | $file = "zcat BIG5.TXT.gz |"; 13 | 14 | for $i ( 0 .. $#ARGV ){ 15 | if( $ARGV[ $i ] eq "-i" ){ 16 | $file = $ARGV[ ++$i ]; 17 | } 18 | } 19 | 20 | open( FILE, $file ) || die( "cannot open $file" ); 21 | 22 | while( ){ 23 | chop; 24 | if( /^#/ ){ 25 | next; 26 | } 27 | ( $big5, $uni, $rest ) = split; 28 | if( $uni ne "0xFFFD" ){ 29 | $count++; 30 | $array{ $big5 } = $uni; 31 | } 32 | } 33 | 34 | print "private codes_t revBIG5[ $count ] = {\n"; 35 | 36 | for $index ( sort keys( %array ) ){ 37 | $code = $array{ $index }; 38 | $count--; 39 | if( $count == 0 ){ 40 | print " { $index, $code }\n"; 41 | } else { 42 | print " { $index, $code },\n"; 43 | } 44 | } 45 | 46 | print "};\n"; 47 | -------------------------------------------------------------------------------- /src/revgb.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl 2 | 3 | # All rights reserved. Copyright (C) 1999 by NARITA Tomio. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | 10 | # Unicode to GB2312 11 | 12 | $file = "zcat GB2312.TXT.gz |"; 13 | 14 | for $i ( 0 .. $#ARGV ){ 15 | if( $ARGV[ $i ] eq "-i" ){ 16 | $file = $ARGV[ ++$i ]; 17 | } 18 | } 19 | 20 | open( FILE, $file ) || die( "cannot open $file" ); 21 | 22 | while( ){ 23 | chop; 24 | if( /^#/ ){ 25 | next; 26 | } 27 | ( $gb, $uni, $rest ) = split; 28 | 29 | if( $array{ $gb } ne "" ){ 30 | print STDERR "Warning: duplicate character, gb:$gb\n"; 31 | next; 32 | } 33 | 34 | $count++; 35 | $array{ $gb } = $uni; 36 | } 37 | 38 | print "private codes_t revGB2312[ $count ] = {\n"; 39 | 40 | for $index ( sort keys( %array ) ){ 41 | $code = $array{ $index }; 42 | $count--; 43 | if( $count == 0 ){ 44 | print " { $index, $code }\n"; 45 | } else { 46 | print " { $index, $code },\n"; 47 | } 48 | } 49 | 50 | print "};\n"; 51 | -------------------------------------------------------------------------------- /src/revksc.pl: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/perl 2 | 3 | # All rights reserved. Copyright (C) 1999 by NARITA Tomio. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | 10 | # Unicode to KSC 5601-1987 11 | 12 | $file = "zcat KSX1001.TXT.gz |"; 13 | 14 | for $i ( 0 .. $#ARGV ){ 15 | if( $ARGV[ $i ] eq "-i" ){ 16 | $file = $ARGV[ ++$i ]; 17 | } 18 | } 19 | 20 | open( FILE, $file ) || die( "cannot open $file" ); 21 | 22 | while( ){ 23 | chop; 24 | if( /^#/ ){ 25 | next; 26 | } 27 | ( $ksc, $uni, $rest ) = split; 28 | $count++; 29 | $array{ $ksc } = $uni; 30 | } 31 | 32 | print "private codes_t revKSC5601[ $count ] = {\n"; 33 | 34 | for $index ( sort keys( %array ) ){ 35 | $code = $array{ $index }; 36 | $count--; 37 | if( $count == 0 ){ 38 | print " { $index, $code }\n"; 39 | } else { 40 | print " { $index, $code },\n"; 41 | } 42 | } 43 | 44 | print "};\n"; 45 | -------------------------------------------------------------------------------- /src/screen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * screen.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: screen.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __SCREEN_H__ 9 | #define __SCREEN_H__ 10 | 11 | #include 12 | 13 | public boolean_t ScreenTop( file_t *f, unsigned int logical ); 14 | public boolean_t ScreenTopPhysical( file_t *f, position_t *pos ); 15 | public boolean_t ScreenBot( file_t *f ); 16 | 17 | public unsigned int ScreenPrev( file_t *f, int physical ); 18 | public unsigned int ScreenNext( file_t *f, int physical ); 19 | 20 | public void ScreenRefresh( file_t *f ); 21 | 22 | #endif /* __SCREEN_H__ */ 23 | -------------------------------------------------------------------------------- /src/shiftjis.c: -------------------------------------------------------------------------------- 1 | /* 2 | * shiftjis.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: shiftjis.c,v 1.7 2004/01/05 07:23:29 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | private void msk2jis( byte *c ) 35 | { 36 | int c1, c2; 37 | 38 | c1 = (int)c[ 0 ]; 39 | c2 = (int)c[ 1 ]; 40 | 41 | if( 0x00e0 <= c1 ) 42 | c1 = ( c1 << 1 ) - 0x0160; /* 63-94 ku */ 43 | else 44 | c1 = ( c1 << 1 ) - 0x00e0; /* 01-62 ku */ 45 | 46 | if( 0x009f <= c2 ) 47 | c2 -= 0x007e; /* even ku */ 48 | else { 49 | c1--; /* odd ku */ 50 | if( c2 >= (int)DEL ) 51 | c2 -= 0x0020; 52 | else 53 | c2 -= 0x001f; 54 | } 55 | 56 | c[ 0 ] = (byte)c1; 57 | c[ 1 ] = (byte)c2; 58 | } 59 | 60 | public void DecodeShiftJis( state_t *state, byte codingSystem ) 61 | { 62 | byte charset, ch; 63 | byte c[ ICHAR_WIDTH ]; 64 | 65 | for( ; ; ){ 66 | GetChar( ch ); 67 | if( ch < SP ){ 68 | if( ESC == ch ){ 69 | if( FALSE == DecodeEscape( state ) ) 70 | break; 71 | } else if( HT == ch ) 72 | DecodeAddTab( state->attr ); 73 | else if( SO == ch ) /* LS1 for 8bit */ 74 | state->gset[ GL ] = G1; 75 | else if( SI == ch ) /* LS0 for 8bit */ 76 | state->gset[ GL ] = G0; 77 | else if( BS == ch ) 78 | DecodeAddBs(); 79 | else 80 | DecodeAddControl( ch ); 81 | } else { 82 | if( 0 != state->sset ){ 83 | if( FALSE == DecodeAddShifted( state, ch ) ) 84 | break; 85 | else 86 | continue; 87 | } else if( 0x80 & ch ){ 88 | if( IsShiftJisByte1( ch ) ){ 89 | charset = X0208; 90 | c[ 0 ] = ch; 91 | GetChar( ch ); 92 | c[ 1 ] = ch; 93 | msk2jis( c ); 94 | if( !IsGraphicChar94( c[ 0 ] ) || !IsGraphicChar94( c[ 1 ] ) ){ 95 | DecodeAddControl( ch ); 96 | continue; 97 | } 98 | } else if( IsKatakana( 0x7f & ch ) ){ 99 | charset = X0201KANA; 100 | c[ 0 ] = 0x7f & ch; 101 | } else { 102 | DecodeAddControl( ch ); 103 | continue; 104 | } 105 | } else { 106 | /* 107 | * iso-2022 108 | */ 109 | charset = CSET( G0 ); 110 | if( !IsGraphicChar( charset, ch ) ){ 111 | if( SP == ch ){ 112 | DecodeAddSpace( state->attr ); 113 | } else { 114 | DecodeAddControl( ch ); 115 | } 116 | continue; 117 | } else if( X0201KANA == charset && !IsKatakana( ch ) ){ 118 | DecodeAddControl( ch ); 119 | continue; 120 | } 121 | c[ 0 ] = ch; 122 | if( TRUE == iTable[ (int)charset ].multi ){ 123 | GetChar( ch ); 124 | ch &= 0x7f; 125 | if( !IsGraphicChar( charset, ch ) ) 126 | continue; 127 | c[ 1 ] = ch; 128 | } 129 | } 130 | DecodeAddChar( charset, c, state->attr ); 131 | } 132 | } 133 | } 134 | 135 | private void jis2msk( byte *c ) 136 | { 137 | int c1, c2; 138 | 139 | c1 = (int)c[ 0 ]; 140 | c2 = (int)c[ 1 ]; 141 | 142 | if( 0 == ( c1 & 0x0001 ) ) 143 | c2 += 0x007e; /* even ku */ 144 | else { 145 | if( c2 >= 0x0060 ) /* odd ku */ 146 | c2 += 0x0020; 147 | else 148 | c2 += 0x001f; 149 | } 150 | 151 | if( 0x005f <= c1 ) 152 | c1 = ( ( c1 - 0x005f ) >> 1 ) + 0x00e0; /* 63-94 ku */ 153 | else 154 | c1 = ( ( c1 - 0x0021 ) >> 1 ) + 0x0081; /* 01-62 ku */ 155 | 156 | c[ 0 ] = (byte)c1; 157 | c[ 1 ] = (byte)c2; 158 | } 159 | 160 | public void EncodeShiftJis( i_str_t *istr, int head, int tail, 161 | byte codingSystem, boolean_t binary ) 162 | { 163 | int idx, attr; 164 | ic_t ic; 165 | byte cset, sj[ 2 ]; 166 | 167 | for( idx = head ; idx < tail ; idx++ ){ 168 | cset = istr[ idx ].charset; 169 | ic = istr[ idx ].c; 170 | attr = (int)istr[ idx ].attr << 8; 171 | #ifndef MSDOS /* IF NOT DEFINED */ 172 | if( UNICODE == cset ) 173 | ic = UNItoJIS( ic, &cset ); 174 | #endif /* MSDOS */ 175 | if( cset < PSEUDO ){ 176 | if( ASCII == cset ){ 177 | EncodeAddChar( attr, ic ); 178 | } else if( X0208 == cset || C6226 == cset ){ 179 | sj[ 0 ] = MakeByte1( ic ); 180 | sj[ 1 ] = MakeByte2( ic ); 181 | jis2msk( sj ); 182 | EncodeAddChar( attr, sj[ 0 ] ); 183 | EncodeAddChar( attr, sj[ 1 ] ); 184 | } else if( X0201KANA == cset ){ 185 | EncodeAddChar( attr, 0x80 | ic ); 186 | } else { 187 | if( FALSE == EncodeAddInvalid( attr, ic, cset ) ) 188 | break; 189 | } 190 | } else if( FALSE == EncodeAddPseudo( attr, ic, cset, binary ) ){ 191 | break; 192 | } 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /src/shiftjis.h: -------------------------------------------------------------------------------- 1 | /* 2 | * shiftjis.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: shiftjis.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __SHIFTJIS_H__ 9 | #define __SHIFTJIS_H__ 10 | 11 | #include 12 | #include 13 | 14 | public void DecodeShiftJis( state_t *state, byte codingSystem ); 15 | 16 | public void EncodeShiftJis( i_str_t *istr, int head, int tail, 17 | byte codingSystem, boolean_t binary ); 18 | 19 | #endif /* __SHIFTJIS_H__ */ 20 | -------------------------------------------------------------------------------- /src/str.h: -------------------------------------------------------------------------------- 1 | /* 2 | * str.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: str.h,v 1.5 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __STR_H__ 9 | #define __STR_H__ 10 | 11 | #define STR_SIZE 1024 /* string logical maximum length */ 12 | 13 | typedef unsigned short str_t; 14 | 15 | #endif /* __STR_H__ */ 16 | -------------------------------------------------------------------------------- /src/stream.c: -------------------------------------------------------------------------------- 1 | /* 2 | * stream.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: stream.c,v 1.5 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef UNIX 30 | #include 31 | #include 32 | #include 33 | #endif /* UNIX */ 34 | 35 | #ifdef MSDOS 36 | #include 37 | #endif /* MSDOS */ 38 | 39 | #include 40 | #include 41 | #include 42 | #include "stream.h" 43 | 44 | private byte *gz_filter = "zcat"; 45 | private byte *bz2_filter = "bzcat"; 46 | 47 | private stream_t *StreamAlloc() 48 | { 49 | stream_t *st; 50 | 51 | st = (stream_t *)Malloc( sizeof( stream_t ) ); 52 | 53 | st->fp = NULL; 54 | st->sp = NULL; 55 | st->pid = -1; 56 | 57 | return st; 58 | } 59 | 60 | public stream_t *StreamOpen( byte *file ) 61 | { 62 | stream_t *st; 63 | byte *exts, *filter = NULL; 64 | 65 | if( access( file, 0 ) ){ 66 | perror( file ); 67 | return NULL; 68 | } 69 | 70 | st = StreamAlloc(); 71 | 72 | if( NULL != (exts = Exts( file )) ){ 73 | if( !strcmp( "gz", exts ) || !strcmp( "GZ", exts ) 74 | || !strcmp( "z", exts ) || !strcmp( "Z", exts ) ) 75 | filter = gz_filter; 76 | else if( !strcmp( "bz2", exts ) || !strcmp( "BZ2", exts ) ) 77 | filter = bz2_filter; 78 | } 79 | if( NULL != filter ){ 80 | /* 81 | * zcat or bzcat 82 | */ 83 | if( NULL == (st->fp = (FILE *)tmpfile()) ) 84 | perror( "temporary file" ), exit( -1 ); 85 | 86 | #ifdef MSDOS 87 | { int sout; 88 | 89 | sout = dup( 1 ); 90 | close( 1 ); 91 | dup( fileno( st->fp ) ); 92 | if( 0 > spawnlp( 0, filter, filter, file, NULL ) ) 93 | FatalErrorOccurred(); 94 | close( 1 ); 95 | dup( sout ); 96 | rewind( st->fp ); 97 | 98 | return st; 99 | } 100 | #endif /* MSDOS */ 101 | 102 | #ifdef UNIX 103 | { int fds[ 2 ], pid; 104 | 105 | if( 0 > pipe( fds ) ) 106 | perror( "pipe" ), exit( -1 ); 107 | 108 | switch( pid = fork() ){ 109 | case -1: 110 | perror( "fork" ), exit( -1 ); 111 | case 0: 112 | /* 113 | * child process 114 | */ 115 | close( fds[ 0 ] ); 116 | close( 1 ); 117 | dup( fds[ 1 ] ); 118 | if( 0 > execlp( filter, filter, file, NULL ) ) 119 | perror( filter ), exit( -1 ); 120 | /* 121 | * never reach here 122 | */ 123 | default: 124 | /* 125 | * parent process 126 | */ 127 | st->pid = pid; 128 | close( fds[ 1 ] ); 129 | if( NULL == (st->sp = fdopen( fds[ 0 ], "r" )) ) 130 | perror( "fdopen" ), exit( -1 ); 131 | 132 | return st; 133 | } 134 | } 135 | #endif /* UNIX */ 136 | } 137 | 138 | if( NULL == (st->fp = fopen( file, "rb" )) ){ 139 | perror( file ); 140 | return NULL; 141 | } 142 | 143 | return st; 144 | } 145 | 146 | private void StdinDuplicationFailed() 147 | { 148 | fprintf( stderr, "lv: stdin duplication failed\n" ); 149 | exit( -1 ); 150 | } 151 | 152 | public stream_t *StreamReconnectStdin() 153 | { 154 | stream_t *st; 155 | #ifdef UNIX 156 | struct stat sbuf; 157 | #endif 158 | 159 | st = StreamAlloc(); 160 | 161 | #ifdef MSDOS 162 | if( NULL == (st->fp = fdopen( dup( 0 ), "rb" )) ) 163 | StdinDuplicationFailed(); 164 | close( 0 ); 165 | dup( 1 ); 166 | #endif /* MSDOS */ 167 | #ifdef UNIX 168 | fstat( 0, &sbuf ); 169 | if( S_IFREG == ( sbuf.st_mode & S_IFMT ) ){ 170 | /* regular */ 171 | if( NULL == (st->fp = fdopen( dup( 0 ), "r" )) ) 172 | StdinDuplicationFailed(); 173 | } else { 174 | /* socket */ 175 | if( NULL == (st->fp = (FILE *)tmpfile()) ) 176 | perror( "temporary file" ), exit( -1 ); 177 | if( NULL == (st->sp = fdopen( dup( 0 ), "r" )) ) 178 | StdinDuplicationFailed(); 179 | } 180 | close( 0 ); 181 | if( IsAtty( 1 ) && 0 != open( "/dev/tty", O_RDONLY ) ) 182 | perror( "/dev/tty" ), exit( -1 ); 183 | #endif /* UNIX */ 184 | 185 | return st; 186 | } 187 | 188 | public boolean_t StreamClose( stream_t *st ) 189 | { 190 | fclose( st->fp ); 191 | if( st->sp ) 192 | fclose( st->fp ); 193 | 194 | free( st ); 195 | 196 | return TRUE; 197 | } 198 | -------------------------------------------------------------------------------- /src/stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * stream.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: stream.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __STREAM_H__ 9 | #define __STREAM_H__ 10 | 11 | #include 12 | 13 | typedef struct { 14 | FILE *fp; 15 | FILE *sp; 16 | int pid; 17 | } stream_t; 18 | 19 | public stream_t *StreamOpen( byte *file ); 20 | public boolean_t StreamClose( stream_t *st ); 21 | public stream_t *StreamReconnectStdin(); 22 | 23 | #endif /* __STREAM_H__ */ 24 | -------------------------------------------------------------------------------- /src/unimap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * unimap.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: unimap.h,v 1.4 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __UNIMAP_H__ 9 | #define __UNIMAP_H__ 10 | 11 | #include 12 | 13 | public boolean_t unimap_iso8859; 14 | 15 | public ic_t UNItoISO8859( ic_t ic, byte *cset, byte codingSystem ); 16 | 17 | public ic_t UNItoBIG5( ic_t ic, byte *cset ); 18 | public ic_t UNItoCNS( ic_t ic, byte *cset ); 19 | public ic_t UNItoGB( ic_t ic, byte *cset ); 20 | public ic_t UNItoJIS( ic_t ic, byte *cset ); 21 | public ic_t UNItoKSC( ic_t ic, byte *cset ); 22 | 23 | public ic_t UNItoChinese( ic_t ic, byte *cset ); 24 | public ic_t UNItoJapanese( ic_t ic, byte *cset ); 25 | public ic_t UNItoKorean( ic_t ic, byte *cset ); 26 | 27 | public void ConvertFromUNI( i_str_t *istr, byte codingSystem ); 28 | 29 | #endif /* __UNIMAP_H__ */ 30 | -------------------------------------------------------------------------------- /src/unirev.h: -------------------------------------------------------------------------------- 1 | /* 2 | * unirev.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: unirev.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __UNIREV_H__ 9 | #define __UNIREV_H__ 10 | 11 | #include 12 | 13 | public ic_t RevUNI( ic_t ic, byte *cset ); 14 | public void ConvertToUNI( i_str_t *istr ); 15 | 16 | #endif /* __UNIREV_H__ */ 17 | -------------------------------------------------------------------------------- /src/utf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * utf.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: utf.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __UTF_H__ 9 | #define __UTF_H__ 10 | 11 | #include 12 | #include 13 | 14 | #define IsUtfEncoding( cset ) ( UTF_7 == (cset) || UTF_8 == (cset) ) 15 | 16 | public void DecodeUTF( state_t *state, byte codingSystem ); 17 | 18 | public void EncodeUTF7( i_str_t *istr, int head, int tail, 19 | byte codingSystem, boolean_t binary ); 20 | 21 | public void EncodeUTF8( i_str_t *istr, int head, int tail, 22 | byte codingSystem, boolean_t binary ); 23 | 24 | #endif /* __UTF_H__ */ 25 | -------------------------------------------------------------------------------- /src/uty.c: -------------------------------------------------------------------------------- 1 | /* 2 | * uty.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: uty.c,v 1.6 2004/01/05 07:23:29 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #ifdef UNIX 28 | #include 29 | #endif /* UNIX */ 30 | 31 | #ifdef MSDOS 32 | #include 33 | #endif /* MSDOS */ 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | public ic_t BinarySearch( codes_t *array, int high, ic_t code ) 41 | { 42 | int low, mid; 43 | 44 | low = 0; 45 | mid = high >> 1; 46 | 47 | for( ; low <= high ; mid = ( low + high ) >> 1 ){ 48 | if( array[ mid ].code == code ){ 49 | return array[ mid ].peer; 50 | } else if( array[ mid ].code > code ){ 51 | high = mid - 1; 52 | } else { 53 | low = mid + 1; 54 | } 55 | } 56 | 57 | return 0; 58 | } 59 | 60 | public ic_t BinarySearchCset( codes_cset_t *array, int high, ic_t code, 61 | byte *cset ) 62 | { 63 | int low, mid; 64 | 65 | low = 0; 66 | mid = high >> 1; 67 | 68 | for( ; low <= high ; mid = ( low + high ) >> 1 ){ 69 | if( array[ mid ].code == code ){ 70 | *cset = array[ mid ].cset; 71 | return array[ mid ].peer; 72 | } else if( array[ mid ].code > code ){ 73 | high = mid - 1; 74 | } else { 75 | low = mid + 1; 76 | } 77 | } 78 | 79 | return 0; 80 | } 81 | 82 | public void NotEnoughMemory() 83 | { 84 | fprintf( stderr, "lv: not enough memory\n" ), exit( -1 ); 85 | } 86 | 87 | public void FatalErrorOccurred() 88 | { 89 | fprintf( stderr, "lv: fatal error occurred\n" ), exit( -1 ); 90 | } 91 | 92 | public void *Malloc( unsigned int size ) 93 | { 94 | void *ptr; 95 | 96 | if( NULL == (ptr = malloc( size )) ) 97 | NotEnoughMemory(); 98 | 99 | return ptr; 100 | } 101 | 102 | #define TOKEN_LENGTH 32 103 | 104 | public byte *TokenAlloc( byte *s ) 105 | { 106 | int i, j; 107 | byte *token; 108 | boolean_t flagQuotation; 109 | byte quotationChar = 0; 110 | 111 | if( '\'' == *s || '"' == *s ){ 112 | flagQuotation = TRUE; 113 | quotationChar = *s; 114 | s++; 115 | } else 116 | flagQuotation = FALSE; 117 | 118 | for( i = 0 ; i < TOKEN_LENGTH ; i++ ){ 119 | if( 0x00 == s[ i ] ) 120 | break; 121 | if( FALSE == flagQuotation ){ 122 | if( ' ' == s[ i ] || 0x09 == s[ i ] ) 123 | break; 124 | } else { 125 | if( quotationChar == s[ i ] ) 126 | break; 127 | } 128 | } 129 | if( i == TOKEN_LENGTH ) 130 | return ""; 131 | 132 | token = (byte *)Malloc( i + 1 ); 133 | for( j = 0 ; j < i ; j++ ) 134 | token[ j ] = s[ j ]; 135 | token[ j ] = 0x00; 136 | 137 | return token; 138 | } 139 | 140 | #ifdef MSDOS 141 | public void far *FarMalloc( unsigned int size ) 142 | { 143 | union REGS regs; 144 | 145 | regs.h.ah = 0x48; 146 | if( size & 0x000f ) 147 | regs.x.bx = 1 + ( size >> 4 ); 148 | else 149 | regs.x.bx = size >> 4; 150 | 151 | intdos( ®s, ®s ); 152 | 153 | if( 0x0001 & regs.x.flags ){ 154 | if( 0x08 == regs.x.ax ) 155 | /*NotEnoughMemory();*/ 156 | return NULL; 157 | else 158 | FatalErrorOccurred(); 159 | } 160 | 161 | return MK_FP( regs.x.ax, 0 ); 162 | } 163 | 164 | public void FarFree( void far *ptr ) 165 | { 166 | union REGS regs; 167 | 168 | regs.h.ah = 0x49; 169 | regs.x.es = FP_SEG( ptr ); 170 | 171 | intdosy( ®s, ®s ); 172 | 173 | if( 0x0001 & regs.x.flags ) 174 | FatalErrorOccurred(); 175 | } 176 | #endif /* MSDOS */ 177 | 178 | public boolean_t IsAtty( int fd ) 179 | { 180 | #ifdef MSDOS 181 | union REGS regs; 182 | 183 | regs.x.ax = 0x4400; 184 | regs.x.bx = fd; 185 | intdos( ®s, ®s ); 186 | 187 | if( 0x0001 & regs.x.flags ){ 188 | /* 189 | * carry flag was set 190 | */ 191 | if( 0x0006 == regs.x.ax ) 192 | fprintf( stderr, "lv: file descripter %d is not opend\n" ); 193 | else 194 | fprintf( stderr, "lv: device io control for fd:%d failed\n", fd ); 195 | exit( -1 ); 196 | } else if( 0x8000 == ( 0x8000 & regs.x.dx ) ){ 197 | /* 198 | * character device 199 | */ 200 | if( 0x0003 == ( 0x0003 & regs.x.dx ) ) 201 | /* 202 | * stdin and stdout 203 | */ 204 | return TRUE; 205 | else 206 | return FALSE; 207 | } else { 208 | /* 209 | * block device 210 | */ 211 | return FALSE; 212 | } 213 | #else 214 | if( isatty( fd ) ) 215 | return TRUE; 216 | else 217 | return FALSE; 218 | #endif /* MSDOS */ 219 | } 220 | 221 | public byte *Exts( byte *s ) 222 | { 223 | int i; 224 | 225 | for( i = strlen( s ) - 1 ; i >= 0 ; i-- ){ 226 | if( '.' == s[ i ] ) 227 | return &s[ i + 1 ]; 228 | else if( '/' == s[ i ] || '\\' == s[ i ] ) 229 | return NULL; 230 | } 231 | 232 | return NULL; 233 | } 234 | -------------------------------------------------------------------------------- /src/uty.h: -------------------------------------------------------------------------------- 1 | /* 2 | * uty.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: uty.h,v 1.3 2003/11/13 03:08:19 nrt Exp $ 6 | */ 7 | 8 | #ifndef __UTY_H__ 9 | #define __UTY_H__ 10 | 11 | #include 12 | 13 | typedef struct { 14 | ic_t code, peer; 15 | } codes_t; 16 | 17 | typedef struct { 18 | ic_t code, peer; 19 | byte cset; 20 | } codes_cset_t; 21 | 22 | public ic_t BinarySearch( codes_t *array, int high, ic_t code ); 23 | public ic_t BinarySearchCset( codes_cset_t *array, int high, ic_t code, 24 | byte *cset ); 25 | 26 | public void NotEnoughMemory(); 27 | public void FatalErrorOccurred(); 28 | 29 | public void *Malloc( unsigned int size ); 30 | public byte *TokenAlloc( byte *s ); 31 | 32 | #ifdef MSDOS 33 | public void far *FarMalloc( unsigned int size ); 34 | public void FarFree( void far *ptr ); 35 | #endif /* MSDOS */ 36 | 37 | public boolean_t IsAtty( int fd ); 38 | public byte *Exts( byte *s ); 39 | 40 | #endif /* __UTY_H__ */ 41 | -------------------------------------------------------------------------------- /src/version.c: -------------------------------------------------------------------------------- 1 | /* 2 | * version.c 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio. 5 | * $Id: version.c,v 1.6 2004/01/05 07:21:26 nrt Exp $ 6 | */ 7 | /* 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | public void Banner() 30 | { 31 | fprintf( stderr, 32 | "# lv " VERSION "\n" 33 | "# All rights reserved. Copyright (C) 1996-2004 by NARITA Tomio\n" 34 | "# ABSOLUTELY NO WARRANTY; for details type `lv -h'\n" 35 | ); 36 | } 37 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * version.h 3 | * 4 | * All rights reserved. Copyright (C) 1996 by NARITA Tomio 5 | * $Id: version.h,v 1.24 2004/01/16 12:25:57 nrt Exp $ 6 | */ 7 | 8 | #ifndef __VERSION_H__ 9 | #define __VERSION_H__ 10 | 11 | #define VERSION "v.4.51 (Jan.16th,2004)" 12 | 13 | public void Banner(); 14 | 15 | #endif /* __VERSION_H__ */ 16 | --------------------------------------------------------------------------------