Index: less/LICENSE diff -u less/LICENSE:1.1.1.3 less/LICENSE:1.3 --- less/LICENSE:1.1.1.3 Tue Aug 30 20:55:42 2005 +++ less/LICENSE Tue Aug 30 22:45:48 2005 @@ -4,6 +4,9 @@ Less Copyright (C) 1984-2002 Mark Nudelman +Japanized part of Less +Copyright (c) 1994-2005 Kazushi (Jam) Marukawa + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Index: less/Makefile.aut diff -u less/Makefile.aut:1.1.1.9 less/Makefile.aut:1.12 --- less/Makefile.aut:1.1.1.9 Tue Aug 30 23:14:54 2005 +++ less/Makefile.aut Wed Aug 31 00:09:14 2005 @@ -14,14 +14,14 @@ help.c ifile.c input.c jump.c line.c linenum.c \ lsystem.c mark.c optfunc.c option.c opttbl.c os.c \ output.c position.c prompt.c search.c signal.c \ - tags.c ttyin.c version.c + tags.c ttyin.c version.c multi.c unify.c DISTFILES_W = \ defines.ds Makefile.dsb Makefile.dsg Makefile.dsu \ defines.o2 Makefile.o2e \ defines.o9 Makefile.o9c Makefile.o9u \ defines.wn Makefile.wnm Makefile.wnb DISTFILES = \ - ${SRC} regexp.c regexp.h \ + ${SRC} regexp.c regexp.h multi.h \ COPYING INSTALL LICENSE Makefile.in Makefile.aut NEWS README \ configure configure.ac lesskey.c lessecho.c scrsize.c \ cmd.h funcs.h lglob.h less.h lesskey.h option.h pckeys.h position.h \ Index: less/Makefile.dsb diff -u less/Makefile.dsb:1.1.1.1 less/Makefile.dsb:1.4 --- less/Makefile.dsb:1.1.1.1 Sun Dec 1 05:41:23 1996 +++ less/Makefile.dsb Fri Mar 13 08:29:03 1998 @@ -23,7 +23,7 @@ input.obj jump.obj line.obj linenum.obj lsystem.obj \ mark.obj optfunc.obj option.obj opttbl.obj os.obj output.obj \ position.obj prompt.obj search.obj signal.obj tags.obj \ - ttyin.obj version.obj + ttyin.obj version.obj multi.obj unify.obj all: less$(EXT) lesskey$(EXT) @@ -41,7 +41,7 @@ -del defines.h -copy defines.ds defines.h -$(OBJ): less.h defines.h +$(OBJ): less.h multi.h defines.h clean: -del *.obj Index: less/Makefile.dsg diff -u less/Makefile.dsg:1.1.1.4 less/Makefile.dsg:1.7 --- less/Makefile.dsg:1.1.1.4 Tue Aug 30 20:55:44 2005 +++ less/Makefile.dsg Tue Aug 30 22:45:48 2005 @@ -38,7 +38,7 @@ help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \ lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \ output.${O} position.${O} prompt.${O} search.${O} signal.${O} \ - tags.${O} ttyin.${O} version.${O} + tags.${O} ttyin.${O} version.${O} multi.${O} unify.${O} all: less lesskey lessecho @@ -54,7 +54,7 @@ defines.h: defines.ds command.com /c copy $< $@ -${OBJ}: ${srcdir}/less.h defines.h ${srcdir}/funcs.h +${OBJ}: ${srcdir}/less.h ${srcdir}/multi.h defines.h ${srcdir}/funcs.h install: all ${srcdir}/less.man ${srcdir}/lesskey.man ${INSTALL_PROGRAM} less.exe ${bindir}/less.exe Index: less/Makefile.dsu diff -u less/Makefile.dsu:1.1.1.1 less/Makefile.dsu:1.2 --- less/Makefile.dsu:1.1.1.1 Sun Oct 29 17:19:18 2000 +++ less/Makefile.dsu Tue Aug 30 22:51:14 2005 @@ -32,7 +32,7 @@ input.obj jump.obj line.obj linenum.obj lsystem.obj \ mark.obj optfunc.obj option.obj opttbl.obj os.obj output.obj \ position.obj prompt.obj search.obj signal.obj tags.obj \ - ttyin.obj version.obj + ttyin.obj version.obj multi.obj unify.obj all: less lesskey @@ -49,7 +49,7 @@ -del defines.h -copy defines.ds defines.h -$(OBJ): less.h defines.h +$(OBJ): less.h multi.h defines.h clean: -del *.obj Index: less/Makefile.in diff -u less/Makefile.in:1.1.1.13 less/Makefile.in:1.16 --- less/Makefile.in:1.1.1.13 Tue Aug 30 23:14:54 2005 +++ less/Makefile.in Wed Aug 31 00:09:14 2005 @@ -44,7 +44,7 @@ help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \ lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \ output.${O} position.${O} prompt.${O} search.${O} signal.${O} \ - tags.${O} ttyin.${O} version.${O} @REGEX_O@ + tags.${O} ttyin.${O} version.${O} @REGEX_O@ multi.${O} unify.${O} all: less lesskey lessecho @@ -57,7 +57,7 @@ lessecho: lessecho.${O} version.${O} ${CC} ${LDFLAGS} -o $@ lessecho.${O} version.${O} -${OBJ}: ${srcdir}/less.h ${srcdir}/funcs.h defines.h +${OBJ}: ${srcdir}/less.h ${srcdir}/funcs.h ${srcdir}/multi.h defines.h install: all ${srcdir}/less.nro ${srcdir}/lesskey.nro installdirs ${INSTALL_PROGRAM} less ${bindir}/${binprefix}less Index: less/Makefile.o2e diff -u less/Makefile.o2e:1.1.1.2 less/Makefile.o2e:1.5 --- less/Makefile.o2e:1.1.1.2 Tue Aug 30 20:55:44 2005 +++ less/Makefile.o2e Tue Aug 30 22:45:48 2005 @@ -23,7 +23,7 @@ help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \ lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \ output.${O} position.${O} prompt.${O} search.${O} signal.${O} \ - tags.${O} ttyin.${O} version.${O} regexp.${O} + tags.${O} ttyin.${O} version.${O} regexp.${O} multi.${O} unify.${O} all: less.exe lesskey.exe scrsize.exe @@ -36,7 +36,7 @@ scrsize.exe: scrsize.c ${CC} ${CFLAGS} -D__ST_MT_ERRNO__ -s -Zmtd -lX11 $< -${OBJ}: defines.h less.h +${OBJ}: defines.h less.h multi.h defines.h: defines.o2 copy defines.o2 defines.h Index: less/Makefile.o9c diff -u less/Makefile.o9c:1.1.1.2 less/Makefile.o9c:1.5 --- less/Makefile.o9c:1.1.1.2 Sun Dec 1 05:41:24 1996 +++ less/Makefile.o9c Fri Mar 13 08:29:04 1998 @@ -27,7 +27,7 @@ help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \ lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \ output.${O} position.${O} prompt.${O} search.${O} signal.${O} \ - tags.${O} ttyin.${O} version.${O} regexp.${O} + tags.${O} ttyin.${O} version.${O} regexp.${O} multi.${O} unify.${O} all: less lessecho lesskey @@ -40,7 +40,7 @@ lessecho: lessecho.${O} version.${O} ${CC} lessecho.${O} version.${O} -f=$@ ${LDFLAGS} -${OBJ}: defines.h less.h +${OBJ}: defines.h less.h multi.h defines.h: defines.o9 copy defines.o9 defines.h -rf Index: less/Makefile.o9u diff -u less/Makefile.o9u:1.1.1.1 less/Makefile.o9u:1.4 --- less/Makefile.o9u:1.1.1.1 Sat Sep 14 00:36:40 1996 +++ less/Makefile.o9u Fri Mar 13 08:29:04 1998 @@ -26,7 +26,7 @@ help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \ lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \ output.${O} position.${O} prompt.${O} search.${O} signal.${O} \ - tags.${O} ttyin.${O} version.${O} regexp.${O} + tags.${O} ttyin.${O} version.${O} regexp.${O} multi.${O} unify.${O} all: less lesskey @@ -36,7 +36,7 @@ lesskey: lesskey.${O} version.${O} ${CC} lesskey.${O} version.${O} -f=$@ ${LDFLAGS} -${OBJ}: defines.h less.h +${OBJ}: defines.h less.h multi.h defines.h: defines.o9 copy defines.o9 defines.h -rf Index: less/Makefile.wnb diff -u less/Makefile.wnb:1.1.1.1 less/Makefile.wnb:1.4 --- less/Makefile.wnb:1.1.1.1 Sun Dec 1 05:41:25 1996 +++ less/Makefile.wnb Fri Mar 13 08:29:04 1998 @@ -23,7 +23,7 @@ input.obj jump.obj line.obj linenum.obj lsystem.obj \ mark.obj optfunc.obj option.obj opttbl.obj os.obj output.obj \ position.obj prompt.obj search.obj signal.obj tags.obj \ - ttyin.obj version.obj regexp.obj + ttyin.obj version.obj regexp.obj multi.obj unify.obj all: less lesskey @@ -40,7 +40,7 @@ -del defines.h -copy defines.wn defines.h -${OBJ}: less.h defines.h funcs.h cmd.h +${OBJ}: less.h multi.h defines.h funcs.h cmd.h clean: -del *.obj Index: less/Makefile.wnm diff -u less/Makefile.wnm:1.1.1.2 less/Makefile.wnm:1.5 --- less/Makefile.wnm:1.1.1.2 Wed Sep 22 10:02:13 1999 +++ less/Makefile.wnm Wed Sep 22 12:44:01 1999 @@ -28,7 +28,7 @@ input.obj jump.obj line.obj linenum.obj lsystem.obj \ mark.obj optfunc.obj option.obj opttbl.obj os.obj output.obj \ position.obj prompt.obj search.obj signal.obj tags.obj \ - ttyin.obj version.obj regexp.obj + ttyin.obj version.obj regexp.obj multi.obj unify.obj all: less.exe lesskey.exe @@ -45,7 +45,7 @@ -del defines.h -copy defines.wn defines.h -$(OBJ): less.h defines.h funcs.h cmd.h +$(OBJ): less.h multi.h defines.h funcs.h cmd.h clean: -del *.obj Index: less/README.iso diff -u /dev/null less/README.iso:1.20 --- /dev/null Sun Sep 4 19:53:50 2005 +++ less/README.iso Sun Sep 4 19:35:32 2005 @@ -0,0 +1,240 @@ +========================================================================= + This is the distribution of enhanced less. + It support ISO 2022 code extension techniques and Japanese codes. + Please report any problems of it to the author at jam@pobox.com. + See http://www.pobox.com/~jam/less/ for the latest info. +========================================================================= + + +**Features** + + - Support ISO 2022 code extension techniques in 7bits and 8bits. + - Understand all following codes. + - ISO 2022 level 3. + - a special sequence, ESC 2/4[$] 2/12[,] FE, which is used in MULE. + - LESS-JIS, UJIS and SJIS. + - LESS-JIS may contain JIS C 6226-1978, JIS X 0208-1983, + JIS X 0208:1990/1997, JIS X 0212:1990, JIS X 0213:2000, + JIS X 0201:1976/1997 left/right planes, and ASCII. + - UJIS may contain one of JIS C 6226-1978, JIS X 0208-1983, + JIS X 0208:1990/1997, or JIS X 0213:2000 plane 1, one of + JIS X 0201:1976/1997 left plane or ASCII, JIS X 0201:1976/1997 + right plane, and both JIS X 0212:1990 and JIS X 0213:2000 + plane 2. + - SJIS may contain one of JIS C 6226-1978, JIS X 0208-1983, + JIS X 0208:1990/1997, or JIS X 0213:2000 plane 1, one of + JIS X 0201:1976/1997 left plane or ASCII, JIS X 0201:1976/1997 + right plane, and JIS X 0213:2000 plane 2. + - Output following codes. + - iso8 (CTEXT, which is defined in X11) + - iso7 with only GZDM4, GZD4, G1DM4, G1DM6, G1D4, G1D6, SI and SO + escape sequences. + - LESS-JIS, UJIS and SJIS. + - LESS-JIS may contain JIS X 0208-1983 with an assumption + that its face is the same as JIS X 0213:2000 plane 1, + JIS X 0201:1976/1997 left/right planes and ASCII. + It does not contain JIS X 0212:1990 or JIS X 0213:2000 plane 2, + so those are marked as wrong character on the fly. + If you need more restricted JIS sequence, please use iso7 or iso8. + - UJIS may contain one of JIS C 6226-1978, JIS X 0208-1983, + JIS X 0208:1990/1997, or JIS X 0213:2000 plane 1, one of + JIS X 0201:1976/1997 left plane or ASCII, JIS X 0201:1976/1997 + right plane, and both JIS X 0212:1990 and JIS X 0213:2000 + plane 2. + - SJIS may contain one of JIS C 6226-1978, JIS X 0208-1983, + JIS X 0208:1990/1997, or JIS X 0213:2000 plane 1, one of + JIS X 0201:1976/1997 left plane or ASCII, JIS X 0201:1976/1997 + right plane, and JIS X 0213:2000 plane 2. + - Automatic decompression of compressed files. + +**Problems** + + - To search, the less program compares characters after conversion into + internal codes. If converted codes contain some gaps, a regular expression + library may be confused. e.g. "$B$"(Ba" which contains an escape + sequence and JIS X 0201 Japanese (Katakana). Search this text using UJIS + Katakana pattern may cause problems. + - If you have a regular expression library with ability to detect + character set, you will be ok since such regular expression library + doesn't confuse among different character sets. + - If you don't have such library, you still can use less without regular + expression by simply typing '^R'. This trigger simple search library + implemented in less that support multiple character sets. + +**Enhancements** + + - The JLESSCHARSET environment variable choose codes for input and + output. For example, if you set "japanese-iso7", the less read all + Japanese codes and iso7 and write iso7. If you set "ujis", the + less read and write only UJIS. Currently you can use followings. + - Same as LESSCHARSET: ascii, latin1, dos, koi8-r, next + - Others: iso7, iso8, ujis-iso7, euc-iso7, sjis-iso7, jis, + ujis-jis, euc-jis, sjis-jis, ujis, euc, jis-ujis, + jis-euc, sjis, jis-sjis, japanese, japanese-iso7, + japanese-jis, japanese-ujis, japanese-euc, japanese-sjis + - Following values of JLESSCHARSET are treated for input and output + separately. For example, if you set "ujis-sjis", the less read + only UJIS and write only SJIS. + - Values: ujis-sjis, euc-sjis, sjis-ujis, sjis-euc + - The JLESSPLANESET environment variable choose plane of iso8 and + iso7. Please read a manual about details. + - The JLESSKEYCHARSET environment variable choose codes for input + from keyboard. All values for the JLESSCHARSET environment + variable are used for this. + - Sometime the less may mistake automatic handling of Japanese codes. + The user change the status for it by '@' key. The function name of + it is "rotate-right". + - If you have a regular expression library with character set + detection, invoke configure script with "--with-cs-regex" option to + use it. Then compile the less. + +**History about Japanized and ISO 2022-ized less** + + - About Japanization of less + - Kato-san posted a difference which give less an ability for + special escape sequence. + - Kameyama-san posted a patch for UJIS code. + - Shinoda-san posted a less.exe for SJIS code. + - Tachi-san posted two patches for JIS and SJIS code. + - Saito-san posted kanji conversion filter for less. + - Ohta-san posted other less which convert roma-ji into kana. + - Yamakita-san posted other patch for convert them into kanji. + - Yoshida-san posted two patches of less-73 for UJIS and SJIS code. + - Yoshida-san posted two patches of less-97 for UJIS and SJIS code. + - Kato-san posted a patch of less-97(UJIS) for JIS code. + - Ishii-san posted a patch of less-97(UJIS or SJIS) for JIS code. + - Tanaka-san posted a modified less-123 for SJIS code. + - Kawakami-san posted a patch of it for JIS code. + - I changed less-177 for all Japanese codes. + - Kusakabe-san changed less-178 by using patches for less-177. + - Senda-san add printing function of Japanese code for less-177. + - Sakai-san changed less-200 by using patches for less-178. + - I changed less-205 for all Japanese codes and ISO 2022 codes. + - Ushine-san changed less-321 by using patches for less-290. + - I changed less-330 by using patches for less-290. It is named + iso202. + - I removed some bugs and made jless-330-iso203. + - I re-wrote jless and made jless-330-iso208. + - I released patches to correct bugs. + + - About jless + - I put 2 unofficial patches of KANJI searching enhancements for + ISO 2022-ized less-237 on ftp. + - I put an unofficial patch to use gawk-2.15.6-mb1.04's KANJI + regular expression library for jless-330-iso210 on ftp. It will + works with iso212 and following. + - I put a less.hlp file which is translated into Japanese. It will + works with iso212 and following. + + - Read version.c for more details. + +**FAQ** + + Q: When I try to view a Japanese text, the less shows inverse + characters only. How do I view Japanese? + A: You have to set JLESSCHARSET environment variable as "japanese". + Or, you have to set "ja_JP" to the LANG environment variable if your + computer support it. Either way works similary. Choose either way + depend on your style. + + Q: When I try to view a Japanese text, the less shows strange + characters only like '$' and others. How do I view Japanese? + A: Does your terminal or terminal emulator have ability to show + Japanese? If so, I guess you have to adjust output of the less by + setting JLESSCHARSET environment variblae as "japanese-ujis" or + "japanese-sjis". + + Q: When I try to view compressed text, the less doesn't work. How do + I view them? + A: The less uses the name of a text file to check whether it is + compressed or not, and uses a "zcat" program to uncompress it. So + the compressed file has to be finished with ".z", ".gz" or ".Z" + and a "zcat" program has to have ability to uncompress it. + + Q: How to set JLESSCHARSET environment variable for all users? + A: You can use a DEFCHARSET declaration in "defines.h". This value is + treated default values and compiled into less binary at compile time. + In addition, if your computer has a LANG property, you may need to set + HAVE_LOCALE to 0 in "defines.h" too. Note: be carefule. this file is + often automatically generated by "configure" program. Don't forget to + edit this file each time you run "configure". + + Q: Sometime my terminal shows non ASCII characters only although I type + "hello". + A: Some terminal emulators have bugs in handling the ISO 2022. You + should tell the less to display only JIS by setting "japanese-jis" + to the JLESSCHARSET environment variable. And, you also need to + restart/reset your terminal emulator. + + Q: Sometime the less shows wrong Japanese characters when I try to + view SJIS coded files. + A: Less detect Japanese code automatically, but it is not perfect. + Please type '^L' to re-display it. If it doesn't work fine, + try to type '@' to change Japanese code by hand. + + On the other hand, if you use the less with a -Z option, the less + give priority to SJIS over UJIS in automatic handling routine. + And you can change the default value of priority and invert the + means of a -Z option by compiling with SJIS_PRE declaration. + + Or if you know the file uses SJIS, you can simply type "less -Ksjis" + to diable the automatic handling routine. + + Q: How do I use SJIS as typing string? + A: You should set "sjis-jis" to the JLESSKEYCHARSET environment + variable. Or, you also be able to set "sjis-jis" to a DEFKEYCHARSET + declaration in "defines.h". + + Q: Can I use regular expression with Japanese? + A: There are 2 ways. You can use multi bytes regular expression + library. Or you can use regular expression library with ability + to detect character sets. + + Please read "http://www.poboxes.com/~jam/less/". + + Q: When I looking up with Kanji, the less shows strange behavior. + A: The less turns on MSB of all bytes of all non ASCII characters to + decrease the possibility of mis-matching between an ASCII character + and an non ASCII characters. But your regular expression library + might not support characters with MSB. Please invoke configure + script with "--disable-msb" option to disable it. Then compile + and install less again. + + Q: How do I input search pattern by JIS? + A: Normally the less uses "\e$" sequence. You should write following + in your "~/.lesskey" file and execute a "lesskey" program to + cancel it. + +#line-edit +\e$ insert ^V\e$ + + Q: How do I use emacs-like key binding? + A: You should write following in your "~/.lesskey" file and execute a + "lesskey" program. + +#line-edit +^A home +^E end +^P up +^N down +^F right +^B left +\ef word-right +^D delete +\ed word-delete + + Q: The os.c was not compiled on NEWS-OS 4.0C. + A: Add following before "#include ". + +#define LANGUAGE_C 1 + +**Conclusion** + + - Please mail to "jam@pobox.com" if you have a problem or a suggestion. + - See http://www.pobox.com/~jam/less/ for the latest info. + + +Local Variables: +mode: indented-text +fill-column: 70 +End: Index: less/README.iso.jp diff -u /dev/null less/README.iso.jp:1.17 --- /dev/null Sun Sep 4 19:53:50 2005 +++ less/README.iso.jp Wed Nov 22 00:01:27 2000 @@ -0,0 +1,267 @@ +========================================================================= + This is the distribution of enhanced less. + It support ISO 2022 code extension techniques and Japanese codes. + Please report any problems of it to the author at jam@pobox.com. + See http://www.pobox.com/~jam/less/ for the latest info. +========================================================================= + This file is written by Japanese and JIS code and contains + almost same information in README.iso. +========================================================================= + + +**$BFCD'(B** + + - ISO 2022 in 7bits$B$H!"(Bin 8bits$B$r%5%]!<%H!#(B + - $BF~NO$H$7$FJ}$,MxMQ$G$-$^$9!#(B + - SJIS$B$O!"(BJIS C 6226-1978$B!"(BJIS X 0208-1983$B!"(BJIS X 0208:1990/1997$B!"(B + JIS X 0213:2000$B$N(B1$BLL$N$&$A$N$I$l$+!"(BJIS X 0201:1976/1997$B:8LL(B + $B$+(BASCII$B$N$I$A$i$+!"(BJIS X 0201:1976/1997$B1&LL!"$=$7$F(B + JIS X 0213:2000$B$N(B2$BLL$,MxMQ$G$-$^$9!#(B + - $B=PNO$H$7$FMxMQ$G$-$kJ8;z%3!<%I$NDj$7$?>e$G$N(BJIS X 0208-1983$B$H!"(B + JIS X 0201:1976/1997$B:8(B/$B1&LL!"(BASCII$B$rMxMQ$7$F=PNO$7$^(B + $B$9!#(BJIS X 0212:1990$B$H(BJIS X 0213:2000$B$N(B2$BLL$O=PNO$G$-$J(B + $B$$$?$a!"=PNO;~$K@5$7$/$J$$J8;z$H$7$F%^!<%/$7$FI=<($5(B + $B$l$^$9!#$b$7!"F~NODL$j$N=PNO$,M_$7$$>l9g$O!"(Biso7$B$d(B + iso8$B$rMxMQ$7$F=PNO$7$F2<$5$$!#(B + - UJIS$B$O!"(BJIS C 6226-1978$B!"(BJIS X 0208-1983$B!"(BJIS X 0208:1990/1997$B!"(B + JIS X 0213:2000$B$N(B1$BLL$N$&$A$N$I$l$+!"(BJIS X 0201:1976/1997$B:8LL(B + $B$+(BASCII$B$N$I$A$i$+!"(BJIS X 0201:1976/1997$B1&LL!"$=$7$F(B + JIS X 0212:1990$B$H(BJIS X 0213:2000$B$N(B2$BLL$NN>J}$,MxMQ$7$F(B + $B=PNO$7$^$9!#(B + - SJIS$B$O!"(BJIS C 6226-1978$B!"(BJIS X 0208-1983$B!"(BJIS X 0208:1990/1997$B!"(B + JIS X 0213:2000$B$N(B1$BLL$N$&$A$N$I$l$+!"(BJIS X 0201:1976/1997$B:8LL(B + $B$+(BASCII$B$N$I$A$i$+!"(BJIS X 0201:1976/1997$B1&LL!"$=$7$F(B + JIS X 0213:2000$B$N(B2$BLL$,MxMQ$7$F=PNO$7$^$9!#(B + - compress$B$d(Bgzip$B$5$l$?%U%!%$%k$r4JC1$KD/$a$k$3$H$,$G$-$k!#(B + +**$BLdBjE@(B** + + - $BJ8;z$N8!:w$O!"FbIt%3!<%I$KJQ49$7$?8e$K=hM}$7$^$9!#$=$NJQ(B + $B49$N:]$KJ8;z$HJ8;z$N4V$K7d4V$,@8$8$?>l9g!"@55,I=8=%i%$%V(B + $B%i%j$K$h$k8!:w$,$G$-$^$;$s!#6qBNE*$K$O!"(B"$B$"(Ba"$B$N$h$&$J%(%9(B + $B%1!<%W%7!<%1%s%9$r69$s$@J8;z$N8!:w$d!"H>3Q%+%?%+%J$,(BUJIS + $B$G=q$+$l$F$$$?>l9g$J$I$K!"8!:w$,$G$-$^$;$s!#(B + - character set$B$rM}2r$9$k@55,I=8=%i%$%V%i%j$rMxMQ$9$k$3$H$K(B + $B$h$C$F!"$3$NLdBj$O2r7h$G$-$^$9!#(B + - $B$^$?!"8!:w$N:]$K!"(B'^R'$B$HF~NO$7$F!"Hs@55,I=8=%b!<%I$G8!:w(B + $B$9$k$3$H$K$h$C$F$b!"$3$NLdBj$r2r7h$G$-$^$9!#(B + +**$B3HD%E@(B** + + - JLESSCHARSET$B4D6-JQ?t$G!"F~NO$H=PNO$KMxMQ$9$k%3!<%I$rF1;~(B + $B$K!"$b$7$/$O$=$l$>$l;XDj$G$-$^$9!#F1;~$K;XDj$9$k>l9g$O!"(B + $BC1=c$K$=$N%3!<%I$r;XDj$7$^$9!#Nc$($P(B"ujis"$B$H$9$k$H!"(BUJIS + $B$@$1$rF~NO$H=PNO$KMxMQ$7$^$9!#JL!9$K;XDj$9$k>l9g$O!"F~NO(B + $B$KMxMQ$9$k%3!<%I$r(B"-"$B$G@\B3$7$F;XDj$7$^$9!#$3$N>l9g:G8e$K(B + $B;XDj$7$?%3!<%I$,=PNOMQ$N%3!<%I$K$J$j$^$9!#Nc$($P!"(B + "japanese-iso7"$B$H$9$k$H!"F|K\8l$N%3!<%I$9$Y$F$H(Biso7$B$rF~NO(B + $B$H$7$F\$7$/$O%^(B + $B%K%e%"%k$rFI$s$G2<$5$$!#(B + - JLESSKEYCHARSET$B4D6-JQ?t$G!"%-!<%\!<%I$+$i$NF~NO$KMxMQ$9$k(B + $B%3!<%I$r;XDj$G$-$^$9!#(BJLESSCHARSET$B$HF1$8CM$,MxMQ$G$-$^$9!#(B + - $B<+F0H=JL$@$1$G$OET9g$,0-$$$3$H$b$"$k$?$a!":G>e0L%S%C%H$,(B + $BN)$C$?%3!<%I$NH=JLJ}K!$r=g!9$KJQ99$9$k$?$a$N%-!<$rMQ0U$7(B + $B$F$$$^$9!#(B'@'$B%-!$O(B"rotate-right"$B$G$9!#(B + - $B%-%c%i%/%?%;%C%H$r2rL>$KJQ49$b9T$&$h$&$KJQ99$7$?(B + $B$b$N$rEj9F$5$l$?!#(B + - $B;3KL$5$s$,!"99$K(BWnn$B$KDL$7$F<+F04A;zJQ49$9$k$?$a$N%Q%C%A(B + $B$rEj9F$5$l$?!#(B + - $B5HED$5$s$,!"(Bless-73$B$r(BUJIS$B!"(BSJIS$B2=$7$?$b$N$rEj9F$5$l$?!#(B + - $B5HED$5$s$,!"(Bless-97$B$r(BUJIS$B!"(BSJIS$B2=$7$?$b$N$rEj9F$5$l$?!#(B + - $B2CF#$5$s$,!"(Bless-97$B$N(BUJIS$B2=HG$r!"99$K(BJIS$B2=$9$k%Q%C%A$rEj(B + $B9F$5$l$?!#(B + - $B@P0f$5$s$,!"2CF#$5$s$N%Q%C%A$r;29M$K!"$I$C$A$NHG$G$b!"(B + JIS$B$H$rDL$9$h$&$K$9$k%Q%C%A$rEj9F$5$l$?!#(B + - $BEDCf$5$s$,!"(Bless-123$B$r(BSJIS$B2=$7$FEj9F$5$l$?!#(B + - $B@n>e$5$s$,!"99$K(BJIS$B2=$9$k%Q%C%A$rEj9F$5$l$?!#(B + - $B4]@n$,!"(Bless-171$B$rF|K\8l2=$7$FEj9F$7$?!#(B + - $B4]@n$,!"(Bless-177$B$rF|K\8l2=$7$FEj9F$7$?!#(B + - $BF|2A0$rIU$1$?!#(B + - $B%P%0$r$7$F(Bjless-330-iso208$B$H$7$FEj9F$7$?!#(B + - $B?'!9$H%P%0$re$O!"H?E>I=<($5$l$?J8;z$G0l(B + $BGU$G$9!#(B + A: JLESSCHARSET$B4D6-JQ?t$K(B"japanese"$B$H@_Dj$7$^$7$g$&!#(BLANG$B4D(B + $B6-JQ?t$K(B"ja_JP"$B$J$I@_Dj$9$k$H$$$&J}K!$b$"$j$^$9!#9%$-$J(B + $BJ}K!$rA*$s$G2<$5$$!#(B + + Q: $BF|K\8l$,I=<($5$l$^$;$s!#2hLL>e$O!"$J$s$+5-9f$G0lGU$G$9!#(B + A: less$B$,=PNO$7$F$$$k4A;z$rCA0$G%$%s(B + $B%9%H!<%k$7$F$*$/$3$H$r$*A&$a$7$^$9!#$^$?!"(Bless$B$N%^%K%e%"(B + $B%k$K=q$+$l$F$$$k$h$&$K!"(BLESSOPEN$B$H(BLESSCLOSE$B$r@_Dj$9$k$3(B + $B$H$K$h$C$F!"B>$N05=L%D!<%k$rMxMQ$9$k$3$H$b$G$-$^$9!#(B + + Q: $BAG?M$N?M$G$b!"4A;z$,I=<($G$-$k$h$&$K!"%G%#%U%)%k%H$N@_Dj(B + $B$r$7$F%$%s%9%H!<%k$7$?$$$N$G$9$,!#(B + A: less$B$O!"(BJLESSCHARSET$B$J$I$N4D6-JQ?t$,@_Dj$5$l$F$$$J$$>l9g(B + $B$K$O!"(Bdefines.h$BCf$N(BDEFCHARSET$B%^%/%m$NJ8;zNs$rMxMQ$9$k$h(B + $B$&$K$J$C$F$$$^$9!#:G=i$K(Bconfigure$B$rl(B + $B9g$O!"(BJLESSCHARSET$B4D6-JQ?t$K!"(B"japanese-jis"$B$J$I$H!"(BJIS + $B$@$1$rMxMQ$9$k$3$H$rL@3N$K@_Dj$7$F;H$C$F2<$5$$!#(B + + Q: SJIS$B$N%U%!%$%k$rFI$`$H!"$?$^$KJQ$JJ8;z$,I=<($5$l$^$9!#(B + A: $B4A;z$N<+F0H=JL$O40`z$G$O$"$j$^$;$s!#$=$N$?$a!"B?>/LdBj$,(B + $BH/@8$7$^$9!#(B'^L'$B$HF~NO$7!"2hLL$r:FIA2h$9$k$HD>$k>l9g$,B?(B + $B$$$G$9!#$=$l$G$bBLL\$J$i!"(B'@'$B%-!<$r?t2s2!$7$F!"2hLL2<$K(B + "sjis codeset..."$B$HI=<($5$;$F2<$5$$!#<+F0H=JL$r6X;_$G$-(B + $B$^$9!#85$N>uBV$KLa$9$K$O!"$3$N%-!<$r7+$jJV$72!$7$F2<$5$$!#(B + + $B0lJ}!"0z?t$K(B-Z$B$H;XDj$9$k$3$H$G!"(BSJIS$B$rM%@h$7$F<+F0H=JL$r(B + $B9T$&$3$H$b$G$-$^$9!#%3%s%Q%$%k;~$K(BSJIS_PRE$B$rDj5A$9$l$P!"(B + $B:G=i$+$i(BSJIS$B$rM%@h$7!"(B-Z$B$G:#EY$O5U$K(BUJIS$B$rM%@h$9$k$H$$$C(B + $B$?!"5U$NF0:n$r$9$k$h$&$K$b$G$-$^$9!#(B + + $B$^$?!"(BJLESSCHARSET$B4D6-JQ?t$r(B"sjis"$B$K$9$k$3$H$G!":G=i$+$i(B + $B<+F0H=JL$r6X;_$9$k$3$H$b$G$-$^$9!#(B + + Q: SJIS$B$G8!:w$9$kF|K\8l$rF~$l$k$HJQ$K$J$j$^$9!#(B + A: JLESSKEYCHARSET$B4D6-JQ?t$K(B"sjis-jis"$B$H@_Dj$7$^$7$g$&!#$^(B + $B$?%3%s%Q%$%k$9$k:]$K!"(Bdefines.h$BCf$G!"(BDEFKEYCHARSET$B$KDj5A(B + $B$7$F$$$kJ8;zNs$r!"(B"sjis-jis"$B$KJQ49$9$k$H$$$&\$7$/$O!"(Bhttp://www.pobox.com/~jam/less/$B$r;2>H$7$F2<$5(B + $B$$!#(B + + Q: $B4A;z$N8!:w$r$9$k$H$H$s$G$b$J$$F0:n$r$9$k$s$G$9$,!#(B + A: character set$B$rM}2r$7$J$$@55,I=8=%i%$%V%i%j$rMxMQ$7$?>l(B + $B9g!"(BASCII$B$HHs(BASCII$B$H$GF1$8CM$r;H$C$?J8;z$K$D$$$F!"4V0c$C(B + $B$F8!:w$K@.8y$7$F$7$^$&>l9g$,$"$j$^$9!#6qBNE*$K$O!"(BJIS + X 0201 Japanese (Katakana)$B$N(B"$B%+(B"$B$H(B"6"$B$J$I$,F1$8CM$K$J$j$^(B + $B$9!#$3$&$$$C$?8m$C$?8!:w$N2DG=@-$r>/$7$G$b8:$i$9$?$a!"(B + less$B$OJ8;z$,Hs(BASCII$B$G$"$C$?>l9g$9$Y$F$N%P%$%H$N(BMSB$B$rN)$F(B + $B$^$9!#$?$@$7!"%i%$%V%i%j$K$h$C$F$O!"(BMSB$B$,N)$C$?J8;z$rl9g!"$D$^$j$I$&$b8!(B + $B:w$,@5$7$/9T$($J$$>l9g$K$O!"(B"--disable-msb"$B$H$$$&%*%W%7%g(B + $B%s$H6&$K!"(Bconfigure$B%9%/%j%W%H$re"$B$NA0$K!"0J2<$NDj5A$rF~$l$F2<$5$$!#(B + +#define LANGUAGE_C 1 + +**$B:G8e$K(B** + + - $BLdBj$d2~A1MW5a$,$"$l$P(Bjam@pobox.com$B$K%a%$%k$7$F2<$5$$!#(B + $BBP=h$G$-$k$+$b$7$l$^$;$s!#$^$?!"2~A1MW5a$K$D$$$F$O!"B??t(B + $B=8$^$l$P!"BP=h$9$k2DG=@-$b9b$/$J$j$^$9!#(B + - http://www.pobox.com/~jam/less/$B$K:G?7$N>pJs$r=8$a$F$$$^$9!#(B + + +Local Variables: +mode: indented-text +fill-column: 60 +End: Index: less/charset.c diff -u less/charset.c:1.1.1.13 less/charset.c:1.67 --- less/charset.c:1.1.1.13 Tue Aug 30 20:55:40 2005 +++ less/charset.c Wed Aug 31 12:22:41 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -24,23 +30,143 @@ /* * Predefined character sets, - * selected by the LESSCHARSET environment variable. + * selected by the JLESSCHARSET or LESSCHARSET environment variable. */ struct charset { char *name; int *p_flag; char *desc; + CODESET left; + CODESET right; + CODESET output; } charsets[] = { - { "ascii", NULL, "8bcccbcc18b95.b" }, - { "dos", NULL, "8bcccbcc12bc5b223.b" }, - { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, - { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, - { "iso8859", NULL, "8bcccbcc18b95.33b." }, - { "koi8-r", NULL, "8bcccbcc18b95.b128." }, - { "next", NULL, "8bcccbcc18b95.bb125.bb" }, - { "utf-8", &utf_mode, "8bcccbcc18b." }, - { NULL, NULL, NULL } + { "ascii", NULL, "8bcccbcc18b95.b", + noconv, none, noconv }, + { "dos", NULL, "8bcccbcc12bc5b223.b", + noconv, noconv, noconv }, + { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.", + noconv, noconv, noconv }, + { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b", + noconv, noconv, noconv }, + { "iso8859", NULL, "8bcccbcc18b95.33b.", + noconv, noconv, noconv }, + { "koi8-r", NULL, "8bcccbcc18b95.b128.", + noconv, noconv, noconv }, + { "next", NULL, "8bcccbcc18b95.bb125.bb", + noconv, noconv, noconv }, + { "utf-8", &utf_mode, "8bcccbcc18b.", + noconv, noconv, noconv }, +#if ISO + { "iso7", NULL, "8bcccb4c11bc4b96.b", + iso7, noconv, iso7 }, + { "iso8", NULL, "8bcccb4c11bc4b95.15b2.16b.", + iso7, iso8, iso8 }, +# if JAPANESE + /* read all KANJI code sets */ + { "japanese", NULL, "8bcccb4c11bc4b95.b127.b", + jis, japanese, jis }, + { "japanese-iso7", NULL, "8bcccb4c11bc4b95.b127.b", + iso7, japanese, iso7 }, + { "japanese-jis", NULL, "8bcccb4c11bc4b95.b127.b", + jis, japanese, jis }, + { "japanese-ujis", NULL, "8bcccb4c11bc4b95.b127.b", + jis, japanese, ujis }, + { "japanese-euc", NULL, "8bcccb4c11bc4b95.b127.b", + jis, japanese, ujis }, + { "japanese-sjis", NULL, "8bcccb4c11bc4b95.b127.b", + jis, japanese, sjis }, + /* read JIS */ + { "jis", NULL, "8bcccb4c11bc4b95.b", + jis, none, jis }, + { "jis-ujis", NULL, "8bcccb4c11bc4b95.15b2.17b94.b", + jis, ujis, ujis }, + { "jis-euc", NULL, "8bcccb4c11bc4b95.15b2.17b94.b", + jis, ujis, ujis }, + { "jis-sjis", NULL, "8bcccb4c11bc4b95.b125.3b", + jis, sjis, sjis }, + /* read UJIS */ + { "ujis", NULL, "8bcccbcc18b95.15b2.17b94.b", + noconv, ujis, ujis }, + { "euc", NULL, "8bcccbcc18b95.15b2.17b94.b", + noconv, ujis, ujis }, + { "ujis-iso7", NULL, "8bcccb4c11bc4b96.14b2.17b94.b", + iso7, ujis, iso7 }, + { "euc-iso7", NULL, "8bcccb4c11bc4b96.14b2.17b94.b", + iso7, ujis, iso7 }, + { "ujis-jis", NULL, "8bcccb4c11bc4b95.15b2.17b94.b", + jis, ujis, jis }, + { "euc-jis", NULL, "8bcccb4c11bc4b95.15b2.17b94.b", + jis, ujis, jis }, + /* disallow UJIS's katakana to improve the encoding detection */ + { "ujis-sjis", NULL, "8bcccbcc18b95.15b.18b94.b", + noconv, ujis, sjis }, + { "euc-sjis", NULL, "8bcccbcc18b95.15b.18b94.b", + noconv, ujis, sjis }, + /* read SJIS */ + { "sjis", NULL, "8bcccbcc18b95.b125.3b", + noconv, sjis, sjis }, + { "sjis-iso7", NULL, "8bcccb4c11bc4b221.b", + iso7, sjis, iso7 }, + { "sjis-jis", NULL, "8bcccb4c11bc4b95.b125.3b", + jis, sjis, jis }, + { "sjis-ujis", NULL, "8bcccbcc18b95.b125.3b", + noconv, sjis, ujis }, + { "sjis-euc", NULL, "8bcccbcc18b95.b125.3b", + noconv, sjis, ujis }, +# endif +#endif + { NULL, NULL, NULL, noconv, noconv, noconv } +}; + +#if HAVE_LOCALE && ISO +/* + * Predefined local languages, + * selected by the setlocale(). + */ +struct charlocale { + char *name; + char *charset; +} charlocales[] = { + { "C", "ascii" }, + { "wr_WR.ct", "iso8" }, + { "ja_JP.jis8", "iso8" }, +# if JAPANESE + { "ja_JP.JIS", "japanese-jis" }, + { "ja_JP.jis7", "japanese-jis" }, + { "ja_JP.EUC", "japanese-ujis" }, + { "ja_JP.ujis", "japanese-ujis" }, + { "ja_JP.SJIS", "japanese-sjis" }, + { "ja_JP.mscode", "japanese-sjis" }, +/* Other local locales */ +# ifdef _AIX + /* AIX's */ + { "Ja_JP", "japanese-sjis" }, + { "ja_JP.IBM-eucJP", "japanese-ujis" }, + { "Ja_JP.IBM-932", "japanese-sjis" }, +# endif +# ifdef __hpux + /* HPUX */ + { "japanese", "japanese-sjis" }, + { "japanese.euc", "japanese-ujis" }, +# endif + { "ja", "japanese-ujis" }, + { "ja_JP", "japanese-ujis" }, + { "japan", "japanese-ujis" }, + { "Japan", "japanese-ujis" }, + { "japanese", "japanese-ujis" }, + { "Japanese", "japanese-ujis" }, + /* DEC OSF/1's */ + { "ja_JP.eucJP", "japanese-ujis" }, + { "ja_JP.deckanji", "japanese-ujis" }, + { "ja_JP.sdeckanji", "japanese-ujis" }, + /* BSDI's */ + { "Japanese-EUC", "japanese-ujis" }, + /* Win32 */ + { "Japanese_Japan.932", "japanese-sjis" }, +# endif + { NULL, "" } }; +#endif struct cs_alias { char *name; @@ -57,7 +183,87 @@ static char chardef[256]; static char *binfmt = NULL; public int binattr = AT_STANDOUT; +public char* opt_charset = NULL; + + +/* + * Look for an appropriate charset and return it. + */ + static struct charset * +search_charset(name) + char *name; +{ + struct charset *p; + char *name2, *n2; + int namelen, name2len; + int maxscore, score; + struct charset *result; + + if (!name) + name = ""; + namelen = strlen(name); + name2 = strchr(name, '-'); + if (name2) + { + name2len = namelen; + namelen = (name2 - name); + name2len -= namelen; + } else + { + name2len = 0; + } + maxscore = 0; + result = NULL; + for (p = charsets; p->name != NULL; p++) + { + score = 0; + n2 = strchr(p->name, '-'); + if (strncmp(name, p->name, namelen) == 0) { + score += namelen; + if ((int) strlen(p->name) == namelen) + score++; /* add bonus point for exactly match */ + } + if (name2 && n2 && strncmp(name2, n2, name2len) == 0) { + score += name2len - 1; /* decrease score of '-' */ + if ((int) strlen(n2) == name2len) + score++; /* add bonus point for exactly match */ + } + if (score > maxscore) + { + maxscore = score; + result = p; + } + } + return (result); +} + +/* + * Return the CODESET of left plane of named charset. + */ + public CODESET +left_codeset_of_charset(name) + register char *name; +{ + struct charset *p = search_charset(name); + if (p) + return (p->left); + return (noconv); +} + +/* + * Return the CODESET of right plane of named charset. + */ + public CODESET +right_codeset_of_charset(name) + register char *name; +{ + struct charset *p = search_charset(name); + + if (p) + return (p->right); + return (none); +} /* * Define a charset, given a description string. @@ -150,15 +356,16 @@ } } - for (p = charsets; p->name != NULL; p++) + p = search_charset(name); + if (p) { - if (strcmp(name, p->name) == 0) - { - ichardef(p->desc); - if (p->p_flag != NULL) - *(p->p_flag) = 1; - return (1); - } + ichardef(p->desc); + if (p->p_flag != NULL) + *(p->p_flag) = 1; +#if ISO + init_def_codesets(p->left, p->right, p->output); +#endif + return (1); } error("invalid charset name", NULL_PARG); @@ -175,6 +382,41 @@ ilocale() { register int c; +#if ISO + /* + * We cannot trust in a system's ctype because it + * cannot treat any coding system are not like EUC. + */ + register char *name; + register struct charlocale *p; + +#if MSB_ENABLE + /* HP-UX is used LC_COLLATE to specify codes in the regexp library. */ + (void) setlocale(LC_COLLATE, ""); +#endif + name = setlocale(LC_CTYPE, ""); +#ifdef __hpux + if (name != NULL) + name = getlocale(LOCALE_STATUS)->LC_CTYPE_D; +#endif + /* + * Search some environment variable like a setlocale() + * because some poor system's setlocale treat only + * system's local locale. + */ + if (name == NULL) + name = getenv("LC_CTYPE"); + if (name == NULL) + name = getenv("LANG"); + for (p = charlocales; name && p->name != NULL; p++) + { + if (strcmp(name, p->name) == 0) + { + (void) icharset(p->charset); + return; + } + } +#endif setlocale(LC_ALL, ""); for (c = 0; c < (int) sizeof(chardef); c++) @@ -186,6 +428,9 @@ else chardef[c] = IS_BINARY_CHAR|IS_CONTROL_CHAR; } +#if ISO + init_def_codesets(noconv, noconv, noconv); +#endif } #endif @@ -217,6 +462,27 @@ } /* + * Initialize planeset data structures. + */ + public void +init_planeset() +{ + char *s; + +#if ISO + s = lgetenv("JLESSPLANESET"); + if (s == NULL) + s = DEFPLANESET; + if (set_planeset(s) < 0) + { + error("invalid plane set", NULL_PARG); + quit(1); + /*NOTREACHED*/ + } +#endif +} + +/* * Initialize charset data structures. */ public void @@ -227,6 +493,22 @@ s = lgetenv("LESSBINFMT"); setbinfmt(s); +#if JAPANESE + /* + * See if option -K is defined. + */ + s = opt_charset; + if (icharset(s)) + return; +#endif +#if ISO + /* + * See if environment variable JLESSCHARSET is defined. + */ + s = lgetenv("JLESSCHARSET"); + if (icharset(s)) + return; +#endif /* * See if environment variable LESSCHARSET is defined. */ @@ -234,7 +516,7 @@ if (icharset(s)) return; /* - * LESSCHARSET is not defined: try LESSCHARDEF. + * JLESSCHARSET and LESSCHARSET are not defined: try LESSCHARDEF. */ s = lgetenv("LESSCHARDEF"); if (s != NULL && *s != '\0') @@ -270,9 +552,10 @@ (void) icharset("dos"); #else /* - * Default to "latin1". + * All variables are not defined either, default to DEFCHARSET. + * DEFCHARSET is defined in defines.h. */ - (void) icharset("latin1"); + (void) icharset(DEFCHARSET); #endif #endif } @@ -299,18 +582,38 @@ return (chardef[c] & IS_CONTROL_CHAR); } +#if ISO +/* + * Change a database to check "control" character. + * This function is called by multi.c only to support iso2022 charset. + */ + public void +change_control_char(c, flag) + int c, flag; +{ + c &= 0377; + if (flag) + chardef[c] |= IS_CONTROL_CHAR; + else + chardef[c] &= ~IS_CONTROL_CHAR; +} +#endif + /* * Return the printable form of a character. * For example, in the "ascii" charset '\3' is printed as "^C". */ public char * -prchar(c) +prchar(c, cs) int c; + CHARSET cs; { static char buf[8]; c &= 0377; - if (!control_char(c)) + if (CSISWRONG(cs) && c > 127) + sprintf(buf, binfmt, c); + else if (!control_char(c)) sprintf(buf, "%c", c); else if (c == ESC) sprintf(buf, "ESC"); Index: less/cmd.h diff -u less/cmd.h:1.1.1.13 less/cmd.h:1.19 --- less/cmd.h:1.1.1.13 Tue Aug 30 20:55:42 2005 +++ less/cmd.h Tue Aug 30 22:45:48 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ #define MAX_USERCMD 500 @@ -66,6 +72,10 @@ #define A_NEXT_TAG 53 #define A_PREV_TAG 54 +#if JAPANESE +#define A_ROT_RCODESET 80 +#endif + #define A_INVALID 100 #define A_NOACTION 101 #define A_UINVALID 102 Index: less/cmdbuf.c diff -u less/cmdbuf.c:1.1.1.16 less/cmdbuf.c:1.44 --- less/cmdbuf.c:1.1.1.16 Tue Aug 30 23:14:52 2005 +++ less/cmdbuf.c Sun Sep 4 13:52:54 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -25,6 +31,11 @@ static char *cp; /* Pointer into cmdbuf */ static int cmd_offset; /* Index into cmdbuf of first displayed char */ static int literal; /* Next input char should not be interpreted */ +static CHARSET cmdcs[CMDBUF_SIZE]; /* Buffer for holding a CHARSET of cmdbuf */ +static CHARSET *csp; /* Pointer into cmdcs */ +#if ISO +static MULBUF *mp = NULL; +#endif #if TAB_COMPLETE_FILENAME static int cmd_complete(); @@ -57,22 +68,23 @@ struct mlist *prev; struct mlist *curr_mp; char *string; + CHARSET *charset; }; /* * These are the various command histories that exist. */ struct mlist mlist_search = - { &mlist_search, &mlist_search, &mlist_search, NULL }; + { &mlist_search, &mlist_search, &mlist_search, NULL, NULL }; public void * constant ml_search = (void *) &mlist_search; struct mlist mlist_examine = - { &mlist_examine, &mlist_examine, &mlist_examine, NULL }; + { &mlist_examine, &mlist_examine, &mlist_examine, NULL, NULL }; public void * constant ml_examine = (void *) &mlist_examine; #if SHELL_ESCAPE || PIPEC struct mlist mlist_shell = - { &mlist_shell, &mlist_shell, &mlist_shell, NULL }; + { &mlist_shell, &mlist_shell, &mlist_shell, NULL, NULL }; public void * constant ml_shell = (void *) &mlist_shell; #endif @@ -95,6 +107,25 @@ /* + * Count the width of strings. + */ + static int +strwidth(s, cs) + char *s; + CHARSET cs; +{ +#if ISO + int w = 0; + + while (*s != '\0') + w += mwidth(*s++, cs); + return (w); +#else + return (strlen(s)); +#endif +} + +/* * Reset command buffer (to empty). */ public void @@ -102,9 +133,25 @@ { cp = cmdbuf; *cp = '\0'; + csp = cmdcs; + *csp = NULLCS; cmd_col = 0; cmd_offset = 0; literal = 0; +#if ISO + if (mp == NULL) + { + char *s = NULL; + mp = new_multi(); + s = getenv("JLESSKEYCHARSET"); + if (s == NULL) + s = DEFKEYCHARSET; + set_codesets(mp, left_codeset_of_charset(s), + right_codeset_of_charset(s)); + init_priority(mp); + } + init_multi(mp); +#endif } /* @@ -125,8 +172,8 @@ char *s; { putstr(s); - cmd_col += strlen(s); - prompt_col += strlen(s); + cmd_col += strwidth(s, ASCII); + prompt_col += strwidth(s, ASCII); } /* @@ -135,7 +182,7 @@ public int len_cmdbuf() { - return (strlen(cmdbuf)); + return (strlen_cs(cmdbuf, cmdcs)); } /* @@ -152,13 +199,13 @@ * Repaint the line from the current position. */ clear_eol(); - for ( ; *cp != '\0'; cp++) + for ( ; *cp != '\0'; cp++, csp++) { - p = prchar(*cp); - if (cmd_col + (int)strlen(p) >= sc_width) + p = prchar(*cp, *csp); + if (cmd_col + strwidth(p, *csp) >= sc_width) break; - putstr(p); - cmd_col += strlen(p); + putmchrs(p, *csp); + cmd_col += strwidth(p, *csp); } /* @@ -182,6 +229,7 @@ } cp = &cmdbuf[cmd_offset]; + csp = &cmdcs[cmd_offset]; } /* @@ -191,6 +239,7 @@ cmd_lshift() { char *s; + CHARSET *t; char *save_cp; int cols; @@ -199,9 +248,10 @@ * right we'd have to move to reach the center of the screen. */ s = cmdbuf + cmd_offset; - cols = 0; - while (cols < (sc_width - prompt_col) / 2 && *s != '\0') - cols += strlen(prchar(*s++)); + t = cmdcs + cmd_offset; + for (cols = 0; cols < (sc_width - prompt_col) / 2 && *s != '\0'; + s++, t++) + cols += strwidth(prchar(*s, *t), *t); cmd_offset = s - cmdbuf; save_cp = cp; @@ -216,6 +266,7 @@ cmd_rshift() { char *s; + CHARSET *t; char *p; char *save_cp; int cols; @@ -226,11 +277,12 @@ * of displayed characters. */ s = cmdbuf + cmd_offset; + t = cmdcs + cmd_offset; cols = 0; while (cols < (sc_width - prompt_col) / 2 && s > cmdbuf) { - p = prchar(*--s); - cols += strlen(p); + p = prchar(*--s, *--t); + cols += strwidth(p, *t); } cmd_offset = s - cmdbuf; @@ -247,6 +299,9 @@ { char *p; +#if ISO + do { +#endif if (*cp == '\0') { /* @@ -254,14 +309,18 @@ */ return (CC_OK); } - p = prchar(*cp); - if (cmd_col + (int)strlen(p) >= sc_width) + p = prchar(*cp, *csp); + if (cmd_col + strwidth(p, *csp) >= sc_width) cmd_lshift(); - else if (cmd_col + (int)strlen(p) == sc_width - 1 && cp[1] != '\0') + else if (cmd_col + strwidth(p, *csp) == sc_width - 1 && cp[1] != '\0') cmd_lshift(); + putmchrs(p, *csp); + cmd_col += strwidth(p, *csp); cp++; - putstr(p); - cmd_col += strlen(p); + csp++; +#if ISO + } while (CSISREST(*csp)); +#endif return (CC_OK); } @@ -273,18 +332,25 @@ { char *p; +#if ISO + do { +#endif if (cp <= cmdbuf) { /* Already at the beginning of the line */ return (CC_OK); } - p = prchar(cp[-1]); - if (cmd_col < prompt_col + (int)strlen(p)) + p = prchar(cp[-1], csp[-1]); + if (cmd_col < prompt_col + strwidth(p, csp[-1])) cmd_rshift(); cp--; - cmd_col -= strlen(p); + csp--; + cmd_col -= strwidth(p, *csp); while (*p++ != '\0') putbs(); +#if ISO + } while (CSISREST(*csp)); +#endif return (CC_OK); } @@ -296,8 +362,13 @@ int c; { char *s; + CHARSET *t; - if (strlen(cmdbuf) >= sizeof(cmdbuf)-2) +#if ISO + if (strlen_cs(cmdbuf, cmdcs) >= (int)sizeof(cmdbuf)-5) +#else + if (strlen_cs(cmdbuf, cmdcs) >= (int)sizeof(cmdbuf)-2) +#endif { /* * No room in the command buffer for another char. @@ -309,9 +380,46 @@ /* * Insert the character into the buffer. */ - for (s = &cmdbuf[strlen(cmdbuf)]; s >= cp; s--) +#if ISO + if (in_mca()) + { + char *cbuf; + CHARSET *csbuf; + int i, j; + + multi_buffering(mp, c, NULL, &cbuf, &csbuf, &i, NULL); + if (i > 0) + for ((s = &cmdbuf[strlen_cs(cmdbuf, cmdcs)]), + t = &cmdcs[strlen_cs(cmdbuf, cmdcs)]; + s >= cp; s--, t--) + { + s[i] = s[0]; + t[i] = t[0]; + } + for (j = 0; j < i; j++) + { + cp[j] = cbuf[j]; + csp[j] = csbuf[j]; + } + cbuf = &cp[i]; + /* + * Reprint the tail of the line from the inserted char. + */ + cmd_repaint(cp); + while (cp < cbuf) + cmd_right(); + return (CC_OK); + } +#endif + for ((s = &cmdbuf[strlen_cs(cmdbuf, cmdcs)]), + t = &cmdcs[strlen_cs(cmdbuf, cmdcs)]; + s >= cp; s--, t--) + { s[1] = s[0]; + t[1] = t[0]; + } *cp = c; + *csp = ASCII; /* * Reprint the tail of the line from the inserted char. */ @@ -328,6 +436,8 @@ cmd_erase() { register char *s; + register CHARSET *t; + int num; if (cp == cmdbuf) { @@ -340,12 +450,17 @@ /* * Move cursor left (to the char being erased). */ + s = cp; cmd_left(); + num = s - cp; /* * Remove the char from the buffer (shift the buffer left). */ - for (s = cp; *s != '\0'; s++) - s[0] = s[1]; + for ((s = cp), t = csp; *s != '\0'; s++, t++) + { + s[0] = s[num]; + t[0] = t[num]; + } /* * Repaint the buffer after the erased char. */ @@ -481,6 +596,8 @@ int action; { char *s; + CHARSET *t; + int i; if (curr_mlist == NULL) { @@ -503,14 +620,18 @@ * Copy the entry into cmdbuf and echo it on the screen. */ s = curr_mlist->curr_mp->string; + t = curr_mlist->curr_mp->charset; if (s == NULL) s = ""; - for (cp = cmdbuf; *s != '\0'; s++) + for ((cp = cmdbuf), (csp = cmdcs), i = 0; *s != '\0'; s++, t++, i++) { - *cp = *s; - cmd_right(); + cp[i] = *s; + csp[i] = *t; } - *cp = '\0'; + cp[i] = '\0'; + csp[i] = NULLCS; + while (*cp != '\0') + cmd_right(); return (CC_OK); } #endif @@ -519,9 +640,10 @@ * Add a string to a history list. */ public void -cmd_addhist(mlist, cmd) +cmd_addhist(mlist, cmd, cs) struct mlist *mlist; char *cmd; + CHARSET *cs; { #if CMD_HISTORY struct mlist *ml; @@ -529,7 +651,7 @@ /* * Don't save a trivial command. */ - if (strlen(cmd) == 0) + if (strlen_cs(cmd, cs) == 0) return; /* * Don't save if a duplicate of a command which is already @@ -548,7 +670,7 @@ * Save the command and put it at the end of the history list. */ ml = (struct mlist *) ecalloc(1, sizeof(struct mlist)); - ml->string = save(cmd); + ml->string = strdup_cs(cmd, cs, &ml->charset); ml->next = mlist; ml->prev = mlist->prev; mlist->prev->next = ml; @@ -575,7 +697,7 @@ */ if (curr_mlist == NULL) return; - cmd_addhist(curr_mlist, cmdbuf); + cmd_addhist(curr_mlist, cmdbuf, cmdcs); #endif } @@ -1049,3 +1171,12 @@ { return (cmdbuf); } + +/* + * Return a pointer to the character set bufffer of the command buffer. + */ + public CHARSET * +get_cmdcs() +{ + return (cmdcs); +} Index: less/command.c diff -u less/command.c:1.1.1.19 less/command.c:1.27 --- less/command.c:1.1.1.19 Tue Aug 30 23:14:52 2005 +++ less/command.c Wed Aug 31 00:09:14 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -179,15 +185,17 @@ exec_mca() { register char *cbuf; + CHARSET *csbuf; cmd_exec(); cbuf = get_cmdbuf(); + csbuf = get_cmdcs(); switch (mca) { case A_F_SEARCH: case A_B_SEARCH: - multi_search(cbuf, (int) number); + multi_search(cbuf, csbuf, (int) number); break; case A_FIRSTCMD: /* @@ -740,8 +748,9 @@ * If SRCH_PAST_EOF is set, continue the search thru multiple files. */ static void -multi_search(pattern, n) +multi_search(pattern, charset, n) char *pattern; + CHARSET *charset; int n; { register int nomore; @@ -772,7 +781,7 @@ for (;;) { - n = search(search_type, pattern, n); + n = search(search_type, pattern, charset, n); /* * The SRCH_NO_MOVE flag doesn't "stick": it gets cleared * after being used once. This allows "n" to work after @@ -1225,7 +1234,7 @@ #define DO_SEARCH() if (number <= 0) number = 1; \ mca_search(); \ cmd_exec(); \ - multi_search((char *)NULL, (int) number); + multi_search((char *)NULL, (CHARSET *)NULL, (int) number); case A_F_SEARCH: @@ -1610,6 +1619,16 @@ c = getcc(); goto again; +#if JAPANESE + case A_ROT_RCODESET: + parg.p_string = + rotate_right_codeset(get_mulbuf(curr_ifile)); + screen_trashed = 1; + make_display(); + error("%s codeset is used in right plane", &parg); + break; +#endif + case A_NOACTION: break; Index: less/configure diff -u less/configure:1.1.1.17 less/configure:1.11 --- less/configure:1.1.1.17 Tue Aug 30 23:14:54 2005 +++ less/configure Wed Aug 31 00:09:14 2005 @@ -1,9 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.54 for less 1. +# Generated by GNU Autoconf 2.59 for less 1. # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -20,9 +19,10 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -36,9 +36,12 @@ PS4='+ ' # NLS nuisances. -for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -82,15 +85,15 @@ # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conftest.sh - echo "exit 0" >>conftest.sh - chmod +x conftest.sh - if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi - rm -f conftest.sh + rm -f conf$$.sh fi @@ -215,16 +218,17 @@ if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -664,7 +668,7 @@ # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir + localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in @@ -704,10 +708,10 @@ # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -799,9 +803,9 @@ cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -838,11 +842,14 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-msb Disable the MSB of non ASCII characters + --disable-jisx0213 Disable the JIS X 0213 mapping for SJIS and UJIS --disable-largefile omit support for large files Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-cs-regex Regular expression library with character set detection --with-regex={auto,pcre,posix,regcmp,re_comp,regcomp,regcomp-local} Select a regular expression library auto --with-editor=PROGRAM use PROGRAM as the default editor vi @@ -891,12 +898,45 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. @@ -907,7 +947,7 @@ echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then + test -f $ac_srcdir/configure.in; then echo $ac_configure --help else @@ -921,10 +961,9 @@ if $ac_init_version; then cat <<\_ACEOF less configure 1 -generated by GNU Autoconf 2.54 +generated by GNU Autoconf 2.59 -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -936,7 +975,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by less $as_me 1, which was -generated by GNU Autoconf 2.54. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -988,24 +1027,54 @@ # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= +ac_configure_args0= +ac_configure_args1= ac_sep= -for ac_arg +ac_must_keep_next=false +for ac_pass in 1 2 do - case $ac_arg in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n ) continue ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -1029,12 +1098,12 @@ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } @@ -1063,7 +1132,7 @@ for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi @@ -1082,7 +1151,7 @@ echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core core.* *.core && + rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 @@ -1162,7 +1231,7 @@ # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" @@ -1179,13 +1248,13 @@ ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. @@ -1245,6 +1314,28 @@ ac_config_headers="$ac_config_headers defines.h" +# Checks for arguments. + +# Check whether --with-cs-regex or --without-cs-regex was given. +if test "${with_cs_regex+set}" = set; then + withval="$with_cs_regex" + have_regex_cs=$withval +else + have_regex_cs=no +fi; +msb_enable=unknown +# Check whether --enable-msb or --disable-msb was given. +if test "${enable_msb+set}" = set; then + enableval="$enable_msb" + msb_enable=$enableval +fi; +jisx0213_enable=unknown +# Check whether --enable-jisx0213 or --disable-jisx0213 was given. +if test "${enable_jisx0213+set}" = set; then + enableval="$enable_jisx0213" + jisx0213_enable=$enableval +fi; + # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -1555,8 +1646,10 @@ fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. @@ -1580,8 +1673,11 @@ (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -1592,12 +1688,12 @@ } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe" +ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 @@ -1611,27 +1707,39 @@ # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.*; do +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - a.out ) # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool --akim. - export ac_cv_exeext - break;; - * ) break;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; esac done else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + { { echo "$as_me:$LINENO: error: C compiler cannot create executables -check \`config.log' for details." >&5 +See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables -check \`config.log' for details." >&2;} +See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi @@ -1658,9 +1766,11 @@ cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&5 +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&2;} +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi @@ -1668,7 +1778,7 @@ echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 -rm -f a.out a.exe conftest$ac_cv_exeext +rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. @@ -1693,14 +1803,16 @@ case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; + export ac_cv_exeext + break;; * ) break;; esac done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -1717,8 +1829,11 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -1743,9 +1858,12 @@ done else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -1761,8 +1879,11 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -1777,11 +1898,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1790,10 +1921,11 @@ ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi @@ -1809,8 +1941,11 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -1822,11 +1957,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1835,10 +1980,11 @@ ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_prog_cc_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 @@ -1865,8 +2011,11 @@ ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include @@ -1889,6 +2038,16 @@ va_end (v); return s; } + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -1915,11 +2074,21 @@ CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1929,9 +2098,10 @@ break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC @@ -1959,19 +2129,28 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ - ''\ - '#include ' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -1979,10 +2158,13 @@ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_declaration +#include int main () { @@ -1993,11 +2175,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2006,13 +2198,17 @@ : else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_declaration int main () @@ -2024,11 +2220,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2037,9 +2243,10 @@ break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -2050,9 +2257,10 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2068,8 +2276,11 @@ ac_func_search_save_LIBS=$LIBS ac_cv_search_strerror=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2088,11 +2299,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2101,15 +2322,20 @@ ac_cv_search_strerror="none required" else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_strerror" = no; then for ac_lib in cposix; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2128,11 +2354,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2142,9 +2378,11 @@ break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS @@ -2179,13 +2417,22 @@ do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include - Syntax error +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2197,6 +2444,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2207,7 +2455,8 @@ : else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi @@ -2216,8 +2465,11 @@ # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 @@ -2230,6 +2482,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2241,7 +2494,8 @@ continue else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break @@ -2270,13 +2524,22 @@ do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include - Syntax error +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2288,6 +2551,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2298,7 +2562,8 @@ : else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi @@ -2307,8 +2572,11 @@ # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 @@ -2321,6 +2589,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2332,7 +2601,8 @@ continue else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break @@ -2345,8 +2615,10 @@ if $ac_preproc_ok; then : else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -2380,8 +2652,11 @@ else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF @@ -2396,8 +2671,11 @@ if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include Autoconf TCGETA _ACEOF @@ -2452,6 +2730,7 @@ # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 @@ -2468,6 +2747,7 @@ case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -2475,20 +2755,20 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi done done ;; @@ -2538,9 +2818,12 @@ while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, @@ -2560,11 +2843,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2573,17 +2866,28 @@ break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext CC="$CC -n32" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2592,10 +2896,11 @@ ac_cv_sys_largefile_CC=' -n32'; break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext - break +rm -f conftest.err conftest.$ac_objext + break done CC=$ac_save_CC rm -f conftest.$ac_ext @@ -2615,8 +2920,11 @@ while :; do ac_cv_sys_file_offset_bits=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, @@ -2636,11 +2944,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2649,12 +2967,16 @@ break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. @@ -2675,11 +2997,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2688,9 +3020,10 @@ ac_cv_sys_file_offset_bits=64; break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext break done fi @@ -2712,8 +3045,11 @@ while :; do ac_cv_sys_large_files=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, @@ -2733,11 +3069,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2746,12 +3092,16 @@ break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. @@ -2772,11 +3122,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2785,9 +3145,10 @@ ac_cv_sys_large_files=1; break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext break done fi @@ -2813,8 +3174,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lxcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2833,11 +3197,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2846,10 +3220,12 @@ ac_cv_lib_xcurses_initscr=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_xcurses_initscr=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_xcurses_initscr" >&5 @@ -2868,8 +3244,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2888,11 +3267,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2901,10 +3290,12 @@ ac_cv_lib_ncurses_initscr=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_ncurses_initscr=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5 @@ -2923,8 +3314,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2943,11 +3337,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2956,10 +3360,12 @@ ac_cv_lib_curses_initscr=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_curses_initscr=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_curses_initscr" >&5 @@ -2978,8 +3384,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-ltermcap $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2998,11 +3407,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3011,10 +3430,12 @@ ac_cv_lib_termcap_tgetent=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_termcap_tgetent=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_tgetent" >&5 @@ -3033,8 +3454,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-ltermlib $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -3053,11 +3477,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3066,10 +3500,12 @@ ac_cv_lib_termlib_tgetent=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_termlib_tgetent=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_termlib_tgetent" >&5 @@ -3091,8 +3527,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lgen $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -3111,11 +3550,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3124,10 +3573,12 @@ ac_cv_lib_gen_regcmp=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_gen_regcmp=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_gen_regcmp" >&5 @@ -3150,8 +3601,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -3170,11 +3624,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3183,10 +3647,12 @@ ac_cv_lib_intl_regcmp=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_intl_regcmp=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_intl_regcmp" >&5 @@ -3209,8 +3675,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lPW $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -3229,11 +3698,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3242,10 +3721,12 @@ ac_cv_lib_PW_regcmp=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_PW_regcmp=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_PW_regcmp" >&5 @@ -3284,8 +3765,11 @@ SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3297,11 +3781,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3310,10 +3804,12 @@ termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi @@ -3326,8 +3822,11 @@ SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3339,11 +3838,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3352,10 +3861,12 @@ termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi @@ -3368,8 +3879,11 @@ SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3381,11 +3895,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3394,10 +3918,12 @@ termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi @@ -3411,8 +3937,11 @@ SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3424,11 +3953,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3437,10 +3976,12 @@ termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi @@ -3455,8 +3996,11 @@ SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3468,11 +4012,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3481,10 +4035,12 @@ termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi @@ -3497,8 +4053,11 @@ SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3510,11 +4069,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3523,10 +4092,12 @@ termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi @@ -3548,44 +4119,63 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include #include +int +main () +{ + + ; + return 0; +} _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_header_stdc=no +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include _ACEOF @@ -3602,8 +4192,11 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include _ACEOF @@ -3623,16 +4216,20 @@ : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else -# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -3643,7 +4240,7 @@ int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -3663,11 +4260,12 @@ else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -3692,7 +4290,7 @@ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h + inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -3701,19 +4299,32 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3722,10 +4333,11 @@ eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -3771,18 +4383,31 @@ echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3791,10 +4416,11 @@ ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -3802,8 +4428,11 @@ echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 @@ -3816,6 +4445,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -3826,7 +4456,8 @@ ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext @@ -3834,26 +4465,43 @@ echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; - no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------- ## +## Report this to the less lists. ## +## ------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -3876,8 +4524,11 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include @@ -3931,8 +4582,11 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3990,11 +4644,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4003,10 +4667,11 @@ ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_c_const=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 @@ -4024,8 +4689,11 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -4040,11 +4708,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4053,10 +4731,11 @@ ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_type_off_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6 @@ -4076,8 +4755,11 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -4092,11 +4774,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4105,10 +4797,11 @@ ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_type_size_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6 @@ -4128,8 +4821,11 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include @@ -4145,11 +4841,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4158,10 +4864,11 @@ ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_header_time=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 @@ -4175,6 +4882,8 @@ # Autoheader templates for symbols defined later by AC_DEFINE. +#AH_TEMPLATE([HAVE_POSIX_REGCOMP_CS], +# [POSIX regcomp() and regex.h with character set detection]) @@ -4229,8 +4938,11 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -4245,11 +4957,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4258,10 +4980,11 @@ ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_type_off_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6 @@ -4278,8 +5001,11 @@ echo "$as_me:$LINENO: checking for void" >&5 echo $ECHO_N "checking for void... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -4291,11 +5017,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4308,16 +5044,20 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: checking for const" >&5 echo $ECHO_N "checking for const... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -4329,11 +5069,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4346,16 +5096,20 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: checking for time_t" >&5 echo $ECHO_N "checking for time_t... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include int main () @@ -4367,11 +5121,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4384,11 +5148,12 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Checks for library functions. echo "$as_me:$LINENO: checking return type of signal handlers" >&5 @@ -4397,8 +5162,11 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #ifdef signal @@ -4420,11 +5188,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4433,10 +5211,11 @@ ac_cv_type_signal=void else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_type_signal=int fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 @@ -4465,43 +5244,73 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" +{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); -char (*f) (); - -int -main () -{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -f = $ac_func; +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4510,10 +5319,12 @@ eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -4533,43 +5344,73 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define tcgetattr to an innocuous variant, in case declares tcgetattr. + For example, HP-UX 11i declares gettimeofday. */ +#define tcgetattr innocuous_tcgetattr + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char tcgetattr (); below. */ -#include + which can conflict with char tcgetattr (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef tcgetattr + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" +{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char tcgetattr (); -char (*f) (); - -int -main () -{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_tcgetattr) || defined (__stub___tcgetattr) choke me #else -f = tcgetattr; +char (*f) () = tcgetattr; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != tcgetattr; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4578,10 +5419,12 @@ ac_cv_func_tcgetattr=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_func_tcgetattr=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_tcgetattr" >&5 echo "${ECHO_T}$ac_cv_func_tcgetattr" >&6 @@ -4596,8 +5439,11 @@ echo "$as_me:$LINENO: checking for fileno" >&5 echo $ECHO_N "checking for fileno... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if HAVE_STDIO_H #include @@ -4612,11 +5458,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4629,17 +5485,22 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext echo "$as_me:$LINENO: checking for strerror" >&5 echo $ECHO_N "checking for strerror... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if HAVE_STDIO_H #include @@ -4660,11 +5521,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4677,17 +5548,22 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext echo "$as_me:$LINENO: checking for sys_errlist" >&5 echo $ECHO_N "checking for sys_errlist... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -4699,11 +5575,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4716,17 +5602,22 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext echo "$as_me:$LINENO: checking for sigset_t" >&5 echo $ECHO_N "checking for sigset_t... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include @@ -4740,11 +5631,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4757,17 +5658,22 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext echo "$as_me:$LINENO: checking for sigemptyset" >&5 echo $ECHO_N "checking for sigemptyset... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include @@ -4781,11 +5687,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4798,18 +5714,23 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext have_errno=no echo "$as_me:$LINENO: checking for errno" >&5 echo $ECHO_N "checking for errno... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if HAVE_ERRNO_H #include @@ -4824,11 +5745,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4841,13 +5772,18 @@ have_errno=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test $have_errno = no; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if HAVE_ERRNO_H #include @@ -4862,11 +5798,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4882,18 +5828,23 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: checking for locale" >&5 echo $ECHO_N "checking for locale... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include int @@ -4906,11 +5857,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4923,16 +5884,21 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext echo "$as_me:$LINENO: checking for ctype functions" >&5 echo $ECHO_N "checking for ctype functions... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if HAVE_CTYPE_H #include @@ -4947,11 +5913,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4964,19 +5940,24 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext # Checks for external variable ospeed in the termcap library. have_ospeed=no echo "$as_me:$LINENO: checking termcap for ospeed" >&5 echo $ECHO_N "checking termcap for ospeed... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #if HAVE_TERMIOS_H @@ -4995,11 +5976,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5012,13 +6003,18 @@ have_ospeed=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test $have_ospeed = no; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -5030,11 +6026,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5050,14 +6056,50 @@ else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi # Checks for regular expression functions. +if test $have_regex_cs != no; then +cat >>confdefs.h <<\_ACEOF +#define CS_REGEX 1 +_ACEOF + +# try to find it with character set detection. +have_regex=no +if test $have_regex = no && test -f ${srcdir}/regex_cs.c; then +echo "$as_me:$LINENO: result: using POSIX regcomp_cs -- local source" >&5 +echo "${ECHO_T}using POSIX regcomp_cs -- local source" >&6; cat >>confdefs.h <<\_ACEOF +#define HAVE_POSIX_REGCOMP_CS 1 +_ACEOF + REGEX_O='regex_cs.$(O)' have_regex=yes +fi +if test $have_regex = no && test -f ${srcdir}/regexp_cs.c; then +echo "$as_me:$LINENO: result: using V8 regcomp_cs -- local source" >&5 +echo "${ECHO_T}using V8 regcomp_cs -- local source" >&6; cat >>confdefs.h <<\_ACEOF +#define HAVE_V8_REGCOMP_CS 1 +_ACEOF + REGEX_O='regexp_cs.$(O)' have_regex=yes +fi +if test $have_regex = no; then +echo "$as_me:$LINENO: result: cannot find regular expression library with character set detection" >&5 +echo "${ECHO_T}cannot find regular expression library with character set detection" >&6; cat >>confdefs.h <<\_ACEOF +#define NO_REGEX 1 +_ACEOF + +fi +else +cat >>confdefs.h <<\_ACEOF +#define CS_REGEX 0 +_ACEOF + +# try to find it without character set detection. have_regex=no have_posix_regex=unknown echo "$as_me:$LINENO: checking for regcomp" >&5 @@ -5079,8 +6121,11 @@ have_posix_regex=unknown else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include @@ -5109,11 +6154,12 @@ else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ( exit $ac_status ) have_posix_regex=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi if test $have_posix_regex = yes; then echo "$as_me:$LINENO: result: using POSIX regcomp" >&5 @@ -5125,8 +6171,11 @@ have_regex=yes elif test $have_posix_regex = unknown; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include @@ -5140,11 +6189,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5158,9 +6217,11 @@ have_regex=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 @@ -5178,8 +6239,11 @@ ac_check_lib_save_LIBS=$LIBS LIBS="-lpcre $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -5198,11 +6262,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5211,10 +6285,12 @@ ac_cv_lib_pcre_pcre_compile=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_lib_pcre_pcre_compile=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_pcre_pcre_compile" >&5 @@ -5238,43 +6314,73 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define regcmp to an innocuous variant, in case declares regcmp. + For example, HP-UX 11i declares gettimeofday. */ +#define regcmp innocuous_regcmp + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char regcmp (); below. */ -#include + which can conflict with char regcmp (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef regcmp + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" +{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char regcmp (); -char (*f) (); - -int -main () -{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_regcmp) || defined (__stub___regcmp) choke me #else -f = regcmp; +char (*f) () = regcmp; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != regcmp; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5283,10 +6389,12 @@ ac_cv_func_regcmp=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_func_regcmp=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_regcmp" >&5 echo "${ECHO_T}$ac_cv_func_regcmp" >&6 @@ -5304,8 +6412,11 @@ if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "regexp.h" int @@ -5318,11 +6429,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5335,9 +6456,11 @@ have_regex=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi fi @@ -5363,43 +6486,73 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define re_comp to an innocuous variant, in case declares re_comp. + For example, HP-UX 11i declares gettimeofday. */ +#define re_comp innocuous_re_comp + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char re_comp (); below. */ -#include + which can conflict with char re_comp (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef re_comp + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" +{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char re_comp (); -char (*f) (); - -int -main () -{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_re_comp) || defined (__stub___re_comp) choke me #else -f = re_comp; +char (*f) () = re_comp; +#endif +#ifdef __cplusplus +} #endif +int +main () +{ +return f != re_comp; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5408,10 +6561,12 @@ ac_cv_func_re_comp=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_func_re_comp=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_re_comp" >&5 echo "${ECHO_T}$ac_cv_func_re_comp" >&6 @@ -5432,6 +6587,62 @@ _ACEOF fi +fi + +case $msb_enable in +yes) echo "$as_me:$LINENO: result: enable the MSB of non ASCII characters" >&5 +echo "${ECHO_T}enable the MSB of non ASCII characters" >&6 + cat >>confdefs.h <<\_ACEOF +#define MSB_ENABLE 1 +_ACEOF +;; +no) echo "$as_me:$LINENO: result: disable the MSB of non ASCII characters" >&5 +echo "${ECHO_T}disable the MSB of non ASCII characters" >&6 + cat >>confdefs.h <<\_ACEOF +#define MSB_ENABLE 0 +_ACEOF +;; +unknown) + if test $have_regex_cs = no; then + echo "$as_me:$LINENO: result: decide to enable the MSB of non ASCII characters" >&5 +echo "${ECHO_T}decide to enable the MSB of non ASCII characters" >&6 + cat >>confdefs.h <<\_ACEOF +#define MSB_ENABLE 1 +_ACEOF + + else + echo "$as_me:$LINENO: result: decide to disable the MSB of non ASCII characters" >&5 +echo "${ECHO_T}decide to disable the MSB of non ASCII characters" >&6 + cat >>confdefs.h <<\_ACEOF +#define MSB_ENABLE 0 +_ACEOF + + fi;; +esac + +case $jisx0213_enable in +unknown|yes) + echo "$as_me:$LINENO: result: enable the JIS X 0213 mapping for SJIS and UJIS" >&5 +echo "${ECHO_T}enable the JIS X 0213 mapping for SJIS and UJIS" >&6 + cat >>confdefs.h <<\_ACEOF +#define SJIS0213 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define UJIS0213 1 +_ACEOF +;; +no) echo "$as_me:$LINENO: result: disable the JIS X 0213 mapping for SJIS and UJIS" >&5 +echo "${ECHO_T}disable the JIS X 0213 mapping for SJIS and UJIS" >&6 + cat >>confdefs.h <<\_ACEOF +#define SJIS0213 0 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define UJIS0213 0 +_ACEOF +;; +esac # Check whether --with-editor or --without-editor was given. @@ -5481,13 +6692,13 @@ # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -5498,7 +6709,7 @@ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache -if cmp -s $cache_file confcache; then :; else +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file @@ -5517,13 +6728,13 @@ # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ + ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; +s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; -s/^[^=]*=[ ]*$//; +s/^[^=]*=[ ]*$//; }' fi @@ -5534,7 +6745,7 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' @@ -5558,6 +6769,8 @@ # configure, is in config.log if it exists. debug=false +ac_cs_recheck=false +ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF @@ -5576,9 +6789,10 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -5592,9 +6806,12 @@ PS4='+ ' # NLS nuisances. -for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -5638,15 +6855,15 @@ # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conftest.sh - echo "exit 0" >>conftest.sh - chmod +x conftest.sh - if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi - rm -f conftest.sh + rm -f conf$$.sh fi @@ -5773,16 +6990,17 @@ if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -5809,7 +7027,7 @@ cat >&5 <<_CSEOF This file was extended by less $as_me 1, which was -generated by GNU Autoconf 2.54. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5849,12 +7067,13 @@ -h, --help print this help, then exit -V, --version print version number, then exit + -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + instantiate the configuration file FILE --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + instantiate the configuration header FILE Configuration files: $config_files @@ -5868,11 +7087,10 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ less config.status 1 -configured by $0, generated by GNU Autoconf 2.54, +configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir @@ -5905,12 +7123,9 @@ case $ac_option in # Handling of the options. _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" - exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; -_ACEOF cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) @@ -5932,6 +7147,9 @@ $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 @@ -5946,6 +7164,20 @@ shift done +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + _ACEOF @@ -5974,6 +7206,9 @@ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { @@ -5982,17 +7217,17 @@ } # Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} + { - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { - tmp=$TMPDIR/cs$$-$RANDOM + tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } @@ -6084,9 +7319,9 @@ (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end @@ -6104,21 +7339,21 @@ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -6134,10 +7369,10 @@ as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -6175,12 +7410,45 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac case $INSTALL in @@ -6202,7 +7470,7 @@ configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." + sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. @@ -6211,24 +7479,24 @@ case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } _ACEOF @@ -6270,12 +7538,12 @@ # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' @@ -6284,11 +7552,11 @@ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac @@ -6302,28 +7570,29 @@ case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF @@ -6346,9 +7615,9 @@ s,[\\$`],\\&,g t clear : clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times @@ -6362,13 +7631,13 @@ # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail @@ -6377,7 +7646,7 @@ # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -6404,7 +7673,7 @@ # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -6432,16 +7701,16 @@ cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then - if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -6457,10 +7726,10 @@ as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -6501,8 +7770,11 @@ # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null - $SHELL $CONFIG_STATUS || ac_cs_success=false + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. Index: less/configure.ac diff -u less/configure.ac:1.1.1.1 less/configure.ac:1.2 --- less/configure.ac:1.1.1.1 Tue Aug 30 23:14:55 2005 +++ less/configure.ac Wed Aug 31 00:09:14 2005 @@ -13,6 +13,13 @@ AC_CONFIG_SRCDIR([forwback.c]) AC_CONFIG_HEADER([defines.h]) +# Checks for arguments. +AC_ARG_WITH(cs-regex, [ --with-cs-regex Regular expression library with character set detection], have_regex_cs=$withval, have_regex_cs=no) +msb_enable=unknown +AC_ARG_ENABLE(msb, [ --disable-msb Disable the MSB of non ASCII characters], msb_enable=$enableval) +jisx0213_enable=unknown +AC_ARG_ENABLE(jisx0213, [ --disable-jisx0213 Disable the JIS X 0213 mapping for SJIS and UJIS], jisx0213_enable=$enableval) + # Checks for programs. AC_PROG_CC AC_ISC_POSIX @@ -150,6 +157,8 @@ AC_HEADER_TIME # Autoheader templates for symbols defined later by AC_DEFINE. +#AH_TEMPLATE([HAVE_POSIX_REGCOMP_CS], +# [POSIX regcomp() and regex.h with character set detection]) AH_TEMPLATE([HAVE_POSIX_REGCOMP], [POSIX regcomp() and regex.h]) AH_TEMPLATE([HAVE_PCRE], @@ -298,6 +307,22 @@ fi # Checks for regular expression functions. +if test $have_regex_cs != no; then +AC_DEFINE(CS_REGEX) +# try to find it with character set detection. +have_regex=no +if test $have_regex = no && test -f ${srcdir}/regex_cs.c; then +AC_MSG_RESULT(using POSIX regcomp_cs -- local source); AC_DEFINE(HAVE_POSIX_REGCOMP_CS) REGEX_O='regex_cs.$(O)' AC_SUBST(REGEX_O) have_regex=yes +fi +if test $have_regex = no && test -f ${srcdir}/regexp_cs.c; then +AC_MSG_RESULT(using V8 regcomp_cs -- local source); AC_DEFINE(HAVE_V8_REGCOMP_CS) REGEX_O='regexp_cs.$(O)' AC_SUBST(REGEX_O) have_regex=yes +fi +if test $have_regex = no; then +AC_MSG_RESULT(cannot find regular expression library with character set detection); AC_DEFINE(NO_REGEX) +fi +else +AC_DEFINE(CS_REGEX, 0) +# try to find it without character set detection. have_regex=no have_posix_regex=unknown AC_MSG_CHECKING(for regcomp) @@ -378,6 +403,32 @@ if test $have_regex = no; then AC_MSG_RESULT(cannot find regular expression library); AC_DEFINE(NO_REGEX) fi +fi + +case $msb_enable in +yes) AC_MSG_RESULT(enable the MSB of non ASCII characters) + AC_DEFINE(MSB_ENABLE);; +no) AC_MSG_RESULT(disable the MSB of non ASCII characters) + AC_DEFINE(MSB_ENABLE, 0);; +unknown) + if test $have_regex_cs = no; then + AC_MSG_RESULT(decide to enable the MSB of non ASCII characters) + AC_DEFINE(MSB_ENABLE) + else + AC_MSG_RESULT(decide to disable the MSB of non ASCII characters) + AC_DEFINE(MSB_ENABLE, 0) + fi;; +esac + +case $jisx0213_enable in +unknown|yes) + AC_MSG_RESULT(enable the JIS X 0213 mapping for SJIS and UJIS) + AC_DEFINE(SJIS0213, 1) + AC_DEFINE(UJIS0213, 1);; +no) AC_MSG_RESULT(disable the JIS X 0213 mapping for SJIS and UJIS) + AC_DEFINE(SJIS0213, 0) + AC_DEFINE(UJIS0213, 0);; +esac AC_ARG_WITH(editor, [ --with-editor=PROGRAM use PROGRAM as the default editor [vi]], Index: less/decode.c diff -u less/decode.c:1.1.1.17 less/decode.c:1.23 --- less/decode.c:1.1.1.17 Tue Aug 30 20:55:40 2005 +++ less/decode.c Tue Aug 30 22:45:49 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -153,6 +159,10 @@ '!',0, A_SHELL, '+',0, A_FIRSTCMD, +#if JAPANESE + '@',0, A_ROT_RCODESET, +#endif + 'H',0, A_HELP, 'h',0, A_HELP, SK(SK_F1),0, A_HELP, Index: less/defines.ds diff -u less/defines.ds:1.1.1.6 less/defines.ds:1.16 --- less/defines.ds:1.1.1.6 Tue Aug 30 20:55:44 2005 +++ less/defines.ds Tue Aug 30 22:45:49 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines reserved. + * + * You may distribute under the terms of the Less License. + */ /* DOS definition file for less. */ @@ -181,6 +187,46 @@ #define HAVE_DUP 1 /* + * COMPRESS is 1 if you want to read comressed file. + */ +#define COMPRESS 1 + +/* + * ISO is 1 if you want to read code which contain many character sets + * by using iso 2022 code extension techniques. + */ +#define ISO 1 + +/* + * JAPANESE is 1 if you want to read several KANJI code. + */ +#define JAPANESE 1 +#if JAPANESE && !ISO +# define ISO 1 +#endif + +/* + * DEFCHARSET is name of the default character set. + * This used as LESSCHARSET envrionment variable if user did not define it. + * The value of this must equal one of the available value which can use as + * LESSCHARSET environment variable + */ +#define DEFCHARSET "iso8" + +/* + * DEFPLANESET is name of the default plane set of iso 2022 extension. + * This used as LESSPLANESET envrionment variable if user did not define it. + * The value of this must equal one of the available value which can use as + * LESSPLANESET environment variable or any escape sequence for setting up. + */ +#define DEFPLANESET "ctext" + +/* + * DEFKEYCHARSET is name of the default character set for keyboard input. + */ +#define DEFKEYCHARSET "sjis-iso7" + +/* * Sizes of various buffers. */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ @@ -207,13 +253,19 @@ /* * Regular expression library. + * Some are extended to detect character set. * Define exactly one of the following to be 1: + * HAVE_POSIX_REGCOMP_CS: extended POSIX regcomp() and regex.h + * HAVE_V8_REGCOMP_CS: extended Henry Spencer V8 regcomp() and regexp.h * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h * HAVE_RE_COMP: BSD re_comp() * HAVE_REGCMP: System V regcmp() * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h - * NO_REGEX: pattern matching is supported, but without metacharacters. + * NO_REGEX: pattern matching with character set detection is supported, + * but without metacharacters. */ +/* #undef HAVE_POSIX_REGCOMP_CS */ +/* #undef HAVE_V8_REGCOMP_CS */ /* #undef HAVE_POSIX_REGCOMP */ /* #undef HAVE_RE_COMP */ /* #undef HAVE_REGCMP */ @@ -224,6 +276,27 @@ #define NO_REGEX 1 #endif +/* + * Does regular expression library detect character set? + */ +#if NO_REGEX +#define CS_REGEX 1 +#else +#define CS_REGEX 0 +#endif + +/* + * Define MSB_ENABLE if you want to enable a MSB of non ASCII characters. + * It will be help if your library has not ability to detect a character set. + * If it has ability, this should be 0. If your system was not worked well, + * try to change following into 0 by hand. + */ +#if CS_REGEX +#define MSB_ENABLE 0 +#else +#define MSB_ENABLE 1 +#endif + /* Define HAVE_VOID if your compiler supports the "void" type. */ #define HAVE_VOID 1 Index: less/defines.h.in diff -u less/defines.h.in:1.1.1.16 less/defines.h.in:1.35 --- less/defines.h.in:1.1.1.16 Tue Aug 30 23:14:55 2005 +++ less/defines.h.in Wed Aug 31 00:09:14 2005 @@ -161,6 +161,46 @@ #define HAVE_DUP 1 /* + * COMPRESS is 1 if you want to read comressed file. + */ +#define COMPRESS 1 + +/* + * ISO is 1 if you want to read code which contain many character sets + * by using iso 2022 code extension techniques. + */ +#define ISO 1 + +/* + * JAPANESE is 1 if you want to read several KANJI code. + */ +#define JAPANESE 1 +#if JAPANESE && !ISO +# define ISO 1 +#endif + +/* + * DEFCHARSET is name of the default character set. + * This used as LESSCHARSET envrionment variable if user did not define it. + * The value of this must equal one of the available value which can use as + * LESSCHARSET environment variable + */ +#define DEFCHARSET "iso8" + +/* + * DEFPLANESET is name of the default plane set of iso 2022 extension. + * This used as LESSPLANESET envrionment variable if user did not define it. + * The value of this must equal one of the available value which can use as + * LESSPLANESET environment variable or any escape sequence for setting up. + */ +#define DEFPLANESET "ctext" + +/* + * DEFKEYCHARSET is name of the default character set for keyboard input. + */ +#define DEFKEYCHARSET "japanese-iso7" + +/* * Sizes of various buffers. */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ @@ -176,6 +216,9 @@ /* Settings automatically determined by configure. */ +/* Does regular expression library detect character set? */ +#undef CS_REGEX + /* Define EDIT_PGM to your editor. */ #undef EDIT_PGM @@ -236,6 +279,9 @@ /* POSIX regcomp() and regex.h */ #undef HAVE_POSIX_REGCOMP +/* POSIX regcomp() and regex.h with character set detection */ +#undef HAVE_POSIX_REGCOMP_CS + /* System V regcmp() */ #undef HAVE_REGCMP @@ -332,6 +378,9 @@ /* Henry Spencer V8 regcomp() and regexp.h */ #undef HAVE_V8_REGCOMP +/* Henry Spencer V8 regcomp() and regexp.h with character set detection */ +#undef HAVE_V8_REGCOMP_CS + /* Define to 1 if you have the header file. */ #undef HAVE_VALUES_H @@ -341,6 +390,14 @@ /* Define to 1 if you have the `_setjmp' function. */ #undef HAVE__SETJMP +/* + * Define MSB_ENABLE if you want to enable a MSB of non ASCII characters. + * It will be help if your library has not ability to detect a character set. + * If it has ability, this should be 0. If your system was not worked well, + * try to change following into 0 by hand. + */ +#undef MSB_ENABLE + /* Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h. */ #undef MUST_DEFINE_ERRNO @@ -349,7 +406,8 @@ termcap.h. */ #undef MUST_DEFINE_OSPEED -/* pattern matching is supported, but without metacharacters. */ +/* pattern matching with character set detection is supported, + but without metacharacters. */ #undef NO_REGEX /* Define to the address where bug reports for this package should be sent. */ @@ -370,12 +428,24 @@ /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE +/* + * Define SJIS0213 if you want to enable a JIS X 0213:2000 mapping of + * SJIS encoding. + */ +#undef SJIS0213 + /* Define to 1 if the `S_IS*' macros in do not work properly. */ #undef STAT_MACROS_BROKEN /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* + * Define UJIS0213 if you want to enable a JIS X 0213:2000 mapping of + * UJIS encoding. + */ +#undef UJIS0213 + /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME Index: less/defines.o2 diff -u less/defines.o2:1.1.1.7 less/defines.o2:1.17 --- less/defines.o2:1.1.1.7 Tue Aug 30 20:55:44 2005 +++ less/defines.o2 Tue Aug 30 22:45:49 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines reserved. + * + * You may distribute under the terms of the Less License. + */ /* OS/2 definition file for less. */ @@ -162,6 +168,46 @@ #define HAVE_DUP 1 /* + * COMPRESS is 1 if you want to read comressed file. + */ +#define COMPRESS 1 + +/* + * ISO is 1 if you want to read code which contain many character sets + * by using iso 2022 code extension techniques. + */ +#define ISO 1 + +/* + * JAPANESE is 1 if you want to read several KANJI code. + */ +#define JAPANESE 1 +#if JAPANESE && !ISO +# define ISO 1 +#endif + +/* + * DEFCHARSET is name of the default character set. + * This used as LESSCHARSET envrionment variable if user did not define it. + * The value of this must equal one of the available value which can use as + * LESSCHARSET environment variable + */ +#define DEFCHARSET "iso8" + +/* + * DEFPLANESET is name of the default plane set of iso 2022 extension. + * This used as LESSPLANESET envrionment variable if user did not define it. + * The value of this must equal one of the available value which can use as + * LESSPLANESET environment variable or any escape sequence for setting up. + */ +#define DEFPLANESET "ctext" + +/* + * DEFKEYCHARSET is name of the default character set for keyboard input. + */ +#define DEFKEYCHARSET "japanese-iso7" + +/* * Sizes of various buffers. */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ @@ -186,13 +232,19 @@ /* * Regular expression library. + * Some are extended to detect character set. * Define exactly one of the following to be 1: + * HAVE_POSIX_REGCOMP_CS: extended POSIX regcomp() and regex.h + * HAVE_V8_REGCOMP_CS: extended Henry Spencer V8 regcomp() and regexp.h * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h * HAVE_RE_COMP: BSD re_comp() * HAVE_REGCMP: System V regcmp() * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h - * NO_REGEX: pattern matching is supported, but without metacharacters. + * NO_REGEX: pattern matching with character set detection is supported, + * but without metacharacters. */ +/* #undef HAVE_POSIX_REGCOMP_CS */ +/* #undef HAVE_V8_REGCOMP_CS */ /* #undef HAVE_POSIX_REGCOMP */ /* #undef HAVE_RE_COMP */ /* #undef HAVE_REGCMP */ @@ -200,6 +252,19 @@ /* #undef NO_REGEX */ #define HAVE_REGEXEC2 1 +/* + * Does regular expression library detect character set? + */ +#define CS_REGEX 0 + +/* + * Define MSB_ENABLE if you want to enable a MSB of non ASCII characters. + * It will be help if your library has not ability to detect a character set. + * If it has ability, this should be 0. If your system was not worked well, + * try to change following into 0 by hand. + */ +#define MSB_ENABLE 1 + /* Define HAVE_VOID if your compiler supports the "void" type. */ #define HAVE_VOID 1 Index: less/defines.o9 diff -u less/defines.o9:1.1.1.9 less/defines.o9:1.19 --- less/defines.o9:1.1.1.9 Tue Aug 30 20:55:44 2005 +++ less/defines.o9 Tue Aug 30 22:45:49 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines reserved. + * + * You may distribute under the terms of the Less License. + */ /* OS/9 definition file for less. */ @@ -169,6 +175,46 @@ #define HAVE_DUP 0 /* + * COMPRESS is 1 if you want to read comressed file. + */ +#define COMPRESS 1 + +/* + * ISO is 1 if you want to read code which contain many character sets + * by using iso 2022 code extension techniques. + */ +#define ISO 1 + +/* + * JAPANESE is 1 if you want to read several KANJI code. + */ +#define JAPANESE 1 +#if JAPANESE && !ISO +# define ISO 1 +#endif + +/* + * DEFCHARSET is name of the default character set. + * This used as LESSCHARSET envrionment variable if user did not define it. + * The value of this must equal one of the available value which can use as + * LESSCHARSET environment variable + */ +#define DEFCHARSET "iso8" + +/* + * DEFPLANESET is name of the default plane set of iso 2022 extension. + * This used as LESSPLANESET envrionment variable if user did not define it. + * The value of this must equal one of the available value which can use as + * LESSPLANESET environment variable or any escape sequence for setting up. + */ +#define DEFPLANESET "ctext" + +/* + * DEFKEYCHARSET is name of the default character set for keyboard input. + */ +#define DEFKEYCHARSET "japanese-iso7" + +/* * Sizes of various buffers. */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ @@ -197,13 +243,19 @@ /* * Regular expression library. + * Some are extended to detect character set. * Define exactly one of the following to be 1: + * HAVE_POSIX_REGCOMP_CS: extended POSIX regcomp() and regex.h + * HAVE_V8_REGCOMP_CS: extended Henry Spencer V8 regcomp() and regexp.h * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h * HAVE_RE_COMP: BSD re_comp() * HAVE_REGCMP: System V regcmp() * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h - * NO_REGEX: pattern matching is supported, but without metacharacters. + * NO_REGEX: pattern matching with character set detection is supported, + * but without metacharacters. */ +#define HAVE_POSIX_REGCOMP_CS 0 +#define HAVE_V8_REGCOMP_CS 0 #define HAVE_POSIX_REGCOMP 0 #define HAVE_RE_COMP 0 #define HAVE_REGCMP 0 @@ -211,6 +263,19 @@ #define NO_REGEX 0 #define HAVE_REGEXEC2 1 +/* + * Does regular expression library detect character set? + */ +#define CS_REGEX 0 + +/* + * Define MSB_ENABLE if you want to enable a MSB of non ASCII characters. + * It will be help if your library has not ability to detect a character set. + * If it has ability, this should be 0. If your system was not worked well, + * try to change following into 0 by hand. + */ +#define MSB_ENABLE 1 + /* Define HAVE_VOID if your compiler supports the "void" type. */ #define HAVE_VOID 1 Index: less/defines.wn diff -u less/defines.wn:1.1.1.7 less/defines.wn:1.17 --- less/defines.wn:1.1.1.7 Tue Aug 30 20:55:44 2005 +++ less/defines.wn Tue Aug 30 22:45:49 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines reserved. + * + * You may distribute under the terms of the Less License. + */ /* Windows definition file for less. */ @@ -163,6 +169,46 @@ #define HAVE_DUP 1 /* + * COMPRESS is 1 if you want to read comressed file. + */ +#define COMPRESS 1 + +/* + * ISO is 1 if you want to read code which contain many character sets + * by using iso 2022 code extension techniques. + */ +#define ISO 1 + +/* + * JAPANESE is 1 if you want to read several KANJI code. + */ +#define JAPANESE 1 +#if JAPANESE && !ISO +# define ISO 1 +#endif + +/* + * DEFCHARSET is name of the default character set. + * This used as LESSCHARSET envrionment variable if user did not define it. + * The value of this must equal one of the available value which can use as + * LESSCHARSET environment variable + */ +#define DEFCHARSET "iso8" + +/* + * DEFPLANESET is name of the default plane set of iso 2022 extension. + * This used as LESSPLANESET envrionment variable if user did not define it. + * The value of this must equal one of the available value which can use as + * LESSPLANESET environment variable or any escape sequence for setting up. + */ +#define DEFPLANESET "ctext" + +/* + * DEFKEYCHARSET is name of the default character set for keyboard input. + */ +#define DEFKEYCHARSET "sjis-iso7" + +/* * Sizes of various buffers. */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ @@ -187,13 +233,19 @@ /* * Regular expression library. + * Some are extended to detect character set. * Define exactly one of the following to be 1: + * HAVE_POSIX_REGCOMP_CS: extended POSIX regcomp() and regex.h + * HAVE_V8_REGCOMP_CS: extended Henry Spencer V8 regcomp() and regexp.h * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h * HAVE_RE_COMP: BSD re_comp() * HAVE_REGCMP: System V regcmp() * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h - * NO_REGEX: pattern matching is supported, but without metacharacters. + * NO_REGEX: pattern matching with character set detection is supported, + * but without metacharacters. */ +/* #undef HAVE_POSIX_REGCOMP_CS */ +/* #undef HAVE_V8_REGCOMP_CS */ /* #undef HAVE_POSIX_REGCOMP */ /* #undef HAVE_RE_COMP */ /* #undef HAVE_REGCMP */ @@ -201,6 +253,19 @@ /* #undef NO_REGEX */ #define HAVE_REGEXEC2 1 +/* + * Does regular expression library detect character set? + */ +#define CS_REGEX 0 + +/* + * Define MSB_ENABLE if you want to enable a MSB of non ASCII characters. + * It will be help if your library has not ability to detect a character set. + * If it has ability, this should be 0. If your system was not worked well, + * try to change following into 0 by hand. + */ +#define MSB_ENABLE 1 + /* Define HAVE_VOID if your compiler supports the "void" type. */ #define HAVE_VOID 1 Index: less/edit.c diff -u less/edit.c:1.1.1.16 less/edit.c:1.27 --- less/edit.c:1.1.1.16 Tue Aug 30 20:55:40 2005 +++ less/edit.c Tue Aug 30 22:45:49 2005 @@ -368,6 +368,9 @@ curr_altpipe = alt_pipe; set_open(curr_ifile); /* File has been opened */ get_pos(curr_ifile, &initial_scrpos); +#if ISO + init_multi(get_mulbuf(curr_ifile)); +#endif new_file = TRUE; ch_init(f, chflags); @@ -399,7 +402,7 @@ #if HILITE_SEARCH clr_hilite(); #endif - cmd_addhist(ml_examine, filename); + cmd_addhist(ml_examine, filename, NULL); if (no_display && errmsgs > 0) { /* Index: less/filename.c diff -u less/filename.c:1.1.1.16 less/filename.c:1.26 --- less/filename.c:1.1.1.16 Tue Aug 30 23:14:52 2005 +++ less/filename.c Wed Aug 31 00:09:15 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of compress file treating routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -780,6 +786,30 @@ return (gfilename); } +#if COMPRESS +/* + * Check a name of input file and easy execution some uncompressing program. + */ + static char* +easy_lessopen_for_compressedfile(filename) + register char *filename; +{ + register int length = strlen(filename); + + if (strcmp(".Z", &filename[length - 2]) == 0 || + strcmp(".z", &filename[length - 2]) == 0) + return ("| zcat %s"); + else if (strcmp(".gz", &filename[length - 3]) == 0 || + strcmp(".GZ", &filename[length - 3]) == 0) + return ("| gzip -cd %s"); + else if (strcmp(".bz2", &filename[length - 4]) == 0 || + strcmp(".BZ2", &filename[length - 4]) == 0) + return ("| bzip2 -cd %s"); + else + return (NULL); +} +#endif + /* * See if we should open a "replacement file" * instead of the file we're about to open. @@ -804,6 +834,9 @@ return (NULL); ch_ungetchar(-1); if ((lessopen = lgetenv("LESSOPEN")) == NULL) +#if COMPRESS + if ((lessopen = easy_lessopen_for_compressedfile(filename)) == NULL) +#endif return (NULL); if (strcmp(filename, "-") == 0) return (NULL); Index: less/funcs.h diff -u less/funcs.h:1.1.1.18 less/funcs.h:1.40 --- less/funcs.h:1.1.1.18 Tue Aug 30 23:14:55 2005 +++ less/funcs.h Sun Sep 4 17:41:18 2005 @@ -50,9 +50,13 @@ public void ch_close (); public int ch_getflags (); public void ch_dump (); + public CODESET left_codeset_of_charset (); + public CODESET right_codeset_of_charset (); + public void init_planeset (); public void init_charset (); public int binary_char (); public int control_char (); + public void change_control_char (); public char * prchar (); public void cmd_reset (); public void clear_cmd (); @@ -64,6 +68,7 @@ public int cmd_char (); public LINENUM cmd_int (); public char * get_cmdbuf (); + public CHARSET * get_cmdcs (); public int in_mca (); public void dispversion (); public int getcc (); @@ -126,6 +131,7 @@ public void store_pos (); public void get_pos (); public void set_open (); + public MULBUF * get_mulbuf (); public int opened (); public void hold_ifile (); public int held_ifile (); @@ -146,6 +152,7 @@ public void plinenum (); public int is_ansi_end (); public int pappend (); + public int pappend_multi (); public void pdone (); public int gline (); public void null_line (); @@ -170,12 +177,14 @@ public void opt__O (); public void opt_l (); public void opt_k (); + public void opt_K (); public void opt_t (); public void opt__T (); public void opt_p (); public void opt__P (); public void opt_b (); public void opt_i (); + public void opt_Z (); public void opt__V (); public void opt_D (); public void opt_x (); @@ -201,8 +210,13 @@ public int os9_signal (); public void put_line (); public void flush (); + public int putchr_raw (); + public void putstr_raw (); public int putchr (); public void putstr (); + public int putmchr (); + public int putmchrs (); + public void putmstr (); public void get_return (); public void error (); public void ierror (); Index: less/help.c diff -u less/help.c:1.1.1.13 less/help.c:1.16 --- less/help.c:1.1.1.13 Tue Aug 30 23:14:52 2005 +++ less/help.c Wed Aug 31 00:09:15 2005 @@ -87,6 +87,8 @@ ' ',' ',':','x',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','E','x','a','m','i','n','e',' ','t','h','e',' ','f','i','r','s','t',' ','(','o','r',' ','_','\b','N','-','t','h',')',' ','f','i','l','e',' ','f','r','o','m',' ','t','h','e',' ','c','o','m','m','a','n','d',' ','l','i','n','e','.','\n', ' ',' ',':','d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','t','h','e',' ','c','u','r','r','e','n','t',' ','f','i','l','e',' ','f','r','o','m',' ','t','h','e',' ','c','o','m','m','a','n','d',' ','l','i','n','e',' ','l','i','s','t','.','\n', ' ',' ','=',' ',' ','^','G',' ',' ',':','f',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','P','r','i','n','t',' ','c','u','r','r','e','n','t',' ','f','i','l','e',' ','n','a','m','e','.','\n', +' ',' ','@',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','o','t','a','t','e',' ','t','h','e',' ','c','o','d','e',' ','r','e','c','o','g','n','i','t','i','o','n',' ','m','e','t','h','o','d',' ','o','f',' ','t','h','e',' ','c','u','r','r','e','n','t',' ','f','i','l','e','.','\n', +' ',' ','V',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','P','r','i','n','t',' ','v','e','r','s','i','o','n',' ','n','u','m','b','e','r',' ','o','f',' ','"','l','e','s','s','"','.','\n', ' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n', '\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','M','\b','M','I','\b','I','S','\b','S','C','\b','C','E','\b','E','L','\b','L','L','\b','L','A','\b','A','N','\b','N','E','\b','E','O','\b','O','U','\b','U','S','\b','S',' ','C','\b','C','O','\b','O','M','\b','M','M','\b','M','A','\b','A','N','\b','N','D','\b','D','S','\b','S','\n', @@ -146,6 +148,8 @@ ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','i','s','p','l','a','y',' ','a',' ','s','t','a','t','u','s',' ','c','o','l','u','m','n',' ','a','t',' ','l','e','f','t',' ','e','d','g','e',' ','o','f',' ','s','c','r','e','e','n','.','\n', ' ',' ','-','k',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','l','e','s','s','k','e','y','-','f','i','l','e','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','s','e',' ','a',' ','l','e','s','s','k','e','y',' ','f','i','l','e','.','\n', +' ',' ','-','K',' ','[','_','\b','c','_','\b','h','_','\b','a','_','\b','r','_','\b','s','_','\b','e','_','\b','t',']',' ',' ','-','-','c','h','a','r','s','e','t','=','[','_','\b','c','_','\b','h','_','\b','a','_','\b','r','_','\b','s','_','\b','e','_','\b','t',']','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','p','e','c','i','f','y',' ','c','h','a','r','a','c','t','e','r',' ','s','e','t','.','\n', ' ',' ','-','L',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','l','e','s','s','o','p','e','n','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','I','g','n','o','r','e',' ','t','h','e',' ','L','E','S','S','O','P','E','N',' ','e','n','v','i','r','o','n','m','e','n','t',' ','v','a','r','i','a','b','l','e','.','\n', ' ',' ','-','m',' ',' ','-','M',' ',' ','.','.','.','.',' ',' ','-','-','l','o','n','g','-','p','r','o','m','p','t',' ',' ','-','-','L','O','N','G','-','P','R','O','M','P','T','\n', @@ -188,8 +192,12 @@ ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','t','e','r','m','c','a','p',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','t','r','i','n','g','s','.','\n', ' ',' ','-','y',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','m','a','x','-','f','o','r','w','-','s','c','r','o','l','l','=','[','_','\b','N',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','c','r','o','l','l',' ','l','i','m','i','t','.','\n', +' ',' ','-','Y',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','m','a','r','k','-','w','r','o','n','g','-','c','h','a','r','\n', +'\t','\t',' ',' ','D','i','s','p','l','a','y',' ','m','a','r','k',' ','c','h','a','r','a','c','t','e','r',' ','i','n','s','t','e','a','d',' ','o','f',' ','w','r','o','n','g',' ','c','h','a','r','a','c','t','e','r','.','\n', ' ',' ','-','z',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','w','i','n','d','o','w','=','[','_','\b','N',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','s','i','z','e',' ','o','f',' ','w','i','n','d','o','w','.','\n', +' ',' ','-','Z',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','c','h','a','n','g','e','-','p','r','i','o','r','i','t','y','\n', +'\t','\t',' ',' ','G','i','v','e',' ','p','r','i','o','r','i','t','y',' ','t','o',' ','t','h','e',' ','S','J','I','S',' ','o','v','e','r',' ','t','h','e',' ','U','J','I','S',' ','i','f',' ','y','o','u',' ','u','s','e',' ','J','a','p','a','n','e','s','e','.','\n', ' ',' ','-','"',' ','[','_','\b','c','[','_','\b','c',']',']',' ',' ','.',' ',' ','-','-','q','u','o','t','e','s','=','[','_','\b','c','[','_','\b','c',']',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','s','h','e','l','l',' ','q','u','o','t','e',' ','c','h','a','r','a','c','t','e','r','s','.','\n', ' ',' ','-','~',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','t','i','l','d','e','\n', Index: less/ifile.c diff -u less/ifile.c:1.1.1.13 less/ifile.c:1.22 --- less/ifile.c:1.1.1.13 Tue Aug 30 20:55:41 2005 +++ less/ifile.c Tue Aug 30 22:45:49 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -33,6 +39,9 @@ int h_hold; /* Hold count */ char h_opened; /* Has this ifile been opened? */ struct scrpos h_scrpos; /* Saved position within the file */ +#if ISO + MULBUF *h_mp; /* MULBUF for multi bytes character */ +#endif }; /* @@ -46,7 +55,11 @@ * Anchor for linked list. */ static struct ifile anchor = { &anchor, &anchor, NULL, NULL, 0, 0, '\0', - { NULL_POSITION, 0 } }; + { NULL_POSITION, 0 } +#if ISO + ,NULL +#endif + }; static int ifiles = 0; static void @@ -119,6 +132,10 @@ p->h_opened = 0; p->h_hold = 0; p->h_filestate = NULL; +#if ISO + p->h_mp = new_multi(); + init_priority(p->h_mp); +#endif link_ifile(p, prev); return (p); } @@ -144,6 +161,9 @@ p = int_ifile(h); unlink_ifile(p); free(p->h_filename); +#if ISO + free(p->h_mp); +#endif free(p); } @@ -280,6 +300,20 @@ } /* + * Get the MULBUF associated with a ifile. + */ + public MULBUF * +get_mulbuf(ifile) + IFILE ifile; +{ +#if ISO + if (ifile != NULL) + return (int_ifile(ifile)->h_mp); +#endif + return (NULL); +} + +/* * Mark the ifile as "opened". */ public void Index: less/input.c diff -u less/input.c:1.1.1.11 less/input.c:1.33 --- less/input.c:1.1.1.11 Tue Aug 30 20:55:41 2005 +++ less/input.c Sun Sep 4 19:52:57 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -33,6 +39,7 @@ extern int hilite_search; extern int size_linebuf; #endif +extern IFILE curr_ifile; /* * Get the next line. @@ -49,6 +56,13 @@ register int c; int blankline; int endline; +#if ISO + char *cbuf; + CHARSET *csbuf; + int i; + POSITION pos; + int ret; +#endif if (curr_pos == NULL_POSITION) { @@ -75,6 +89,9 @@ prewind(); plinenum(curr_pos); +#if ISO + multi_start_buffering(get_mulbuf(curr_ifile), curr_pos); +#endif (void) ch_seek(curr_pos); c = ch_forw_get(); @@ -94,6 +111,10 @@ } if (c == '\n' || c == EOI) { +#if ISO + multi_buffering(get_mulbuf(curr_ifile), -1, NULL, &cbuf, &csbuf, &i, &pos); + ret = pappend_multi(cbuf, csbuf, i, pos); +#endif /* * End of the line. */ @@ -105,7 +126,14 @@ /* * Append the char to the line and get the next char. */ - if (pappend(c, ch_tell()-1)) +#if ISO + pos = ch_tell() - 1; + multi_buffering(get_mulbuf(curr_ifile), c, &pos, &cbuf, &csbuf, &i, &pos); + ret = pappend_multi(cbuf, csbuf, i, pos); +#else + ret = pappend(c, control_char(c) ? WRONGCS : ASCII, 1, ch_tell()-1); +#endif + if (ret != 0) { /* * The char won't fit in the line; the line @@ -114,16 +142,32 @@ */ if (chopline || hshift > 0) { +#if ISO + c = ch_forw_get(); + while (c != '\n' && c != EOI) + { + multi_parsing(get_mulbuf(curr_ifile), + c); + c = ch_forw_get(); + } + multi_parsing(get_mulbuf(curr_ifile), -1); +#else do { c = ch_forw_get(); } while (c != '\n' && c != EOI); +#endif new_pos = ch_tell(); endline = TRUE; quit_if_one_screen = FALSE; } else { +#if ISO + multi_parsing(get_mulbuf(curr_ifile), -1); + new_pos = pos; +#else new_pos = ch_tell() - 1; +#endif endline = FALSE; } break; @@ -167,6 +211,13 @@ POSITION new_pos, begin_new_pos; int c; int endline; +#if ISO + char *cbuf; + CHARSET *csbuf; + int i; + POSITION pos; + int ret; +#endif if (curr_pos == NULL_POSITION || curr_pos <= ch_zero()) { @@ -267,6 +318,9 @@ begin_new_pos = new_pos; prewind(); plinenum(new_pos); +#if ISO + multi_start_buffering(get_mulbuf(curr_ifile), new_pos); +#endif (void) ch_seek(new_pos); do @@ -280,11 +334,25 @@ new_pos++; if (c == '\n') { +#if ISO + multi_buffering(get_mulbuf(curr_ifile), -1, NULL, &cbuf, &csbuf, &i, &pos); + ret = pappend_multi(cbuf, csbuf, i, pos); +#endif endline = TRUE; break; } - if (pappend(c, ch_tell()-1)) +#if ISO + pos = ch_tell() - 1; + multi_buffering(get_mulbuf(curr_ifile), c, &pos, &cbuf, &csbuf, &i, &pos); + ret = pappend_multi(cbuf, csbuf, i, pos); +#else + ret = pappend(c, control_char(c) ? WRONGCS : ASCII, 1, ch_tell()-1); +#endif + if (ret != 0) { +#if ISO + multi_parsing(get_mulbuf(curr_ifile), -1); +#endif /* * Got a full printable line, but we haven't * reached our curr_pos yet. Discard the line @@ -296,12 +364,23 @@ quit_if_one_screen = FALSE; break; } +#if ISO + pdone(0); + i = ch_tell() - pos; + new_pos -= i; + while (--i >= 0) + ch_back_get(); +#else pdone(0); (void) ch_back_get(); new_pos--; +#endif goto loop; } } while (new_pos < curr_pos); +#if ISO + multi_parsing(get_mulbuf(curr_ifile), -1); +#endif pdone(endline); Index: less/less.h diff -u less/less.h:1.1.1.19 less/less.h:1.54 --- less/less.h:1.1.1.19 Tue Aug 30 23:14:55 2005 +++ less/less.h Wed Aug 31 00:09:15 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -162,7 +168,7 @@ /* * Flags for open() */ -#if MSDOS_COMPILER || OS2 +#if MSDOS_COMPILER || OS2 || __CYGWIN__ #define OPEN_READ (O_RDONLY|O_BINARY) #else #ifdef _OSK @@ -192,7 +198,7 @@ #if MSDOS_COMPILER==MSOFTC #define SET_BINARY(f) _setmode(f, _O_BINARY); #else -#if MSDOS_COMPILER || OS2 +#if MSDOS_COMPILER || OS2 || __CYGWIN__ #define SET_BINARY(f) setmode(f, O_BINARY) #else #define SET_BINARY(f) @@ -297,6 +303,11 @@ #define AT_INVIS (4) #define AT_STANDOUT (5) +/* + * Defines for multi character set and code set. + */ +#include "multi.h" + #if '0' == 240 #define IS_EBCDIC_HOST 1 #endif Index: less/less.hlp diff -u less/less.hlp:1.1.1.14 less/less.hlp:1.18 --- less/less.hlp:1.1.1.14 Tue Aug 30 23:14:56 2005 +++ less/less.hlp Wed Aug 31 00:09:15 2005 @@ -84,6 +84,8 @@ :x * Examine the first (or _N-th) file from the command line. :d Delete the current file from the command line list. = ^G :f Print current file name. + @ Rotate the code recognition method of the current file. + V Print version number of "less". --------------------------------------------------------------------------- MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS @@ -143,6 +145,8 @@ Display a status column at left edge of screen. -k [_f_i_l_e] . --lesskey-file=[_f_i_l_e] Use a lesskey file. + -K [_c_h_a_r_s_e_t] --charset=[_c_h_a_r_s_e_t] + Specify character set. -L ........ --no-lessopen Ignore the LESSOPEN environment variable. -m -M .... --long-prompt --LONG-PROMPT @@ -185,8 +189,12 @@ Don't use termcap keypad init/deinit strings. -y [_N] .... --max-forw-scroll=[_N] Forward scroll limit. + -Y ........ --mark-wrong-char + Display mark character instead of wrong character. -z [_N] .... --window=[_N] Set size of window. + -Z ........ --change-priority + Give priority to the SJIS over the UJIS if you use Japanese. -" [_c[_c]] . --quotes=[_c[_c]] Set shell quote characters. -~ ........ --tilde Index: less/less.nro diff -u less/less.nro:1.1.1.20 less/less.nro:1.51 --- less/less.nro:1.1.1.20 Sun Sep 4 19:10:59 2005 +++ less/less.nro Sun Sep 4 19:13:38 2005 @@ -1,4 +1,4 @@ -.TH LESS 1 "Version 382: 03 Feb 2004" +.TH LESS 1 "Version 382+iso258: 04 Sep 2005" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -10,11 +10,13 @@ .br .B "less --version" .br -.B "less [-[+]aBcCdeEfFgGiIJLmMnNqQrRsSuUVwWX~]" +.B "less [-[+]aBcCdeEfFgGiIJLmMnNqQrRsSuUVwWXYZ~]" .br .B " [-b \fIspace\fP] [-h \fIlines\fP] [-j \fIline\fP] [-k \fIkeyfile\fP]" .br -.B " [-{oO} \fIlogfile\fP] [-p \fIpattern\fP] [-P \fIprompt\fP] [-t \fItag\fP]" +.B " [-K \fIcharacter set\fP] [-{oO} \fIlogfile\fP]" +.br +.B " [-p \fIpattern\fP] [-P \fIprompt\fP] [-t \fItag\fP]" .br .B " [-T \fItagsfile\fP] [-x \fItab\fP,...] [-y \fIlines\fP] [-[z] \fIlines\fP]" .br @@ -300,6 +302,13 @@ If possible, it also prints the length of the file, the number of lines in the file and the percent of the file above the last displayed line. +.IP "@" +Rotate the code recognition method of the current file. +Enhanced +.I less +has 7 methods for recognition, default (which is chosen +by the JLESSCHARSET environment variable), japanese, ujis, sjis, +iso8, noconv and none. .IP \- Followed by one of the command line option letters (see OPTIONS below), this will change the setting of that option @@ -396,6 +405,8 @@ .I less is running, via the "\-" command. .PP +Options are also taken from the environment variable "LESS" and "JLESS". +.PP Most options may be given in one of two forms: either a dash followed by a single letter, or two dashes followed by a long option name. @@ -427,8 +438,8 @@ percent signs in the options string by double percent signs. .sp The environment variable is parsed before the command line, -so command line options override the LESS environment variable. -If an option appears in the LESS variable, it can be reset +so command line options override the LESS and JLESS environment variables. +If an option appears in the LESS and JLESS variables, it can be reset to its default value on the command line by beginning the command line option with "\-+". .sp @@ -585,6 +596,11 @@ This option can be set from within \fIless\fP, but it will apply only to files opened subsequently, not to the file which is currently open. +.IP -K\fIcharset\fP +Causes +.I less +to use this charset instead of a charset defined in the JLESSCHARSET or +LESSCHARSET environment variable. .IP "-m or --long-prompt" Causes .I less @@ -640,11 +656,11 @@ .IP "-P\fIprompt\fP or --prompt=\fIprompt\fP" Provides a way to tailor the three prompt styles to your own preference. -This option would normally be put in the LESS environment -variable, rather than being typed in with each +This option would normally be put in the LESS and JLESS environment +variables, rather than being typed in with each .I less command. -Such an option must either be the last option in the LESS variable, +Such an option must either be the last option in the LESS and JLESS variables, or be terminated by a dollar sign. -Ps followed by a string changes the default (short) prompt to that string. @@ -789,6 +805,9 @@ The -c or -C option may be used to repaint from the top of the screen if desired. By default, any forward movement causes scrolling. +.IP -Y +Causes mark characters to be used to represent wrong characters. +By default, such wrong characters displayed as binary. .IP "-[z]\fIn\fP or --window=\fIn\fP" Changes the default scrolling window size to \fIn\fP lines. The default is one screenful. @@ -803,6 +822,10 @@ For example, if the screen is 24 lines, \fI-z-4\fP sets the scrolling window to 20 lines. If the screen is resized to 40 lines, the scrolling window automatically changes to 36 lines. +.IP -Z +Causes to give priority to the SJIS over the UJIS if a "japanese" was selected +by the JLESSCHARSET environment variable. The default value is +to give priority to the UJIS over the SJIS. .IP "-\fI\(dqcc\fP\ or\ --quotes=\fIcc\fP" Changes the filename quoting character. This may be necessary if you are trying to name a file @@ -1102,8 +1125,15 @@ .PP A "character set" is simply a description of which characters are to be considered normal, control, and binary. -The LESSCHARSET environment variable may be used to select a character set. -Possible values for LESSCHARSET are: +The JLESSCHARSET and LESSCHARSET environment variables may be used to select +a character set. There is no difference between them in program of +.I less. +But I suppose you should use the JLESSCHARSET environment variable +because not enhanced +.I less +will make errors if you use enhanced character set in +your LESSCHARSET environment variable. +Possible values for them are: .IP ascii BS, TAB, NL, CR, and formfeed are control characters, all chars with values between 32 and 126 are normal, @@ -1132,6 +1162,156 @@ .IP utf-8 Selects the UTF-8 encoding of the ISO 10646 character set. .PP +And possible values for only JLESSCHARSET are: +.IP iso7 +Multi character sets with the ISO 2022 code extension techniques +in 7 bits are assumed. +Characters with values between 128 and 255 are treated as binary. +The level of implementation of +.I Less +is level 3 of ISO 2022. +.IP iso8 +Multi character sets with the ISO 2022 code extension techniques +in 8 bits are assumed. +The level of implementation of +.I Less +is level 3 of ISO 2022. +.IP jis +Only Japanese character sets with the ISO 2022 code extension +techniques in 7 bits are assumed. +.IP ujis +If characters has values between 32 and 127, +the ASCII character set are assumed. +If characters has values between 162 and 254, +the JISX 0208 character set, +a right half of the JISX 0201 character set and +the JISX 0212 character set with the UJIS coding are assumed. +Otherwise, characters are treated as binary. +.IP euc +Same as ujis. +.IP sjis +If characters has values between 32 and 127, +the ASCII character set are assumed. +If characters has values between 128 and 252, +the JISX 0208 character set and +a right half of the JISX 0201 character set are assumed. +Otherwise, characters are treated as binary. +.IP japanese +All Japanese character sets, jis, ujis and sjis, are assumed. But +.I less +output only the jis. +.PP +Japanese has several code sets (not character sets). +Thus +.I less +must convert among them to display them correctly. +Possible values with this conversion for only JLESSCHARSET are: +.IP ujis-iso7 +The ujis and iso7 are assumend. But +.I less +output only the iso7. +.IP euc-iso7 +Same as ujis-iso7. +.IP sjis-iso7 +The sjis and iso7 are assumend. But +.I less +output only the iso7. +.IP ujis-jis +The ujis and jis are assumend. But +.I less +output only the jis. +.IP euc-jis +Same as ujis-jis. +.IP sjis-jis +The sjis and jis are assumend. But +.I less +output only the jis. +.IP jis-ujis +The jis and ujis are assumend. But +.I less +output only the ujis. +.IP jis-euc +Same as jis-ujis. +.IP jis-sjis +The jis and sjis are assumend. But +.I less +output only the sjis. +.IP japanese-iso7 +The japanese and iso7 are assumend. But +.I less +output only the iso7. +.IP japanese-jis +The japanese is assumend. But +.I less +output only the jis. +Same as japanese. +.IP japanese-ujis +The japanese is assumend. But +.I less +output only the ujis. +.IP japanese-euc +Same as japanese-ujis. +.IP japanese-sjis +The japanese is assumend. But +.I less +output only the sjis. +.IP ujis-sjis +The ujis is assumend. But +.I less +output only the sjis. +.IP euc-sjis +Same as ujis-sjis. +.IP sjis-ujis +The sjis is assumend. But +.I less +output only the ujis. +.IP sjis-euc +Same as sjis-ujis. +.PP +Other way to select a character set is to use the LANG environment variable. +If it start with "ja_JP" or "japan", +.I less +read all Japanese coded characters as some Japanese character set, +and a rest of the LANG environment variable specify output coding. +.PP +The ISO 2022 code extension techniques define +4 planes to display many character sets easy. +Default setting of planes is selected by +the JLESSPLANESET environment variable. +If the JLESSPLANESET vriable is equal to "japanese", "ujis" or "euc", +.I less +treat g1 plane as JISX 0208, g2 plane as JISX 0201 right half, g3 plane +as JISX 0212. If it is equal to "latin1", "latin2", "latin3", "latin4", +"greek", "arabic", "hebrew", "cyrillic" or "latin5", +.I less +treat g1 plane as one of ISO 8859. +Otherwise, +.I less +try to parse the JLESSPLANESET variable as +real escape sequences for setting up, and "\\e" in JLESSPLANESET +is treated as escape code when parsing. +.PP +.I Less +understand almost all escape sequence about character set +in the ISO 2022 code extension techniques. There are many escape sequences +to select the character set. On the one hand, +.I less +output only 6 escape sequences to select a character +set: '^[(', '^[-', '^[$(', '^[$-', '^N' and '^O'. +It means +.I less +is friendly to a terminal and a terminal emulator. +.PP +And there is special "character set" for keyboard inputs. +The JLESSKEYCHARSET environment variable is used +for such purpose. Possible values of it are equal +to the JLESSCHARSET environment variable. +.PP +If the LESSCHARSET environment variable is not set, +the default character set is latin1. +However, if the string "UTF-8" is found in the LC_ALL, LC_CTYPE or LANG +environment variables, then the default character set is utf-8 instead. +.PP In special cases, it may be desired to tailor .I less to use a character set other than the ones definable by LESSCHARSET. @@ -1266,6 +1446,8 @@ Usually used at the end of the string, but may appear anywhere. .IP "%x" Replaced by the name of the next input file in the list. +.IP "%K" +Replaced by the name of the last non ASCII character set or code set. .PP If any item is unknown (for example, the file size if input is a pipe), a question mark is printed instead. @@ -1446,6 +1628,8 @@ Options which are passed to .I less automatically. +.IP JLESS +same as the LESS environment variable. .IP LESSANSIENDCHARS Characters which are assumed to end an ANSI color escape sequence (default "m"). @@ -1453,8 +1637,14 @@ Format for displaying non-printable, non-control characters. .IP LESSCHARDEF Defines a character set. -.IP LESSCHARSET +.IP JLESSCHARSET Selects a predefined character set. +.IP LESSCHARSET +Selects a predefined character set if JLESSCHARSET is not defined. +.IP JLESSKEYCHARSET +Selects a predefined character set for keyboard inputs. +.IP JLESSPLANESET +Selects a predefined plane set of the ISO 2022 code extension techniques. .IP LESSCLOSE Command line to invoke the (optional) input-postprocessor. .IP LESSECHO @@ -1575,3 +1765,11 @@ Send bug reports or comments to the above address or to bug-less@gnu.org. .br For more information, see the less homepage at http://www.greenwoodsoftware.com/less. + +.SH PATCH +Copyright (c) 1994-2005 Kazushi (Jam) Marukawa, Japanized routines only +.br +Comments about this part to: jam@pobox.com +.br +You may distribute under the terms of the Less License. + Index: less/lesskey.c diff -u less/lesskey.c:1.1.1.19 less/lesskey.c:1.25 --- less/lesskey.c:1.1.1.19 Tue Aug 30 23:14:55 2005 +++ less/lesskey.c Wed Aug 31 00:09:15 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -149,6 +155,9 @@ { "undo-hilite", A_UNDO_SEARCH }, { "version", A_VERSION }, { "visual", A_VISUAL }, +#if JAPANESE + { "rotate-right", A_ROT_RCODESET }, +#endif { NULL, 0 } }; Index: less/lesskey.nro diff -u less/lesskey.nro:1.1.1.18 less/lesskey.nro:1.25 --- less/lesskey.nro:1.1.1.18 Sun Sep 4 19:10:59 2005 +++ less/lesskey.nro Sun Sep 4 19:13:38 2005 @@ -1,4 +1,4 @@ -.TH LESSKEY 1 "Version 382: 03 Feb 2004" +.TH LESSKEY 1 "Version 382+iso258: 04 Sep 2005" .SH NAME lesskey \- specify key bindings for less .SH SYNOPSIS @@ -220,6 +220,7 @@ v visual ! shell + firstcmd + @ rotate-right H help h help V version @@ -382,3 +383,9 @@ .br Send bug reports or comments to the above address or to bug-less@gnu.org. +.SH PATCH +Copyright (c) 1994-2005 Kazushi (Jam) Marukawa, Japanized routines only +.br +Comments to: jam@pobox.com +.br +You may distribute under the terms of the Less License. Index: less/line.c diff -u less/line.c:1.1.1.15 less/line.c:1.92 --- less/line.c:1.1.1.15 Tue Aug 30 23:14:52 2005 +++ less/line.c Sun Sep 4 17:41:18 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -20,6 +26,7 @@ #define IS_CONT(c) (((c) & 0xC0) == 0x80) public char *linebuf = NULL; /* Buffer which holds the current output line */ +static CHARSET *charset = NULL; /* Extension of linebuf to hold character set */ static char *attr = NULL; /* Extension of linebuf to hold attributes */ public int size_linebuf = 0; /* Size of line buffer (and attr buffer) */ @@ -41,6 +48,7 @@ static POSITION pendpos; static char *end_ansi_chars; +static int pwidth(); static int do_append(); extern int bs_mode; @@ -55,6 +63,8 @@ extern int bl_s_width, bl_e_width; extern int so_s_width, so_e_width; extern int sc_width, sc_height; +extern IFILE curr_ifile; + extern int utf_mode; extern POSITION start_attnpos; extern POSITION end_attnpos; @@ -69,6 +79,7 @@ if (end_ansi_chars == NULL || *end_ansi_chars == '\0') end_ansi_chars = "m"; linebuf = (char *) ecalloc(LINEBUF_SIZE, sizeof(char)); + charset = (CHARSET *) ecalloc(LINEBUF_SIZE, sizeof(CHARSET)); attr = (char *) ecalloc(LINEBUF_SIZE, sizeof(char)); size_linebuf = LINEBUF_SIZE; } @@ -81,20 +92,26 @@ { int new_size = size_linebuf + LINEBUF_SIZE; char *new_buf = (char *) calloc(new_size, sizeof(char)); + CHARSET *new_charset = (CHARSET *) calloc(new_size, sizeof(CHARSET)); char *new_attr = (char *) calloc(new_size, sizeof(char)); - if (new_buf == NULL || new_attr == NULL) + if (new_buf == NULL || new_charset == NULL || new_attr == NULL) { if (new_attr != NULL) free(new_attr); + if (new_charset != NULL) + free(new_charset); if (new_buf != NULL) free(new_buf); return 1; } memcpy(new_buf, linebuf, size_linebuf * sizeof(char)); + memcpy(new_charset, charset, size_linebuf * sizeof(CHARSET)); memcpy(new_attr, attr, size_linebuf * sizeof(char)); free(attr); + free(charset); free(linebuf); linebuf = new_buf; + charset = new_charset; attr = new_attr; size_linebuf = new_size; return 0; @@ -148,6 +165,7 @@ if (status_col) { linebuf[curr] = ' '; + charset[curr] = ASCII; if (start_attnpos != NULL_POSITION && pos >= start_attnpos && pos < end_attnpos) attr[curr] = AT_STANDOUT; @@ -171,8 +189,10 @@ n = MIN_LINENUM_WIDTH; sprintf(linebuf+curr, "%*s ", n, buf); n++; /* One space after the line number. */ - for (i = 0; i < n; i++) + for (i = 0; i < n; i++) { + charset[curr+i] = ASCII; attr[curr+i] = AT_NORMAL; + } curr += n; column += n; lmargin += n; @@ -184,6 +204,7 @@ while (column < lmargin) { linebuf[curr] = ' '; + charset[curr] = ASCII; attr[curr++] = AT_NORMAL; column++; } @@ -256,12 +277,69 @@ { int i; int nchars; + int j; + int real_shift; /* exact columns to shift */ + int exact_length; /* exact bytes to shift */ + int padding; /* columns for padding */ if (shift > column - lmargin) shift = column - lmargin; if (shift > curr - lmargin) shift = curr - lmargin; +#if ISO + /* + * Calculate exact bytes to shift. + * + * We would like to shift linebuf, charset, and attr by "shift" + * characters. The problem is we don't know how many bytes we + * need to shift. So, calculate it first. + */ + padding = 0; + real_shift = 0; + exact_length = 0; + /* + * Skip rest of multi bytes character. + */ + for (j = lmargin; j < curr && pwidth(linebuf[j], charset[j], attr[j]) == 0; j++) + { + padding++; + exact_length++; + } + /* + * Calculate how many bytes we need to shift. + */ + for (; j < curr && real_shift < shift; j++) + { + real_shift += pwidth(linebuf[j], charset[j], attr[j]); + exact_length++; + } + /* + * Skip following rest bytes of a last multi bytes character. + */ + for (; j < curr && pwidth(linebuf[j], charset[j], attr[j]) == 0; j++) + { + exact_length++; + } + + /* + * Put characters. + */ + for (i = 0; i < padding; i++) + { + linebuf[lmargin + i] = ' '; + charset[lmargin + i] = ASCII; + attr[lmargin + i] = AT_NORMAL;; + } + for (i = 0; i < curr - exact_length; i++) + { + linebuf[lmargin + i + padding] = linebuf[lmargin + i + exact_length]; + charset[lmargin + i + padding] = charset[lmargin + i + exact_length]; + attr[lmargin + i + padding] = attr[lmargin + i + exact_length]; + } + + curr -= exact_length; +#else if (utf_mode) nchars = utf_shift_chars(linebuf + lmargin, shift); else @@ -271,9 +349,12 @@ for (i = 0; i < curr - nchars; i++) { linebuf[lmargin + i] = linebuf[lmargin + i + nchars]; + charset[lmargin + i] = charset[lmargin + i + nchars]; attr[lmargin + i] = attr[lmargin + i + nchars]; } + curr -= nchars; +#endif column -= shift; cshift += shift; } @@ -321,8 +402,9 @@ * attribute sequence to be inserted, so this must be taken into account. */ static int -pwidth(c, a) +pwidth(c, cs, a) int c; + CHARSET cs; int a; { register int w; @@ -348,7 +430,11 @@ * Other characters take one space, * plus the width of any attribute enter/exit sequence. */ +#if ISO + w = mwidth(c, cs); +#else w = 1; +#endif if (curr > 0 && attr[curr-1] != a) w += attr_ewidth(attr[curr-1]); if (a && (curr == 0 || attr[curr-1] != a)) @@ -362,8 +448,15 @@ static void backc() { - curr--; - column -= pwidth(linebuf[curr], attr[curr]); + /* remove garbage in the buffer. */ + if (CSISREST(charset[curr])) + charset[curr] = 0; + /* delete the previous character. */ + do + { + curr--; + column -= pwidth(linebuf[curr], charset[curr], attr[curr]); + } while (curr > 0 && CSISREST(charset[curr])); } /* @@ -401,12 +494,14 @@ /* * Append a character and attribute to the line buffer. */ -#define STORE_CHAR(c,a,pos) \ - do { if (store_char((c),(a),(pos))) return (1); else curr++; } while (0) +#define STORE_CHAR(c,cs,n,a,pos) \ + do { if (store_char((c),(cs),(n),(a),(pos))) return (1); else curr++; } while (0) static int -store_char(c, a, pos) +store_char(c, cs, n, a, pos) int c; + CHARSET cs; + int n; int a; POSITION pos; { @@ -415,7 +510,7 @@ if (a != AT_NORMAL) last_overstrike = a; #if HILITE_SEARCH - if (is_hilited(pos, pos+1, 0)) + if (is_hilited(pos, pos+n, 0)) { /* * This character should be highlighted. @@ -428,7 +523,7 @@ if (ctldisp == OPT_ONPLUS && in_ansi_esc_seq()) w = 0; else - w = pwidth(c, a); + w = pwidth(c, cs, a); if (ctldisp != OPT_ON && column + w + attr_ewidth(a) > sc_width) /* * Won't fit on screen. @@ -456,7 +551,7 @@ * It's hardly worth doing this much. }} */ if (curr > 0 && a != AT_NORMAL && - linebuf[curr-1] == ' ' && attr[curr-1] == AT_NORMAL && + linebuf[curr-1] == ' ' && charset[curr-1] == ASCII && attr[curr-1] == AT_NORMAL && attr_swidth(a) > 0) { /* @@ -479,6 +574,7 @@ /* End of magic cookie handling. */ linebuf[curr] = c; + charset[curr] = cs; attr[curr] = a; column += w; return (0); @@ -498,6 +594,7 @@ { int to_tab = column + cshift - lmargin; int i; + CHARSET tmpcs = ASCII; if (ntabstops < 2 || to_tab >= tabstops[ntabstops-1]) to_tab = tabdefault - @@ -511,26 +608,118 @@ } do { - STORE_CHAR(' ', attr, pos); + STORE_CHAR(' ', tmpcs, 1, attr, pos); } while (--to_tab > 0); return 0; } /* + * Append multiple characters to the line buffer. + * Expand tabs into spaces, handle underlining, boldfacing, etc. + * Returns 0 if ok, 1 if couldn't fit in buffer. + */ + public int +pappend_multi(cbuf, csbuf, byte, pos) + char *cbuf; + CHARSET *csbuf; + int byte; + POSITION pos; +{ + int r; + int saved_curr; + int saved_column; + int saved_overstrike; + int saved_last_overstrike; + int saved_hilites; + int saved_cshift; + int i; + + if (pendc) + { + if (do_append(pendc, control_char(pendc) ? WRONGCS : + ASCII, 1, pendpos)) + /* + * Oops. We've probably lost the char which + * was in pendc, since caller won't back up. + */ + return (1); + pendc = '\0'; + } + + if (*cbuf == '\r' && byte == 1 && bs_mode == BS_SPECIAL) + { + /* + * Don't put the CR into the buffer until we see + * the next char. If the next char is a newline, + * discard the CR. + */ + pendc = *cbuf; + pendpos = pos; + return (0); + } + + /* + * Save several variables. + */ + saved_curr = curr; + saved_column = column; + saved_overstrike = overstrike; + saved_last_overstrike = last_overstrike; + saved_hilites = hilites; + saved_cshift = cshift; + r = 0; + for (i = 0; i < byte && r == 0; i++) + { + r = do_append(cbuf[i], csbuf[i], byte - i, pos); + } + curr = saved_curr; + column = saved_column; + overstrike = saved_overstrike; + last_overstrike = saved_last_overstrike; + hilites = saved_hilites; + cshift = saved_cshift; + if (r != 0) + { + return (r); + } + + for (i = 0; i < byte && r == 0; i++) + { + r = do_append(cbuf[i], csbuf[i], byte - i, pos); + } + + /* + * If we need to shift the line, do it. + * But wait until we get to at least the middle of the screen, + * so shifting it doesn't affect the chars we're currently + * pappending. (Bold & underline can get messed up otherwise.) + */ + if (cshift < hshift && column > sc_width / 2) + { + linebuf[curr] = '\0'; + pshift(hshift - cshift); + } + return (r); +} + +/* * Append a character to the line buffer. * Expand tabs into spaces, handle underlining, boldfacing, etc. * Returns 0 if ok, 1 if couldn't fit in buffer. */ public int -pappend(c, pos) +pappend(c, cs, i, pos) register int c; + CHARSET cs; + int i; POSITION pos; { int r; if (pendc) { - if (do_append(pendc, pendpos)) + if (do_append(pendc, control_char(pendc) ? WRONGCS : + ASCII, 1, pendpos)) /* * Oops. We've probably lost the char which * was in pendc, since caller won't back up. @@ -551,7 +740,7 @@ return (0); } - r = do_append(c, pos); + r = do_append(c, cs, i, pos); /* * If we need to shift the line, do it. * But wait until we get to at least the middle of the screen, @@ -572,28 +761,51 @@ #define IS_UTF8_TRAIL(c) ( ((c) & 0xc0) == 0x80 ) static int -do_append(c, pos) +do_append(c, cs, n, pos) int c; + CHARSET cs; + int n; POSITION pos; { register char *s; register int a; -#define STOREC(c,a) \ - if ((c) == '\t') STORE_TAB((a),pos); else STORE_CHAR((c),(a),pos) +#define STOREC(c,cs,n,a) \ + if ((c) == '\t') STORE_TAB((a),pos); else STORE_CHAR((c),(cs),(n),(a),pos) - if (c == '\b') +#if ISO + if (overstrike) + { + /* + * Check about multi '\b' for multi bytes character. + */ + if (c == '\b') + { + if (linebuf[curr] == '_' && CSISASCII(charset[curr])) + goto do_bs_char; /* do backc on underline */ + else + return (0); /* ignore it */ + } + } +#endif + if (CSISWRONG(cs) && c != '\b' && c != '\t') + { + goto do_control_char; + } else if (c == '\b' && CSISWRONG(cs)) { + do_bs_char: switch (bs_mode) { case BS_NORMAL: - STORE_CHAR(c, AT_NORMAL, pos); + STORE_CHAR(c, cs, n, AT_NORMAL, pos); break; case BS_CONTROL: goto do_control_char; case BS_SPECIAL: if (curr == 0) - break; + goto do_control_char; + if (CSISWRONG(charset[curr - 1])) + goto do_control_char; backc(); overstrike = 1; break; @@ -613,23 +825,23 @@ backc(); backc(); backc(); - STORE_CHAR(linebuf[curr], AT_BOLD, pos); + STORE_CHAR(linebuf[curr], cs, n, AT_BOLD, pos); overstrike = 3; } else if (utf_mode && (IS_UTF8_3BYTE(c) || (overstrike==2 && IS_UTF8_TRAIL(c))) && curr > 1 && (char)c == linebuf[curr-2]) { backc(); backc(); - STORE_CHAR(linebuf[curr], AT_BOLD, pos); + STORE_CHAR(linebuf[curr], cs, n, AT_BOLD, pos); overstrike = 2; } else if (utf_mode && curr > 0 && (IS_UTF8_2BYTE(c) || (overstrike==1 && IS_UTF8_TRAIL(c))) && (char)c == linebuf[curr-1]) { backc(); - STORE_CHAR(linebuf[curr], AT_BOLD, pos); + STORE_CHAR(linebuf[curr], cs, n, AT_BOLD, pos); overstrike = 1; } else if (utf_mode && curr > 0 && IS_UTF8_TRAIL(c) && attr[curr-1] == AT_UNDERLINE) { - STOREC(c, AT_UNDERLINE); - } else if ((char)c == linebuf[curr]) + STOREC(c, cs, n, AT_UNDERLINE); + } else if ((char)c == linebuf[curr] && charset[curr] == cs) { /* * Overstriking a char with itself means make it bold. @@ -639,10 +851,10 @@ * Use the previous overstrike to resolve it. */ if (c == '_' && last_overstrike != AT_NORMAL) - STOREC(c, last_overstrike); + STOREC(c, cs, n, last_overstrike); else - STOREC(c, AT_BOLD); - } else if (c == '_') + STOREC(c, cs, n, AT_BOLD); + } else if (c == '_' && CSISASCII(cs)) { if (utf_mode) { @@ -654,8 +866,13 @@ attr[curr-i-1] = AT_UNDERLINE; } } - STOREC(linebuf[curr], AT_UNDERLINE); - } else if (linebuf[curr] == '_') + STOREC(linebuf[curr], charset[curr], n, AT_UNDERLINE); +#if ISO + while (CSISREST(charset[curr])) + STOREC(linebuf[curr], charset[curr], --n, + AT_UNDERLINE); +#endif + } else if (linebuf[curr] == '_' && CSISASCII(charset[curr])) { if (utf_mode) { @@ -666,12 +883,12 @@ else if (IS_UTF8_4BYTE(c)) overstrike = 3; } - STOREC(c, AT_UNDERLINE); - } else if (control_char(c)) + STOREC(c, cs, n, AT_UNDERLINE); + } else if (CSISWRONG(cs) && control_char(c)) goto do_control_char; else - STOREC(c, AT_NORMAL); - } else if (c == '\t') + STOREC(c, cs, n, AT_NORMAL); + } else if (c == '\t' && CSISWRONG(cs)) { /* * Expand a tab into spaces. @@ -685,7 +902,7 @@ STORE_TAB(AT_NORMAL, pos); break; } - } else if (control_char(c)) + } else if (CSISWRONG(cs) && control_char(c)) { do_control_char: if (ctldisp == OPT_ON || (ctldisp == OPT_ONPLUS && c == ESC)) @@ -693,13 +910,13 @@ /* * Output as a normal character. */ - STORE_CHAR(c, AT_NORMAL, pos); + STORE_CHAR(c, cs, n, AT_NORMAL, pos); } else { /* * Convert to printable representation. */ - s = prchar(c); + s = prchar(c, cs); a = binattr; /* @@ -711,11 +928,16 @@ return (1); for ( ; *s != 0; s++) - STORE_CHAR(*s, a, pos); + STORE_CHAR(*s, WRONGCS, 1, a, pos); } +#if ISO + } else if (CSISREST(cs)) + { + STOREC(c, cs, n, attr[curr - 1]); +#endif } else { - STOREC(c, AT_NORMAL); + STOREC(c, cs, n, AT_NORMAL); } return (0); @@ -734,7 +956,8 @@ * But discard a pending CR if we are at end of line * (that is, discard the CR in a CR/LF sequence). */ - (void) do_append(pendc, pendpos); + (void) do_append(pendc, control_char(pendc) ? WRONGCS : + ASCII, 1, pendpos); /* * Make sure we've shifted the line, if we need to. @@ -749,16 +972,19 @@ if (column < sc_width || !auto_wrap || ignaw || ctldisp == OPT_ON) { linebuf[curr] = '\n'; + charset[curr] = ASCII; attr[curr] = AT_NORMAL; curr++; } linebuf[curr] = '\0'; + charset[curr] = ASCII; attr[curr] = AT_NORMAL; #if HILITE_SEARCH if (status_col && hilites > 0) { linebuf[0] = '*'; + charset[0] = ASCII; attr[0] = AT_STANDOUT; } #endif @@ -775,8 +1001,9 @@ * and the character attribute in *ap. */ public int -gline(i, ap) +gline(i, csp, ap) register int i; + register int *csp; register int *ap; { char *s; @@ -787,11 +1014,13 @@ * If there is no current line, we pretend the line is * either "~" or "", depending on the "twiddle" flag. */ + *csp = ASCII; *ap = AT_BOLD; s = (twiddle) ? "~\n" : "\n"; return (s[i]); } + *csp = charset[i]; *ap = attr[i]; return (linebuf[i] & 0377); } Index: less/main.c diff -u less/main.c:1.1.1.17 less/main.c:1.26 --- less/main.c:1.1.1.17 Tue Aug 30 20:55:40 2005 +++ less/main.c Tue Aug 30 22:45:49 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1998-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -112,12 +118,18 @@ get_term(); init_cmds(); init_prompt(); + init_planeset(); init_charset(); init_line(); init_option(); s = lgetenv("LESS"); if (s != NULL) scan_option(save(s)); +#if ISO + s = lgetenv("JLESS"); + if (s != NULL) + scan_option(save(s)); +#endif #define isoptstring(s) (((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0') while (argc > 0 && (isoptstring(*argv) || isoptpending())) Index: less/multi.c diff -u /dev/null less/multi.c:1.127 --- /dev/null Sun Sep 4 19:53:51 2005 +++ less/multi.c Sun Sep 4 19:07:19 2005 @@ -0,0 +1,2121 @@ +/* + * Copyright (c) 1994-2005 Kazushi (Jam) Marukawa + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice in the documentation and/or other materials provided with + * the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +/* + * Routines to manipulate a buffer to hold string of multi bytes character. + * Detect a character set from input string and convert them to internal + * codes. And convert it to other codes to display them. + */ + +#include "defines.h" +#include "less.h" + +#include +#include + +#if STDC_HEADERS +#include +#include +#endif + +#define LESS 1 + +/* TODO: remove caller control_char(), change_control_char() and ecalloc() */ +extern int control_char (); +extern void change_control_char (); +extern void* ecalloc (); + + +#if ISO + +static void reject_first_byte(); +static void rebuffering_multi(); + + +#if JAPANESE + +int markwrongchar = 1; + + +/* + * Kanji convetion + */ +#define ISJIS(c) (0x21 <= (c) && (c) <= 0x7e) +#define ISUJIS(c) (0xa1 <= (c) && (c) <= 0xfe) +#define ISUJISSS(c) ((c) == 0x8e || (c) == 0x8f) +#define ISUJISKANJI(c1,c2) (ISUJIS(c1) && ISUJIS(c2)) +#define ISUJISKANJI1(c) (ISUJIS(c)) +#define ISUJISKANA(c1,c2) ((c1) == 0x8e && ISUJIS(c2)) +#define ISUJISKANA1(c) ((c) == 0x8e) +#define ISUJISKANJISUP(c1,c2,c3) ((c1) == 0x8f && ISUJIS(c2) && ISUJIS(c3)) +#define ISUJISKANJISUP1(c) ((c) == 0x8f) +#define ISSJISKANJI(c1,c2) (((0x81 <= (c1) && (c1) <= 0x9f) || \ + (0xe0 <= (c1) && (c1) <= 0xfc)) && \ + (0x40 <= (c2) && (c2) <= 0xfc && (c2) != 0x7f)) +#define ISSJISKANJI1(c) ((0x81 <= (c) && (c) <= 0x9f) || \ + (0xe0 <= (c) && (c) <= 0xfc)) +#define ISSJISKANA(c) (0xa1 <= (c) && (c) <= 0xdf) +#endif + + +/* + * Definitions for understanding the escape sequence. + * Following escape sequences which be understood by less: + * ESC 2/4 2/8,2/9,2/10,2/11,2/13,2/14,2/15 F + * ESC 2/4 4/0,4/1,4/2 + * ESC 2/6 F + * ESC 2/8,2/9,2/10,2/11,2/13,2/14,2/15 F + * ESC 2/12 F This is used in MULE. Less support this as input. + * 0/14,0/15 + * ESC 4/14,4/15,6/14,6/15,7/12,7/13,7/14 + * 8/14,8/15 + */ +enum escape_sequence { + NOESC, /* No */ ESC_, /* ^[ */ + ESC_2_4, /* ^[$ */ ESC_2_4_8, /* ^[$( */ + ESC_2_4_9, /* ^[$) */ ESC_2_4_10, /* ^[$* */ + ESC_2_4_11, /* ^[$+ */ ESC_2_4_13, /* ^[$- */ + ESC_2_4_14, /* ^[$. */ ESC_2_4_15, /* ^[$/ */ + ESC_2_6, /* ^[& */ ESC_2_8, /* ^[( */ + ESC_2_9, /* ^[) */ ESC_2_10, /* ^[* */ + ESC_2_11, /* ^[+ */ ESC_2_12, /* ^[, */ + ESC_2_13, /* ^[- */ ESC_2_14, /* ^[. */ + ESC_2_15 /* ^[/ */ +}; + + +static CODESET def_left = iso7; /* Default code set of left plane */ +static CODESET def_right = iso8; /* Default code set of right plane */ +static int def_gs[4] = { + ASCII, /* Default g0 plane status */ + WRONGCS, /* Default g1 plane status */ + WRONGCS, /* Default g2 plane status */ + WRONGCS /* Default g3 plane status */ +}; + +static CODESET output = iso8; /* Code set for output */ +#if JAPANESE +static CODESET def_priority = ujis; /* Which code was given priority. */ +#endif + +typedef POSITION m_position; +#define M_NULL_POS ((POSITION)(-1)) + +/* + * Structure to represent character set information. + * + * This data set contains current character set and other information + * to keep the status of ISO-2022 escape sequence. + */ +struct m_status { + /* Graphi Sets */ + int gs[4]; /* Current g0..g3 plane sets. */ + /* gl, gr, and sg refer one of 4 planes. */ + int gl; /* Current gl plane status */ + int gr; /* Current gr plane status */ + int sg; /* Current status of single-shifted plane */ +#define WRONGPLANE (-1) +#define ISVALIDPLANE(mp,plane) ((mp)->ms->plane != WRONGPLANE) +#define FINDCS(mp,c) ((mp)->ms->gs[(ISVALIDPLANE((mp), sg) ? (mp)->ms->sg : \ + ((c) & 0x80) ? (mp)->ms->gr : (mp)->ms->gl)]) +#define PLANE2CS(mp,plane) ((mp)->ms->gs[(mp)->ms->plane]) + + int irr; /* Identify revised registration number */ +}; + +struct multibuf { + struct { + CODESET left; + CODESET right; + } io; + + CODESET orig_io_right; + int rotation_io_right; + + enum escape_sequence eseq; + /* + * Variables to control of escape sequences as output. + */ + int cs; /* Current character set */ + struct m_status* ms; +#if JAPANESE + CODESET priority; /* Which code was given priority. */ + int sequence_counter; /* Special counter for detect UJIS KANJI. */ +#endif + + int icharset; /* Last non ASCII character set of input */ + + /* + * Buffers to keep all bytes of a multi-bytes character until it is + * proved to be right sequence. + */ + /* + * Buffer for input/parsing + */ + m_position lastpos; /* position of last byte */ + m_position startpos; /* position of first byte buffered */ + unsigned char inbuf[20]; + /* + * Second buffer. + * All recognized data is buffered with character set tag. + */ + unsigned char multiint[10]; /* Buffer for recognized data */ + CHARSET multics[10]; /* Buffer for character set marks */ + int intindex; /* Index of multiint */ + m_position lastesqpos; /* Last escape sequence position */ + /* (point FIN char) */ +}; + +#define INBUF(mp) ((mp)->inbuf[(mp)->lastpos%sizeof((mp)->inbuf)]) +#define INBUFI(mp,i) ((mp)->inbuf[(i)%sizeof((mp)->inbuf)]) + +static int code_length(mp, cs) +MULBUF* mp; +CHARSET cs; +{ +#if JAPANESE + unsigned char c; +#endif + + if (CSISWRONG(cs)) + return 1; + +#if JAPANESE + switch (CS2CHARSET(cs)) { + case UJIS: + c = INBUFI(mp, mp->startpos); + if (ISUJISKANJI1(c)) return 2; + if (ISUJISKANA1(c)) return 2; + if (ISUJISKANJISUP1(c)) return 3; + return 1; + case SJIS: + c = INBUFI(mp, mp->startpos); + if (ISSJISKANJI1(c)) return 2; + if (ISSJISKANA(c)) return 1; + return 1; + } +#endif + + switch (CS2TYPE(cs)) + { + case TYPE_94_CHARSET: + case TYPE_96_CHARSET: + return 1; + case TYPE_94N_CHARSET: + case TYPE_96N_CHARSET: + switch (CS2FT(cs) & 0x70) + { + case 0x30: return 2; /* for private use */ + case 0x40: + case 0x50: return 2; + case 0x60: return 3; + case 0x70: return 4; /* or more bytes */ + } + } + assert(0); + return (0); +} + +/* + * Convert first byte of buffered data as one byte ASCII data + * without any conversion. + */ +static void noconv1(mp) +MULBUF *mp; +{ + mp->multiint[mp->intindex] = INBUFI(mp, mp->startpos); + mp->multics[mp->intindex] = ASCII; + mp->intindex++; + mp->startpos++; +} + +/* + * Convert first byte of buffered data as one byte WRONGCS data + * without any conversion. + */ +static void wrongcs1(mp) +MULBUF *mp; +{ + mp->multiint[mp->intindex] = INBUFI(mp, mp->startpos); + mp->multics[mp->intindex] = WRONGCS; + mp->intindex++; + mp->startpos++; +} + +/* + * Write a wrongmark on out buffer. + */ +static void put_wrongmark(mp) +MULBUF *mp; +{ + mp->multiint[mp->intindex + 0] = '"'; + mp->multiint[mp->intindex + 1] = '.'; + mp->multics[mp->intindex + 0] = JISX0208KANJI; + mp->multics[mp->intindex + 1] = REST_MASK | JISX0208KANJI; + mp->intindex += 2; +} + +/* + * Convert first several bytes of buffered data. + * + * If less is in marking mode, it erase several bytes of data (depend on + * the current character set) and write "?" mark on output buffer. + * If less is not in marking mode, it calls wrongcs1(). + */ +static void wrongchar(mp) +MULBUF *mp; +{ + if (markwrongchar) { + switch (CS2CHARSET(mp->multics[mp->intindex])) { + case JISX0201KANA: + case JISX0201ROMAN: + case LATIN1: + case LATIN2: + case LATIN3: + case LATIN4: + case GREEK: + case ARABIC: + case HEBREW: + case CYRILLIC: + case LATIN5: + /* Should I use one byte character, like '?' or '_'? */ + put_wrongmark(mp); + break; + case JISX0208_78KANJI: + case JISX0208KANJI: + case JISX0208_90KANJI: + case JISX0212KANJISUP: + case JISX0213KANJI1: + case JISX0213KANJI2: + case UJIS: + case SJIS: + put_wrongmark(mp); + break; + case GB2312: + case KSC5601: + default: + break; + } + } else { + int i; + + i = code_length(mp, mp->multics[mp->intindex]); + while (--i >= 0) { + wrongcs1(mp); + } + } +} + +/* + * Internalize input stream. + * We recognized input data as using ISO coding set. + */ +static void internalize_iso(mp) +MULBUF *mp; +{ + register int i; + m_position pos; + m_position to; + int intindex; + + /* + * If character set points empty character set, reject buffered data. + */ + if (CSISWRONG(mp->cs)) { + wrongcs1(mp); + return; + } + + /* + * If character set points 94 or 94x94 character set, reject + * DEL and SPACE codes in buffered data. + */ + if (CS2TYPE(mp->cs) == TYPE_94_CHARSET || + CS2TYPE(mp->cs) == TYPE_94N_CHARSET) { + unsigned char c = INBUF(mp); + if ((c & 0x7f) == 0x7f) { + if (mp->lastpos - mp->startpos + 1 == 1) { + wrongcs1(mp); + } else { + wrongcs1(mp); + rebuffering_multi(); + } + return; + } else if ((c & 0x7f) == 0x20) { + /* + * A 0x20 (SPACE) code is wrong, but I treat it as + * a SPACE. + */ + if (mp->lastpos - mp->startpos + 1 == 1) { + noconv1(mp); + } else { + wrongcs1(mp); + rebuffering_multi(); + } + return; + } + } + + /* + * Otherwise, keep buffering. + */ + pos = mp->startpos; + to = pos + code_length(mp, mp->cs) - 1; + if (mp->lastpos < to) { + return; /* Not enough, so go back to fetch next data. */ + } + + /* + * We buffered enough data for one character of multi byte characters. + * Therefore, start to convert this buffered data into a first character. + */ + intindex = mp->intindex; + mp->multiint[intindex] = INBUFI(mp, pos) & 0x7f; + mp->multics[intindex] = mp->cs; + intindex++; + for (pos++; pos <= to; pos++) { + mp->multiint[intindex] = INBUFI(mp, pos) & 0x7f; + mp->multics[intindex] = REST_MASK | mp->cs; + intindex++; + } + /* + * Check newly converted code. If it is not valid code, + * less may mark it as not valid code. + */ + if (chisvalid_cs(&mp->multiint[mp->intindex], &mp->multics[mp->intindex])) { + mp->intindex = intindex; + mp->startpos = pos; + } else { + /* + * less ignore the undefined codes + */ + wrongchar(mp); + mp->startpos = pos; + rebuffering_multi(mp); + } +} + +#if JAPANESE +/* + * Internalize input stream. + * We recognized input data as using UJIS coding set. + */ +static void internalize_ujis(mp) +MULBUF *mp; +{ + if (mp->lastpos - mp->startpos + 1 == 1) { + /* do nothing */ + } else if (mp->lastpos - mp->startpos + 1 == 2) { + if (ISUJISKANA(INBUFI(mp, mp->startpos), INBUF(mp))) { + mp->multiint[mp->intindex] = INBUF(mp) & 0x7f; + mp->multics[mp->intindex] = mp->cs; + mp->intindex += 1; + mp->startpos = mp->lastpos + 1; + } else if (ISUJISKANJI(INBUFI(mp, mp->startpos), INBUF(mp))) { + mp->multiint[mp->intindex] = INBUFI(mp, mp->startpos); + mp->multics[mp->intindex] = UJIS; + mp->multiint[mp->intindex + 1] = INBUF(mp); + mp->multics[mp->intindex + 1] = REST_MASK | UJIS; + + /* + * Eliminate some wrong codes + */ + if (chisvalid_cs(&mp->multiint[mp->intindex], + &mp->multics[mp->intindex])) { + /* JIS X 0208:1997 */ + mp->multiint[mp->intindex] = mp->multiint[0] & 0x7f; + mp->multics[mp->intindex] = mp->cs; + mp->multiint[mp->intindex + 1] = mp->multiint[1] & 0x7f; + mp->multics[mp->intindex + 1] = REST_MASK | mp->cs; + mp->intindex += 2; + mp->startpos = mp->lastpos + 1; + } else { + /* + * less ignore the undefined codes + */ + wrongchar(mp); + mp->startpos = mp->lastpos + 1; + rebuffering_multi(mp); + } + } + } else if (mp->lastpos - mp->startpos + 1 == 3 && + ISUJISKANJISUP(INBUFI(mp, mp->startpos), + INBUFI(mp, mp->startpos + 1), INBUF(mp))) { + mp->multiint[mp->intindex] = INBUFI(mp, mp->startpos); + mp->multics[mp->intindex] = UJIS; + mp->multiint[mp->intindex + 1] = INBUFI(mp, mp->startpos + 1); + mp->multics[mp->intindex + 1] = REST_MASK | UJIS; + mp->multiint[mp->intindex + 2] = INBUF(mp); + mp->multics[mp->intindex + 2] = REST_MASK | UJIS; + + /* + * Eliminate some wrong codes + */ + if (chisvalid_cs(&mp->multiint[mp->intindex], + &mp->multics[mp->intindex])) { + register int c1; + static unsigned char table[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#if UJIS0213 + 0, 0x21, 0, 0x23, 0x24, 0x25, 0, 0, + 0x28, 0, 0, 0, 0x2C, 0x2D, 0x2E, 0x2F, +#else + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#endif + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#if UJIS0213 + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0 +#else + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#endif + }; + c1 = mp->multiint[1] & 0x7f; + if (table[c1] != 0) { + /* JIS X 0213:2000 plane 2 */ + if (output == jis) { + /* JIS cannot output JIS X 0213:2000 plane 2 */ + wrongcs1(mp); + rebuffering_multi(mp); + } else { + mp->multiint[mp->intindex] = c1; + mp->multics[mp->intindex] = + JISX0213KANJI2; + mp->multiint[mp->intindex + 1] = + mp->multiint[2] & 0x7f; + mp->multics[mp->intindex + 1] = + REST_MASK | JISX0213KANJI2; + mp->intindex += 2; + mp->startpos = mp->lastpos + 1; + } + } else { + /* JIS X 0212:1990 */ + if (output == sjis || output == jis) { + /* SJIS cannot output JIS X 0212:1990 */ + wrongcs1(mp); + rebuffering_multi(mp); + } else { + mp->multiint[mp->intindex] = c1; + mp->multics[mp->intindex] = mp->cs; + mp->multiint[mp->intindex + 1] = + mp->multiint[2] & 0x7f; + mp->multics[mp->intindex + 1] = + REST_MASK | mp->cs; + mp->intindex += 2; + mp->startpos = mp->lastpos + 1; + } + } + } else { + wrongchar(mp); + mp->startpos = mp->lastpos + 1; + rebuffering_multi(mp); + } + } else { + wrongcs1(mp); + rebuffering_multi(mp); + } +} + +/* + * Check and normalize all SJIS codes + */ +static void internalize_sjis(mp) +MULBUF *mp; +{ + if (mp->lastpos - mp->startpos + 1 == 1) { + if (!ISSJISKANA(INBUF(mp))) { + wrongcs1(mp); + } else { + mp->multiint[mp->intindex] = INBUF(mp) & 0x7f; + mp->multics[mp->intindex] = mp->cs; + mp->intindex += 1; + mp->startpos = mp->lastpos + 1; + } + } else if (mp->lastpos - mp->startpos + 1 == 2 && + ISSJISKANJI(INBUFI(mp, mp->startpos), INBUF(mp))) { + mp->multiint[mp->intindex] = INBUFI(mp, mp->startpos); + mp->multics[mp->intindex] = SJIS; + mp->multiint[mp->intindex + 1] = INBUF(mp); + mp->multics[mp->intindex + 1] = REST_MASK | SJIS; + + /* + * Check the correctness of SJIS encoded characters and + * convert them into internal representation. + */ + if (chisvalid_cs(&mp->multiint[mp->intindex], + &mp->multics[mp->intindex])) { + register int c1, c2, c3; + static unsigned char table[] = { + 0, 0x21, 0x23, 0x25, 0x27, 0x29, 0x2B, 0x2D, + 0x2F, 0x31, 0x33, 0x35, 0x37, 0x39, 0x3B, 0x3D, + 0x3F, 0x41, 0x43, 0x45, 0x47, 0x49, 0x4B, 0x4D, + 0x4F, 0x51, 0x53, 0x55, 0x57, 0x59, 0x5B, 0x5D, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x5F, 0x61, 0x63, 0x65, 0x67, 0x69, 0x6B, 0x6D, +#if SJIS0213 + 0x6F, 0x71, 0x73, 0x75, 0x77, 0x79, 0x7B, 0x7D, + 0x80, 0xA3, 0x81, 0xAD, 0x82, 0xEF, 0xF1, 0xF3, + 0xF5, 0xF7, 0xF9, 0xFB, 0xFD, 0, 0, 0 +#else + 0x6F, 0x71, 0x73, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#endif + }; + + c1 = table[INBUFI(mp, mp->startpos) & 0x7f]; + c2 = INBUF(mp) - ((unsigned char)INBUF(mp) >= 0x80 ? 1 : 0); + c3 = c2 >= 0x9e; + if (c1 < 0x80) { + /* JIS X 0213:2000 plane 1 or JIS X 0208:1997 */ + mp->multiint[mp->intindex] = + (c1 + (c3 ? 1 : 0)); + mp->multics[mp->intindex] = mp->cs; + mp->multiint[mp->intindex + 1] = + (c2 - (c3 ? 0x9e - 0x21 : 0x40 - 0x21)); + mp->multics[mp->intindex + 1] = + REST_MASK | mp->cs; + mp->intindex += 2; + mp->startpos = mp->lastpos + 1; + } else { + /* JIS X 0213:2000 plane 2 */ + if (output == jis) { + /* JIS cannot output JIS X 0213:2000 plane 2 */ + wrongcs1(mp); + rebuffering_multi(mp); + } else { + if (c1 > 0xA0) { + /* row 3-4, 13-14, and 79-94 */ + mp->multiint[mp->intindex] = + ((c1 & 0x7f) + (c3 ? 1 : 0)); + } else if (c1 == 0x80) { + /* row 1 or 8 */ + mp->multiint[mp->intindex] = + c3 ? 0x28 : 0x21; + } else if (c1 == 0x81) { + /* row 5 or 12 */ + mp->multiint[mp->intindex] = + c3 ? 0x2C : 0x25; + } else { + /* row 15 or 78 */ + mp->multiint[mp->intindex] = + c3 ? 0x6E : 0x2F; + } + mp->multics[mp->intindex] = JISX0213KANJI2; + mp->multiint[mp->intindex + 1] = + (c2 - (c3 ? 0x9e - 0x21 : 0x40 - 0x21)); + mp->multics[mp->intindex + 1] = + REST_MASK | JISX0213KANJI2; + mp->intindex += 2; + mp->startpos = mp->lastpos + 1; + } + } + } else { + /* + * Less ignores undefined characters after marking + * them as wrong characters. + */ + wrongchar(mp); + mp->startpos = mp->lastpos + 1; + rebuffering_multi(mp); + } + } else { + wrongcs1(mp); + rebuffering_multi(mp); + } +} +#endif + +static void internalize(mp) +MULBUF *mp; +{ + int c = INBUF(mp); + + if (mp->lastpos - mp->startpos + 1 == 1) { + if ((c <= 0x7f && mp->io.left == noconv) || + (c >= 0x80 && mp->io.right == noconv)) { +#if JAPANESE + mp->sequence_counter = 0; +#endif + if (control_char(c)) { + wrongcs1(mp); + } else { + noconv1(mp); + } + return; + } else if (c >= 0x80 && mp->io.right == none) { +#if JAPANESE + mp->sequence_counter = 0; +#endif + wrongcs1(mp); + return; + } + + mp->cs = ASCII; + if (c < 0x20) { +#if JAPANESE + mp->sequence_counter = 0; +#endif + wrongcs1(mp); + return; + } else if (c <= 0x7f || + (mp->io.right == iso8 && (0xa0 <= c && c <= 0xff))) { +#if JAPANESE + mp->sequence_counter = 0; +#endif + /* + * Decide current character set. + */ + mp->cs = FINDCS(mp, c); + /* + * Check cs that fit for output code set. + */ + /* JIS cannot output JISX0212, JISX0213_2, or ISO2022 */ + if (output == jis && mp->cs != ASCII && + mp->cs != JISX0201KANA && + mp->cs != JISX0201ROMAN && + mp->cs != JISX0208_78KANJI && + mp->cs != JISX0208KANJI && + mp->cs != JISX0208_90KANJI && + mp->cs != JISX0213KANJI1) { + wrongcs1(mp); + rebuffering_multi(mp); + return; + } + /* UJIS cannot output regular ISO2022 except JIS */ + if (output == ujis && mp->cs != ASCII && + mp->cs != JISX0201KANA && + mp->cs != JISX0201ROMAN && + mp->cs != JISX0208_78KANJI && + mp->cs != JISX0208KANJI && + mp->cs != JISX0208_90KANJI && + mp->cs != JISX0212KANJISUP && + mp->cs != JISX0213KANJI1 && + mp->cs != JISX0213KANJI2) { + wrongcs1(mp); + rebuffering_multi(mp); + return; + } + /* SJIS cannot output JISX0212 or ISO2022 */ + if (output == sjis && mp->cs != ASCII && + mp->cs != JISX0201KANA && + mp->cs != JISX0201ROMAN && + mp->cs != JISX0208_78KANJI && + mp->cs != JISX0208KANJI && + mp->cs != JISX0208_90KANJI && + mp->cs != JISX0213KANJI1 && + mp->cs != JISX0213KANJI2) { + wrongcs1(mp); + rebuffering_multi(mp); + return; + } + + if (mp->cs != ASCII) + mp->icharset = mp->cs; + internalize_iso(mp); + return; + } else if (control_char(c)) { +#if JAPANESE + mp->sequence_counter = 0; +#endif + wrongcs1(mp); + return; + } +#if JAPANESE + if (mp->priority == sjis && ISSJISKANA(c)) { + if (mp->io.right == japanese) { + mp->sequence_counter++; + if (mp->sequence_counter % 2 == 1 && + INBUFI(mp, mp->startpos) != 0xa4) /* ???? */ + { + mp->sequence_counter = 0; + } + if (mp->sequence_counter >= 6) + /* + * It looks like a sequence of UJIS + * hiragana. Thus we give priority + * to not sjis. + */ + mp->priority = ujis; + } + mp->cs = JISX0201KANA; + mp->icharset = SJIS; + internalize_sjis(mp); + return; + } else if (mp->io.right == ujis || mp->io.right == sjis || + mp->io.right == japanese) { + mp->sequence_counter = 0; + return; + } + mp->sequence_counter = 0; +#endif + wrongcs1(mp); + return; + } + +#if JAPANESE + assert(mp->sequence_counter == 0); +#endif + if (c < 0x20) { + wrongcs1(mp); + rebuffering_multi(mp); + return; + } else if (mp->cs != ASCII && + (c <= 0x7f || + (mp->io.right == iso8 && 0xa0 <= c && c <= 0xff))) { + if (mp->cs != FINDCS(mp, c)) { + wrongcs1(mp); + rebuffering_multi(mp); + } else { + internalize_iso(mp); + } + return; + } else if (control_char(c)) { + wrongcs1(mp); + rebuffering_multi(mp); + return; + } +#if JAPANESE + if (mp->lastpos - mp->startpos + 1 == 2) { + int c0 = INBUFI(mp, mp->startpos); + if (mp->priority == sjis && ISSJISKANJI(c0, c)) { +#if UJIS0213 + mp->cs = JISX0213KANJI1; +#else + mp->cs = JISX0208KANJI; +#endif + mp->icharset = SJIS; + internalize_sjis(mp); + return; + } else if (mp->priority == ujis) { + if (ISUJISKANA(c0, c)) { + mp->cs = JISX0201KANA; + mp->icharset = UJIS; + internalize_ujis(mp); + return; + } else if (ISUJISKANJI(c0, c)) { +#if UJIS0213 + mp->cs = JISX0213KANJI1; +#else + mp->cs = JISX0208KANJI; +#endif + mp->icharset = UJIS; + internalize_ujis(mp); + return; + } else if (ISUJISKANJISUP(c0, c, 0xa1)) { + return; + } + } + + if ((mp->io.right == sjis || mp->io.right == japanese) && + ISSJISKANJI(c0, c)) { +#if UJIS0213 + mp->cs = JISX0213KANJI1; +#else + mp->cs = JISX0208KANJI; +#endif + mp->priority = sjis; + mp->icharset = SJIS; + internalize_sjis(mp); + return; + } else if ((mp->io.right == ujis || mp->io.right == japanese)) { + if (ISUJISKANA(c0, c)) { + mp->cs = JISX0201KANA; + mp->priority = ujis; + mp->icharset = UJIS; + internalize_ujis(mp); + return; + } else if (ISUJISKANJI(c0, c)) { +#if UJIS0213 + mp->cs = JISX0213KANJI1; +#else + mp->cs = JISX0208KANJI; +#endif + mp->priority = ujis; + mp->icharset = UJIS; + internalize_ujis(mp); + return; + } else if (ISUJISKANJISUP(c0, c, 0xa1)) + { + return; + } + } + } else if (mp->lastpos - mp->startpos + 1 == 3 && + (mp->priority == ujis || + mp->io.right == ujis || mp->io.right == japanese) && + ISUJISKANJISUP(INBUFI(mp, mp->startpos), + INBUFI(mp, mp->startpos + 1), c)) { + mp->cs = JISX0212KANJISUP; + mp->priority = ujis; + mp->icharset = UJIS; + internalize_ujis(mp); + return; + } +#endif + wrongcs1(mp); + rebuffering_multi(mp); +} + +/* + * Check routines + */ +static int check_ft(mp, c, type, plane) +MULBUF *mp; +register int c; +int type; +int *plane; +{ + if (mp->io.left == jis) { + /* + * If the target code system is traditional jis, + * allow only JIS C6226-1978, JIS X0208-1983, JIS X0208-1990, + * JIS X0213-2000, JIS X0212-1990, ASCII, + * JIS X0201 right, and JIS X0201 left. + */ + if ((type == TYPE_94N_CHARSET && + (c == '@' || c == 'B' || c == 'D' || + c == 'O' || c == 'P')) || + (type == TYPE_94_CHARSET && + (c == 'B' || c == 'I' || c == 'J'))) { + *plane = (mp->ms->irr ? IRR2CS(mp->ms->irr) : 0) | TYPE2CS(type) | FT2CS(c); + mp->ms->irr = 0; + mp->eseq = NOESC; + mp->lastesqpos = mp->lastpos; + return (0); + } + } else if (0x30 <= c && c <= 0x7e) { + /* + * Otherwise, accept all. + */ + *plane = (mp->ms->irr ? IRR2CS(mp->ms->irr) : 0) | TYPE2CS(type) | FT2CS(c); + mp->ms->irr = 0; + mp->eseq = NOESC; + mp->lastesqpos = mp->lastpos; + return (0); + } + return (-1); +} + +static int check_irr(mp, c) +MULBUF *mp; +register int c; +{ + if (0x40 <= c && c <= 0x7e) { + mp->ms->irr = CODE2IRR(c); + mp->eseq = NOESC; + mp->lastesqpos = mp->lastpos; + return (0); + } + return (-1); +} + +static void fix_status_for_escape_sequence(mp) +MULBUF *mp; +{ + if (mp->eseq == NOESC) { + switch (CS2TYPE(ISVALIDPLANE(mp, sg) ? PLANE2CS(mp, sg) : + PLANE2CS(mp, gl))) { + case TYPE_96_CHARSET: + case TYPE_96N_CHARSET: + change_control_char(0177, 0); + break; + case TYPE_94_CHARSET: + case TYPE_94N_CHARSET: + change_control_char(0177, 1); + break; + } + switch (CS2TYPE(ISVALIDPLANE(mp, sg) ? PLANE2CS(mp, sg) : + PLANE2CS(mp, gr))) { + case TYPE_96_CHARSET: + case TYPE_96N_CHARSET: + change_control_char(0377, 0); + break; + case TYPE_94_CHARSET: + case TYPE_94N_CHARSET: + change_control_char(0377, 1); + break; + } + } +} + +static int check_escape_sequence(mp) +MULBUF *mp; +{ + int c = INBUF(mp); + + switch (mp->eseq) { + case ESC_: + switch (c) { + case '$': mp->eseq = ESC_2_4; break; + case '&': mp->eseq = ESC_2_6; break; + case '(': mp->eseq = ESC_2_8; break; + case ')': mp->eseq = ESC_2_9; break; + case '*': mp->eseq = ESC_2_10; break; + case '+': mp->eseq = ESC_2_11; break; + case ',': mp->eseq = ESC_2_12; break; + case '-': mp->eseq = ESC_2_13; break; + case '.': mp->eseq = ESC_2_14; break; + case '/': mp->eseq = ESC_2_15; break; + case 'N': mp->ms->sg = 2; mp->eseq = NOESC; /*SS2*/break; + case 'O': mp->ms->sg = 3; mp->eseq = NOESC; /*SS3*/break; + case 'n': mp->ms->gl = 2; mp->eseq = NOESC; break; + case 'o': mp->ms->gl = 3; mp->eseq = NOESC; break; + case '|': if (mp->io.right != iso8) goto wrong; + mp->ms->gr = 3; mp->eseq = NOESC; break; + case '}': if (mp->io.right != iso8) goto wrong; + mp->ms->gr = 2; mp->eseq = NOESC; break; + case '~': if (mp->io.right != iso8) goto wrong; + mp->ms->gr = 1; mp->eseq = NOESC; break; + default: goto wrong; + } + break; + case ESC_2_4: + switch (c) { + case '(': mp->eseq = ESC_2_4_8; break; + case ')': mp->eseq = ESC_2_4_9; break; + case '*': mp->eseq = ESC_2_4_10; break; + case '+': mp->eseq = ESC_2_4_11; break; + case '-': mp->eseq = ESC_2_4_13; break; + case '.': mp->eseq = ESC_2_4_14; break; + case '/': mp->eseq = ESC_2_4_15; break; + case '@': + case 'A': + case 'B': if (check_ft(mp, c, TYPE_94N_CHARSET, &(mp->ms->gs[0])) == 0) + break; + default: goto wrong; + } + break; + case ESC_2_6: + if (check_irr(mp, c) == 0) break; + goto wrong; + case ESC_2_8: + if (check_ft(mp, c, TYPE_94_CHARSET, &(mp->ms->gs[0])) == 0) break; + goto wrong; + case ESC_2_9: + if (check_ft(mp, c, TYPE_94_CHARSET, &(mp->ms->gs[1])) == 0) break; + goto wrong; + case ESC_2_10: + if (check_ft(mp, c, TYPE_94_CHARSET, &(mp->ms->gs[2])) == 0) break; + goto wrong; + case ESC_2_11: + if (check_ft(mp, c, TYPE_94_CHARSET, &(mp->ms->gs[3])) == 0) break; + goto wrong; + case ESC_2_12: + if (check_ft(mp, c, TYPE_96_CHARSET, &(mp->ms->gs[0])) == 0) break; + goto wrong; + case ESC_2_13: + if (check_ft(mp, c, TYPE_96_CHARSET, &(mp->ms->gs[1])) == 0) break; + goto wrong; + case ESC_2_14: + if (check_ft(mp, c, TYPE_96_CHARSET, &(mp->ms->gs[2])) == 0) break; + goto wrong; + case ESC_2_15: + if (check_ft(mp, c, TYPE_96_CHARSET, &(mp->ms->gs[3])) == 0) break; + goto wrong; + case ESC_2_4_8: + if (check_ft(mp, c, TYPE_94N_CHARSET, &(mp->ms->gs[0])) == 0) break; + goto wrong; + case ESC_2_4_9: + if (check_ft(mp, c, TYPE_94N_CHARSET, &(mp->ms->gs[1])) == 0) break; + goto wrong; + case ESC_2_4_10: + if (check_ft(mp, c, TYPE_94N_CHARSET, &(mp->ms->gs[2])) == 0) break; + goto wrong; + case ESC_2_4_11: + if (check_ft(mp, c, TYPE_94N_CHARSET, &(mp->ms->gs[3])) == 0) break; + goto wrong; + case ESC_2_4_13: + if (check_ft(mp, c, TYPE_96N_CHARSET, &(mp->ms->gs[1])) == 0) break; + goto wrong; + case ESC_2_4_14: + if (check_ft(mp, c, TYPE_96N_CHARSET, &(mp->ms->gs[2])) == 0) break; + goto wrong; + case ESC_2_4_15: + if (check_ft(mp, c, TYPE_96N_CHARSET, &(mp->ms->gs[3])) == 0) break; + goto wrong; + case NOESC: + /* + * This sequence is wrong if we buffered some data. + */ + if (mp->lastpos != mp->startpos) { + switch (c) { + case 0033: + case 0016: + case 0017: + case 0031: goto wrong; + case 0216: + case 0217: if (mp->io.right == iso8) goto wrong; + default: goto wrongone; + } + } + /* + * Nothing is buffered. So, check this sequence. + */ + switch (c) { + case 0033: mp->eseq = ESC_; break; + case 0016: mp->ms->gl = 1; mp->eseq = NOESC; break; + case 0017: mp->ms->gl = 0; mp->eseq = NOESC; break; + case 0031: mp->ms->sg = 2; mp->eseq = NOESC; /*SS2*/ break; + case 0216: if (mp->io.right != iso8) goto wrongone; + mp->ms->sg = 2; mp->eseq = NOESC; /*SS2*/ break; + case 0217: if (mp->io.right != iso8) goto wrongone; + mp->ms->sg = 3; mp->eseq = NOESC; /*SS3*/ break; + default: goto wrongone; + } + break; + default: + assert(0); + } + if (mp->eseq == NOESC) { + mp->lastesqpos = mp->lastpos; + fix_status_for_escape_sequence(mp); + mp->startpos = mp->lastpos + 1; + return (0); + } + return (0); +wrong: + if (mp->eseq != NOESC) { + mp->eseq = NOESC; + fix_status_for_escape_sequence(mp); + } + mp->lastesqpos = mp->startpos; + wrongcs1(mp); + rebuffering_multi(mp); + return (0); +wrongone: + assert(mp->eseq == NOESC); + return (-1); +} + +struct planeset { + char *name; + char *planeset; +} planesets[] = { + { "ascii", "" }, + { "ctext", "\\e-A" }, + { "latin1", "\\e-A" }, + { "latin2", "\\e-B" }, + { "latin3", "\\e-C" }, + { "latin4", "\\e-D" }, + { "greek", "\\e-F" }, + { "arabic", "\\e-G" }, + { "hebrew", "\\e-H" }, + { "cyrillic", "\\e-L" }, + { "latin5", "\\e-M" }, + { "japanese", "\\e$)B\\e*I\\e$+D" }, + { "ujis", "\\e$)B\\e*I\\e$+D" }, + { "euc", "\\e$)B\\e*I\\e$+D" }, + { NULL, "" } +}; + +int set_planeset(name) +register char *name; +{ + register struct planeset *p; + MULBUF *mp; + int ret; + int i; + + if (name == NULL) { + return -1; + } + for (p = planesets; p->name != NULL; p++) { + if (strcmp(name, p->name) == 0) { + name = p->planeset; + break; + } + } + mp = new_multi(); + init_priority(mp); + while (*name) { + if (*name == '\\' && + (*(name + 1) == 'e' || *(name + 1) == 'E')) { + ++mp->lastpos; + INBUF(mp) = '\033'; + ret = check_escape_sequence(mp); + name += 2; + } else { + ++mp->lastpos; + INBUF(mp) = *name++; + ret = check_escape_sequence(mp); + } + if (ret < 0 || mp->intindex > 0) { + free(mp); + return -1; + } + } + def_gs[0] = mp->ms->gs[0]; + def_gs[1] = mp->ms->gs[1]; + def_gs[2] = mp->ms->gs[2]; + def_gs[3] = mp->ms->gs[3]; + free(mp); + return 0; +} + +void init_def_codesets(left, right, out) +CODESET left; +CODESET right; +CODESET out; +{ + def_left = left; + def_right = right; + output = out; +} + +void init_def_priority(pri) +CODESET pri; +{ +#if JAPANESE + assert(pri == sjis || pri == ujis); + def_priority = pri; +#endif +} + +void init_priority(mp) +MULBUF *mp; +{ +#if JAPANESE + if (mp->io.right == sjis) + mp->priority = sjis; + else if (mp->io.right == ujis) + mp->priority = ujis; + else if (mp->io.right == japanese) + mp->priority = def_priority; + else + mp->priority = noconv; + mp->sequence_counter = 0; +#endif +} + +CODESET get_priority(mp) +MULBUF *mp; +{ +#if JAPANESE + return (mp->priority); +#else + return (noconv); +#endif +} + +void set_priority(mp, pri) +MULBUF *mp; +CODESET pri; +{ +#if JAPANESE + assert(pri == sjis || pri == ujis || pri == noconv); + mp->priority = pri; +#endif +} + +MULBUF *new_multi() +{ + MULBUF *mp = (MULBUF*) ecalloc(1, sizeof(MULBUF)); + mp->io.left = def_left; + mp->io.right = def_right; + mp->orig_io_right = def_right; + mp->rotation_io_right = 0; + mp->eseq = NOESC; + mp->ms = (struct m_status*) ecalloc(1, sizeof(struct m_status)); + init_multi(mp); + return (mp); +} + +void clear_multi(mp) +MULBUF *mp; +{ + mp->lastpos = M_NULL_POS; + mp->startpos = 0; + mp->intindex = 0; +} + +static void init_ms(ms) +struct m_status *ms; +{ + ms->gs[0] = def_gs[0]; + ms->gs[1] = def_gs[1]; + ms->gs[2] = def_gs[2]; + ms->gs[3] = def_gs[3]; + ms->gl = 0; + ms->gr = 1; + ms->sg = WRONGPLANE; + ms->irr = 0; +} + +void init_multi(mp) +MULBUF *mp; +{ +#if 0 + fprintf(stderr, "init_multi: %d, %d, %d, %d, %d, %d\n", mp->startpos, mp->lastpos, mp->lastesqpos); +#endif + if (mp->eseq != NOESC) { + mp->eseq = NOESC; + fix_status_for_escape_sequence(mp); + } + mp->cs = ASCII; + init_ms(mp->ms); +#if JAPANESE + mp->sequence_counter = 0; +#endif + mp->icharset = ASCII; + clear_multi(mp); + mp->lastesqpos = M_NULL_POS; +} + +/* + * Buffering characters untile get a guarantee that it is right sequence. + */ +static void check_new_buffered_byte(mp) +MULBUF *mp; +{ + m_position last_startpos = mp->startpos; + + if (mp->io.left == jis || mp->io.left == iso7 || mp->io.right == iso8) { + if (check_escape_sequence(mp) == 0) { + return; /* going process well */ + } + } + + /* it is not a escape sequence, try to use it as character */ + internalize(mp); + + /* + * If a character was detected in internalize(), + * clean sg since single shift affect only one character. + */ + if (last_startpos != mp->startpos && mp->ms->sg != WRONGPLANE) { + mp->ms->sg = WRONGPLANE; + fix_status_for_escape_sequence(mp); + } +} + +/* + * Re-parse all buffered data. + * + * This routine is called when we find a problem in buffered data. + * We firstly take out the first byte of buffered data before we call + * this function. This routine parse all rest of buffered data again. + */ +static void rebuffering_multi(mp) +MULBUF *mp; +{ + m_position to; + + /* + * We found something wrong and going to move first byte. + * So, we clear single-shifted character set because it will + * shift only this one byte being makred wrong. + */ + if (mp->ms->sg != WRONGPLANE) { + mp->ms->sg = WRONGPLANE; + fix_status_for_escape_sequence(mp); + } + +#if JAPANESE + /* + * Quick japanese code hack. + * Check whether character is SJIS KANA or no. + * If it is SJIS KANA, it means our prediction was failed. + * Now going to fall back to SJIS KANA mode. + */ + if ((mp->priority == sjis || + mp->io.right == sjis || mp->io.right == japanese) && + ISSJISKANA(mp->multiint[mp->intindex - 1])) { + mp->cs = JISX0201KANA; + mp->priority = sjis; + mp->icharset = SJIS; + mp->multiint[mp->intindex - 1] &= 0x7f; + mp->multics[mp->intindex - 1] = mp->cs; + } +#endif + + /* + * Retry to parse rest of buffered data. + */ + to = mp->lastpos; + for (mp->lastpos = mp->startpos; mp->lastpos <= to; mp->lastpos++) { + check_new_buffered_byte(mp); + } + mp->lastpos = to; +} + +#if LESS +void multi_find_cs(mp, pos) +MULBUF* mp; +m_position pos; +{ + int c; + m_position lpos = pos; + + if (ch_seek(pos) == 0) { + /* + * Back up to the beginning of the line. + */ + while ((c = ch_back_get()) != '\n' && c != EOI) ; + if (c == '\n') { + (void)ch_forw_get(); + } + + lpos = ch_tell(); + + while (lpos < pos) { + c = ch_forw_get(); + assert(c != EOI && c != '\n'); + multi_parsing(mp, c); + lpos++; + } + ch_seek(pos); + } +} +#endif + +#if 0 +int debug; +#endif + +/* + * Manage m_status data structure to maintain ISO-2022 status of input stream. + */ +void multi_start_buffering(mp, pos) +MULBUF *mp; +m_position pos; +{ +#if 0 + if (pos == 1562) + debug = 1; +#endif +/* fprintf(stderr, "%d, %d, %d, %d, %d, %d, %d, %d\n", pos, mp->lastpos, mp->startpos, mp->lastesqpos); */ + if (pos != mp->lastpos + 1) { +#if 0 + fprintf(stderr, "%d, %d, %d, %d, %d, %d, %d, %d\n", pos, mp->lastpos, mp->startpos, mp->lastesqpos); + fprintf(stderr, "oct %o, %o, %o, %o, %o, %o, %o, %o\n", pos, mp->lastpos, mp->startpos, mp->lastesqpos); +#endif + assert(mp->lastpos < mp->startpos); + if (pos <= mp->lastpos && pos > mp->lastesqpos) { + clear_multi(mp); + } else { + init_multi(mp); +#if LESS + multi_find_cs(mp, pos); + clear_multi(mp); +#endif + } + } else { + /* Nothing to do */ + } +} + +/* + * Buffering characters untile get a guarantee that it is right sequence. + */ +void multi_buffering(mp, c, pos, strbuf, csbuf, length, retpos) +MULBUF* mp; +int c; +m_position* pos; +unsigned char** strbuf; +CHARSET** csbuf; +unsigned int* length; +m_position* retpos; +{ + if (c < 0) { + if (retpos != NULL) { + *retpos = mp->startpos; + } + /* + * Force to flush out buffered characters. + */ + if (mp->eseq != NOESC) { + mp->eseq = NOESC; + fix_status_for_escape_sequence(mp); + } + while (mp->startpos <= mp->lastpos) { + wrongcs1(mp); + rebuffering_multi(mp); + } + + *strbuf = mp->multiint; + *csbuf = mp->multics; + *length = mp->intindex; + mp->intindex = 0; + } else { + if (pos != NULL) { + if (*pos != mp->lastpos + 1) { + /* buffer must be empty */ + assert(mp->lastpos < mp->startpos); + /* start buffering */ + mp->startpos = *pos; + } + mp->lastpos = *pos; + } else { + mp->lastpos++; + } + INBUF(mp) = c; + + if (retpos != NULL) { + *retpos = mp->startpos; + } + + /* + * Put it into buffer and parse it. + */ + check_new_buffered_byte(mp); + + *strbuf = mp->multiint; + *csbuf = mp->multics; + *length = mp->intindex; + mp->intindex = 0; + } +} + +/* + * Parse and discard characters. This routine is used for chopping line. + */ +void multi_parsing(mp, c) +MULBUF *mp; +int c; +{ + unsigned char *strbuf; + CHARSET *csbuf; + unsigned int length; + + multi_buffering(mp, c, NULL, &strbuf, &csbuf, &length, NULL); +} + +void set_codesets(mp, left, right) +MULBUF *mp; +CODESET left; +CODESET right; +{ + mp->io.left = left; + mp->io.right = right; +} + +/* + * Return string representation about multi bytes character + * which was buffered. + */ +char *get_icharset_string(mp) +MULBUF *mp; +{ + static char buf[10]; + + switch (mp->icharset) + { +#if JAPANESE + /* + * Code set + */ + case SJIS: return ("SJIS"); + case UJIS: return ("UJIS"); +#endif + /* + * Character set + */ + case ASCII: return ("ASCII"); + case JISX0201KANA: return ("JIS-KANA"); + case JISX0201ROMAN: return ("JIS-ROMAN"); + case LATIN1: return ("LATIN1"); + case LATIN2: return ("LATIN2"); + case LATIN3: return ("LATIN3"); + case LATIN4: return ("LATIN4"); + case GREEK: return ("GREEK"); + case ARABIC: return ("ARABIC"); + case HEBREW: return ("HEBREW"); + case CYRILLIC: return ("CYRILLIC"); + case LATIN5: return ("LATIN5"); + case JISX0208_78KANJI: return ("JIS-78KANJI"); + case GB2312: return ("GB2312"); + case JISX0208KANJI: return ("JIS-83KANJI"); + case JISX0208_90KANJI: return ("JIS-90KANJI"); + case KSC5601: return ("KSC5601"); + case JISX0212KANJISUP: return ("JIS-KANJISUP"); + case JISX0213KANJI1: return ("JISX0213KANJI1"); + case JISX0213KANJI2: return ("JISX0213KANJI2"); + } + switch (CS2TYPE(mp->icharset)) + { + case TYPE_94_CHARSET: + strcpy(buf, "94( )"); + buf[3] = CS2FT(mp->icharset); + break; + case TYPE_96_CHARSET: + strcpy(buf, "96( )"); + buf[3] = CS2FT(mp->icharset); + break; + case TYPE_94N_CHARSET: + strcpy(buf, "94N( )"); + buf[4] = CS2FT(mp->icharset); + break; + case TYPE_96N_CHARSET: + strcpy(buf, "96N( )"); + buf[4] = CS2FT(mp->icharset); + break; + default: + assert(0); + } + if (CS2IRR(mp->icharset) > 0) + { + char num[3]; + sprintf(num, "%d", CS2IRR(mp->icharset)); + strcat(buf, num); + } + return (buf); +} + +static int old_output_charset = ASCII; /* Last displayed character set */ + +static unsigned char *make_escape_sequence(charset) +int charset; +{ + static unsigned char p[9]; + int len; + + if (CSISWRONG(charset)) + { + charset = ASCII; + } + + p[0] = '\033'; + len = 1; + if ((output == iso7 || output == iso8) && CS2IRR(charset) > 0) + { + p[len] = '&'; + p[len + 1] = IRR2CODE(CS2IRR(charset)); + p[len + 2] = '\033'; + len += 3; + } + switch (CS2TYPE(charset)) + { + case TYPE_94_CHARSET: + p[len] = '('; + p[len + 1] = CS2FT(charset); + len += 2; + break; + case TYPE_94N_CHARSET: + switch (CS2FT(charset)) + { + case '@': + case 'A': + case 'B': + p[len] = '$'; + p[len + 1] = CS2FT(charset); + len += 2; + break; + default: + p[len] = '$'; + p[len + 1] = '('; + p[len + 2] = CS2FT(charset); + len += 3; + break; + } + break; + case TYPE_96_CHARSET: + p[len] = '-'; + p[len + 1] = CS2FT(charset); + len += 2; + break; + case TYPE_96N_CHARSET: + p[len] = '$'; + p[len + 1] = '-'; + p[len + 2] = CS2FT(charset); + len += 3; + break; + } + if (output != iso8) + { + switch (CS2TYPE(charset)) + { + case TYPE_94_CHARSET: + case TYPE_94N_CHARSET: + switch (CS2TYPE(old_output_charset)) + { + case TYPE_96_CHARSET: + case TYPE_96N_CHARSET: + p[len] = '\017'; + len++; + } + break; + case TYPE_96_CHARSET: + case TYPE_96N_CHARSET: + switch (CS2TYPE(old_output_charset)) + { + case TYPE_94_CHARSET: + case TYPE_94N_CHARSET: + p[len] = '\016'; + len++; + } + break; + } + } + p[len] = '\0'; + return (p); +} + +static char cvbuffer[32]; +static int cvindex = 0; +static char *nullcvbuffer = ""; + + +static char *convert_to_iso(c, cs) +int c; +int cs; +{ + register unsigned char *p; + static char buffer2[2]; + + if (output == iso8 && c != 0 && + (CS2TYPE(cs) == TYPE_96_CHARSET || + CS2TYPE(cs) == TYPE_96N_CHARSET)) + c |= 0x80; + + buffer2[0] = c; + buffer2[1] = '\0'; + + if (CSISREST(cs)) + { + return (buffer2); + } + if (CSISWRONG(cs)) + { + cs = ASCII; + } + + cs = CS2CHARSET(cs); + + if (cs == old_output_charset) + { + return (buffer2); + } + else + { + p = make_escape_sequence(cs); + old_output_charset = cs; + strcpy(cvbuffer, p); + strcat(cvbuffer, buffer2); + return (cvbuffer); + } +} + +static char *convert_to_jis(c, cs) +int c; +int cs; +{ + register unsigned char *p; + static char buffer2[3]; + + if (c == 0) + { + cvindex = 0; + return (nullcvbuffer); + } + + buffer2[cvindex++] = c; + buffer2[cvindex] = '\0'; + + if (CSISWRONG(cs)) + { + cs = ASCII; + } + + cs = CS2CHARSET(cs); + + if (cs == ASCII || cs == JISX0201ROMAN) + { + assert(cvindex == 1); + cvindex = 0; + } else if (cs == JISX0201KANA) + { + assert(cvindex == 1); + cvindex = 0; + } else if (cs == JISX0208_78KANJI) + { + if (cvindex == 1) + return (nullcvbuffer); + assert(cvindex == 2); + jis78to90(buffer2); + cs = JISX0208_90KANJI; + cvindex = 0; + } else if (cs == JISX0208KANJI || cs == JISX0208_90KANJI) + { + if (cvindex == 1) + return (nullcvbuffer); + assert(cvindex == 2); + cvindex = 0; + } else if (cs == JISX0213KANJI1) + { + if (cvindex == 1) + return (nullcvbuffer); + assert(cvindex == 2); + cvindex = 0; + cs = JISX0208KANJI; + } else + { + assert(0); + cvindex = 0; + } + + if (cs == old_output_charset) + { + return (buffer2); + } + else + { + p = make_escape_sequence(cs); + old_output_charset = cs; + strcpy(cvbuffer, p); + strcat(cvbuffer, buffer2); + return (cvbuffer); + } +} + +#if JAPANESE +static char *convert_to_ujis(c, cs) +int c; +int cs; +{ + if (c == 0) + { + cvindex = 0; + return (nullcvbuffer); + } + + cvbuffer[cvindex++] = c; + cvbuffer[cvindex] = '\0'; + + if (CSISWRONG(cs)) + { + cs = ASCII; + } + + cs = CS2CHARSET(cs); + + if (cs == ASCII || cs == JISX0201ROMAN) + { + assert(cvindex == 1); + cvindex = 0; + return (cvbuffer); + } else if (cs == JISX0201KANA) + { + assert(cvindex == 1); + cvbuffer[2] = '\0'; + cvbuffer[1] = cvbuffer[0] | 0x80; + cvbuffer[0] = 0x8e; + cvindex = 0; + return (cvbuffer); + } else if (cs == JISX0208_78KANJI || cs == JISX0208KANJI || + cs == JISX0208_90KANJI || cs == JISX0213KANJI1) + { + if (cvindex == 1) + return (nullcvbuffer); + assert(cvindex == 2); + if (cs == JISX0208_78KANJI) + jis78to90(cvbuffer); + cvbuffer[0] |= 0x80; + cvbuffer[1] |= 0x80; + cvindex = 0; + return (cvbuffer); + } else if (cs == JISX0212KANJISUP) + { + if (cvindex == 1) + return (nullcvbuffer); + assert(cvindex == 2); + cvbuffer[2] = cvbuffer[1] | 0x80; + cvbuffer[1] = cvbuffer[0] | 0x80; + cvbuffer[0] = 0x8f; + cvbuffer[3] = '\0'; + cvindex = 0; + return (cvbuffer); + } else if (cs == JISX0213KANJI2) + { + if (cvindex == 1) + return (nullcvbuffer); + assert(cvindex == 2); + cvbuffer[2] = cvbuffer[1] | 0x80; + cvbuffer[1] = cvbuffer[0] | 0x80; + cvbuffer[0] = 0x8f; + cvbuffer[3] = '\0'; + cvindex = 0; + return (cvbuffer); + } + assert(0); + cvindex = 0; + return (cvbuffer); +} + +static char *convert_to_sjis(c, cs) +int c; +int cs; +{ + if (c == 0) + { + cvindex = 0; + return (nullcvbuffer); + } + + cvbuffer[cvindex++] = c; + cvbuffer[cvindex] = '\0'; + + if (CSISWRONG(cs)) + { + cs = ASCII; + } + + cs = CS2CHARSET(cs); + + if (cs == ASCII || cs == JISX0201ROMAN) + { + assert(cvindex == 1); + cvindex = 0; + return (cvbuffer); + } else if (cs == JISX0201KANA) + { + assert(cvindex == 1); + cvbuffer[0] |= 0x80; + cvindex = 0; + return (cvbuffer); + } else if (cs == JISX0208_78KANJI || cs == JISX0208KANJI || + cs == JISX0208_90KANJI || cs == JISX0213KANJI1) + { + register int c1, c2, c3; + static unsigned char table[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, +#if SJIS0213 + 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, +#else + 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0, +#endif + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, +#if SJIS0213 + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, +#else + 0xE8, 0xE9, 0xEA, 0, 0, 0, 0, 0, +#endif + }; + + if (cvindex == 1) + return (nullcvbuffer); + assert(cvindex == 2); + if (cs == JISX0208_78KANJI) + jis78to90(cvbuffer); + c3 = cvbuffer[0] & 0x7f; + c1 = c3 & 1; + c2 = (cvbuffer[1] & 0x7f) + (c1 ? 0x40 - 0x21 : 0x9e - 0x21); + c1 = table[c3 / 2 + c1]; + cvbuffer[0] = c1; + cvbuffer[1] = c2 + (c2 >= 0x7f ? 1 : 0); + cvindex = 0; + return (cvbuffer); + } else if (cs == JISX0213KANJI2) + { + register int c1, c2, c3; + if (cvindex == 1) + return (nullcvbuffer); + assert(cvindex == 2); + c3 = cvbuffer[0] & 0x7f; + c1 = c3 & 1; + c2 = (cvbuffer[1] & 0x7f) + + (c1 ? 0x40 - 0x21 : 0x9e - 0x21); + if (c3 <= 0x25) { + /* Map 1, 3, 4, and 5-KU */ + /* Note: 2-KU is rejected already. */ + c1 = (c3 - 0x21) / 2 + 0xf0; + } else if (c3 == 0x28) { + /* Map 8-KU */ + c1 = 0xf0; + } else if (c3 <= 0x2f) { + /* Map 12, 13, 14, and 15-KU */ + c1 = (c3 - 0x2b) / 2 + 0xf2; + } else { + /* Map 78-94 KU. */ + /* Note: 16-77 KU is rejected already. */ + c1 = (c3 - 0x6d) / 2 + 0xf4; + } + cvbuffer[0] = c1; + cvbuffer[1] = c2 + (c2 >= 0x7f ? 1 : 0); + cvindex = 0; + return (cvbuffer); + } + assert(0); + cvindex = 0; + return (cvbuffer); +} +#endif + +char *outchar(c, cs) +int c; +CHARSET cs; +{ + if (c < 0) + { + c = 0; + cs = ASCII; + } + + if (output == iso7 || output == iso8) + return (convert_to_iso(c, cs)); + if (output == jis) + return (convert_to_jis(c, cs)); +#if JAPANESE + if (output == ujis) + return (convert_to_ujis(c, cs)); + if (output == sjis) + return (convert_to_sjis(c, cs)); +#endif + cvbuffer[0] = c; + cvbuffer[1] = '\0'; + return (cvbuffer); +} + +char *outbuf(p, cs) +unsigned char *p; +CHARSET cs; +{ + static char buffer[1024]; + char *s; + int i = 0; + + while (*p != '\0') + { + s = outchar(*p++, cs); + while (*s != '\0') + buffer[i++] = *s++; + assert(i < (int)sizeof(buffer)); + } + buffer[i] = '\0'; + return (buffer); +} + +int mwidth(c, cs) +int c; +CHARSET cs; +{ + if (CSISREST(cs)) + return (0); + switch (CS2TYPE(cs)) + { + case TYPE_94_CHARSET: + case TYPE_96_CHARSET: + return (1); + case TYPE_94N_CHARSET: + case TYPE_96N_CHARSET: + return (2); + default: + assert(0); + return (0); + } +} + +char *rotate_right_codeset(mp) +MULBUF *mp; +{ + char *p = NULL; + + mp->rotation_io_right++; + mp->rotation_io_right %= 7; + switch (mp->rotation_io_right) { + case 0: p = "original"; mp->io.right = mp->orig_io_right; break; + case 1: p = "japanese"; mp->io.right = japanese; break; + case 2: p = "ujis"; mp->io.right = ujis; break; + case 3: p = "sjis"; mp->io.right = sjis; break; + case 4: p = "iso8"; mp->io.right = iso8; break; + case 5: p = "noconv"; mp->io.right = noconv; break; + case 6: p = "none"; mp->io.right = none; break; + default: assert(0); break; + } + init_priority(mp); + return (p); +} + +#endif + +int strlen_cs(str, cs) +char* str; +CHARSET* cs; +{ + int i = 0; + if (cs == NULL) + return strlen(str); + while (*str != NULCH || !CSISNULLCS(*cs)) { + str++; + cs++; + i++; + } + return i; +} + +int chlen_cs(chstr, cs) +char* chstr; +CHARSET* cs; +{ + int i; + if (cs == NULL) + { + if (chstr == NULL || *chstr == NULCH) + return 0; + else + return 1; + } + if (*chstr == NULCH && CSISNULLCS(*cs)) + return 0; + i = 0; + do { + i++; + cs++; + } while (CSISREST(*cs)); + return i; +} + +char* strdup_cs(str, cs, csout) +char* str; +CHARSET* cs; +CHARSET** csout; +{ + int len = strlen_cs(str, cs); + char* save_str = (char *)ecalloc(len + 1, 1); + CHARSET* save_cs = (CHARSET *)ecalloc(len + 1, sizeof(CHARSET)); + memcpy(save_str, str, sizeof(char) * (len + 1)); + if (cs) + memcpy(save_cs, cs, sizeof(CHARSET) * (len + 1)); + else { + cs = save_cs; + while (--len >= 0) + *cs++ = ASCII; + *cs = NULLCS; + } + *csout = save_cs; + return save_str; +} Index: less/multi.h diff -u /dev/null less/multi.h:1.22 --- /dev/null Sun Sep 4 19:53:51 2005 +++ less/multi.h Sun Sep 4 13:52:55 2005 @@ -0,0 +1,235 @@ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice in the documentation and/or other materials provided with + * the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +/* + * Definition of values to specify the character set. + * And definitions some well known character sets and a types of set. + */ +typedef unsigned short CHARSET; + +/* + * The structure of CHARSET: + * + * 151413121110 9 8 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * |r| IRR |m|n| F | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * + * r: True if it is not the first byte of multi-byte characters. + * IRR: Identification of Revisions of Registered character sets (IRR). + * Read ISO-2022 for mode details. The value of IRR is ranged from + * 00/01 to 03/15. 00/00 means no IRR. IRR (from 00/01 to 03/15) + * is mapped to a code from 04/00 to 07/14 in ISO-2022. + * m: True if it is part of multi-byte characters. + * n: True if it is one of 96 or 96x96 graphic sets, otherwise it is one + * of 94 or 94x94 graphic sets. + * F: Final byte (F). This select graphi sets of characters. + * The value of F is ranged from 00/00 to 04/14. Such values are coded + * from 03/00 to 07/14 in ISO-2022. + */ + +#define REST_MASK 0x8000 /* r */ +#define CSISHEAD(cs) (!((cs) & REST_MASK)) +#define CSISREST(cs) ((cs) & REST_MASK) + +#define IRR_MASK 0x7e00 /* IRR */ +#define IRR_SHIFT 9 +#define CS2IRR(cs) (((cs) & IRR_MASK) >> IRR_SHIFT) +#define IRR2CS(irr) (((irr) << IRR_SHIFT) & IRR_MASK) + +#define CODE_MASK 0x003f /* coded IRR in ISO 2022 */ +#define CODE_DIFF 0x0040 +#define IRR2CODE(irr) ((((irr) - 1) & CODE_MASK) + CODE_DIFF) +#define CODE2IRR(code) ((((code) - CODE_DIFF) & CODE_MASK) + 1) + +#define TYPE_94_CHARSET 0x0000 /* m & n */ +#define TYPE_96_CHARSET 0x0080 +#define TYPE_94N_CHARSET 0x0100 +#define TYPE_96N_CHARSET 0x0180 +#define TYPE_MASK 0x0180 +#define CS2TYPE(cs) ((cs) & TYPE_MASK) +#define TYPE2CS(type) ((type) & TYPE_MASK) + +#define FT_MASK 0x007f /* F */ +#define FT_DIFF 0x0030 +#define CS2FT(cs) (((cs) & FT_MASK) + FT_DIFF) +#define FT2CS(ft) (((ft) - FT_DIFF) & FT_MASK) + +/* + * Each character sets is represented by IRR, TYPE and FT. + */ +#define CHARSET_MASK (IRR_MASK | TYPE_MASK | FT_MASK) +#define CS2CHARSET(cs) ((cs) & CHARSET_MASK) + +/* + * There is a reserved empty set in every type of charset. 07/14. + * So we cannot use (CS2CHARSET(cs) == WRONGCS) to check it. + */ +#define CSISWRONG(cs) (CS2FT(cs) == '~') + +/* + * List of representative character sets. + */ +#define ASCII (TYPE_94_CHARSET | FT2CS('B')) +#define WRONGCS (TYPE_94_CHARSET | FT2CS('~')) +#if ISO +#define JISX0201KANA (TYPE_94_CHARSET | FT2CS('I')) +#define JISX0201ROMAN (TYPE_94_CHARSET | FT2CS('J')) +#define LATIN1 (TYPE_96_CHARSET | FT2CS('A')) +#define LATIN2 (TYPE_96_CHARSET | FT2CS('B')) +#define LATIN3 (TYPE_96_CHARSET | FT2CS('C')) +#define LATIN4 (TYPE_96_CHARSET | FT2CS('D')) +#define GREEK (TYPE_96_CHARSET | FT2CS('F')) +#define ARABIC (TYPE_96_CHARSET | FT2CS('G')) +#define HEBREW (TYPE_96_CHARSET | FT2CS('H')) +#define CYRILLIC (TYPE_96_CHARSET | FT2CS('L')) +#define LATIN5 (TYPE_96_CHARSET | FT2CS('M')) +#define JISX0208_78KANJI (TYPE_94N_CHARSET | FT2CS('@')) +#define GB2312 (TYPE_94N_CHARSET | FT2CS('A')) +#define JISX0208KANJI (TYPE_94N_CHARSET | FT2CS('B')) +#define JISX0208_90KANJI (IRR2CS(1) | TYPE_94N_CHARSET | FT2CS('B')) +#define KSC5601 (TYPE_94N_CHARSET | FT2CS('C')) +#define JISX0212KANJISUP (TYPE_94N_CHARSET | FT2CS('D')) +#define JISX0213KANJI1 (TYPE_94N_CHARSET | FT2CS('O')) +#define JISX0213KANJI2 (TYPE_94N_CHARSET | FT2CS('P')) +#if JAPANESE +/* + * Special number for Japanese code set. Only input_set use following with + * above definitions. The 07/15 is not valid for F. Thus I use it to + * indicate the special character sets. + */ +#define SJIS (IRR2CS(1) | TYPE_94N_CHARSET | FT_MASK) +#define UJIS (IRR2CS(2) | TYPE_94N_CHARSET | FT_MASK) +#endif +#endif + +/* + * List of special characters and character set for it. + * + * A terminator of string with character set is represented by + * both a NULCH and a NULLCS. A padding character in string with + * character set is represented by both a PADCH and a NULLCS. A + * binary data '\0' and '\1' are represented by both '\0' and a + * WRONGCS, and both '\1' and a WRONGCS respectively. + */ +#define NULCH ('\0') +#define PADCH ('\1') +#define NULLCS (ASCII) + +/* + * Macros for easy checking. + */ +#define CSISASCII(cs) (CS2CHARSET(cs) == ASCII) +#define CSISNULLCS(cs) (CS2CHARSET(cs) == NULLCS) + + +/* + * Definition of values to specify the character set and character. + */ +typedef int CHARVAL; + +#define MAKECV(ch, cs) (((cs) << 8 * sizeof(char)) | ch) +#define CV2CH(cv) ((cv) & ((1 << 8 * sizeof(char)) - 1)) +#define CV2CS(cv) ((cv) >> 8 * sizeof(char)) + + +/* + * Definition of code sets. The code set is not character set. + * It is only means of code, and we use these value when we + * decide what input data are. + */ +typedef enum { + /* code sets for left, right and output plane */ + noconv, /* A code set which doesn't need converting */ + /* code sets for left and output plane */ + jis, /* A subset of ISO 2022 */ + /* + * It may contain JIS C 6226-1978, JIS X 0208-1983, + * JIS X 0208:1990/1997, JIS X 0212:1990, JIS X 0213:2000, + * JIS X 0201:1976/1997 left/right planes, and ASCII as input. + * + * In the case of output, this means all JIS C 6226-1978, + * JIS X 0208-1983, JIS X 0208:1990/1997, and JIS X 0213:2000 + * are converted into JIS X 0208-1983 encode with an assumption + * that character set of JIS X 0208-1983 encode is + * JIS X 0213:2000. And JIS X 0212:1990 and 2nd plane of + * JIS X 0213:2000 are rejected when output. + * + * If you need the same code as the output, please use iso7 + * or iso8. + */ + iso7, /* A code set which is extented by iso2022 */ + /* code sets for only right plane */ + none, /* No code set */ + japanese, /* Both of UJIS and SJIS */ + /* code sets for right and output plane */ + ujis, /* Japanese code set named UJIS */ + sjis, /* Japanese code set named SJIS */ + iso8 /* A code set which is extented by iso2022 */ +} CODESET; + + +/* + * struct multibuf is internal data structure for multi.c. + * Defines it name only. + */ +typedef struct multibuf MULBUF; + + +/* + * in multi.c + */ +extern int set_planeset (); +extern void init_def_codesets (); +extern void init_def_priority (); +extern void init_priority (); +extern CODESET get_priority (); +extern void set_priority (); +extern MULBUF * new_multi (); +extern void clear_multi (); +extern void init_multi (); +extern void multi_start_buffering (); +extern void multi_buffering (); +extern void multi_parsing (); +extern void set_codesets (); +extern char * get_icharset_string (); +extern char * outchar(); +extern char * outbuf(); +extern int mwidth(); +extern char * rotate_right_codeset (); +extern int strlen_cs(); +extern int chlen_cs(); +extern char* strdup_cs(); + +/* + * in unify.c + */ +extern void jis78to90(); +extern void chconvert_cs(); +extern void chunify_cs(); +extern int chcmp_cs(); +extern int chisvalid_cs(); Index: less/optfunc.c diff -u less/optfunc.c:1.1.1.16 less/optfunc.c:1.26 --- less/optfunc.c:1.1.1.16 Tue Aug 30 20:55:41 2005 +++ less/optfunc.c Tue Aug 30 22:45:49 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -62,6 +68,10 @@ extern int so_fg_color, so_bg_color; extern int bl_fg_color, bl_bg_color; #endif +#if JAPANESE +extern char *opt_charset; +extern int opt_Z_var; +#endif #if LOGFILE @@ -345,6 +355,66 @@ } } +#if JAPANESE +/* + * Handlers for -K option. + */ + public void +opt_K(type, s) + int type; + char *s; +{ + switch (type) + { + case INIT: + opt_charset = s; + init_charset(); + break; + } +} + +/* + * Handler for the -Z option. + */ + /*ARGSUSED*/ + public void +opt_Z(type, s) + int type; + char *s; +{ + switch (type) + { + case INIT: + if (opt_Z_var == OPT_ON) + init_def_priority(sjis); + else if (opt_Z_var == OPT_OFF) + init_def_priority(ujis); + break; + case QUERY: + break; + case TOGGLE: + switch (get_priority(get_mulbuf(curr_ifile))) { + case sjis: + opt_Z_var = OPT_OFF; + break; + case ujis: + opt_Z_var = OPT_ON; + break; + case noconv: + default: + opt_Z_var = OPT_ONPLUS; /* we use this to mean error */ + return; + } + if (opt_Z_var == OPT_ON) + init_def_priority(sjis); + else if (opt_Z_var == OPT_OFF) + init_def_priority(ujis); + init_priority(get_mulbuf(curr_ifile)); + break; + } +} +#endif + /* * Handler for the -V option. */ @@ -372,6 +442,8 @@ putstr("For information about the terms of redistribution,\n"); putstr("see the file named README in the less distribution.\n"); putstr("Homepage: http://www.greenwoodsoftware.com/less\n"); + putstr("\nJapanized part of Less\n"); + putstr("Copyright (c) 1994-2005 Kazushi (Jam) Marukawa\n"); quit(QUIT_OK); break; } Index: less/option.c diff -u less/option.c:1.1.1.11 less/option.c:1.19 --- less/option.c:1.1.1.11 Tue Aug 30 20:55:41 2005 +++ less/option.c Tue Aug 30 22:45:49 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -468,7 +474,7 @@ { static char buf[8]; - sprintf(buf, "-%s", prchar(c)); + sprintf(buf, "-%s", prchar(c, ASCII)); return (buf); } Index: less/opttbl.c diff -u less/opttbl.c:1.1.1.17 less/opttbl.c:1.29 --- less/opttbl.c:1.1.1.17 Tue Aug 30 23:14:53 2005 +++ less/opttbl.c Wed Aug 31 00:09:15 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -51,6 +57,10 @@ #if HILITE_SEARCH public int hilite_search; /* Highlight matched search patterns? */ #endif +#if JAPANESE +public int opt_Z_var; /* Initial variable for opt_Z */ +extern int markwrongchar; /* Display marker instead of wrong character */ +#endif /* * Long option names. @@ -101,6 +111,11 @@ static struct optname X__optname = { "no-init", NULL }; static struct optname y_optname = { "max-forw-scroll", NULL }; static struct optname z_optname = { "window", NULL }; +#if JAPANESE +static struct optname K_optname = { "charset", NULL }; +static struct optname Y_optname = { "mark-wrong-char", NULL }; +static struct optname Z_optname = { "change-priority", NULL }; +#endif static struct optname quote_optname = { "quotes", NULL }; static struct optname tilde_optname = { "tilde", NULL }; static struct optname query_optname = { "help", NULL }; @@ -245,6 +260,12 @@ { NULL, NULL, NULL } }, #endif +#if JAPANESE + { 'K', &K_optname, + STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_K, + NULL, NULL, NULL + }, +#endif { 'l', NULL, STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_l, { NULL, NULL, NULL } @@ -377,6 +398,14 @@ NULL } }, +#if JAPANESE + { 'Y', &Y_optname, + BOOL|REPAINT, OPT_OFF, &markwrongchar, NULL, + "Display marker instead of wrong character", + "Display wrong character", + NULL + }, +#endif { 'z', &z_optname, NUMBER, -1, &swindow, NULL, { @@ -385,6 +414,19 @@ NULL } }, +#if JAPANESE +#ifdef SJIS_PRE +#define OPT_Z OPT_ON +#else +#define OPT_Z OPT_OFF +#endif + { 'Z', &Z_optname, + BOOL|REPAINT, OPT_Z, &opt_Z_var, opt_Z, + "Give priority to the UJIS over the SJIS", + "Give priority to the SJIS over the UJIS", + "Cannot give priority since Japanese is not treated now", + }, +#endif { '"', "e_optname, STRING, 0, NULL, opt_quote, { "quotes: ", NULL, NULL } @@ -439,6 +481,12 @@ if (o->otype & INIT_HANDLER) (*(o->ofunc))(INIT, (char *) NULL); } +#if JAPANESE + if (opt_Z_var == OPT_ON) + init_def_priority(sjis); + else if (opt_Z_var == OPT_OFF) + init_def_priority(ujis); +#endif } /* Index: less/output.c diff -u less/output.c:1.1.1.15 less/output.c:1.34 --- less/output.c:1.1.1.15 Tue Aug 30 23:14:53 2005 +++ less/output.c Wed Aug 31 00:09:15 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -47,6 +53,7 @@ register int c; register int i; int a; + int cs; int curr_attr; if (ABORT_SIGS()) @@ -60,7 +67,7 @@ curr_attr = AT_NORMAL; - for (i = 0; (c = gline(i, &a)) != '\0'; i++) + for (i = 0; (c = gline(i, &cs, &a)) != '\0'; i++) { if (a != curr_attr) { @@ -90,7 +97,11 @@ if (c == '\b') putbs(); else +#if ISO + putmchr(c, cs); +#else putchr(c); +#endif } switch (curr_attr) @@ -357,7 +368,7 @@ * Output a character. */ public int -putchr(c) +putchr_raw(c) int c; { if (need_clr) @@ -369,12 +380,12 @@ if (c == '\n' && is_tty) { /* remove_top(1); */ - putchr('\r'); + putchr_raw('\r'); } #else #ifdef _OSK if (c == '\n' && is_tty) /* In OS-9, '\n' == 0x0D */ - putchr(0x0A); + putchr_raw(0x0A); #endif #endif /* @@ -391,11 +402,85 @@ * Output a string. */ public void -putstr(s) +putstr_raw(s) register char *s; { while (*s != '\0') - putchr(*s++); + putchr_raw(*s++); +} + +/* + * Output a character as ASCII. + */ + public int +putchr(c) + int c; +{ +#if ISO + char *p = outchar(c & 0377, ASCII); + putstr_raw(p); + return (c); +#else + return (putchr_raw(c)); +#endif +} + +/* + * Output a string as ASCII. + */ + public void +putstr(s) + char *s; +{ +#if ISO + char *p = outbuf(s, ASCII); + putstr_raw(p); +#else + putstr_raw(s); +#endif +} + +/* + * Output a character which is a part of multi-bytes character. + */ + public int +putmchr(c, cs) + int c; + CHARSET cs; +{ +#if ISO + char *p = outchar(c & 0377, cs); + putstr_raw(p); +#else + putchr_raw(c); +#endif + return (c); +} + +/* + * Output a part of multi-bytes character. + */ + public int +putmchrs(s, cs) + char *s; + CHARSET cs; +{ + int c = *s; + while (*s != '\0') + putmchr(*s++, cs); + return (c); +} + +/* + * Output a string of multi-bytes character. + */ + public void +putmstr(s, cs) + char *s; + CHARSET *cs; +{ + while (*s != '\0') + putmchr(*s++, *cs++); } Index: less/prompt.c diff -u less/prompt.c:1.1.1.13 less/prompt.c:1.22 --- less/prompt.c:1.1.1.13 Tue Aug 30 23:14:53 2005 +++ less/prompt.c Wed Aug 31 00:09:15 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -47,7 +53,7 @@ static constant char M_proto[] = "?f%f .?n?m(%T %i of %m) ..?ltlines %lt-%lb?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\\: %x.:?pB%pB\\%..%t"; static constant char e_proto[] = - "?f%f .?m(%T %i of %m) .?ltlines %lt-%lb?L/%L. .byte %bB?s/%s. ?e(END) :?pB%pB\\%..%t"; + "?f%f .?m(%T %i of %m) .?ltlines %lt-%lb?L/%L. .byte %bB?s/%s. ?e(END) :?pB%pB\\%.. code %K%t"; static constant char h_proto[] = "HELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done"; static constant char w_proto[] = @@ -365,6 +371,13 @@ else ap_quest(); break; + case 'K': /* Character set or code set of last non ASCII char. */ +#if ISO + ap_str(get_icharset_string(get_mulbuf(curr_ifile))); +#else + ap_str(""); +#endif + break; } } Index: less/search.c diff -u less/search.c:1.1.1.19 less/search.c:1.62 --- less/search.c:1.1.1.19 Tue Aug 30 23:14:53 2005 +++ less/search.c Sun Sep 4 15:48:03 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -16,9 +22,19 @@ #include "less.h" #include "position.h" +#include + #define MINPOS(a,b) (((a) < (b)) ? (a) : (b)) #define MAXPOS(a,b) (((a) > (b)) ? (a) : (b)) +#if HAVE_POSIX_REGCOMP_CS +#include +#ifdef REG_EXTENDED +#define REGCOMP_FLAG REG_EXTENDED +#else +#define REGCOMP_FLAG 0 +#endif +#endif #if HAVE_POSIX_REGCOMP #include #ifdef REG_EXTENDED @@ -39,6 +55,9 @@ char *regex(); extern char *__loc1; #endif +#if HAVE_V8_REGCOMP_CS +#include "regexp_cs.h" +#endif #if HAVE_V8_REGCOMP #include "regexp.h" #endif @@ -53,6 +72,7 @@ extern int jump_sline; extern int bs_mode; extern int ctldisp; +extern IFILE curr_ifile; extern int status_col; extern POSITION start_attnpos; extern POSITION end_attnpos; @@ -80,7 +100,7 @@ * These are the static variables that represent the "remembered" * search pattern. */ -#if HAVE_POSIX_REGCOMP +#if HAVE_POSIX_REGCOMP_CS || HAVE_POSIX_REGCOMP static regex_t *regpattern = NULL; #endif #if HAVE_PCRE @@ -92,7 +112,7 @@ #if HAVE_REGCMP static char *cpattern = NULL; #endif -#if HAVE_V8_REGCOMP +#if HAVE_V8_REGCOMP_CS || HAVE_V8_REGCOMP static struct regexp *regpattern = NULL; #endif @@ -100,6 +120,95 @@ static int is_ucase_pattern; static int last_search_type; static char *last_pattern = NULL; +static CHARSET *last_charset = NULL; + +#if ISO && !NO_REGEX && (!CS_REGEX || MSB_ENABLE) +/* + * Normalize text. Add quote for some non ASCII characters or enable MSB + * of them since some regular expression library parse them as ASCII. + */ + static char * +normalize_text(src, cs, search_type) + char *src; + CHARSET *cs; + int search_type; +{ + static char *buf = NULL; + static int size = 0; + int len = strlen_cs(src, cs) * 2; + char *dst; + + if (len + 1 > size) + { + size = (len + 1 + 255) / 256 * 256; + if (buf) + free(buf); + buf = (char *) ecalloc(size, sizeof(char)); + } + dst = buf; + while (*src != '\0') + { +#if MSB_ENABLE + if (CSISASCII(*cs) || CSISWRONG(*cs)) + *dst++ = *src++; + else + *dst++ = *src++ | 0x80; + cs++; +#else + if (!CSISASCII(*cs++) && !(search_type & SRCH_NO_REGEX)) + { + switch (*src) { + /* Basic Regular Expressions */ + case '[': + case ']': + case '.': + case '*': + case '\\': + case '^': + case '$': +#if (HAVE_POSIX_REGCOMP_CS || HAVE_POSIX_REGCOMP) && defined(REG_EXTENDED) + /* Extended Regular Expressions */ + case '+': + case '?': + case '|': + case '(': + case ')': + case '{': + case '}': +#endif +#if HAVE_RE_COMP + /* No Extended Regular Expressions */ +#endif +#if HAVE_REGCMP + /* Extended Regular Expressions */ + case '+': + case '(': + case ')': + case '{': + case '}': +#endif +#if HAVE_V8_REGCOMP_CS || HAVE_V8_REGCOMP + /* Extended Regular Expressions */ + case '+': + case '?': + case '|': + case '(': + case ')': +#endif + *dst++ = '\\'; + /* fall through */ + default: + *dst++ = *src++; + break; + } + } else + *dst++ = *src++; +#endif + } + *dst = '\0'; + return (buf); +} +#endif /* * Convert text. Perform one or more of these transformations: @@ -108,9 +217,12 @@ #define CVT_BS 02 /* Do backspace processing */ #define CVT_CRLF 04 /* Remove CR after LF */ #define CVT_ANSI 010 /* Remove ANSI escape sequences */ +#define CVT_TO_INT 020 /* Convert all multi bytes characters into */ + /* internal form */ +#define CVT_PAD 040 /* Remove padding character */ static void -cvt_text(odst, osrc, ops) +cvt_text_ascii(odst, osrc, ops) char *odst; char *osrc; int ops; @@ -141,6 +253,202 @@ *dst = '\0'; } + static void +cvt_text(odst, odstcs, osrc, osrccs, pos, ops) + char *odst; + CHARSET *odstcs; + char *osrc; + CHARSET *osrccs; + POSITION pos; + int ops; +{ + char *src = osrc; + CHARSET *srccs = osrccs; + char *dst = odst; + CHARSET *dstcs = odstcs; + int bufcount; + char *cbuf; + CHARSET *csbuf; + char cbuffer[10]; + CHARSET csbuffer[10]; + int donef = 0; + +#if ISO + if (!(ops & CVT_TO_INT) && srccs == NULL) + { + cvt_text_ascii(dst, src, ops); + if (dstcs) + while (*dst++ != '\0') + *dstcs++ = ASCII; + return; + } + + multi_start_buffering(get_mulbuf(curr_ifile), pos); + while ((srccs != NULL && (*src != NULCH || !CSISNULLCS(*srccs))) || + (srccs == NULL && !donef)) + { + if (ops & CVT_TO_INT) + { + if (srccs == NULL) + { + int i, j; + if (*src == '\0') + { + /* flush buffer */ + multi_buffering(get_mulbuf(curr_ifile), + -1, NULL, &cbuf, &csbuf, + &bufcount, NULL); + donef = 1; + } else + { + /* make charset */ + multi_buffering(get_mulbuf(curr_ifile), + (unsigned char) *src, + &pos, &cbuf, &csbuf, + &bufcount, NULL); + } + if (bufcount == 0) + { + if (donef) + { + /* adjust the address */ + dst--; + if (dstcs) dstcs--; + } else + { + /* fill pad */ + *dst = PADCH; + if (dstcs) + *dstcs = ASCII; + } + } + cbuf[bufcount] = NULCH; + csbuf[bufcount] = NULLCS; + + /* unify character(s) in buffer */ + i = 0; + j = 0; + while (i < bufcount) { + chunify_cs(&cbuf[i], &csbuf[i], + &cbuffer[j], &csbuffer[j]); + i += chlen_cs(&cbuf[i], &csbuf[i]); + j += chlen_cs(&cbuffer[j], + &csbuffer[j]); + } + bufcount = j; + cbuf = cbuffer; + csbuf = csbuffer; + } else + { + int i; + cbuf = cbuffer; + csbuf = csbuffer; + chunify_cs(src, srccs, cbuf, csbuf); + bufcount = chlen_cs(src, srccs); + src += bufcount - 1; + if (srccs) srccs += bufcount - 1; + for (i = 0; i < bufcount - 1; i++) + { + *dst++ = PADCH; + if (dstcs) + *dstcs++ = ASCII; + } + bufcount = chlen_cs(cbuf, csbuf); + } + } else + { + static CHARSET dummy_cs[] = { ASCII, ASCII }; + bufcount = 1; + cbuf = src; + csbuf = srccs ? srccs : dummy_cs; + } + + assert(dst - odst >= bufcount - 1); + + while (--bufcount >= 0) + { +#if MSB_ENABLE + if (!CSISASCII(*csbuf) && !CSISWRONG(*csbuf)) + *cbuf |= 0x80; +#endif + if ((ops & CVT_TO_LC) && CSISASCII(*csbuf) && + isupper((unsigned char) *cbuf)) + { + /* Convert uppercase to lowercase. */ + dst[-bufcount] = tolower((unsigned char) *cbuf); + if (dstcs) + dstcs[-bufcount] = *csbuf; + } else if ((ops & CVT_BS) && CSISWRONG(*csbuf) && + *cbuf == '\b' && dst > odst) + { + /* Delete BS and preceding char. */ + if (bufcount == 0) + { + dst -= 2; + if (dstcs) + dstcs -= 2; + } else + { + dst -= 1; + if (dstcs) + dstcs -= 1; + } + } else + { + /* Just copy. */ + dst[-bufcount] = *cbuf; + if (dstcs) + dstcs[-bufcount] = *csbuf; + } + cbuf++; + csbuf++; + } + src++; + dst++; + pos++; + if (srccs) srccs++; + if (dstcs) dstcs++; + } + *dst = NULCH; + if (dstcs) *dstcs = NULLCS; + + if (odstcs && (ops & CVT_PAD)) + { + src = odst; + srccs = odstcs; + dst = odst; + dstcs = odstcs; + while (*src != NULCH || !CSISNULLCS(*srccs)) + { + if (*src != PADCH || !CSISNULLCS(*srccs)) + { + *dst++ = *src; + *dstcs++ = *srccs; + } + src++; + srccs++; + } + *dst = NULCH; + *dstcs = NULLCS; + } +#else + cvt_text_ascii(dst, src, ops); + if (dstcs) + { + while (*dst++ != '\0') + *dstcs++ = ASCII; + *dstcs = NULLCS; + } +#endif + if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r') { + *--dst = NULCH; + if (dstcs) + { + *--dstcs = NULLCS; + } + } +} + /* * Determine which conversions to perform. */ @@ -169,13 +477,14 @@ * Are there any uppercase letters in this string? */ static int -is_ucase(s) +is_ucase(s, cs) char *s; + CHARSET *cs; { register char *p; - for (p = s; *p != '\0'; p++) - if (isupper((unsigned char) *p)) + for (p = s; *p != '\0'; p++, cs++) + if (CSISASCII(*cs) && isupper((unsigned char) *p)) return (1); return (0); } @@ -188,7 +497,7 @@ { if (last_search_type & SRCH_NO_REGEX) return (last_pattern != NULL); -#if HAVE_POSIX_REGCOMP +#if HAVE_POSIX_REGCOMP_CS || HAVE_POSIX_REGCOMP return (regpattern != NULL); #endif #if HAVE_PCRE @@ -200,7 +509,7 @@ #if HAVE_REGCMP return (cpattern != NULL); #endif -#if HAVE_V8_REGCOMP +#if HAVE_V8_REGCOMP_CS || HAVE_V8_REGCOMP return (regpattern != NULL); #endif #if NO_REGEX @@ -325,12 +634,27 @@ * Compile a search pattern, for future use by match_pattern. */ static int -compile_pattern(pattern, search_type) +compile_pattern(pattern, charset, search_type) char *pattern; + CHARSET *charset; int search_type; { + int len = strlen_cs(pattern, charset); + if ((search_type & SRCH_NO_REGEX) == 0) { +#if HAVE_POSIX_REGCOMP_CS + regex_t *s = (regex_t *) ecalloc(1, sizeof(regex_t)); + if (regcomp_cs(s, pattern, charset, REGCOMP_FLAG)) + { + free(s); + error("Invalid pattern", NULL_PARG); + return (-1); + } + if (regpattern != NULL) + regfree_cs(regpattern); + regpattern = s; +#endif #if HAVE_POSIX_REGCOMP regex_t *s = (regex_t *) ecalloc(1, sizeof(regex_t)); if (regcomp(s, pattern, REGCOMP_FLAG)) @@ -378,6 +702,20 @@ free(cpattern); cpattern = s; #endif +#if HAVE_V8_REGCOMP_CS + struct regexp *s; + if ((s = regcomp_cs(pattern, charset)) == NULL) + { + /* + * regcomp has already printed an error message + * via regerror(). + */ + return (-1); + } + if (regpattern != NULL) + free(regpattern); + regpattern = s; +#endif #if HAVE_V8_REGCOMP struct regexp *s; if ((s = regcomp(pattern)) == NULL) @@ -396,9 +734,10 @@ if (last_pattern != NULL) free(last_pattern); - last_pattern = (char *) calloc(1, strlen(pattern)+1); - if (last_pattern != NULL) - strcpy(last_pattern, pattern); + if (last_charset != NULL) + free(last_charset); + + last_pattern = strdup_cs(pattern, charset, &last_charset); last_search_type = search_type; return (0); @@ -410,6 +749,11 @@ static void uncompile_pattern() { +#if HAVE_POSIX_REGCOMP_CS + if (regpattern != NULL) + regfree_cs(regpattern); + regpattern = NULL; +#endif #if HAVE_POSIX_REGCOMP if (regpattern != NULL) regfree(regpattern); @@ -428,12 +772,13 @@ free(cpattern); cpattern = NULL; #endif -#if HAVE_V8_REGCOMP +#if HAVE_V8_REGCOMP_CS || HAVE_V8_REGCOMP if (regpattern != NULL) free(regpattern); regpattern = NULL; #endif last_pattern = NULL; + last_charset = NULL; } /* @@ -441,8 +786,9 @@ * Set sp and ep to the start and end of the matched string. */ static int -match_pattern(line, sp, ep, notbol) +match_pattern(line, charset, sp, ep, notbol) char *line; + CHARSET *charset; char **sp; char **ep; int notbol; @@ -450,8 +796,19 @@ int matched; if (last_search_type & SRCH_NO_REGEX) - return (match(last_pattern, line, sp, ep)); + return (match(last_pattern, last_charset, line, charset, + sp, ep)); +#if HAVE_POSIX_REGCOMP_CS + { + regmatch_t rm; + matched = !regexec_cs(regpattern, line, charset, 1, &rm, 0); + if (!matched) + return (0); + *sp = line + rm.rm_so; + *ep = line + rm.rm_eo; + } +#endif #if HAVE_POSIX_REGCOMP { regmatch_t rm; @@ -494,6 +851,13 @@ return (0); *sp = __loc1; #endif +#if HAVE_V8_REGCOMP_CS + matched = regexec_cs(regpattern, line, charset); + if (!matched) + return (0); + *sp = regpattern->startp[0]; + *ep = regpattern->endp[0]; +#endif #if HAVE_V8_REGCOMP #if HAVE_REGEXEC2 matched = regexec2(regpattern, line, notbol); @@ -506,7 +870,7 @@ *ep = regpattern->endp[0]; #endif #if NO_REGEX - matched = match(last_pattern, line, sp, ep); + matched = match(last_pattern, last_charset, line, charset, sp, ep); #endif return (matched); } @@ -707,9 +1071,10 @@ * sp,ep delimit the first match already found. */ static void -hilite_line(linepos, line, sp, ep, cvt_ops) +hilite_line(linepos, line, charset, sp, ep, cvt_ops) POSITION linepos; char *line; + CHARSET *charset; char *sp; char *ep; int cvt_ops; @@ -753,13 +1118,29 @@ * move to the first char after the string we matched. * If we matched zero, just move to the next char. */ +#if ISO + if (ep > searchp) + { + charset += ep - searchp; + searchp = ep; + } else if (*searchp != '\0') + { + do + { + searchp++; + charset++; + } while (CSISREST(*charset)); + } else /* end of line */ + break; +#else if (ep > searchp) searchp = ep; else if (*searchp != '\0') searchp++; else /* end of line */ break; - } while (match_pattern(searchp, &sp, &ep, 1)); +#endif + } while (match_pattern(searchp, charset, &sp, &ep, 1)); /* * If there were backspaces in the original line, they @@ -930,6 +1311,11 @@ int cvt_ops; POSITION linepos, oldpos; + static CHARSET *charset = NULL; +#if ISO + static int charset_len = 0; +#endif + linenum = find_linenum(pos); oldpos = pos; for (;;) @@ -1008,14 +1394,57 @@ * If we're doing backspace processing, delete backspaces. */ cvt_ops = get_cvt_ops(); - cvt_text(line, line, cvt_ops); +#if ISO + if (1) +#else + if (is_caseless || bs_mode == BS_SPECIAL) +#endif + { + int ops = 0; +#if ISO + int len; +#endif + + if (is_caseless) + ops |= CVT_TO_LC; + if (bs_mode == BS_SPECIAL) + ops |= CVT_BS; + if (bs_mode != BS_CONTROL) + ops |= CVT_CRLF; +#if ISO + ops |= CVT_TO_INT; +#endif + +#if ISO + /* + * Make charset buffer and convert input lines + * into internal codes and its charsets. + */ + len = (strlen(line) + 1 + 1023) / 1024 * 1024; + if (len > charset_len) + { + charset_len = len; + if (charset) + free(charset); + charset = (CHARSET *) + ecalloc(len, sizeof(CHARSET)); + } + + cvt_text(line, charset, line, NULL, linepos, ops); +#else + cvt_text(line, NULL, line, NULL, NULL_POSITION, ops); +#endif + } else if (bs_mode != BS_CONTROL) + { + cvt_text(line, NULL, line, NULL, NULL_POSITION, CVT_CRLF); + } /* * Test the next line to see if we have a match. * We are successful if we either want a match and got one, * or if we want a non-match and got one. */ - line_match = match_pattern(line, &sp, &ep, 0); + line_match = match_pattern(line, charset, &sp, &ep, 0); line_match = (!(search_type & SRCH_NO_MATCH) && line_match) || ((search_type & SRCH_NO_MATCH) && !line_match); if (!line_match) @@ -1032,7 +1461,7 @@ * hilite list and keep searching. */ if (line_match) - hilite_line(linepos, line, sp, ep, cvt_ops); + hilite_line(linepos, line, charset, sp, ep, cvt_ops); #endif } else if (--matches <= 0) { @@ -1049,7 +1478,7 @@ */ clr_hilite(); if (line_match) - hilite_line(linepos, line, sp, ep, cvt_ops); + hilite_line(linepos, line, charset, sp, ep, cvt_ops); } #endif if (plinepos != NULL) @@ -1069,9 +1498,10 @@ * if less than n matches are found in this file. */ public int -search(search_type, pattern, n) +search(search_type, pattern, charset, n) int search_type; char *pattern; + CHARSET *charset; int n; { POSITION pos; @@ -1116,14 +1546,41 @@ } else { /* + * Save the pattern. + */ + char* save_pattern; + CHARSET* save_charset; + save_pattern = strdup_cs(pattern, charset, &save_charset); + pattern = save_pattern; + charset = save_charset; + /* * Compile the pattern. */ - ucase = is_ucase(pattern); + ucase = is_ucase(pattern, charset); if (caseless == OPT_ONPLUS) - cvt_text(pattern, pattern, CVT_TO_LC); - if (compile_pattern(pattern, search_type) < 0) + cvt_text(pattern, charset, pattern, charset, + NULL_POSITION, CVT_TO_LC | CVT_TO_INT | CVT_PAD); + else + cvt_text(pattern, charset, pattern, charset, + NULL_POSITION, CVT_TO_INT | CVT_PAD); +#if ISO && !NO_REGEX && (!CS_REGEX || MSB_ENABLE) + /* + * The normalize_text must not change charset if it is + * used in regex. Otherwise charset will be dicared + * in regex, so there are no problem. + */ + pattern = normalize_text(pattern, charset, search_type); +#endif + if (compile_pattern(pattern, charset, search_type) < 0) return (-1); /* + * Free the saved pattern. + */ + if (save_pattern != NULL) + free(save_pattern); + if (save_charset != NULL) + free(save_charset); + /* * Ignore case if -I is set OR * -i is set AND the pattern is all lowercase. */ @@ -1344,14 +1801,76 @@ * It supports no metacharacters like *, etc. */ static int -match(pattern, buf, pfound, pend) - char *pattern, *buf; +match(pattern, charset, buf, bufcharset, pfound, pend) + char *pattern; + CHARSET *charset; + char *buf; + CHARSET *bufcharset; char **pfound, **pend; { register char *pp, *lp; +#if ISO + register CHARSET *pc, *lc; +#endif - for ( ; *buf != '\0'; buf++) - { +#if 0 +write(2, "pa1: ", 5); +write(2, pattern, strlen(pattern)); +write(2, "\r\n", 2); +write(2, "cs1: ", 5); +write(2, charset, strlen(pattern)*2); +write(2, "\r\n", 2); +write(2, "pa2: ", 5); +write(2, buf, strlen(buf)); +write(2, "\r\n", 2); +write(2, "cs2: ", 5); +write(2, bufcharset, strlen(buf)*2); +write(2, "\r\n", 2); +#endif + while (*buf != '\0') + { +#if ISO + pp = pattern; + pc = charset; + lp = buf; + lc = bufcharset; + while (1) + { + if ((*pp == NULCH && *pc == NULLCS) || + (*lp == NULCH && *lc == NULLCS)) + break; + + while (*pp == PADCH && CSISASCII(*pc)) + { + pp++; + pc++; + } + while (*lp == PADCH && CSISASCII(*lc)) + { + lp++; + lc++; + } + if (*pp != *lp || *pc != *lc) + break; + pp++; + pc++; + lp++; + lc++; + } + if (*pp == NULCH && *pc == NULLCS) + { + if (pfound != NULL) + *pfound = buf; + if (pend != NULL) + *pend = lp; + return (1); + } + do + { + buf++; + bufcharset++; + } while (CSISREST(*bufcharset)); +#else for (pp = pattern, lp = buf; *pp == *lp; pp++, lp++) if (*pp == '\0' || *lp == '\0') break; @@ -1363,11 +1882,13 @@ *pend = lp; return (1); } + buf++; +#endif } return (0); } -#if HAVE_V8_REGCOMP +#if HAVE_V8_REGCOMP_CS || HAVE_V8_REGCOMP /* * This function is called by the V8 regcomp to report * errors in regular expressions. Index: less/unify.c diff -u /dev/null less/unify.c:1.30 --- /dev/null Sun Sep 4 19:53:51 2005 +++ less/unify.c Sun Sep 4 17:51:59 2005 @@ -0,0 +1,1659 @@ +/* + * Copyright (c) 1998-2005 Kazushi (Jam) Marukawa + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice in the documentation and/or other materials provided with + * the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +/* + * Routines to unify a multi bytes character. + */ + +#include "defines.h" +#include "multi.h" + + +#if ISO + +#include +#include +#include + +typedef struct { + char* input1; /* if input2 is null, convert input1 to output */ + char* input2; /* if input2 is here, convert input1-input2 to output */ + char* output; + CHARSET charset; +} convtab; + +typedef struct { + int num; + convtab tab[1]; +} sortedconvtab; + +typedef struct { + convtab* ctab; + sortedconvtab* sctab; +} convtable; + +static int comp_convtab(p, q) +void* p; +void* q; +{ + return strcmp(((convtab*)p)->input1, ((convtab*)q)->input1); +} + +static sortedconvtab* make_sortedconvtab(tab) +convtab tab[]; +{ + int i; + sortedconvtab* sctab; + + for (i = 0; tab[i].input1 != NULL; i++) + ; + sctab = (sortedconvtab*)malloc(sizeof(sortedconvtab) + + sizeof(convtab) * i - 1); + if (sctab == NULL) + return NULL; + sctab->num = i; + for (i = 0; i < sctab->num; i++) + sctab->tab[i] = tab[i]; + qsort(sctab->tab, sctab->num, sizeof(convtab), comp_convtab); + return sctab; +} + +static convtab* find_convtab_from_sctab(sctab, input) +sortedconvtab* sctab; +char* input; +{ + int from = 0; + int to = sctab->num; + int cur; + int cmp; + + if (to == 0) + return NULL; + while (1) { + cur = (from + to) / 2; + cmp = strcmp(input, sctab->tab[cur].input1); + if (cmp == 0) + return &sctab->tab[cur]; + if (sctab->tab[cur].input2 && + cmp > 0 && + strcmp(input, sctab->tab[cur].input2) <= 0) + return &sctab->tab[cur]; + if (to - from == 1) + return NULL; + if (cmp < 0) + to = cur; + if (0 < cmp) + from = cur; + } +} + +static void init_convtable(ctable) +convtable* ctable; +{ + if (ctable->sctab == NULL) + ctable->sctab = make_sortedconvtab(ctable->ctab); +} + +static convtab* find_convtab(ctable, input) +convtable* ctable; +char* input; +{ + convtab* ptab; + int cmp; + + if (ctable->sctab == NULL) + init_convtable(ctable); + + if (ctable->sctab != NULL) + return find_convtab_from_sctab(ctable->sctab, input); + + for (ptab = ctable->ctab; ptab->input1; ptab++) + if ((cmp = strcmp(input, ptab->input1)) == 0) + return ptab; + else if (ptab->input2 && + cmp > 0 && + strcmp(input, ptab->input2) <= 0) + return ptab; + return NULL; +} + +static convtab conv_jisx0208_78_90[] = { + /* 0x3646($@6F(B) -> 0x7421(&@$Bt!(B) */ + { "6F", NULL, "t!", JISX0208_90KANJI }, + /* 0x4B6A($@Kj(B) -> 0x7422(&@$Bt"(B) */ + { "Kj", NULL, "t\"", JISX0208_90KANJI }, + /* 0x4D5A($@MZ(B) -> 0x7423(&@$Bt#(B) */ + { "MZ", NULL, "t#", JISX0208_90KANJI }, + /* 0x6076($@`v(B) -> 0x7424(&@$Bt$(B) */ + { "`v", NULL, "t$", JISX0208_90KANJI }, + /* 0x3033($@03(B) -> 0x724D(&@$BrM(B) */ + { "03", NULL, "rM", JISX0208_90KANJI }, + /* 0x724D($@rM(B) -> 0x3033(&@$B03(B) */ + { "rM", NULL, "03", JISX0208_90KANJI }, + /* 0x3229($@2)(B) -> 0x7274(&@$Brt(B) */ + { "2)", NULL, "rt", JISX0208_90KANJI }, + /* 0x7274($@rt(B) -> 0x3229(&@$B2)(B) */ + { "rt", NULL, "2)", JISX0208_90KANJI }, + /* 0x3342($@3B(B) -> 0x695A(&@$BiZ(B) */ + { "3B", NULL, "iZ", JISX0208_90KANJI }, + /* 0x695A($@iZ(B) -> 0x3342(&@$B3B(B) */ + { "iZ", NULL, "3B", JISX0208_90KANJI }, + /* 0x3349($@3I(B) -> 0x5978(&@$BYx(B) */ + { "3I", NULL, "Yx", JISX0208_90KANJI }, + /* 0x5978($@Yx(B) -> 0x3349(&@$B3I(B) */ + { "Yx", NULL, "3I", JISX0208_90KANJI }, + /* 0x3376($@3v(B) -> 0x635E(&@$Bc^(B) */ + { "3v", NULL, "c^", JISX0208_90KANJI }, + /* 0x635E($@c^(B) -> 0x3376(&@$B3v(B) */ + { "c^", NULL, "3v", JISX0208_90KANJI }, + /* 0x3443($@4C(B) -> 0x5E75(&@$B^u(B) */ + { "4C", NULL, "^u", JISX0208_90KANJI }, + /* 0x5E75($@^u(B) -> 0x3443(&@$B4C(B) */ + { "^u", NULL, "4C", JISX0208_90KANJI }, + /* 0x3452($@4R(B) -> 0x6B5D(&@$Bk](B) */ + { "4R", NULL, "k]", JISX0208_90KANJI }, + /* 0x6B5D($@k](B) -> 0x3452(&@$B4R(B) */ + { "k]", NULL, "4R", JISX0208_90KANJI }, + /* 0x375B($@7[(B) -> 0x7074(&@$Bpt(B) */ + { "7[", NULL, "pt", JISX0208_90KANJI }, + /* 0x7074($@pt(B) -> 0x375B(&@$B7[(B) */ + { "pt", NULL, "7[", JISX0208_90KANJI }, + /* 0x395C($@9\(B) -> 0x6268(&@$Bbh(B) */ + { "9\\", NULL, "bh", JISX0208_90KANJI }, + /* 0x6268($@bh(B) -> 0x395C(&@$B9\(B) */ + { "bh", NULL, "9\\", JISX0208_90KANJI }, + /* 0x3C49($@ 0x6922(&@$Bi"(B) */ + { " 0x3C49(&@$B 0x7057(&@$BpW(B) */ + { "?Y", NULL, "pW", JISX0208_90KANJI }, + /* 0x7057($@pW(B) -> 0x3F59(&@$B?Y(B) */ + { "pW", NULL, "?Y", JISX0208_90KANJI }, + /* 0x4128($@A((B) -> 0x6C4D(&@$BlM(B) */ + { "A(", NULL, "lM", JISX0208_90KANJI }, + /* 0x6C4D($@lM(B) -> 0x4128(&@$BA((B) */ + { "lM", NULL, "A(", JISX0208_90KANJI }, + /* 0x445B($@D[(B) -> 0x5464(&@$BTd(B) */ + { "D[", NULL, "Td", JISX0208_90KANJI }, + /* 0x5464($@Td(B) -> 0x445B(&@$BD[(B) */ + { "Td", NULL, "D[", JISX0208_90KANJI }, + /* 0x4557($@EW(B) -> 0x626A(&@$Bbj(B) */ + { "EW", NULL, "bj", JISX0208_90KANJI }, + /* 0x626A($@bj(B) -> 0x4557(&@$BEW(B) */ + { "bj", NULL, "EW", JISX0208_90KANJI }, + /* 0x456E($@En(B) -> 0x5B6D(&@$B[m(B) */ + { "En", NULL, "[m", JISX0208_90KANJI }, + /* 0x5B6D($@[m(B) -> 0x456E(&@$BEn(B) */ + { "[m", NULL, "En", JISX0208_90KANJI }, + /* 0x4573($@Es(B) -> 0x5E39(&@$B^9(B) */ + { "Es", NULL, "^9", JISX0208_90KANJI }, + /* 0x5E39($@^9(B) -> 0x4573(&@$BEs(B) */ + { "^9", NULL, "Es", JISX0208_90KANJI }, + /* 0x4676($@Fv(B) -> 0x6D6E(&@$Bmn(B) */ + { "Fv", NULL, "mn", JISX0208_90KANJI }, + /* 0x6D6E($@mn(B) -> 0x4676(&@$BFv(B) */ + { "mn", NULL, "Fv", JISX0208_90KANJI }, + /* 0x4768($@Gh(B) -> 0x6A24(&@$Bj$(B) */ + { "Gh", NULL, "j$", JISX0208_90KANJI }, + /* 0x6A24($@j$(B) -> 0x4768(&@$BGh(B) */ + { "j$", NULL, "Gh", JISX0208_90KANJI }, + /* 0x4930($@I0(B) -> 0x5B58(&@$B[X(B) */ + { "I0", NULL, "[X", JISX0208_90KANJI }, + /* 0x5B58($@[X(B) -> 0x4930(&@$BI0(B) */ + { "[X", NULL, "I0", JISX0208_90KANJI }, + /* 0x4B79($@Ky(B) -> 0x5056(&@$BPV(B) */ + { "Ky", NULL, "PV", JISX0208_90KANJI }, + /* 0x5056($@PV(B) -> 0x4B79(&@$BKy(B) */ + { "PV", NULL, "Ky", JISX0208_90KANJI }, + /* 0x4C79($@Ly(B) -> 0x692E(&@$Bi.(B) */ + { "Ly", NULL, "i.", JISX0208_90KANJI }, + /* 0x692E($@i.(B) -> 0x4C79(&@$BLy(B) */ + { "i.", NULL, "Ly", JISX0208_90KANJI }, + /* 0x4F36($@O6(B) -> 0x6446(&@$BdF(B) */ + { "O6", NULL, "dF", JISX0208_90KANJI }, + /* 0x6446($@dF(B) -> 0x4F36(&@$BO6(B) */ + { "dF", NULL, "O6", JISX0208_90KANJI }, + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable ctable_jisx0208_78_90 = { conv_jisx0208_78_90, NULL }; + +static convtab unify_jisx0208[] = { + /* 0x2121(&@$B!!(B) -> 0x20( ) */ + { "!!", NULL, " ", ASCII }, + /* 0x2122(&@$B!"(B) -> 0x2C(,) */ + { "!\"", NULL, ",", ASCII }, + /* 0x2123(&@$B!#(B) -> 0x2E(.) */ + { "!#", NULL, ".", ASCII }, + /* 0x2124(&@$B!$(B) -> 0x2C(,) */ + { "!$", NULL, ",", ASCII }, + /* 0x2125(&@$B!%(B) -> 0x2E(.) */ + { "!%", NULL, ".", ASCII }, + /* 0x2127(&@$B!'(B) -> 0x3A(:) */ + { "!'", NULL, ":", ASCII }, + /* 0x2128(&@$B!((B) -> 0x3B(;) */ + { "!(", NULL, ";", ASCII }, + /* 0x2129(&@$B!)(B) -> 0x3F(?) */ + { "!)", NULL, "?", ASCII }, + /* 0x212A(&@$B!*(B) -> 0x21(!) */ + { "!*", NULL, "!", ASCII }, + /* 0x2130(&@$B!0(B) -> 0x5E(^) */ + { "!0", NULL, "^", ASCII }, + /* 0x2132(&@$B!2(B) -> 0x5F(_) */ + { "!2", NULL, "_", ASCII }, + /* 0x213D(&@$B!=(B) -> 0x2D(-) */ + { "!=", NULL, "-", ASCII }, + /* 0x213E(&@$B!>(B) -> 0x2D(-) */ + { "!>", NULL, "-", ASCII }, + /* 0x213F(&@$B!?(B) -> 0x2F(/) */ + { "!?", NULL, "/", ASCII }, + /* 0x2140(&@$B!@(B) -> 0x5C(\) */ + { "!@", NULL, "\\", ASCII }, + /* 0x2141(&@$B!A(B) -> 0x2D(-) */ + { "!A", NULL, "-", ASCII }, + /* 0x2143(&@$B!C(B) -> 0x7C(|) */ + { "!C", NULL, "|", ASCII }, + /* 0x2146(&@$B!F(B) -> 0x27(') */ + { "!F", NULL, "'", ASCII }, + /* 0x2147(&@$B!G(B) -> 0x27(') */ + { "!G", NULL, "'", ASCII }, + /* 0x2148(&@$B!H(B) -> 0x22(") */ + { "!H", NULL, "\"", ASCII }, + /* 0x2149(&@$B!I(B) -> 0x22(") */ + { "!I", NULL, "\"", ASCII }, + /* 0x214A(&@$B!J(B) -> 0x28(() */ + { "!J", NULL, "(", ASCII }, + /* 0x214B(&@$B!K(B) -> 0x29()) */ + { "!K", NULL, ")", ASCII }, + /* 0x214C(&@$B!L(B) -> 0x5B([) */ + { "!L", NULL, "[", ASCII }, + /* 0x214D(&@$B!M(B) -> 0x5D(]) */ + { "!M", NULL, "]", ASCII }, + /* 0x214E(&@$B!N(B) -> 0x5B([) */ + { "!N", NULL, "[", ASCII }, + /* 0x214F(&@$B!O(B) -> 0x5D(]) */ + { "!O", NULL, "]", ASCII }, + /* 0x2150(&@$B!P(B) -> 0x7B({) */ + { "!P", NULL, "{", ASCII }, + /* 0x2151(&@$B!Q(B) -> 0x7D(}) */ + { "!Q", NULL, "}", ASCII }, + /* 0x2152(&@$B!R(B) -> 0x5B([) */ + { "!R", NULL, "[", ASCII }, + /* 0x2153(&@$B!S(B) -> 0x5D(]) */ + { "!S", NULL, "]", ASCII }, + /* 0x2154(&@$B!T(B) -> 0x5B([) */ + { "!T", NULL, "[", ASCII }, + /* 0x2155(&@$B!U(B) -> 0x5D(]) */ + { "!U", NULL, "]", ASCII }, + /* 0x2156(&@$B!V(B) -> 0x5B([) */ + { "!V", NULL, "[", ASCII }, + /* 0x2157(&@$B!W(B) -> 0x5D(]) */ + { "!W", NULL, "]", ASCII }, + /* 0x2158(&@$B!X(B) -> 0x5B([) */ + { "!X", NULL, "[", ASCII }, + /* 0x2159(&@$B!Y(B) -> 0x5D(]) */ + { "!Y", NULL, "]", ASCII }, + /* 0x215A(&@$B!Z(B) -> 0x5B([) */ + { "!Z", NULL, "[", ASCII }, + /* 0x215B(&@$B![(B) -> 0x5D(]) */ + { "![", NULL, "]", ASCII }, + /* 0x215C(&@$B!\(B) -> 0x2B(+) */ + { "!\\", NULL, "+", ASCII }, + /* 0x215D(&@$B!](B) -> 0x2D(-) */ + { "!]", NULL, "-", ASCII }, + /* 0x215F(&@$B!_(B) -> 0x2A(*) */ + { "!_", NULL, "*", ASCII }, + /* 0x2160(&@$B!`(B) -> 0x2F(/) */ + { "!`", NULL, "/", ASCII }, + /* 0x2161(&@$B!a(B) -> 0x3D(=) */ + { "!a", NULL, "=", ASCII }, + /* 0x2163(&@$B!c(B) -> 0x3C(<) */ + { "!c", NULL, "<", ASCII }, + /* 0x2164(&@$B!d(B) -> 0x3E(>) */ + { "!d", NULL, ">", ASCII }, + /* 0x216C(&@$B!l(B) -> 0x27(') */ + { "!l", NULL, "'", ASCII }, + /* 0x216D(&@$B!m(B) -> 0x22(") */ + { "!m", NULL, "\"", ASCII }, + /* 0x2170(&@$B!p(B) -> 0x24($) */ + { "!p", NULL, "$", ASCII }, + /* 0x2173(&@$B!s(B) -> 0x25(%) */ + { "!s", NULL, "%", ASCII }, + /* 0x2174(&@$B!t(B) -> 0x23(#) */ + { "!t", NULL, "#", ASCII }, + /* 0x2175(&@$B!u(B) -> 0x26(&) */ + { "!u", NULL, "&", ASCII }, + /* 0x2176(&@$B!v(B) -> 0x2A(*) */ + { "!v", NULL, "*", ASCII }, + /* 0x2177(&@$B!w(B) -> 0x40(@) */ + { "!w", NULL, "@", ASCII }, + /* 0x2330(&@$B#0(B) -> 0x30(0) */ + { "#0", NULL, "0", ASCII }, + /* 0x2331(&@$B#1(B) -> 0x31(1) */ + { "#1", NULL, "1", ASCII }, + /* 0x2332(&@$B#2(B) -> 0x32(2) */ + { "#2", NULL, "2", ASCII }, + /* 0x2333(&@$B#3(B) -> 0x33(3) */ + { "#3", NULL, "3", ASCII }, + /* 0x2334(&@$B#4(B) -> 0x34(4) */ + { "#4", NULL, "4", ASCII }, + /* 0x2335(&@$B#5(B) -> 0x35(5) */ + { "#5", NULL, "5", ASCII }, + /* 0x2336(&@$B#6(B) -> 0x36(6) */ + { "#6", NULL, "6", ASCII }, + /* 0x2337(&@$B#7(B) -> 0x37(7) */ + { "#7", NULL, "7", ASCII }, + /* 0x2338(&@$B#8(B) -> 0x38(8) */ + { "#8", NULL, "8", ASCII }, + /* 0x2339(&@$B#9(B) -> 0x39(9) */ + { "#9", NULL, "9", ASCII }, + /* 0x2341(&@$B#A(B) -> 0x41(A) */ + { "#A", NULL, "A", ASCII }, + /* 0x2342(&@$B#B(B) -> 0x42(B) */ + { "#B", NULL, "B", ASCII }, + /* 0x2343(&@$B#C(B) -> 0x43(C) */ + { "#C", NULL, "C", ASCII }, + /* 0x2344(&@$B#D(B) -> 0x44(D) */ + { "#D", NULL, "D", ASCII }, + /* 0x2345(&@$B#E(B) -> 0x45(E) */ + { "#E", NULL, "E", ASCII }, + /* 0x2346(&@$B#F(B) -> 0x46(F) */ + { "#F", NULL, "F", ASCII }, + /* 0x2347(&@$B#G(B) -> 0x47(G) */ + { "#G", NULL, "G", ASCII }, + /* 0x2348(&@$B#H(B) -> 0x48(H) */ + { "#H", NULL, "H", ASCII }, + /* 0x2349(&@$B#I(B) -> 0x49(I) */ + { "#I", NULL, "I", ASCII }, + /* 0x234A(&@$B#J(B) -> 0x4A(J) */ + { "#J", NULL, "J", ASCII }, + /* 0x234B(&@$B#K(B) -> 0x4B(K) */ + { "#K", NULL, "K", ASCII }, + /* 0x234C(&@$B#L(B) -> 0x4C(L) */ + { "#L", NULL, "L", ASCII }, + /* 0x234D(&@$B#M(B) -> 0x4D(M) */ + { "#M", NULL, "M", ASCII }, + /* 0x234E(&@$B#N(B) -> 0x4E(N) */ + { "#N", NULL, "N", ASCII }, + /* 0x234F(&@$B#O(B) -> 0x4F(O) */ + { "#O", NULL, "O", ASCII }, + /* 0x2350(&@$B#P(B) -> 0x50(P) */ + { "#P", NULL, "P", ASCII }, + /* 0x2351(&@$B#Q(B) -> 0x51(Q) */ + { "#Q", NULL, "Q", ASCII }, + /* 0x2352(&@$B#R(B) -> 0x52(R) */ + { "#R", NULL, "R", ASCII }, + /* 0x2353(&@$B#S(B) -> 0x53(S) */ + { "#S", NULL, "S", ASCII }, + /* 0x2354(&@$B#T(B) -> 0x54(T) */ + { "#T", NULL, "T", ASCII }, + /* 0x2355(&@$B#U(B) -> 0x55(U) */ + { "#U", NULL, "U", ASCII }, + /* 0x2356(&@$B#V(B) -> 0x56(V) */ + { "#V", NULL, "V", ASCII }, + /* 0x2357(&@$B#W(B) -> 0x57(W) */ + { "#W", NULL, "W", ASCII }, + /* 0x2358(&@$B#X(B) -> 0x58(X) */ + { "#X", NULL, "X", ASCII }, + /* 0x2359(&@$B#Y(B) -> 0x59(Y) */ + { "#Y", NULL, "Y", ASCII }, + /* 0x235A(&@$B#Z(B) -> 0x5A(Z) */ + { "#Z", NULL, "Z", ASCII }, + /* 0x2361(&@$B#a(B) -> 0x61(a) */ + { "#a", NULL, "a", ASCII }, + /* 0x2362(&@$B#b(B) -> 0x62(b) */ + { "#b", NULL, "b", ASCII }, + /* 0x2363(&@$B#c(B) -> 0x63(c) */ + { "#c", NULL, "c", ASCII }, + /* 0x2364(&@$B#d(B) -> 0x64(d) */ + { "#d", NULL, "d", ASCII }, + /* 0x2365(&@$B#e(B) -> 0x65(e) */ + { "#e", NULL, "e", ASCII }, + /* 0x2366(&@$B#f(B) -> 0x66(f) */ + { "#f", NULL, "f", ASCII }, + /* 0x2367(&@$B#g(B) -> 0x67(g) */ + { "#g", NULL, "g", ASCII }, + /* 0x2368(&@$B#h(B) -> 0x68(h) */ + { "#h", NULL, "h", ASCII }, + /* 0x2369(&@$B#i(B) -> 0x69(i) */ + { "#i", NULL, "i", ASCII }, + /* 0x236A(&@$B#j(B) -> 0x6A(j) */ + { "#j", NULL, "j", ASCII }, + /* 0x236B(&@$B#k(B) -> 0x6B(k) */ + { "#k", NULL, "k", ASCII }, + /* 0x236C(&@$B#l(B) -> 0x6C(l) */ + { "#l", NULL, "l", ASCII }, + /* 0x236D(&@$B#m(B) -> 0x6D(m) */ + { "#m", NULL, "m", ASCII }, + /* 0x236E(&@$B#n(B) -> 0x6E(n) */ + { "#n", NULL, "n", ASCII }, + /* 0x236F(&@$B#o(B) -> 0x6F(o) */ + { "#o", NULL, "o", ASCII }, + /* 0x2370(&@$B#p(B) -> 0x70(p) */ + { "#p", NULL, "p", ASCII }, + /* 0x2371(&@$B#q(B) -> 0x71(q) */ + { "#q", NULL, "q", ASCII }, + /* 0x2372(&@$B#r(B) -> 0x72(r) */ + { "#r", NULL, "r", ASCII }, + /* 0x2373(&@$B#s(B) -> 0x73(s) */ + { "#s", NULL, "s", ASCII }, + /* 0x2374(&@$B#t(B) -> 0x74(t) */ + { "#t", NULL, "t", ASCII }, + /* 0x2375(&@$B#u(B) -> 0x75(u) */ + { "#u", NULL, "u", ASCII }, + /* 0x2376(&@$B#v(B) -> 0x76(v) */ + { "#v", NULL, "v", ASCII }, + /* 0x2377(&@$B#w(B) -> 0x77(w) */ + { "#w", NULL, "w", ASCII }, + /* 0x2378(&@$B#x(B) -> 0x78(x) */ + { "#x", NULL, "x", ASCII }, + /* 0x2379(&@$B#y(B) -> 0x79(y) */ + { "#y", NULL, "y", ASCII }, + /* 0x237a(&@$B#z(B) -> 0x7A(z) */ + { "#z", NULL, "z", ASCII }, + /* 0x2621(&@$B&!(B) -> 0x41(-FA) */ + { "&!", NULL, "A", GREEK }, + /* 0x2622(&@$B&"(B) -> 0x42(-FB) */ + { "&\"", NULL, "B", GREEK }, + /* 0x2623(&@$B&#(B) -> 0x43(-FC) */ + { "&#", NULL, "C", GREEK }, + /* 0x2624(&@$B&$(B) -> 0x44(-FD) */ + { "&$", NULL, "D", GREEK }, + /* 0x2625(&@$B&%(B) -> 0x45(-FE) */ + { "&%", NULL, "E", GREEK }, + /* 0x2626(&@$B&&(B) -> 0x46(-FF) */ + { "&&", NULL, "F", GREEK }, + /* 0x2627(&@$B&'(B) -> 0x47(-FG) */ + { "&'", NULL, "G", GREEK }, + /* 0x2628(&@$B&((B) -> 0x48(-FH) */ + { "&(", NULL, "H", GREEK }, + /* 0x2629(&@$B&)(B) -> 0x49(-FI) */ + { "&)", NULL, "I", GREEK }, + /* 0x262A(&@$B&*(B) -> 0x4A(-FJ) */ + { "&*", NULL, "J", GREEK }, + /* 0x262B(&@$B&+(B) -> 0x4B(-FK) */ + { "&+", NULL, "K", GREEK }, + /* 0x262C(&@$B&,(B) -> 0x4C(-FL) */ + { "&,", NULL, "L", GREEK }, + /* 0x262D(&@$B&-(B) -> 0x4D(-FM) */ + { "&-", NULL, "M", GREEK }, + /* 0x262E(&@$B&.(B) -> 0x4E(-FN) */ + { "&.", NULL, "N", GREEK }, + /* 0x262F(&@$B&/(B) -> 0x4F(-FO) */ + { "&/", NULL, "O", GREEK }, + /* 0x2630(&@$B&0(B) -> 0x50(-FP) */ + { "&0", NULL, "P", GREEK }, + /* 0x2631(&@$B&1(B) -> 0x51(-FQ) */ + { "&1", NULL, "Q", GREEK }, + /* 0x2632(&@$B&2(B) -> 0x53(-FS) */ + { "&2", NULL, "S", GREEK }, + /* 0x2633(&@$B&3(B) -> 0x54(-FT) */ + { "&3", NULL, "T", GREEK }, + /* 0x2634(&@$B&4(B) -> 0x55(-FU) */ + { "&4", NULL, "U", GREEK }, + /* 0x2635(&@$B&5(B) -> 0x56(-FV) */ + { "&5", NULL, "V", GREEK }, + /* 0x2636(&@$B&6(B) -> 0x57(-FW) */ + { "&6", NULL, "W", GREEK }, + /* 0x2637(&@$B&7(B) -> 0x58(-FX) */ + { "&7", NULL, "X", GREEK }, + /* 0x2638(&@$B&8(B) -> 0x59(-FY) */ + { "&8", NULL, "Y", GREEK }, + /* 0x2641(&@$B&A(B) -> 0x61(-Fa) */ + { "&A", NULL, "a", GREEK }, + /* 0x2642(&@$B&B(B) -> 0x62(-Fb) */ + { "&B", NULL, "b", GREEK }, + /* 0x2643(&@$B&C(B) -> 0x63(-Fc) */ + { "&C", NULL, "c", GREEK }, + /* 0x2644(&@$B&D(B) -> 0x64(-Fd) */ + { "&D", NULL, "d", GREEK }, + /* 0x2645(&@$B&E(B) -> 0x65(-Fe) */ + { "&E", NULL, "e", GREEK }, + /* 0x2646(&@$B&F(B) -> 0x66(-Ff) */ + { "&F", NULL, "f", GREEK }, + /* 0x2647(&@$B&G(B) -> 0x67(-Fg) */ + { "&G", NULL, "g", GREEK }, + /* 0x2648(&@$B&H(B) -> 0x68(-Fh) */ + { "&H", NULL, "h", GREEK }, + /* 0x2649(&@$B&I(B) -> 0x69(-Fi) */ + { "&I", NULL, "i", GREEK }, + /* 0x264A(&@$B&J(B) -> 0x6A(-Fj) */ + { "&J", NULL, "j", GREEK }, + /* 0x264B(&@$B&K(B) -> 0x6B(-Fk) */ + { "&K", NULL, "k", GREEK }, + /* 0x264C(&@$B&L(B) -> 0x6C(-Fl) */ + { "&L", NULL, "l", GREEK }, + /* 0x264D(&@$B&M(B) -> 0x6D(-Fm) */ + { "&M", NULL, "m", GREEK }, + /* 0x264E(&@$B&N(B) -> 0x6E(-Fn) */ + { "&N", NULL, "n", GREEK }, + /* 0x264F(&@$B&O(B) -> 0x6F(-Fo) */ + { "&O", NULL, "o", GREEK }, + /* 0x2650(&@$B&P(B) -> 0x70(-Fp) */ + { "&P", NULL, "p", GREEK }, + /* 0x2651(&@$B&Q(B) -> 0x71(-Fq) */ + { "&Q", NULL, "q", GREEK }, + /* 0x2652(&@$B&R(B) -> 0x73(-Fs) */ + { "&R", NULL, "s", GREEK }, + /* 0x2653(&@$B&S(B) -> 0x74(-Ft) */ + { "&S", NULL, "t", GREEK }, + /* 0x2654(&@$B&T(B) -> 0x75(-Fu) */ + { "&T", NULL, "u", GREEK }, + /* 0x2655(&@$B&U(B) -> 0x76(-Fv) */ + { "&U", NULL, "v", GREEK }, + /* 0x2656(&@$B&V(B) -> 0x77(-Fw) */ + { "&V", NULL, "w", GREEK }, + /* 0x2657(&@$B&W(B) -> 0x78(-Fx) */ + { "&W", NULL, "x", GREEK }, + /* 0x2658(&@$B&X(B) -> 0x79(-Fy) */ + { "&X", NULL, "y", GREEK }, + /* 0x2721(&@$B'!(B) -> 0x30(-L0) */ + { "'!", NULL, "0", CYRILLIC }, + /* 0x2722(&@$B'"(B) -> 0x31(-L1) */ + { "'\"", NULL, "1", CYRILLIC }, + /* 0x2723(&@$B'#(B) -> 0x32(-L2) */ + { "'#", NULL, "2", CYRILLIC }, + /* 0x2724(&@$B'$(B) -> 0x33(-L3) */ + { "'$", NULL, "3", CYRILLIC }, + /* 0x2725(&@$B'%(B) -> 0x34(-L4) */ + { "'%", NULL, "4", CYRILLIC }, + /* 0x2726(&@$B'&(B) -> 0x35(-L5) */ + { "'&", NULL, "5", CYRILLIC }, + /* 0x2727(&@$B''(B) -> 0x21(-L!) */ + { "''", NULL, "!", CYRILLIC }, + /* 0x2728(&@$B'((B) -> 0x36(-L6) */ + { "'(", NULL, "6", CYRILLIC }, + /* 0x2729(&@$B')(B) -> 0x37(-L7) */ + { "')", NULL, "7", CYRILLIC }, + /* 0x272A(&@$B'*(B) -> 0x38(-L8) */ + { "'*", NULL, "8", CYRILLIC }, + /* 0x272B(&@$B'+(B) -> 0x39(-L9) */ + { "'+", NULL, "9", CYRILLIC }, + /* 0x272C(&@$B',(B) -> 0x3A(-L:) */ + { "',", NULL, ":", CYRILLIC }, + /* 0x272D(&@$B'-(B) -> 0x3B(-L;) */ + { "'-", NULL, ";", CYRILLIC }, + /* 0x272E(&@$B'.(B) -> 0x3C(-L<) */ + { "'.", NULL, "<", CYRILLIC }, + /* 0x272F(&@$B'/(B) -> 0x3D(-L=) */ + { "'/", NULL, "=", CYRILLIC }, + /* 0x2730(&@$B'0(B) -> 0x3E(-L>) */ + { "'0", NULL, ">", CYRILLIC }, + /* 0x2731(&@$B'1(B) -> 0x3F(-L?) */ + { "'1", NULL, "?", CYRILLIC }, + /* 0x2732(&@$B'2(B) -> 0x40(-L@) */ + { "'2", NULL, "@", CYRILLIC }, + /* 0x2733(&@$B'3(B) -> 0x41(-LA) */ + { "'3", NULL, "A", CYRILLIC }, + /* 0x2734(&@$B'4(B) -> 0x42(-LB) */ + { "'4", NULL, "B", CYRILLIC }, + /* 0x2735(&@$B'5(B) -> 0x43(-LC) */ + { "'5", NULL, "C", CYRILLIC }, + /* 0x2736(&@$B'6(B) -> 0x44(-LD) */ + { "'6", NULL, "D", CYRILLIC }, + /* 0x2737(&@$B'7(B) -> 0x45(-LE) */ + { "'7", NULL, "E", CYRILLIC }, + /* 0x2738(&@$B'8(B) -> 0x46(-LF) */ + { "'8", NULL, "F", CYRILLIC }, + /* 0x2739(&@$B'9(B) -> 0x47(-LG) */ + { "'9", NULL, "G", CYRILLIC }, + /* 0x273A(&@$B':(B) -> 0x48(-LH) */ + { "':", NULL, "H", CYRILLIC }, + /* 0x273B(&@$B';(B) -> 0x49(-LI) */ + { "';", NULL, "I", CYRILLIC }, + /* 0x273C(&@$B'<(B) -> 0x4A(-LJ) */ + { "'<", NULL, "J", CYRILLIC }, + /* 0x273D(&@$B'=(B) -> 0x4B(-LK) */ + { "'=", NULL, "K", CYRILLIC }, + /* 0x273E(&@$B'>(B) -> 0x4C(-LL) */ + { "'>", NULL, "L", CYRILLIC }, + /* 0x273F(&@$B'?(B) -> 0x4D(-LM) */ + { "'?", NULL, "M", CYRILLIC }, + /* 0x2740(&@$B'@(B) -> 0x4E(-LN) */ + { "'@", NULL, "N", CYRILLIC }, + /* 0x2741(&@$B'A(B) -> 0x4F(-LO) */ + { "'A", NULL, "O", CYRILLIC }, + /* 0x2751(&@$B'Q(B) -> 0x50(-LP) */ + { "'Q", NULL, "P", CYRILLIC }, + /* 0x2752(&@$B'R(B) -> 0x51(-LQ) */ + { "'R", NULL, "Q", CYRILLIC }, + /* 0x2753(&@$B'S(B) -> 0x52(-LR) */ + { "'S", NULL, "R", CYRILLIC }, + /* 0x2754(&@$B'T(B) -> 0x53(-LS) */ + { "'T", NULL, "S", CYRILLIC }, + /* 0x2755(&@$B'U(B) -> 0x54(-LT) */ + { "'U", NULL, "T", CYRILLIC }, + /* 0x2756(&@$B'V(B) -> 0x55(-LU) */ + { "'V", NULL, "U", CYRILLIC }, + /* 0x2757(&@$B'W(B) -> 0x71(-Lq) */ + { "'W", NULL, "q", CYRILLIC }, + /* 0x2758(&@$B'X(B) -> 0x56(-LV) */ + { "'X", NULL, "V", CYRILLIC }, + /* 0x2759(&@$B'Y(B) -> 0x57(-LW) */ + { "'Y", NULL, "W", CYRILLIC }, + /* 0x275A(&@$B'Z(B) -> 0x58(-LX) */ + { "'Z", NULL, "X", CYRILLIC }, + /* 0x275B(&@$B'[(B) -> 0x59(-LY) */ + { "'[", NULL, "Y", CYRILLIC }, + /* 0x275C(&@$B'\(B) -> 0x5A(-LZ) */ + { "'\\", NULL, "Z", CYRILLIC }, + /* 0x275D(&@$B'](B) -> 0x5B(-L[) */ + { "']", NULL, "[", CYRILLIC }, + /* 0x275E(&@$B'^(B) -> 0x5C(-L\) */ + { "'^", NULL, "\\", CYRILLIC }, + /* 0x275F(&@$B'_(B) -> 0x5D(-L]) */ + { "'_", NULL, "]", CYRILLIC }, + /* 0x2760(&@$B'`(B) -> 0x5E(-L^) */ + { "'`", NULL, "^", CYRILLIC }, + /* 0x2761(&@$B'a(B) -> 0x5F(-L_) */ + { "'a", NULL, "_", CYRILLIC }, + /* 0x2762(&@$B'b(B) -> 0x60(-L`) */ + { "'b", NULL, "`", CYRILLIC }, + /* 0x2763(&@$B'c(B) -> 0x61(-La) */ + { "'c", NULL, "a", CYRILLIC }, + /* 0x2764(&@$B'd(B) -> 0x62(-Lb) */ + { "'d", NULL, "b", CYRILLIC }, + /* 0x2765(&@$B'e(B) -> 0x63(-Lc) */ + { "'e", NULL, "c", CYRILLIC }, + /* 0x2766(&@$B'f(B) -> 0x64(-Ld) */ + { "'f", NULL, "d", CYRILLIC }, + /* 0x2767(&@$B'g(B) -> 0x65(-Le) */ + { "'g", NULL, "e", CYRILLIC }, + /* 0x2768(&@$B'h(B) -> 0x66(-Lf) */ + { "'h", NULL, "f", CYRILLIC }, + /* 0x2769(&@$B'i(B) -> 0x67(-Lg) */ + { "'i", NULL, "g", CYRILLIC }, + /* 0x276A(&@$B'j(B) -> 0x68(-Lh) */ + { "'j", NULL, "h", CYRILLIC }, + /* 0x276B(&@$B'k(B) -> 0x69(-Li) */ + { "'k", NULL, "i", CYRILLIC }, + /* 0x276C(&@$B'l(B) -> 0x6A(-Lj) */ + { "'l", NULL, "j", CYRILLIC }, + /* 0x276D(&@$B'm(B) -> 0x6B(-Lk) */ + { "'m", NULL, "k", CYRILLIC }, + /* 0x276E(&@$B'n(B) -> 0x6C(-Ll) */ + { "'n", NULL, "l", CYRILLIC }, + /* 0x276F(&@$B'o(B) -> 0x6D(-Lm) */ + { "'o", NULL, "m", CYRILLIC }, + /* 0x2770(&@$B'p(B) -> 0x6E(-Ln) */ + { "'p", NULL, "n", CYRILLIC }, + /* 0x2771(&@$B'q(B) -> 0x6F(-Lo) */ + { "'q", NULL, "o", CYRILLIC }, + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable utable_jisx0208 = { unify_jisx0208, NULL }; + +static convtab unify_n_jisx0201roman[] = { + /* 0x5C((J\(B) -X 0x5C(\) */ + { "\\", NULL, "\\", ASCII }, + /* 0x7E((J~(B) -X 0x7E(~) */ + { "~", NULL, "~", ASCII }, + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable utable_n_jisx0201roman = { unify_n_jisx0201roman, NULL }; + +static convtab unify_n_iso646[] = { + /* 0x23((@#(B) -X 0x23(#) */ + { "#", NULL, "#", ASCII }, + /* 0x24((@$(B) -X 0x24($) */ + { "$", NULL, "$", ASCII }, + /* 0x40((@@(B) -X 0x40(@) */ + { "@", NULL, "@", ASCII }, + /* 0x5B((@[(B) -X 0x5B([) */ + { "[", NULL, "[", ASCII }, + /* 0x5C((@\(B) -X 0x5C(\) */ + { "\\", NULL, "\\", ASCII }, + /* 0x5D((@](B) -X 0x5D(]) */ + { "]", NULL, "]", ASCII }, + /* 0x5E((@^(B) -X 0x5E(^) */ + { "^", NULL, "^", ASCII }, + /* 0x60((@`(B) -X 0x60(`) */ + { "`", NULL, "`", ASCII }, + /* 0x7B((@{(B) -X 0x7B({) */ + { "{", NULL, "{", ASCII }, + /* 0x7C((@|(B) -X 0x7C(|) */ + { "|", NULL, "|", ASCII }, + /* 0x7D((@}(B) -X 0x7D(}) */ + { "}", NULL, "}", ASCII }, + /* 0x7E((@~(B) -X 0x7E(~) */ + { "~", NULL, "~", ASCII }, + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable utable_n_iso646 = { unify_n_iso646, NULL }; + +static convtab eliminate_wrong_jisx0208_78[] = { + /* empty rows */ + /* 8-15 KU 0x2821($@(!(B)-0x2F7E($@/~(B) -> 0x222E($B".(B) */ + { "(!", "/~", "\".", JISX0208KANJI }, + /* 84-94 KU 0x7421($@t!(B)-0x7E7E($@~~(B) -> 0x222E($B".(B) */ + { "t!", "~~", "\".", JISX0208KANJI }, + + /* sequences of empty columns */ + /* 2 KU 0x222F($@"/(B)-0x227E($@"~(B) -> 0x222E($B".(B) */ + { "\"/", "\"~", "\".", JISX0208KANJI }, + /* 3 KU 0x2321($@#!(B)-0x232F($@#/(B) -> 0x222E($B".(B) */ + { "#!", "#/", "\".", JISX0208KANJI }, + /* 3 KU 0x233A($@#:(B)-0x2340($@#@(B) -> 0x222E($B".(B) */ + { "#:", "#@", "\".", JISX0208KANJI }, + /* 3 KU 0x235B($@#[(B)-0x2360($@#`(B) -> 0x222E($B".(B) */ + { "#[", "#`", "\".", JISX0208KANJI }, + /* 3 KU 0x237B($@#{(B)-0x237E($@#~(B) -> 0x222E($B".(B) */ + { "#{", "#~", "\".", JISX0208KANJI }, + /* 4 KU 0x2474($@$t(B)-0x247E($@$~(B) -> 0x222E($B".(B) */ + { "$t", "$~", "\".", JISX0208KANJI }, + /* 5 KU 0x2577($@%w(B)-0x257E($@%~(B) -> 0x222E($B".(B) */ + { "%w", "%~", "\".", JISX0208KANJI }, + /* 6 KU 0x2639($@&9(B)-0x2640($@&@(B) -> 0x222E($B".(B) */ + { "&9", "&@", "\".", JISX0208KANJI }, + /* 6 KU 0x2659($@&Y(B)-0x267E($@&~(B) -> 0x222E($B".(B) */ + { "&Y", "&~", "\".", JISX0208KANJI }, + /* 7 KU 0x2742($@'B(B)-0x2750($@'P(B) -> 0x222E($B".(B) */ + { "'B", "'P", "\".", JISX0208KANJI }, + /* 7 KU 0x2772($@'r(B)-0x277E($@'~(B) -> 0x222E($B".(B) */ + { "'r", "'~", "\".", JISX0208KANJI }, + /* 47 KU 0x4F54($@OT(B)-0x4F7E($@O~(B) -> 0x222E($B".(B) */ + { "OT", "O~", "\".", JISX0208KANJI }, + + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable etable_jisx0208_78 = { eliminate_wrong_jisx0208_78, NULL }; + +static convtab eliminate_wrong_jisx0208_83[] = { + /* empty rows */ + /* 9-15 KU 0x2921($B)!(B)-0x2F7E($B/~(B) -> 0x222E($B".(B) */ + { ")!", "/~", "\".", JISX0208KANJI }, + /* 85-94 KU 0x7521($Bu!(B)-0x7E7E($B~~(B) -> 0x222E($B".(B) */ + { "u!", "~~", "\".", JISX0208KANJI }, + + /* sequences of empty columns */ + /* 2 KU 0x222F($B"/(B)-0x2239($B"9(B) -> 0x222E($B".(B) */ + { "\"/", "\"9", "\".", JISX0208KANJI }, + /* 2 KU 0x2242($B"B(B)-0x2249($B"I(B) -> 0x222E($B".(B) */ + { "\"B", "\"I", "\".", JISX0208KANJI }, + /* 2 KU 0x2251($B"Q(B)-0x225B($B"[(B) -> 0x222E($B".(B) */ + { "\"Q", "\"[", "\".", JISX0208KANJI }, + /* 2 KU 0x226B($B"k(B)-0x2271($B"q(B) -> 0x222E($B".(B) */ + { "\"k", "\"q", "\".", JISX0208KANJI }, + /* 2 KU 0x227A($B"z(B)-0x227D($B"}(B) -> 0x222E($B".(B) */ + { "\"z", "\"}", "\".", JISX0208KANJI }, + /* 3 KU 0x2321($B#!(B)-0x232F($B#/(B) -> 0x222E($B".(B) */ + { "#!", "#/", "\".", JISX0208KANJI }, + /* 3 KU 0x233A($B#:(B)-0x2340($B#@(B) -> 0x222E($B".(B) */ + { "#:", "#@", "\".", JISX0208KANJI }, + /* 3 KU 0x235B($B#[(B)-0x2360($B#`(B) -> 0x222E($B".(B) */ + { "#[", "#`", "\".", JISX0208KANJI }, + /* 3 KU 0x237B($B#{(B)-0x237E($B#~(B) -> 0x222E($B".(B) */ + { "#{", "#~", "\".", JISX0208KANJI }, + /* 4 KU 0x2474($B$t(B)-0x247E($B$~(B) -> 0x222E($B".(B) */ + { "$t", "$~", "\".", JISX0208KANJI }, + /* 5 KU 0x2577($B%w(B)-0x257E($B%~(B) -> 0x222E($B".(B) */ + { "%w", "%~", "\".", JISX0208KANJI }, + /* 6 KU 0x2639($B&9(B)-0x2640($B&@(B) -> 0x222E($B".(B) */ + { "&9", "&@", "\".", JISX0208KANJI }, + /* 6 KU 0x2659($B&Y(B)-0x267E($B&~(B) -> 0x222E($B".(B) */ + { "&Y", "&~", "\".", JISX0208KANJI }, + /* 7 KU 0x2742($B'B(B)-0x2750($B'P(B) -> 0x222E($B".(B) */ + { "'B", "'P", "\".", JISX0208KANJI }, + /* 7 KU 0x2772($B'r(B)-0x277E($B'~(B) -> 0x222E($B".(B) */ + { "'r", "'~", "\".", JISX0208KANJI }, + /* 8 KU 0x2841($B(A(B)-0x287E($B(~(B) -> 0x222E($B".(B) */ + { "(A", "(~", "\".", JISX0208KANJI }, + /* 47 KU 0x4F54($BOT(B)-0x4F7E($BO~(B) -> 0x222E($B".(B) */ + { "OT", "O~", "\".", JISX0208KANJI }, + /* 84 KU 0x7425($Bt%(B)-0x747E($Bt~(B) -> 0x222E($B".(B) */ + { "t%", "t~", "\".", JISX0208KANJI }, + + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable etable_jisx0208_83 = { eliminate_wrong_jisx0208_83, NULL }; + +static convtab eliminate_wrong_jisx0208_90[] = { + /* empty rows */ + /* 9-15 KU 0x2921(&@$B)!(B)-0x2F7E(&@$B/~(B) -> 0x222E($B".(B) */ + { ")!", "/~", "\".", JISX0208KANJI }, + /* 85-94 KU 0x7521(&@$Bu!(B)-0x7E7E(&@$B~~(B) -> 0x222E($B".(B) */ + { "u!", "~~", "\".", JISX0208KANJI }, + + /* sequences of empty columns */ + /* 2 KU 0x222F(&@$B"/(B)-0x2239(&@$B"9(B) -> 0x222E($B".(B) */ + { "\"/", "\"9", "\".", JISX0208KANJI }, + /* 2 KU 0x2242(&@$B"B(B)-0x2249(&@$B"I(B) -> 0x222E($B".(B) */ + { "\"B", "\"I", "\".", JISX0208KANJI }, + /* 2 KU 0x2251(&@$B"Q(B)-0x225B(&@$B"[(B) -> 0x222E($B".(B) */ + { "\"Q", "\"[", "\".", JISX0208KANJI }, + /* 2 KU 0x226B(&@$B"k(B)-0x2271(&@$B"q(B) -> 0x222E($B".(B) */ + { "\"k", "\"q", "\".", JISX0208KANJI }, + /* 2 KU 0x227A(&@$B"z(B)-0x227D(&@$B"}(B) -> 0x222E($B".(B) */ + { "\"z", "\"}", "\".", JISX0208KANJI }, + /* 3 KU 0x2321(&@$B#!(B)-0x232F(&@$B#/(B) -> 0x222E($B".(B) */ + { "#!", "#/", "\".", JISX0208KANJI }, + /* 3 KU 0x233A(&@$B#:(B)-0x2340(&@$B#@(B) -> 0x222E($B".(B) */ + { "#:", "#@", "\".", JISX0208KANJI }, + /* 3 KU 0x235B(&@$B#[(B)-0x2360(&@$B#`(B) -> 0x222E($B".(B) */ + { "#[", "#`", "\".", JISX0208KANJI }, + /* 3 KU 0x237B(&@$B#{(B)-0x237E(&@$B#~(B) -> 0x222E($B".(B) */ + { "#{", "#~", "\".", JISX0208KANJI }, + /* 4 KU 0x2474(&@$B$t(B)-0x247E(&@$B$~(B) -> 0x222E($B".(B) */ + { "$t", "$~", "\".", JISX0208KANJI }, + /* 5 KU 0x2577(&@$B%w(B)-0x257E(&@$B%~(B) -> 0x222E($B".(B) */ + { "%w", "%~", "\".", JISX0208KANJI }, + /* 6 KU 0x2639(&@$B&9(B)-0x2640(&@$B&@(B) -> 0x222E($B".(B) */ + { "&9", "&@", "\".", JISX0208KANJI }, + /* 6 KU 0x2659(&@$B&Y(B)-0x267E(&@$B&~(B) -> 0x222E($B".(B) */ + { "&Y", "&~", "\".", JISX0208KANJI }, + /* 7 KU 0x2742(&@$B'B(B)-0x2750(&@$B'P(B) -> 0x222E($B".(B) */ + { "'B", "'P", "\".", JISX0208KANJI }, + /* 7 KU 0x2772(&@$B'r(B)-0x277E(&@$B'~(B) -> 0x222E($B".(B) */ + { "'r", "'~", "\".", JISX0208KANJI }, + /* 8 KU 0x2841(&@$B(A(B)-0x287E(&@$B(~(B) -> 0x222E($B".(B) */ + { "(A", "(~", "\".", JISX0208KANJI }, + /* 47 KU 0x4F54(&@$BOT(B)-0x4F7E(&@$BO~(B) -> 0x222E($B".(B) */ + { "OT", "O~", "\".", JISX0208KANJI }, + /* 84 KU 0x7427(&@$Bt'(B)-0x747E(&@$Bt~(B) -> 0x222E($B".(B) */ + { "t'", "t~", "\".", JISX0208KANJI }, + + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable etable_jisx0208_90 = { eliminate_wrong_jisx0208_90, NULL }; + +static convtab eliminate_wrong_jisx0212[] = { + /* empty rows */ + /* 1 KU 0x2121($(D!!(B)-0x217E($(D!~(B) -> 0x222E($B".(B) */ + { "!!", "!~", "\".", JISX0208KANJI }, + /* 3-5 KU 0x2321($(D#!(B)-0x257E($(D%~(B) -> 0x222E($B".(B) */ + { "#!", "%~", "\".", JISX0208KANJI }, + /* 8 KU 0x2821($(D(!(B)-0x287E($(D(~(B) -> 0x222E($B".(B) */ + { "(!", "(~", "\".", JISX0208KANJI }, + /* 12-15 KU 0x2C21($(D,!(B)-0x2F7E($(D/~(B) -> 0x222E($B".(B) */ + { ",!", "/~", "\".", JISX0208KANJI }, + /* 78-94 KU 0x6E21($(Dn!(B)-0x7E7E($(D~~(B) -> 0x222E($B".(B) */ + { "n!", "~~", "\".", JISX0208KANJI }, + + /* sequences of empty columns */ + /* 2 KU 0x2221($(D"!(B)-0x222E($(D".(B) -> 0x222E($B".(B) */ + { "\"!", "\".", "\".", JISX0208KANJI }, + /* 2 KU 0x223A($(D":(B)-0x2241($(D"A(B) -> 0x222E($B".(B) */ + { "\":", "\"A", "\".", JISX0208KANJI }, + /* 2 KU 0x2245($(D"E(B)-0x226A($(D"j(B) -> 0x222E($B".(B) */ + { "\"E", "\"j", "\".", JISX0208KANJI }, + /* 2 KU 0x2272($(D"r(B)-0x227E($(D"~(B) -> 0x222E($B".(B) */ + { "\"r", "\"~", "\".", JISX0208KANJI }, + /* 6 KU 0x2621($(D&!(B)-0x2660($(D&`(B) -> 0x222E($B".(B) */ + { "&!", "&`", "\".", JISX0208KANJI }, + /* 6 KU 0x2666($(D&f(B) -> 0x222E($B".(B) */ + { "&f", NULL, "\".", JISX0208KANJI }, + /* 6 KU 0x2668($(D&h(B) -> 0x222E($B".(B) */ + { "&h", NULL, "\".", JISX0208KANJI }, + /* 6 KU 0x266B($(D&k(B) -> 0x222E($B".(B) */ + { "&k", NULL, "\".", JISX0208KANJI }, + /* 6 KU 0x266D($(D&m(B)-0x2670($(D&p(B) -> 0x222E($B".(B) */ + { "&m", "&p", "\".", JISX0208KANJI }, + /* 6 KU 0x267D($(D&}(B)-0x267E($(D&~(B) -> 0x222E($B".(B) */ + { "&}", "&~", "\".", JISX0208KANJI }, + /* 7 KU 0x2721($(D'!(B)-0x2741($(D'A(B) -> 0x222E($B".(B) */ + { "'!", "'A", "\".", JISX0208KANJI }, + /* 7 KU 0x274F($(D'O(B)-0x2771($(D'q(B) -> 0x222E($B".(B) */ + { "'O", "'q", "\".", JISX0208KANJI }, + /* 9 KU 0x2923($(D)#(B) -> 0x222E($B".(B) */ + { ")#", NULL, "\".", JISX0208KANJI }, + /* 9 KU 0x2925($(D)%(B) -> 0x222E($B".(B) */ + { ")%", NULL, "\".", JISX0208KANJI }, + /* 9 KU 0x2927($(D)'(B) -> 0x222E($B".(B) */ + { ")'", NULL, "\".", JISX0208KANJI }, + /* 9 KU 0x292A($(D)*(B) -> 0x222E($B".(B) */ + { ")*", NULL, "\".", JISX0208KANJI }, + /* 9 KU 0x292E($(D).(B) -> 0x222E($B".(B) */ + { ").", NULL, "\".", JISX0208KANJI }, + /* 9 KU 0x2931($(D)1(B)-0x2940($(D)@(B) -> 0x222E($B".(B) */ + { ")1", ")@", "\".", JISX0208KANJI }, + /* 9 KU 0x2951($(D)Q(B)-0x297E($(D)~(B) -> 0x222E($B".(B) */ + { ")Q", ")~", "\".", JISX0208KANJI }, + /* 10 KU 0x2A39($(D*9(B) -> 0x222E($B".(B) */ + { "*9", NULL, "\".", JISX0208KANJI }, + /* 10 KU 0x2A78($(D*x(B)-0x2A7E($(D*~(B) -> 0x222E($B".(B) */ + { "*x", "*~", "\".", JISX0208KANJI }, + /* 11 KU 0x2B3C($(D+<(B) -> 0x222E($B".(B) */ + { "+<", NULL, "\".", JISX0208KANJI }, + /* 11 KU 0x2B44($(D+D(B) -> 0x222E($B".(B) */ + { "+D", NULL, "\".", JISX0208KANJI }, + /* 11 KU 0x2B78($(D+x(B)-0x2B7E($(D+~(B) -> 0x222E($B".(B) */ + { "+x", "+~", "\".", JISX0208KANJI }, + /* 77 KU 0x6D64($(Dmd(B)-0x6D7E($(Dm~(B) -> 0x222E($B".(B) */ + { "md", "m~", "\".", JISX0208KANJI }, + + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable etable_jisx0212 = { eliminate_wrong_jisx0212, NULL }; + +static convtab eliminate_wrong_jisx0213_1[] = { + /* no empty row */ + + /* sequences of empty columns */ + /* 4 KU 0x247C($(O$|(B)-0x247E($(O$~(B) -> 0x222E($B".(B) */ + { "$|", "$~", "\".", JISX0208KANJI }, + /* 8 KU 0x285F($(O(_(B)-0x2866($(O(f(B) -> 0x222E($B".(B) */ + { "(_", "(f", "\".", JISX0208KANJI }, + /* 8 KU 0x287D($(O(}(B)-0x287E($(O(~(B) -> 0x222E($B".(B) */ + { "(}", "(~", "\".", JISX0208KANJI }, + /* 12 KU 0x2C74($(O,t(B)-0x2C7C($(O,|(B) -> 0x222E($B".(B) */ + { ",t", ",|", "\".", JISX0208KANJI }, + /* 13 KU 0x2D58($(O-X(B)-0x2D5E($(O-^(B) -> 0x222E($B".(B) */ + { "-X", "-^", "\".", JISX0208KANJI }, + /* 13 KU 0x2D70($(O-p(B)-0x2D72($(O-r(B) -> 0x222E($B".(B) */ + { "-p", "-r", "\".", JISX0208KANJI }, + /* 13 KU 0x2D74($(O-t(B)-0x2D77($(O-w(B) -> 0x222E($B".(B) */ + { "-t", "-w", "\".", JISX0208KANJI }, + /* 13 KU 0x2D7A($(O-z(B)-0x2D7C($(O-|(B) -> 0x222E($B".(B) */ + { "-z", "-|", "\".", JISX0208KANJI }, + /* 14 KU 0x2E21($(O.!(B) -> 0x222E($B".(B) */ + { ".!", NULL, "\".", JISX0208KANJI }, + /* 15 KU 0x2F7E($(O/~(B) -> 0x222E($B".(B) */ + { "/~", NULL, "\".", JISX0208KANJI }, + /* 47 KU 0x4F54($(OOT(B) -> 0x222E($B".(B) */ + { "OT", NULL, "\".", JISX0208KANJI }, + /* 47 KU 0x4F7E($(OO~(B) -> 0x222E($B".(B) */ + { "O~", NULL, "\".", JISX0208KANJI }, + /* 84 KU 0x7427($(Ot'(B) -> 0x222E($B".(B) */ + { "t'", NULL, "\".", JISX0208KANJI }, + /* 94 KU 0x7E7A($(O~z(B)-0x7E7E($(O~~(B) -> 0x222E($B".(B) */ + { "~z", "~~", "\".", JISX0208KANJI }, + + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable etable_jisx0213_1 = { eliminate_wrong_jisx0213_1, NULL }; + +static convtab eliminate_wrong_jisx0213_2[] = { + /* empty rows */ + /* 2 KU 0x2221($(P"!(B)-0x227E($(P"~(B) -> 0x222E($B".(B) */ + { "\"!", "\"~", "\".", JISX0208KANJI }, + /* 6-7 KU 0x2621($(P&!(B)-0x277E($(P'~(B) -> 0x222E($B".(B) */ + { "&!", "'~", "\".", JISX0208KANJI }, + /* 9-11 KU 0x2921($(P)!(B)-0x2B7E($(P+~(B) -> 0x222E($B".(B) */ + { ")!", "+~", "\".", JISX0208KANJI }, + /* 16-77 KU 0x3021($(P0!(B)-0x6D7E($(Pm~(B) -> 0x222E($B".(B) */ + { "0!", "m~", "\".", JISX0208KANJI }, + + /* sequences of empty columns */ + /* 94 KU 0x7E77($(P~w(B)-0x7E7E($(P~~(B) -> 0x222E($B".(B) */ + { "~w", "~~", "\".", JISX0208KANJI }, + + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable etable_jisx0213_2 = { eliminate_wrong_jisx0213_2, NULL }; + +static convtab eliminate_wrong_sjis[] = { +#if SJIS0213 + /* JIS X 0213:2000 plane 1 for SJIS0213 */ + + /* no empty row */ + + /* sequences of empty columns */ + /* 4 KU 0x82FA($(O$|(B)-0x82FC($(O$~(B) -> 0x222E($B".(B) */ + { "\202\372", "\202\374", "\201\254", SJIS }, + /* 8 KU 0x84DD($(O(_(B)-0x84E4($(O(f(B) -> 0x222E($B".(B) */ + { "\204\335", "\204\344", "\201\254", SJIS }, + /* 8 KU 0x84FB($(O(}(B)-0x84FC($(O(~(B) -> 0x222E($B".(B) */ + { "\204\373", "\204\374", "\201\254", SJIS }, + /* 12 KU 0x86F2($(O,t(B)-0x86FA($(O,|(B) -> 0x222E($B".(B) */ + { "\206\362", "\206\372", "\201\254", SJIS }, + /* 13 KU 0x8777($(O-X(B)-0x877D($(O-^(B) -> 0x222E($B".(B) */ + { "\207\167", "\207\175", "\201\254", SJIS }, + /* 13 KU 0x8790($(O-p(B)-0x8792($(O-r(B) -> 0x222E($B".(B) */ + { "\207\220", "\207\222", "\201\254", SJIS }, + /* 13 KU 0x8794($(O-t(B)-0x8797($(O-w(B) -> 0x222E($B".(B) */ + { "\207\224", "\207\227", "\201\254", SJIS }, + /* 13 KU 0x879A($(O-z(B)-0x879C($(O-|(B) -> 0x222E($B".(B) */ + { "\207\232", "\207\234", "\201\254", SJIS }, + /* 14 KU 0x879F($(O.!(B) -> 0x222E($B".(B) */ + { "\207\237", NULL, "\201\254", SJIS }, + /* 15 KU 0x889E($(O/~(B) -> 0x222E($B".(B) */ + { "\210\236", NULL, "\201\254", SJIS }, + /* 47 KU 0x9873($(OOT(B) -> 0x222E($B".(B) */ + { "\230\163", NULL, "\201\254", SJIS }, + /* 47 KU 0x989E($(OO~(B) -> 0x222E($B".(B) */ + { "\230\236", NULL, "\201\254", SJIS }, + /* 84 KU 0xEAA5($(Ot'(B) -> 0x222E($B".(B) */ + { "\352\245", NULL, "\201\254", SJIS }, + /* 94 KU 0xEFF8($(O~z(B)-0xEFFC($(O~~(B) -> 0x222E($B".(B) */ + { "\357\370", "\357\374", "\201\254", SJIS }, + + /* JIS X 0213:2000 plane 2 for SJIS0213 */ + /* In SJIS0213, JIS X 0213:2000 occupies from 96 to 120 KU */ + + /* no empty row */ + + /* sequences of empty columns */ + /* 94 KU 0xFCF5($(P~w(B)-0xFCFC($(P~~(B) -> 0x222E($B".(B) */ + { "\374\365", "\374\374", "\201\254", SJIS }, +#else /* SJIS0213 */ + /* JIS X 0208:1990 for SJIS */ + /* 2 KU 0x81AD(&@$B"/(B)-0x81B7(&@$B"9(B) -> 0x81AC($B".(B) */ + { "\201\255", "\201\267", "\201\254", SJIS }, + /* 2 KU 0x81C0(&@$B"B(B)-0x81C7(&@$B"I(B) -> 0x81AC($B".(B) */ + { "\201\300", "\201\307", "\201\254", SJIS }, + /* 2 KU 0x81CF(&@$B"Q(B)-0x81D9(&@$B"[(B) -> 0x81AC($B".(B) */ + { "\201\317", "\201\331", "\201\254", SJIS }, + /* 2 KU 0x81E9(&@$B"k(B)-0x81EF(&@$B"q(B) -> 0x81AC($B".(B) */ + { "\201\351", "\201\357", "\201\254", SJIS }, + /* 2 KU 0x81F8(&@$B"z(B)-0x81FB(&@$B"}(B) -> 0x81AC($B".(B) */ + { "\201\370", "\201\373", "\201\254", SJIS }, + /* 3 KU 0x8240(&@$B#!(B)-0x824E(&@$B#/(B) -> 0x81AC($B".(B) */ + { "\202\100", "\202\116", "\201\254", SJIS }, + /* 3 KU 0x8259(&@$B#:(B)-0x825F(&@$B#@(B) -> 0x81AC($B".(B) */ + { "\202\131", "\202\137", "\201\254", SJIS }, + /* 3 KU 0x827A(&@$B#[(B)-0x8280(&@$B#`(B) -> 0x81AC($B".(B) */ + { "\202\172", "\202\200", "\201\254", SJIS }, + /* 3 KU 0x829B(&@$B#{(B)-0x829E(&@$B#~(B) -> 0x81AC($B".(B) */ + { "\202\233", "\202\236", "\201\254", SJIS }, + /* 4 KU 0x82F2(&@$B$t(B)-0x82FC(&@$B$~(B) -> 0x81AC($B".(B) */ + { "\202\362", "\202\374", "\201\254", SJIS }, + /* 5 KU 0x8397(&@$B%w(B)-0x839E(&@$B%~(B) -> 0x81AC($B".(B) */ + { "\203\227", "\203\236", "\201\254", SJIS }, + /* 6 KU 0x83B7(&@$B&9(B)-0x83BE(&@$B&@(B) -> 0x81AC($B".(B) */ + { "\203\267", "\203\276", "\201\254", SJIS }, + /* 6 KU 0x83D7(&@$B&Y(B)-0x83FC(&@$B&~(B) -> 0x81AC($B".(B) */ + { "\203\327", "\203\374", "\201\254", SJIS }, + /* 7 KU 0x8461(&@$B'B(B)-0x846F(&@$B'P(B) -> 0x81AC($B".(B) */ + { "\204\141", "\204\157", "\201\254", SJIS }, + /* 7 KU 0x8492(&@$B'r(B)-0x849E(&@$B'~(B) -> 0x81AC($B".(B) */ + { "\204\222", "\204\236", "\201\254", SJIS }, + /* 8 KU 0x84BF(&@$B(A(B)-0x84FC(&@$B(~(B) -> 0x81AC($B".(B) */ + { "\204\277", "\204\374", "\201\254", SJIS }, + /* 9-14 KU 0x8540(&@$B)!(B)-0x87FC(&@$B.~(B) -> 0x81AC($B".(B) */ + { "\205\100", "\207\374", "\201\254", SJIS }, + /* 15 KU 0x8840(&@$B/!(B)-0x889E(&@$B/~(B) -> 0x81AC($B".(B) */ + { "\210\100", "\210\236", "\201\254", SJIS }, + /* 47 KU 0x9873(&@$BOT(B)-0x989E(&@$BO~(B) -> 0x81AC($B".(B) */ + { "\230\163", "\230\236", "\201\254", SJIS }, + /* 84 KU 0xEAA5(&@$Bt'(B)-0xEAFC(&@$Bt~(B) -> 0x81AC($B".(B) */ + { "\352\245", "\352\374", "\201\254", SJIS }, + + /* + * SJIS uses area from 85 KU to 120 KU for GAIJI, but current less + * doesn't allow GAIJI. + */ + /* 85-94 KU 0xEB40(&@$Bu!(B)-0xEFFC(&@$B~~(B) -> 0x81AC($B".(B) */ + { "\353\100", "\357\374", "\201\254", SJIS }, + /* 95-120 KU 0xF040(none)-0xFC9E(none) -> 0x81AC($B".(B) */ + { "\360\100", "\374\374", "\201\254", SJIS }, +#endif /* SJIS0213 */ + + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable etable_sjis = { eliminate_wrong_sjis, NULL }; + +static convtab eliminate_wrong_ujis[] = { +#if UJIS0213 + /* JIS X 0213:2000 plane 1 for UJIS0213 */ + + /* no empty row */ + + /* sequences of empty columns */ + /* 4 KU 0xA4FC($(O$|(B)-0xA4FE($(O$~(B) -> 0xA2AE($B".(B) */ + { "\244\374", "\244\376", "\242\256", UJIS }, + /* 8 KU 0xA8DF($(O(_(B)-0xA8E6($(O(f(B) -> 0xA2AE($B".(B) */ + { "\250\337", "\250\346", "\242\256", UJIS }, + /* 8 KU 0xA8FD($(O(}(B)-0xA8FE($(O(~(B) -> 0xA2AE($B".(B) */ + { "\250\375", "\250\376", "\242\256", UJIS }, + /* 12 KU 0xACF4($(O,t(B)-0xACFC($(O,|(B) -> 0xA2AE($B".(B) */ + { "\254\364", "\254\374", "\242\256", UJIS }, + /* 13 KU 0xADD8($(O-X(B)-0xADDE($(O-^(B) -> 0xA2AE($B".(B) */ + { "\255\330", "\255\336", "\242\256", UJIS }, + /* 13 KU 0xADF0($(O-p(B)-0xADF2($(O-r(B) -> 0xA2AE($B".(B) */ + { "\255\360", "\255\362", "\242\256", UJIS }, + /* 13 KU 0xADF4($(O-t(B)-0xADF7($(O-w(B) -> 0xA2AE($B".(B) */ + { "\255\364", "\255\367", "\242\256", UJIS }, + /* 13 KU 0xADFA($(O-z(B)-0xADFC($(O-|(B) -> 0xA2AE($B".(B) */ + { "\255\372", "\255\374", "\242\256", UJIS }, + /* 14 KU 0xAEA1($(O.!(B) -> 0xA2AE($B".(B) */ + { "\256\241", NULL, "\242\256", UJIS }, + /* 15 KU 0xAFFE($(O/~(B) -> 0xA2AE($B".(B) */ + { "\257\376", NULL, "\242\256", UJIS }, + /* 47 KU 0xCFD4($(OOT(B) -> 0xA2AE($B".(B) */ + { "\317\324", NULL, "\242\256", UJIS }, + /* 47 KU 0xCFFE($(OO~(B) -> 0xA2AE($B".(B) */ + { "\317\376", NULL, "\242\256", UJIS }, + /* 84 KU 0xF4A7($(Ot'(B) -> 0xA2AE($B".(B) */ + { "\364\247", NULL, "\242\256", UJIS }, + /* 94 KU 0xFEFA($(O~z(B)-0xFEFE($(O~~(B) -> 0xA2AE($B".(B) */ + { "\376\372", "\376\376", "\242\256", UJIS }, + + /* + * UJIS0213 shares G2 space by JIS X 0213:2000 plane 2 and + * JIS X 0212:1990. later has some empty rows and some empty + * columns in particular rows. JIS X 0213:2000 plane 2 shares + * those empty rows. So, totally UJIS0213 has no empty row. + */ + + /* JIS X 0212:1990 for UJIS0213 */ + /* Empty columns in particular rows are defined after below #endif */ + + /* JIS X 0213:2000 plane 2 for UJIS0213 */ + /* sequences of empty columns */ + /* 94 KU 0xFEF7($(P~w(B)-0xFEFE($(P~~(B) -> 0xA2AE($B".(B) */ + { "\217\376\367", "\217\376\376", "\242\256", UJIS }, +#else /* UJIS0213 */ + /* UJIS uses JIS X 0208 1983 */ + + /* empty rows */ + /* 9-15 KU 0xA9A1($B)!(B)-0xAFFE($B/~(B) -> 0xA2AE($B".(B) */ + { "\251\241", "\257\376", "\242\256", UJIS }, + /* + * UJIS uses area from 85 KU to 94 KU for GAIJI, but current less + * doesn't allow GAIJI. + */ + /* 85-94 KU 0xF5A1($Bu!(B)-0xFEFE($B~~(B) -> 0xA2AE($B".(B) */ + { "\365\241", "\376\376", "\242\256", UJIS }, + + /* sequences of empty columns */ + /* 2 KU 0xA2AF($B"/(B)-0xA2B9($B"9(B) -> 0xA2AE($B".(B) */ + { "\242\257", "\242\271", "\242\256", UJIS }, + /* 2 KU 0xA2C2($B"B(B)-0xA2C9($B"I(B) -> 0xA2AE($B".(B) */ + { "\242\302", "\242\311", "\242\256", UJIS }, + /* 2 KU 0xA2D1($B"Q(B)-0xA2DB($B"[(B) -> 0xA2AE($B".(B) */ + { "\242\321", "\242\333", "\242\256", UJIS }, + /* 2 KU 0xA2EB($B"k(B)-0xA2F1($B"q(B) -> 0xA2AE($B".(B) */ + { "\242\353", "\242\361", "\242\256", UJIS }, + /* 2 KU 0xA2FA($B"z(B)-0xA2FD($B"}(B) -> 0xA2AE($B".(B) */ + { "\242\372", "\242\375", "\242\256", UJIS }, + /* 3 KU 0xA3A1($B#!(B)-0xA3AF($B#/(B) -> 0xA2AE($B".(B) */ + { "\243\241", "\243\257", "\242\256", UJIS }, + /* 3 KU 0xA3BA($B#:(B)-0xA3C0($B#@(B) -> 0xA2AE($B".(B) */ + { "\243\272", "\243\300", "\242\256", UJIS }, + /* 3 KU 0xA3DB($B#[(B)-0xA3E0($B#`(B) -> 0xA2AE($B".(B) */ + { "\243\333", "\243\340", "\242\256", UJIS }, + /* 3 KU 0xA3FB($B#{(B)-0xA3FE($B#~(B) -> 0xA2AE($B".(B) */ + { "\243\373", "\243\376", "\242\256", UJIS }, + /* 4 KU 0xA4F4($B$t(B)-0xA4FE($B$~(B) -> 0xA2AE($B".(B) */ + { "\244\364", "\244\376", "\242\256", UJIS }, + /* 5 KU 0xA5F7($B%w(B)-0xA5FE($B%~(B) -> 0xA2AE($B".(B) */ + { "\245\367", "\245\376", "\242\256", UJIS }, + /* 6 KU 0xA6B9($B&9(B)-0xA6C0($B&@(B) -> 0xA2AE($B".(B) */ + { "\246\271", "\246\300", "\242\256", UJIS }, + /* 6 KU 0xA6D9($B&Y(B)-0xA6FE($B&~(B) -> 0xA2AE($B".(B) */ + { "\246\331", "\246\376", "\242\256", UJIS }, + /* 7 KU 0xA7C2($B'B(B)-0xA7D0($B'P(B) -> 0xA2AE($B".(B) */ + { "\247\302", "\247\320", "\242\256", UJIS }, + /* 7 KU 0xA7F2($B'r(B)-0xA7FE($B'~(B) -> 0xA2AE($B".(B) */ + { "\247\362", "\247\376", "\242\256", UJIS }, + /* 8 KU 0xA8C1($B(A(B)-0xA8FE($B(~(B) -> 0xA2AE($B".(B) */ + { "\250\301", "\250\376", "\242\256", UJIS }, + /* 47 KU 0xCFD4($BOT(B)-0xCFFE($BO~(B) -> 0xA2AE($B".(B) */ + { "\317\324", "\317\376", "\242\256", UJIS }, + /* 84 KU 0xF4A5($Bt%(B)-0xF4FE($Bt~(B) -> 0xA2AE($B".(B) */ + { "\364\245", "\364\376", "\242\256", UJIS }, + + /* JIS X 0212:1990 for UJIS */ + /* + * Here, we defines only empty rows. Empty columns in + * particular rows are defined after below #endif + */ + /* empty rows */ + /* 1 KU 0xA1A1($(D!!(B)-0xA1FE($(D!~(B) -> 0xA2AE($B".(B) */ + { "\217\241\241", "\217\241\376", "\242\256", UJIS }, + /* 3-5 KU 0xA3A1($(D#!(B)-0xA5FE($(D%~(B) -> 0xA2AE($B".(B) */ + { "\217\243\241", "\217\245\376", "\242\256", UJIS }, + /* 8 KU 0xA8A1($(D(!(B)-0xA8FE($(D(~(B) -> 0xA2AE($B".(B) */ + { "\217\250\241", "\217\250\376", "\242\256", UJIS }, + /* 12-15 KU 0xACA1($(D,!(B)-0xACFE($(D/~(B) -> 0xA2AE($B".(B) */ + { "\217\254\241", "\217\257\376", "\242\256", UJIS }, + /* 78-94 KU 0xEEA1($(Dn!(B)-0xFEFE($(D~~(B) -> 0xA2AE($B".(B) */ + { "\217\356\241", "\217\376\376", "\242\256", UJIS }, +#endif /* UJIS0213 */ + /* JIS X 0212:1990 */ + /* + * Here, we defines only empty columns in particular rows + * Empty rows are defined before above #endif + */ + /* sequences of empty columns */ + /* 2 KU 0xA2A1($(D"!(B)-0xA2AE($(D".(B) -> 0xA2AE($B".(B) */ + { "\217\242\241", "\217\242\256", "\242\256", UJIS }, + /* 2 KU 0xA2BA($(D":(B)-0xA2C1($(D"A(B) -> 0xA2AE($B".(B) */ + { "\217\242\272", "\217\242\301", "\242\256", UJIS }, + /* 2 KU 0xA2C5($(D"E(B)-0xA2EA($(D"j(B) -> 0xA2AE($B".(B) */ + { "\217\242\305", "\217\242\352", "\242\256", UJIS }, + /* 2 KU 0xA2F2($(D"r(B)-0xA2FE($(D"~(B) -> 0xA2AE($B".(B) */ + { "\217\242\362", "\217\242\376", "\242\256", UJIS }, + /* 6 KU 0xA6A1($(D&!(B)-0xA6E0($(D&`(B) -> 0xA2AE($B".(B) */ + { "\217\246\241", "\217\246\340", "\242\256", UJIS }, + /* 6 KU 0xA6E6($(D&f(B) -> 0xA2AE($B".(B) */ + { "\217\246\346", NULL, "\242\256", UJIS }, + /* 6 KU 0xA6E8($(D&h(B) -> 0xA2AE($B".(B) */ + { "\217\246\350", NULL, "\242\256", UJIS }, + /* 6 KU 0xA6EB($(D&k(B) -> 0xA2AE($B".(B) */ + { "\217\246\353", NULL, "\242\256", UJIS }, + /* 6 KU 0xA6ED($(D&m(B)-0xA6F0($(D&p(B) -> 0xA2AE($B".(B) */ + { "\217\246\355", "\217\246\360", "\242\256", UJIS }, + /* 6 KU 0xA6FD($(D&}(B)-0xA6FE($(D&~(B) -> 0xA2AE($B".(B) */ + { "\217\246\375", "\217\246\376", "\242\256", UJIS }, + /* 7 KU 0xA7A1($(D'!(B)-0xA7C1($(D'A(B) -> 0xA2AE($B".(B) */ + { "\217\247\241", "\217\247\301", "\242\256", UJIS }, + /* 7 KU 0xA7CF($(D'O(B)-0xA7F1($(D'q(B) -> 0xA2AE($B".(B) */ + { "\217\247\317", "\217\247\361", "\242\256", UJIS }, + /* 9 KU 0xA9A3($(D)#(B) -> 0xA2AE($B".(B) */ + { "\217\251\243", NULL, "\242\256", UJIS }, + /* 9 KU 0xA9A5($(D)%(B) -> 0xA2AE($B".(B) */ + { "\217\251\245", NULL, "\242\256", UJIS }, + /* 9 KU 0xA9A7($(D)'(B) -> 0xA2AE($B".(B) */ + { "\217\251\247", NULL, "\242\256", UJIS }, + /* 9 KU 0xA9AA($(D)*(B) -> 0xA2AE($B".(B) */ + { "\217\251\252", NULL, "\242\256", UJIS }, + /* 9 KU 0xA9AE($(D).(B) -> 0xA2AE($B".(B) */ + { "\217\251\256", NULL, "\242\256", UJIS }, + /* 9 KU 0xA9B1($(D)1(B)-0xA9C0($(D)@(B) -> 0xA2AE($B".(B) */ + { "\217\251\261", "\217\251\300", "\242\256", UJIS }, + /* 9 KU 0xA9D1($(D)Q(B)-0xA9FE($(D)~(B) -> 0xA2AE($B".(B) */ + { "\217\251\321", "\217\251\376", "\242\256", UJIS }, + /* 10 KU 0xAAB9($(D*9(B) -> 0xA2AE($B".(B) */ + { "\217\252\271", NULL, "\242\256", UJIS }, + /* 10 KU 0xAAF8($(D*x(B)-0xAAFE($(D*~(B) -> 0xA2AE($B".(B) */ + { "\217\252\370", "\217\252\376", "\242\256", UJIS }, + /* 11 KU 0xABBC($(D+<(B) -> 0xA2AE($B".(B) */ + { "\217\253\274", NULL, "\242\256", UJIS }, + /* 11 KU 0xABC4($(D+D(B) -> 0xA2AE($B".(B) */ + { "\217\253\304", NULL, "\242\256", UJIS }, + /* 11 KU 0xABF8($(D+x(B)-0xABFE($(D+~(B) -> 0xA2AE($B".(B) */ + { "\217\253\370", "\217\253\376", "\242\256", UJIS }, + /* 77 KU 0xEDE4($(Dmd(B)-0xEDFE($(Dm~(B) -> 0xA2AE($B".(B) */ + { "\217\355\344", "\217\355\376", "\242\256", UJIS }, + + /* NULL */ + { 0, 0, 0, 0 } +}; +static convtable etable_ujis = { eliminate_wrong_ujis, NULL }; + + +static int iso646p(cs) +CHARSET cs; +{ + if (CS2TYPE(cs) != TYPE_94_CHARSET) + return 0; + switch (CS2CHARSET(cs)) { + case TYPE_94_CHARSET | FT2CS('@'): /* ISO 646 IRV 1983 */ + case TYPE_94_CHARSET | FT2CS('A'): /* BSI 4730 United Kingdom */ + case TYPE_94_CHARSET | FT2CS('C'): /* NATS Standard Swedish/Finish */ + case TYPE_94_CHARSET | FT2CS('G'): /* ISO 646 Swedish */ + /* (SEN 850200 Ann. B) */ + case TYPE_94_CHARSET | FT2CS('H'): /* ISO 646 Swedish Name */ + /* (SEN 850200 Ann. C) */ + case JISX0201ROMAN: /* JIS X 0201-1976 Roman */ + case TYPE_94_CHARSET | FT2CS('K'): /* ISO 646 German (DIN 66083) */ + case TYPE_94_CHARSET | FT2CS('L'): /* ISO 646 Portuguese (ECMA) */ + case TYPE_94_CHARSET | FT2CS('R'): /* French */ + case TYPE_94_CHARSET | FT2CS('T'): /* China */ + case TYPE_94_CHARSET | FT2CS('Y'): /* Italian */ + case TYPE_94_CHARSET | FT2CS('Z'): /* Spanish */ + case TYPE_94_CHARSET | FT2CS('`'): /* NS 4551 Version 1 */ + case TYPE_94_CHARSET | FT2CS('a'): /* NS 4551 Version 2 */ + case TYPE_94_CHARSET | FT2CS('f'): /* NF Z 62-010-1982 */ + case TYPE_94_CHARSET | FT2CS('g'): /* IBM Portuguese */ + case TYPE_94_CHARSET | FT2CS('h'): /* IBM Spanish */ + case TYPE_94_CHARSET | FT2CS('i'): /* MS Z 7795/3 [Hungary] */ + case TYPE_94_CHARSET | FT2CS('n'): /* JIS C 6229-1984 OCR-B [Japan] */ + case TYPE_94_CHARSET | FT2CS('u'): /* CCITT Recommendation T.61 */ + /* Teletex Primary Set */ + case TYPE_94_CHARSET | FT2CS('w'): /* CSA Z 243.4-1985 Alternate */ + /* Primary Set No.1 [Canada] */ + case TYPE_94_CHARSET | FT2CS('x'): /* CSA Z 243.4-1985 Alternate */ + /* Primary Set No.2 [Canada] */ + case TYPE_94_CHARSET | FT2CS('z'): /* JUS I.B1.002 [Yugoslavia] */ + return 1; + default: + return 0; + } +} + +#if 0 +static char * +quote_it(src, cs, search_type) + char *src; + CHARSET *cs; + int search_type; +{ + static char *buf = NULL; + static int size = 0; + int len = strlen_cs(src, cs) * 2; + char *dst; + + if (len + 1 > size) + { + size = (len + 1 + 255) / 256 * 256; + if (buf) + free(buf); + buf = (char *) ecalloc(size, sizeof(char)); + } + dst = buf; + while (*src != '\0') + { +#if MSB_ENABLE + if (CSISASCII(*cs) || CSISWRONG(*cs)) + *dst++ = *src++; + else + *dst++ = *src++ | 0x80; + cs++; +#else + if (!CSISASCII(*cs++) && !(search_type & SRCH_NO_REGEX)) + { + switch (*src) { + /* Basic Regular Expressions */ + case '[': + case ']': + case '.': + case '*': + case '\\': + case '^': + case '$': +#if (HAVE_POSIX_REGCOMP_CS || HAVE_POSIX_REGCOMP) && defined(REG_EXTENDED) + /* Extended Regular Expressions */ + case '+': + case '?': + case '|': + case '(': + case ')': + case '{': + case '}': +#endif +#if HAVE_RE_COMP + /* No Extended Regular Expressions */ +#endif +#if HAVE_REGCMP + /* Extended Regular Expressions */ + case '+': + case '(': + case ')': + case '{': + case '}': +#endif +#if HAVE_V8_REGCOMP_CS || HAVE_V8_REGCOMP + /* Extended Regular Expressions */ + case '+': + case '?': + case '|': + case '(': + case ')': +#endif + *dst++ = '\\'; + /* fall through */ + default: + *dst++ = *src++; + break; + } + } else + *dst++ = *src++; +#endif + } + *dst = '\0'; + return (buf); +} +#endif + +/* + * convert JIS C 6226-1978 into JIS X 0208:1990 + */ +void jis78to90(str) +char* str; +{ + convtab* ptab; + + /* convert JIS C 6226-1978 into JIS X 0208:1990 */ + ptab = find_convtab(&ctable_jisx0208_78_90, str); + if (ptab) { + str[0] = ptab->output[0]; + str[1] = ptab->output[1]; + } +} + +void chconvert_cs(istr, ics, ostr, ocs, flag) +char* istr; +CHARSET* ics; +char* ostr; +CHARSET* ocs; +int flag; /* quote regexp pattern */ +{ + int i; + convtab* ptab; + + if (istr[0] == NULCH && CSISNULLCS(ics[0])) { + ostr[0] = NULCH; + ocs[0] = NULLCS; + return; + } + /* convert codes into some traditional character sets */ + if (CS2CHARSET(*ics) == JISX0208_78KANJI) { + /* convert JIS C 6226-1978 into JIS X 0208:1990 */ + ptab = find_convtab(&ctable_jisx0208_78_90, istr); + if (ptab) { + ostr[0] = ptab->output[0]; + ostr[1] = ptab->output[1]; + ocs[0] = ptab->charset; + ocs[1] = ptab->charset | REST_MASK; + } else { + ostr[0] = istr[0]; + ostr[1] = istr[1]; + ocs[0] = JISX0208_90KANJI; + ocs[1] = JISX0208_90KANJI | REST_MASK; + } + ostr[2] = NULCH; + ocs[2] = NULLCS; + } else if (CS2CHARSET(*ics) == JISX0208KANJI) { + /* convert JIS X 0208-1983 into JIS X 0208:1990 */ + ostr[0] = istr[0]; + ostr[1] = istr[1]; + ocs[0] = JISX0208_90KANJI; + ocs[1] = JISX0208_90KANJI | REST_MASK; + + /* + * Difference betwen 1983 and 1990 are two added characters, + * 0x7425 and 0x7426. So, here is nothing to do. + */ + ostr[2] = NULCH; + ocs[2] = NULLCS; + } else if (CS2CHARSET(*ics) == JISX0201ROMAN) { + /* convert JIS X 0201:1976 into ASCII */ + ptab = find_convtab(&utable_n_jisx0201roman, istr); + ostr[0] = istr[0]; + if (!ptab) { + ocs[0] = ASCII; + } + ostr[1] = NULCH; + ocs[1] = NULLCS; + } else if (iso646p(*ics)) { + /* convert domestic ISO 646 into ASCII */ + ptab = find_convtab(&utable_n_iso646, istr); + ostr[0] = istr[0]; + if (!ptab) { + ocs[0] = ASCII; + } + ostr[1] = NULCH; + ocs[1] = NULLCS; + } else { + /* copy input to output */ + i = 0; + do { + ostr[i] = istr[i]; + ocs[i] = ics[i]; + i++; + } while (CSISREST(ics[i])); + ostr[i] = NULCH; + ocs[i] = NULLCS; + } +} + +void chunify_cs(istr, ics, ostr, ocs) +char* istr; +CHARSET* ics; +char* ostr; +CHARSET* ocs; +{ + int i; + convtab* ptab; + + chconvert_cs(istr, ics, ostr, ocs); + /* unify codes */ + if (CS2CHARSET(*ocs) == JISX0208_90KANJI) { + /* + * convert ASCII, GREEK and CYRILLIC character in + * JIS X 0208-1990 into ASCII, ISO 8859-7 and ISO 8859-5 + * respectively. + */ + ptab = find_convtab(&utable_jisx0208, ostr); + if (ptab) { + int len = strlen(ptab->output); + assert(len <= (int)strlen(ostr)); + ostr[0] = ptab->output[0]; + ocs[0] = ptab->charset; + for (i = 1; i < len; i++) { + ostr[i] = ptab->output[i]; + ocs[i] = ptab->charset | REST_MASK; + } + ostr[i] = NULCH; + ocs[i] = NULLCS; + } + } +} + +int chcmp_cs(str1, cs1, str2, cs2) +char* str1; +CHARSET* cs1; +char* str2; +CHARSET* cs2; +{ + char buf1[32]; + CHARSET bcs1[32]; + char buf2[32]; + CHARSET bcs2[32]; + + /* if there is no character set, compare them as ASCII */ + if (cs1 == NULL && cs2 == NULL) + return *str1 - *str2; + if (cs1 == NULL) + return chcmp_cs(str2, cs2, str1, cs1); + if (cs2 == NULL) + return MAKECV(*str1, *cs1) - MAKECV(*str2, ASCII); + + /* unify both of inputs */ + chunify_cs(str1, cs1, buf1, bcs1); + str1 = buf1; + cs1 = bcs1; + chunify_cs(str2, cs2, buf2, bcs2); + str2 = buf2; + cs2 = bcs2; + /* compare them */ + if ((*str1 == NULCH && CSISNULLCS(*cs1)) || + (*str2 == NULCH && CSISNULLCS(*cs2))) + return MAKECV(*str1, *cs1) - MAKECV(*str2, *cs2); + do { + if (*str1 != *str2 || *cs1 != *cs2) { + return MAKECV(*str1, *cs1) - MAKECV(*str2, *cs2); + } + str1++; + cs1++; + str2++; + cs2++; + } while (CSISREST(*cs1)); + return 0; +} + +int chisvalid_cs(istr, ics) +char* istr; +CHARSET* ics; +{ + int i; + convtab* ptab; + + if (istr[0] == NULCH && CSISNULLCS(ics[0])) + return 0; + + /* check wrong codes if it is some traditional character set */ + if (CS2CHARSET(*ics) == JISX0208_78KANJI) { + ptab = find_convtab(&etable_jisx0208_78, istr); + if (ptab) + return 0; + else + return 1; + } else if (CS2CHARSET(*ics) == JISX0208KANJI) { + ptab = find_convtab(&etable_jisx0208_83, istr); + if (ptab) + return 0; + else + return 1; + } else if (CS2CHARSET(*ics) == JISX0208_90KANJI) { + /* eliminate wrong codes */ + ptab = find_convtab(&etable_jisx0208_90, istr); + if (ptab) + return 0; + else + return 1; + } else if (CS2CHARSET(*ics) == JISX0212KANJISUP) { + ptab = find_convtab(&etable_jisx0212, istr); + if (ptab) + return 0; + else + return 1; + } else if (CS2CHARSET(*ics) == JISX0213KANJI1) { + ptab = find_convtab(&etable_jisx0213_1, istr); + if (ptab) + return 0; + else + return 1; + } else if (CS2CHARSET(*ics) == JISX0213KANJI2) { + ptab = find_convtab(&etable_jisx0213_2, istr); + if (ptab) + return 0; + else + return 1; + } else if (CS2CHARSET(*ics) == SJIS) { + /* eliminate wrong codes */ + ptab = find_convtab(&etable_sjis, istr); + if (ptab) + return 0; + else + return 1; + } else if (CS2CHARSET(*ics) == UJIS) { + /* eliminate wrong codes */ + ptab = find_convtab(&etable_ujis, istr); + if (ptab) + return 0; + else + return 1; + /* TODO: G2 */ + } + return 1; +} + +#endif Index: less/version.c diff -u less/version.c:1.1.1.22 less/version.c:1.104 --- less/version.c:1.1.1.22 Sun Sep 4 19:10:57 2005 +++ less/version.c Sun Sep 4 19:13:38 2005 @@ -7,6 +7,12 @@ * For more information about less, or for information on how to * contact the author, see the README file. */ +/* + * Copyright (c) 1997-2005 Kazushi (Jam) Marukawa + * All rights of japanized routines are reserved. + * + * You may distribute under the terms of the Less License. + */ /* @@ -646,6 +652,102 @@ v381 11/28/02 Make -N use 7 columns for line number if possible. ----------------------------------------------------------------- v382 2/3/04 Remove copyrighted code. + +----------------------------------------------------------------- + Other patches by jam@pobox.com +kanji 7/18/91 Support Kanji as one of the charset. +zcat 4/21/94 Add easy uncompressing feature by invoking zcat. +iso 8/11/94 Support ISO2022 encoding and special Japanese KANJI encodings + as one of the charset. +iso2 9/21/94 Fix a variety of bugs of iso patch. +iso2p1 10/22/94 Fix a variety of bugs. +iso202 12/1/96 Chang to fit less version 330 and fixed some bugs. +iso203 12/5/96 Fix line termination bug. +iso204 12/15/96 Change all internal data structure. Add CHARSET and + "CHARSET charset[]" in line.c. +iso205 12/16/96 Add CODESET and structure of CODESET in multi.c and + made buffering_multi() recursively. +iso206 12/21/96 Support multi bytes characters in command buffer. + And add rotate-right command for rotating the code set in the + right plane. +iso207 12/22/96 Support search of multi bytes characters. +iso208 12/23/96 Encapsulate multi bytes buffering data. And change + the structure of CHARSET. +iso209 1/5/97 Fix bugs of KANJI search and sophisticate SJIS routines. +iso210 1/12/97 Fix BS handling and add priority argument of KANJI code. +iso211 1/19/97 Add and change comments. +iso212 1/21/97 Fix a bug about UJIS_REGEXP search. +iso213 1/22/97 Fix a bug about 8-bit error message. +iso214 1/24/97 Fix a bug about handling of BS character. +iso215 1/25/97 Change to invert -Z option if SJIS_PRE is defined +iso216 3/9/97 Fix a bug about buffering of KANJI supplement. +iso217 4/13/97 Fix a bug about initialization of priority table. +iso218 4/13/97 Change search routines to check the CHARSET at any time. +iso219 5/5/97 Fix a typo and some codes which are warned. +iso220 5/5/97 Changed the name of UJIS_REGEXP macro to EIGHTBIT_REGEXP. +iso221 5/6/97 Changed to use USE_CHARSET macro well. +iso222 12/2/97 Support private character sets and empty character set. +iso223 12/8/97 Fix some typos and warnings. +iso224 12/10/97 Fix a converting bug about WRONGCS. +iso225 2/8/98 Use appropriate matching when looking for a charset. +iso226 2/9/98 Add -K option to choose CHARSET easy. +iso227 2/15/98 Fix some bugs in code conversion routines. +iso228 2/16/98 Change to ignore all user defined characters in SJIS and UJIS. +iso229 3/5/98 Display blank characters instead of delete them when a part of + a multi column character needed to display. +iso230 3/6/98 Support regular expression library with character set ability. +iso231 3/7/98 Fixed typo. +iso232 3/8/98 Change a configure script. +iso233 3/10/98 Fixed typo and made multi.h. +iso234 3/12/98 Removed prewind_multi and pdone_multi because it depend on + less. Add init_multi and clear_multi instead of them. +iso235 3/13/98 Add unify.c for chcmp_cs function. +iso236 3/14/98 Fixed MSB_ENABLE bugs. +iso237 3/16/98 Add unification among JIS X 0208, ASCII, Cyrillic and Greek. +iso238 3/17/98 Add NULLCS to represent a terminator. + Changed a character set for control characters to WRONGCS. + Add chunify_cs and chconvert_cs as external function. +iso239 3/20/98 Fixed a bug in match() and add assertion in chunify_cs(). +iso240 3/25/98 Corrected all cmdbuf and cmdcs buffers' handling. + Fixed a control character handling bug. + Changed to remove padded codes from search pattern. +iso241 4/2/98 Fixed small bugs in search.c. +iso242 5/18/98 Fixed a buffering problem of search. +iso243 7/1/98 Add elimination of wrong characters for JIS C 6226-1978, + JIS X 0208-1983 and JIS X 0208:1990/1997. +iso244 7/2/98 Add elimination of wrong characters for SJIS and UJIS. +iso245 7/2/98 Fix a bug about elimination for SJIS. +iso246 8/8/98 Add one locale for Win32, eliminate all MSB_ENABLE stuff + from unify.c, and fix eliminating table for JIS C 6226-1978. +iso247 8/8/98 Add -W option. And change the point of putting a mark. Now + multi.c call checking function, then mark wrong characters. +iso248 8/12/98 Fix a problem of outputting WRONGCS. Add checking table + for JIS X 0212:1990. +iso249 10/29/00 Joined with less-358. Fixed some bugs caused by join. +iso250 11/21/00 Support JIS X 0213:2000. Added support of cygwin. + Thanks to nayuta-san. +iso251 11/22/00 Support SJIS and UJIS using JIS X 0213:2000. +iso252 11/24/00 Fixed a problem to output JIS X 0212:1990 using jis style. +iso253 12/2/00 Fixed a problem to output SJIS. Thanks to nayuta-san. + Fixed assertion problem in search.c. Thanks to SAKAKI + Kiyotake, Tanaka Akira, and Yuichi SATO. +iso254 12/5/00 Fixed a problem to output JIS X 0213:2000 plane 2 into SJIS. + Thanks to Shinya Hanataka. +iso255 8/30/05 Joined with less-378. +iso256 8/30/05 Joined with less-381. +iso257 9/4/05 Fixed problems caused by merge. + Changed buffering mechanism to track exact POSITION through + code set conversion. This helped hiliting routine and improved + less running speed. + Changed to parse text from the beginning of physical line when + less jumps into the middle of text. This fixed major problems + on stateful text like ISO-2022. + Fixed JIS X 0213:2000 related problems. Thanks to Takeshi + WATANABE. Also, fixed a problem reported by him. Less will + not split one wrong multi-byte character into different lines + even it is not fit in first line. Less moves entire text to + represent the character into second line. +iso258 9/4/05 Joined with less-382. */ -char version[] = "382"; +char version[] = "382+iso258";