Index: README.m17n *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/README.m17n Wed Aug 20 16:08:51 1997 *************** *** 0 **** --- 1,786 ---- + multilingual patch for Keith Bostic's nvi + Jun-ichiro itojun Itoh + $Id: README.english,v 1.100 1997/08/20 07:08:50 itojun Exp $ + + + vi users of the world, unite! + + + OVERVIEW + + This patchkit contains multilingual patch for nvi 1.79. + We call it "nvi-m17n" for short. "m17n" stands for + multilingualization, since "multilingualization" is made up by + m, 17 letters, and n. + + You can obtain the latest release of nvi from the following place: + ftp://ftp.cs.berkeley.edu/ucb/4bsd/ + This package and more up-to-date versions can be found from the + following place: + ftp://ftp.foretune.co.jp/pub/tools/nvi-m17n/ + + Historical note: + We once called it "jnvi" since it started as Japanization of nvi. + You may see the name "jnvi" left somewhere. That means "nvi-m17n". + + REDISTRIBUTION + + Freely redistributable, under condition written in LICENSE file. + + WARRANITY AND COPYRIGHT + + Absolutely no warranty. Pray and backup before try. + + The patch is based on the Japanization work on nvi 1.03 by: + Yoshitaka Tokugawa + and Japanization patch to elvis(vi clone by Steve Kirkendall) by: + Jun-ichiro itojun Itoh + + Some part of multibyte support has been derived from other people's + work. See comment in multibyte.c. + + Multilingual portion copyright(c) 1996, 1997 by Jun-ichiro Itoh. + All rights reserved. + + DOCUMENTATION NOTE + + We denote "multilingualized nvi" as "nvi" where it is obvious. + If it is not obvious, we denote that as "nvi-m17n". + + QUICK START GUIDE (for impatients) + + First of all, please note that the patch DOES NOT multilingual-ize + all the functionality of original nvi. + Therefore, there are some functionalities that shall NOT be invoked. + The list of functionalities that are multilingualized, and that are + not multilingualized, will be provided later in the document. + For details refer to "IT ENABLES..." and "IT DOES NOT ENABLE..." + sections. + + 0. patch the original nvi package. + % cd nvi-1.79 + % patch -p1 < nvi-m17n.diff + 1. configure nvi with multilingual patch enabled. + % cd build + % ./configure --enable-multibyte + If you need canna support (Japanese keyboard input engine), + configure as following. + /usr/local/canna should be the path to canna library/header. + % ./configure --enable-multibyte --enable-canna=/usr/local/canna + + 2. build and install it. + % make + % su + password: xxxx + # make install + + 3. If you're using X, I recommend you to install kterm 6.2.0 for + multilingual display. kterm 6.2.0 can be found at X11R6 contrib + mirror site near you. Also you might need to install some + additional fonts. + + 4. edit the configuration file. (~/.exrc) + 4-a. iso-2022-* display capability + If you have fully iso-2022-* capable terminal software, add the + following line: + set noskipdisplay + If you don't have one, add the following line: + set skipdisplay + 4-b. display encoding + Choose encoding scheme of your terminal output from the list + below. Add a line like this: + set displayencoding=iso-2022-jp + set displayencoding=sjis + set displayencoding=euc-jp + set displayencoding=big5 + Please note that, the display encoding support has very big twist. + See "IT ENABLES..." section for details. + 4-c. keyboard encoding + Choose encoding scheme of your keyboard input from the list below. + Add a line like this: + set inputencoding=euc-jp + Note that not all the encodings are available as keyboard input + encoding. + 4-d. file encoding + Choose encoding scheme of your file i/o from the list below. + Add a line like this: + set fileencoding=iso-2022-jp + Also, if you would like an automatic encoding scheme selection + on file read operation, add the following line: + set autodetect=jp (for detecting euc-jp/sjis/iso-2022-jp) + set autodetect=cn (for detecting euc-cn/big5/hz/iso-2022-cn) + set autodetect=tw (for detecting euc-tw/big5/hz/iso-2022-cn) + set autodetect=kr (for detecting euc-kr/iso-2022-kr) + You can also set autodetection procedure to overwrite + fileencoding option, on file open time. (:e/:n) + In this case, you should append "+" to autodetect option. + In this case, you can preserve encoding method of the file + you are editing: + set autodetect=jp+ + set autodetect=cn+ + + It should be noted that, if you are using chinese encodings + (:set autodetect=cn), it is adviced that you have "euc-cn" or + "big5" set to fileencoding. Making a correct guess between + euc-cn and big5 is almost impossible, so the autodetection + usually fails. If autodetection fails, the value set to + fileencoding will be used. + Therefore, if you prefer big5, use the following setting: + set autodetect=cn fileencoding=big5 + If you prefer euc-cn, use the following setting: + set autodetect=cn fileencoding=euc-cn + No other settings are recommended for chinese code detection. + + If you use autodetection of tiwanese encodings + (:set autodetect=tw) the above description will apply. + Please set fileencoding option to "euc-tw" or "big5". + + 4-e. canna support + If you are willing to use canna support, add the following line: + set canna + If you would like to have automatic canna fence control, add the + following too. (also, set fepkey as you like): + set cannactrl + If you need to specify canna server, do it as following: + set cannaserver="somehost.your.domain" + If you would like to change canna starter key, specify that as + following. This will set the canna starter key to control-O. + be VERY careful making choice!: + set cannakey=^O + + 5. Please note that, after applying this patch, some part of nvi's + original document are no longer valid. + For example, locale-related items (as found as the first question + in nvi-1.79/FAQ) are not applicable to nvi-m17n. + + 6. You're all set. Enjoy! + + Here are some exaples for .exrc file: + + Example 1: using iso-2022-* capable terminal, uses euc-jp terminal + and filesystem, autodetection enabled for Japanese encodings + set noskipdisplay + set displayencoding=euc-jp + set inputencoding=euc-jp + set fileencoding=euc-jp + set autodetect=jp + + Example 2: using iso-2022-* capable terminal, uses iso-2022-jp terminal + and filesystem, autodetection enabled for Japanese encodings, + need canna support, and automatic fence control. + set noskipdisplay + set displayencoding=iso-2022-jp + set inputencoding=iso-2022-jp + set fileencoding=iso-2022-jp + set autodetect=jp + set canna cannactrl + + Example 3: using iso-2022-* capable terminal, uses big5 terminal + and filesystem, autodetection enabled for Chinese encodings + set noskipdisplay + set displayencoding=big5 + set inputencoding=big5 + set fileencoding=big5 + set autodetect=cn + + ENCODING SCHEMES + + "*" sign at the leftmost column of the line indicates that the + encoding is available as keyboard input encoding too. + (:set inputencoding=xxx) + + "!" sign at the leftmost column indicates that the encoding scheme + does not conform to the specification. Please look into the note for + detail. + + Note that multilingual encoding uses iso-2022-* designations for + character sets that are not specified in the encoding specification. + (For example, latin-1 character set in iso-2022-kr, cyrillic in + iso-2022-cn, and so forth) + Monolingual encoding skips characters of unsupported character set. + + For details of encoding scheme treatment, refer to the "IT ENABLES..." + section. + + fully multilingual encodings: + name note initially designated charsets + --- --- --- + * euc-jp-1978 G0=ascii, G1=JIS X0208-1978, + G2=JIS X0201 kana, + G3=JIS X0212-1990. + SS1 and SS2 used + * euc-jp G0=ascii, G1=JIS X0208-1983, + G2=JIS X0201 kana, + G3=JIS X0212-1990. + SS1 and SS2 used + * euc-jp-1983 same as euc-jp + * euc-jp-1990 G0=ascii, G1=JIS X0208-1990, + G2=JIS X0201 kana, + G3=JIS X0212-1990. + SS1 and SS2 used + * euc-cn G0=ascii/G1=GB2312 + * euc-kr G0=ascii/G1=KSC5601 + + * iso-8859-1 8bit G0=ascii/G1=iso-8859-1 + * iso-8859-2 8bit G0=ascii/G1=iso-8859-2 + * iso-8859-3 8bit G0=ascii/G1=iso-8859-3 + * iso-8859-4 8bit G0=ascii/G1=iso-8859-4 + * iso-8859-7 8bit G0=ascii/G1=iso-8859-7 + * iso-8859-8 8bit G0=ascii/G1=iso-8859-8 + * iso-8859-9 8bit G0=ascii/G1=iso-8859-9 + * latin1 8bit alias of iso-8859-1 + * latin2 8bit alias of iso-8859-2 + * iso-2022-cn-ext G0=ascii + rfc1922 SI, SO, SS2 and SS3 used + * iso-2022-cn rfc1922 alias of iso-2022-cn-ext + (they are compatible) + * iso-2022-jp-2 rfc1554 G0=ascii + SS2 used + * iso-2022-jp rfc1468 alias of iso-2022-jp-2 + (they are compatible) + *! iso-2022-kr rfc1557 G0=ascii + SI and SO used + * ctext X11 compound text G0=ascii/G1=iso-8859-1 + 8bit no locking shift used + + * iso-2022-7-1 generic 7bit for test, use G0 only + * iso-2022-7-2 generic 7bit for test, use G0/1 + * iso-2022-8-2 generic 8bit for test, use G0/1 + + monolingual encodings: + name note character sets(fixed) + --- --- --- + * none imitates original nvi G0=ascii, G1=ascii(binary) + * sjis MS-Kanji/Shift JIS + * big5 + * euc-tw G0=ascii, G1=CNS11643-1, + G2=CNS11643-[2-7] + hz rfc1842 + + + iso-2022-kr feature: + Though not documented in rfc1557, actual practice shows that it is + necessery to remove EOL of the line with KSC5601 designation only. + nvi-m17n implements this behavior. + + CHARACTER SETS + + nvi will not recognize the designation sequence for the character + sets that are not listed here. If you need some character sets + to be recognized, please drop the author a note. + + 94 character sets: + name designation to G0 note + --- --- --- + IRV 1983 ESC ( @ + UK ESC ( A + ASCII (IRV 1991) ESC ( B hardcoded as default + Swedish ESC ( C + Norwegian ESC ( E + JIS X0201 right ESC ( I katakana + JIS X0201 left ESC ( J + German ESC ( K + French ESC ( R + Italian ESC ( Y + Spanish ESC ( Z + + 96 character sets: + name designation to G0 note + --- --- --- + Latin1 ESC , A iso-8859-1 + Latin2 ESC , B iso-8859-2 + Latin3 ESC , C iso-8859-3 + Latin4 ESC , D iso-8859-4 + Greek ESC , F iso-8859-7 + Arabic ESC , G iso-8859-6 + Hebrew ESC , H iso-8859-8 + Cyrillic ESC , L iso-8859-5 + Latin5 ESC , M iso-8859-9 + Thai ESC , T TIS620.2529 + Latin6 ESC , V iso-8859-10 + Latin6 additions ESC , X iso-8859-10 additions + + 94x94 character sets: + name designation to G0 note + --- --- --- + JIS X0208 1978 ESC $ ( @ or ESC $ @ + GB2312-80 ESC $ ( A or ESC $ A + JIS X0208 1983 ESC $ ( B or ESC $ B + JIS X0208 1990 ESC & @ ESC $ ( B or ESC & @ ESC $ B + KSC5601 1987 ESC $ ( C + JIS X0212.1990 ESC $ ( D + ISO IR-165 ESC $ ( E + CNS11643-1992-1 ESC $ ( G + CNS11643-1992-2 ESC $ ( H + CNS11643-1992-3 ESC $ ( I + CNS11643-1992-4 ESC $ ( J + CNS11643-1992-5 ESC $ ( K + CNS11643-1992-6 ESC $ ( L + CNS11643-1992-7 ESC $ ( M + Big5-1 ESC $ ( 0 unofficial, Mule-like + Big5-2 ESC $ ( 1 unofficial, Mule-like + + OPTIONS ADDED + + name type range description + --- --- --- --- + autodetect(ad) str - detect encoding at file input + displayencoding(de) str global display encoding + fepkey str - lists cmds with auto fence ctrl + fileencoding(fe) str - file input/output encoding + inputencoding(ie) str - keyboard input encoding + skipdisplay(sd) bool - skip unsupported chars on disp + + OPTIONS ADDED FOR CANNA SUPPORT + + name type range description + --- --- --- --- + canna bool global use canna or not + cannactrl bool - controls fence automatically + cannakey str - canna starter key + cannaserver str global hostname of canna server + + CONFIGURATION + + MULTIBYTE + + On configuration time, you need to add "--enable-multibyte" to enable + multibyte support. Typical installation procedure might be as follows: + % cd build + % ./configure --enable-multibyte + % make + You might want to give a default parameter for multibyte encoding, + such as: + % ./configure --enable-multibyte=euc-kr + % ./configure --enable-multibyte=iso-2022-jp + % ./configure --enable-multibyte=euc-cn + If you didn't specify encoding method, it will become "none". + + CANNA + + If you would like to use canna support, you should add "--enable-canna" + to the argument to configure. It must come with --enable-multibyte. + % cd build + % ./configure --enable-multibyte --enable-canna + + You may need to specify directory where the compiler can find + canna headers and libraries. + If you specify directory SOMEWHERE as argument to --enable-canna, + like: + % ./configure --enable-multibyte --enable-canna=SOMEWHERE + it means that you have the following headers and libraries: + SOMEWHERE/include/canna/jrkanji.h + SOMEWHERE/lib/libcanna.a + + If you have non-standard installation, and the directory prefix + is not the same for headers/libraries, you should specify those + directories manually. If you have headers/libraries in the following + location: + SOMEWHERE/canna/jrkanji.h + ELSEWHERE/libcanna.a + you should do the following: + % env CFLAGS=-ISOMEWHERE LDFLAGS=-LELSEWHERE \ + ./configure --enable-multibyte --enable-canna + + In most cases, you will need to use the following setting: + % ./configure --enable-multibyte --enable-canna=/usr/local/canna + + IT ENABLES... + + Multibyte-safe movement/input. + + Multibyte word movement. (currently japanese/korean only, sorry) + + Console output for iso-2022-* capable terminal, and primitive + euc-jp/euc-cn/euc-kr/euc-tw/sjis/big5 support. + Encoding must be set by + :set displayencoding=foobaa + + The available encodings are listed in "ENCODING SCHEMES" section. + However, it is not very straightforward; read the following + description with care. + + Multibyte chars will be displayed in the following manner: + + 1. If special function was defined for the encoding, use that. + special function is defined for each some 8bit encodings. + name note + --- --- + euc-jp G0/G1 only + G0=ASCII, G1=JIS X0208-1990/1983/1978 + euc-cn + euc-kr + euc-tw G0/G1 only (G0=ASCII, G1=CNS11643-1) + sjis supports JIS X0208-1990/1983/1978 and JIS X0201 kana + big5 + + 2. if ":set skipdisplay" was done, skip it by displaying "?" or "??". + + 3. Otherwise, try displaying it with G0 designation of iso-2022-* + escape sequence, such as "ESC $ B" for JIS X0208-1983, + "ESC , A" for latin-1. We use G0 designation only for simplicity. + It is same as "iso-2022-7-1" encoding, which uses G0 designations + only. + + For multilingual use, (case 3 in the above steps) best suited for + use with fully iso-2022-* capable terminals. For example, you may + want to try kterm-6.2.0, which can be found on ftp servers that has + X11R6 contrib. + + If you would like to know about detail of the patch to curses, + see curses/README.m17n. + + :set displayencoding=xxx is global option, so it will affect + all the sub-screens. On the other hand, :set skipdisplay is + not an global option, so that a user can have a control over it + per sub-screen manner. + + File i/o encoding is switchable. + The available encodings are listed in "ENCODING SCHEMES" section. + + Most of multilingual encodings are made possible by using generic + iso-2022-* parser/generator. + Please note that, some multilingual encoding specification does not + specify some of the character set. For example, iso-2022-jp2 + (RFC1554) specifies how to designate arbitrary character set, + but iso-2022-kr(RFC1557) does not. + If the encoding scheme you are using does not specify how to encode + some character set, nvi will recognize/generate iso-2022-* + escape sequences. + Example: + If you use JIS X0208-1983 while you are using + ":set fileencoding=latin1" setting, nvi will emit + "ESC $ B whatever ESC ( B", which is valid iso-2022-* sequence + for JIS X0208-1983. + + Monolingual encodings (namely sjis and hz) are hardcoded, and + they will just skip any charsets that are not supported. + + :set fileencoding=xxx affects the filter command (! in vi), + file open/read/write (:r, :w, :e and :n), and scripting input/output + to shell (:script). + + Automatic encoding detection at file open/read time. + Capable of autodetecting several encoding schemes on the fly. + :set autodetect=jp (for detecting euc-jp/sjis/iso-2022-jp) + :set autodetect=cn (for detecting euc-cn/big5/hz/iso-2022-cn) + :set autodetect=tw (for detecting euc-tw/big5/hz/iso-2022-cn) + :set autodetect=kr (for detecting euc-kr/iso-2022-kr) + If other value is set to autodetect option, autodetect will not + be performed. + + On file edit-start time (such as :n or :e) or file read time (:r) + the content of the file will be read into the backing database, + then the autodetection procedure starts. Autodetection procedure + tries to figure out the encoding, and converts the backing database + into proper internal expression based on the result. + If the autodetection was unsuccessful, the value set to fileencoding + option (:set fileencoding) will be used as default value. + + You can also set autodetection procedure to overwrite fileencoding + option, at edit-start time. (:e/:n) By doing so, you can preserve + encoding method of an file across edit sessions. + In this case, you should append "+" to autodetect option, like: + set autodetect=jp+ + set autodetect=cn+ + If you use this option, control-G vi command will display the encoding + method you're using. + + Please note that autodetection may take some time over a huge file, + since autodetection procedure may scan whole lines which are + just read into the backing database. + (Maximum lines to be scanned can be changed by changing + PREDICT_MAXLINES in common/multibyte.c.) + Also, autodetection is not always possible; especially for short + files. + I don't think the autodetection procedure will be happy with binary + files, so please be warned. + + :set autodetect=xxx only affects file open/read operations. + (:r, :e and :n) + + It should be noted that, if you are using chinese encodings + (:set autodetect=cn), it is adviced that you have "euc-cn" or + "big5" set to fileencoding. Making a correct guess between + euc-cn and big5 is almost impossible, so the autodetection + usually fails. If autodetection fails, the value set to + fileencoding will be used. + Therefore, if you prefer big5, use the following setting: + :set autodetect=cn fileencoding=big5 + If you prefer euc-cn, use the following setting: + :set autodetect=cn fileencoding=euc-cn + No other settings are recommended for chinese code detection. + + If you use autodetection of tiwanese encodings (:set autodetect=tw) + the above description will apply. Please set fileencoding option + to "euc-tw" or "big5". + + - Multibyte keyboard input. + selection of keyboard input code should be done like: + :set inputencoding=euc-jp + :set inputencoding=iso-2022-jp + euc-jp/kr/cn and iso-2022-* encodings use generic iso-2022-* + parser. Therefore, their input stream handling is truely + multilingual. (as far as we've tested) + Note that if you are going to use iso-2022-* encodings for keyboard + input, there'll be problem with ESC. ESC denotes the start of + character set designation, as well as finish of vi entry mode... + We currently identify them by timeout mechanism. There may some + trouble arise when you are using nvi over very slow serial line. + + - Regular expression search over multibyte chars. + For list of restrictions/notes, refer to regex/README.m17n. + + - Direct canna support for Japanese text entry. + "canna" is an client-server protocol for Japanese text conversion. + added options are listed in separate section. + Canna support is for vi mode only; in ex mode execution, canna + support is not available. + + If you would like to use canna, do the following: + :set canna + It will connect nvi to canna server. You can disconnect from + canna server by doing: + :set nocanna + + To switch to canna mode (activate fence), tap control-O. + The keystroke is determined by cannakey option. You can change + it by setting cannakey option, as follows. This example sets + canna starter key to control-X: + :set cannakey=^X (to enter it on colon mode, use ^V^X) + Please be VERY careful about your choice. The selected keystroke + will overrider everything, and that keystroke will NEVER be passed + to nvi itself, while canna option is set. + + Sometimes it might be annoying to see canna fence activated while + you're in the vi command mode. nvi can automatically control + deactivation of canna. You can enable this feature by setting + the following option: + :set cannactrl + If you set this option, the following events will happen: + - on leaving from text entry (for selected commands), + canna fence will be deactivated automatically. + - on entering to text entry (for selected commands), + canna fence will be activated automatically, + if was recently automatically deactivated. + - on entering to vi command mode (for all commands), + canna fence will be automatically turned off. + You can select commands to be controlled as above, by setting + fepkey option. By default, it is set to "/?aioAIO". + You may want to add "ftFT", for example. + Full-featured example would be as follows: + :set fepkey="?/aioAIOcCrRtfTF" + Believe me, it works. + + To change canna server, do the following + :set cannaserver="hostname.your.domain". + + There are several twists to canna support. See "KNOWN TWISTS" + secton. + + SETTING UP OPTIONS SPECIFIC TO NVI + + As you see, There are several options added to original nvi. + However, under some circumstances, option settings written in .exrc + may trouble you: + 1. If you use both nvi-m17n and original nvi/other vi clone, other + implementations may not understand extended options of nvi-m17n. + In that case, they will bark on startup, or they do not start up. + 2. If you are willing to use multiple settings, it would be nice if + you can switch one setting to another. + + In case of 1., there are three sideways: + - You can use .nexrc rather than .exrc to resolve conflict between + nvi and other vi clones. + Since .nexrc is introduced in original nvi, it is unable to pass + different options to nvi-m17n and original nvi, by using .nexrc. + - You can use environment variable NEXINIT too. + It works just like EXINIT, but it is for nvi/nvi-m17n only. + - You can use wrapper script (described below) + In case of 2., you can use wrapper script. + + Wrapper script + You can use wrapper script to pass some options specific to nvi-m17n. + For example, see below: + + --->8 example for japanese editing (save as, say "jnvi") + #! /bin/sh + + EXINIT0="set canna cannactrl autodetect=jp fileencoding=iso-2022-jp displayencoding=iso-2022-jp inputencoding=iso-2022-jp noskipdisplay" + if [ -f ~/.exrc ]; then + EXINIT="$EXINIT0 `sed -e '/^set /!d' -e 's/^set //' < ~/.exrc | tr '\012' ' '`" + else + EXINIT=$EXINIT0 + fi + export EXINIT + exec /usr/local/bin/nvi $* + --->8 + + ADDITIONAL TOOL + + The package adds a perl script called "regular" to original nvi package. + + regular [-options] + + Some text files contain ASCII text with unnecessery designations. + For example, "a" in UK charset, "a" in JIS X0201 roman charset, + and so forth. They are correct use, however, they sometimes + annoy the users of nvi-m17n since it is not always easy to input those + chars in those charset, not ASCII "a". + Regular converts these chars into ASCII "a". + + Regular has several options. + -7 + Output encoding will be iso-2022-7-1. + All charset will be designated to G0. + No locking shift/single shift will be used. + Regular acts like this by default. + -8 + Output encoding will be iso-2022-8-2. + All 94/94x94 charset will be designated to G0, + and all 96/96x96 charset will be designated to G1. + No locking shift/single shift will be used. + -kr + Assume that input is iso-2022-kr. + It means that, charsets designated to G0/G1/whatever + will be valid across the line-break. In other + cases, designation will be reset to + G0=ASCII, G1=G2=G3=nothing + at every line break. + It eats text from standard input, and generate output to standard + output. Use like + % regular < source.txt > dst.txt + or, from nvi-m17n, use filter (! in vi mode) command. + + Known twists: + - Though nvi-m17n can handle it, output encoding is very uncommon. + It must not be regarded as generic tool. It is just for supporting + nvi-m17n. + - It is not possible to handle euc-*/sjis/big5/whatever document. + If you use vi filter command, fileencoding options in nvi-m17n must + be set to iso-2022-* kind of encoding. + - Regular is DEADLY slow. Be warned. + If you feel it unusable, please use "qregular" instead. + It recognize direct G0/G1 designation only. + + IT DOES NOT ENABLE... + + The patch DOES NOT multilingual-ize all the functionality of nvi. + Therefore, there are some functionalities that shall NOT be invoked. + I list SOME of them here. Check source code for unsupported features: + - sideway scrolling screen mode (:set leftright) sometimes generate + core-dump, or infinite loop. + - display interfaces other than curses will not work. + - can be compiled with embedded perl interpreter. however, it is + almost unusable since perl script will need to handle nvi's + internal code. + - not confirmed with tcl linked. I think it won't work. + - in ex mode, the echoback of the keystroke you typed will be + performed by the terminal software you're using, not by nvi itself. + (this is the behavior of original nvi) + therefore, there might be garbled echoback if your terminal software + does not properly handle it. + - there is no canna support in ex mode, due to screen control + method used by origial nvi. (colon mode in vi has canna support) + + KNOWN TWISTS(of original nvi 1.79) + + There's a problem with tcsh 6.05.00. + In tcsh 6.05.00, + % echo -n 'hoge' | tcsh -c cat + will hang. Also, + % ( echo 'hoge'; echo -n 'hoge') | tcsh -c cat + will produce only the first line, which is a different result from + that of csh. + Because of this, if your login shell is tcsh 6.05.00, and you invoke + "filter 1 line" command (say, "!!cat" or "!!fmt") in nvi, nvi hangs + with tcsh. + The easiest way around it is not to use tcsh from nvi. For that, + you may want to add a line in your .exrc: + set shell=/bin/csh + + If you do + :set + then + :set all + the screen will scroll too much (1 lines more than expected). + You will not be able to read the first line generated by :set all. + + The original nvi assumes that macros defined in ctype.h (isprint(), + isblank() and alike) will properly handle minus values. + (NOTE: this is NOT in the ANSI C specification!) + If it is not satisfied, nvi will hang if chars that are 8th bit set + (0x80-0xff) appears. It is very critical situation to + multilingualization, since it uses values that are 8th bit set heavily. + I've fixed most of the occurences, however, I might missed somewhere. + If nvi hangs in your configuration, please tell me how can you + repeat that. + + KNOWN TWISTS(of nvi-m17n) + + If you use iso-2022-* encoding as keyboard input, + (:set inputencoding=xxx) control-O and control-N will always + be treated as SI/SO which switches character set. Therefore, you + can't use control-N as "next line" vi command. + (If you use canna support, the behavior might be overriden by + canna starter key. See below) + To type in those kind of control key strokes, you should temporarily + change the keyboard encoding, like: + :set inputencoding=none + + Multilingual parser/generator for keyboard, terminal output, file i/o + are implemented separately. They have slightly different + characteristics. This is because: + - Keyboard parser must understand halfway-entered text stream + - Terminal output generator must designate everything into G0 + (although monolingual encoding such as sjis can use 8bit) + - File i/o is the easiest one of the three guys + + Autodetection of chinese encoding method is almost impossible. + + Canna starter key (as defined by :set cannakey) overrides everything. + Therefore, for example, if you set canna starter key to control-O, + you will not be able to use control-O as SI. If you set canna starter + key to control-M, you will not be able to enter CR! + Be very careful choosing starter key. + + Some vi commands are implemented by using other vi commands. + For example, S command is implemented as c_ command. + C, D, S, and Y commands are implemented in this way. + fepkey option looks into translated version of the command. + Therefore, if you enable automatic canna control for c command, + automatic control for S command will be automatically enabled. + see v_alias() in vi/vi.c for details. + + When you set wrapmargin/wraplen option, it will wrap lines at + word boundary which is recognized by W/B vi command. Sometimes + it may look annoying when you do it over multibyte lines. + Now I'm trying to find a good way to wrap multibyte lines. + If you have some comments, please let me know. + + I haven't checked autodetection of korean/chinese encoding very much. + If you have any suggestions, please let me know. + + If you are using iso-2022-* variants to keyboard encoding, + keyboard timeout is too long (twice as long as non-multibyte + implementation). + + Please note that, after applying this patch, some part of nvi's + original document are no longer valid. + For example, locale-related items (as found as the first question + in nvi-1.79/FAQ) are not applicable to nvi-m17n. + + COMMENTS AND SUGGESTIONS + + Bugs and comments should be sent by the following methods: + via http://www.itojun.org/cgi-bin/gnats-send-pr + e-mailed to nvi-m17n@dit.co.jp + Please specify the version number of the patch you've tried. + + CONTACTING THE AUTHOR + + Jun-ichiro itojun Itoh + itojun@mt.cs.keio.ac.jp + itojun@itojun.org + Contribution to the author, in any form (example: just say "thanks"), + is always appreciated. Index: build/Makefile.in Prereq: 8.75 *** nvi-1.79/build/Makefile.in Wed Oct 23 22:43:38 1996 --- nvi-1.79-m17n/build/Makefile.in Sun Mar 30 12:55:22 1997 *************** *** 41,47 **** v_scroll.o v_search.o v_section.o v_sentence.o v_status.o v_txt.o \ v_ulcase.o v_undo.o v_util.o v_word.o v_xchar.o v_yank.o v_z.o \ v_zexit.o vi.o vs_line.o vs_msg.o vs_refresh.o vs_relative.o \ ! vs_smap.o vs_split.o all: nvi @tknvi@ --- 41,50 ---- v_scroll.o v_search.o v_section.o v_sentence.o v_status.o v_txt.o \ v_ulcase.o v_undo.o v_util.o v_word.o v_xchar.o v_yank.o v_z.o \ v_zexit.o vi.o vs_line.o vs_msg.o vs_refresh.o vs_relative.o \ ! vs_smap.o vs_split.o \ ! multibyte.o multi_chclass.o multi_big5.o multi_euc.o multi_eucjp.o \ ! multi_hz.o multi_iso2022.o multi_none.o multi_sjis.o multi_canna.o \ ! multi_euctw.o all: nvi @tknvi@ *************** *** 89,94 **** --- 92,101 ---- `echo vi | sed '$(transform)'` `echo ex | sed '$(transform)'` cd $(bindir) && $(ln) \ `echo vi | sed '$(transform)'` `echo view | sed '$(transform)'` + cd $(bindir) && $(rm) -f regular qregular + $(cp) regular $(bindir)/regular + $(cp) qregular $(bindir)/qregular + cd $(bindir) && $(chmod) $(emode) regular qregular [ -d $(mandir) ] || \ ($(mkdir) $(mandir) && $(chmod) $(dmode) $(mandir)) [ -d $(mandir)/cat1 ] || \ *************** *** 139,145 **** cd $(datadir)/vi/catalog && $(chmod) $(fmode) *) @echo "Installing Perl scripts: $(datadir)/vi/perl ..." $(mkdir) $(datadir)/vi/perl && $(chmod) $(dmode) $(datadir)/vi/perl ! [ -f VI.pm ] && $(cp) VI.pm $(datadir)/vi/perl && \ cd $(datadir)/vi/perl && $(chmod) $(fmode) VI.pm) (cd $(srcdir)/perl_scripts && $(cp) *.pl $(datadir)/vi/perl && \ cd $(datadir)/vi/perl && $(chmod) $(fmode) *.pl) --- 146,152 ---- cd $(datadir)/vi/catalog && $(chmod) $(fmode) *) @echo "Installing Perl scripts: $(datadir)/vi/perl ..." $(mkdir) $(datadir)/vi/perl && $(chmod) $(dmode) $(datadir)/vi/perl ! [ ! -f VI.pm ] || ($(cp) VI.pm $(datadir)/vi/perl && \ cd $(datadir)/vi/perl && $(chmod) $(fmode) VI.pm) (cd $(srcdir)/perl_scripts && $(cp) *.pl $(datadir)/vi/perl && \ cd $(datadir)/vi/perl && $(chmod) $(fmode) *.pl) *************** *** 156,161 **** --- 163,169 ---- cd $(bindir) && $(rm) -f `echo ex | sed '$(transform)'` cd $(bindir) && $(rm) -f `echo vi | sed '$(transform)'` cd $(bindir) && $(rm) -f `echo view | sed '$(transform)'` + cd $(bindir) && $(rm) -f regular qregular cd $(mandir)/cat1 && $(rm) -f `echo ex.0 | sed '$(transform)'` cd $(mandir)/cat1 && $(rm) -f `echo vi.0 | sed '$(transform)'` cd $(mandir)/cat1 && $(rm) -f `echo view.0 | sed '$(transform)'` *************** *** 185,191 **** distclean maintainer-clean realclean: clean cleandocs -rm -f Makefile config.cache config.h config.log config.status ! -rm -f pathnames.h port.h # Vi curses sources. cl_bsd.o: $(srcdir)/cl/cl_bsd.c --- 193,199 ---- distclean maintainer-clean realclean: clean cleandocs -rm -f Makefile config.cache config.h config.log config.status ! -rm -f pathnames.h port.h regular qregular # Vi curses sources. cl_bsd.o: $(srcdir)/cl/cl_bsd.c *************** *** 627,630 **** --- 635,662 ---- strtoul.o: $(srcdir)/clib/strtoul.c $(CC) $(CFLAGS) $? vsnprintf.o: $(srcdir)/clib/vsnprintf.c + $(CC) $(CFLAGS) $? + + # addition by itojun. + multibyte.o: $(srcdir)/common/multibyte.c + $(CC) $(CFLAGS) $? + multi_chclass.o: $(srcdir)/common/multi_chclass.c + $(CC) $(CFLAGS) $? + multi_big5.o: $(srcdir)/common/multi_big5.c + $(CC) $(CFLAGS) $? + multi_euc.o: $(srcdir)/common/multi_euc.c + $(CC) $(CFLAGS) $? + multi_eucjp.o: $(srcdir)/common/multi_eucjp.c + $(CC) $(CFLAGS) $? + multi_hz.o: $(srcdir)/common/multi_hz.c + $(CC) $(CFLAGS) $? + multi_iso2022.o: $(srcdir)/common/multi_iso2022.c + $(CC) $(CFLAGS) $? + multi_none.o: $(srcdir)/common/multi_none.c + $(CC) $(CFLAGS) $? + multi_sjis.o: $(srcdir)/common/multi_sjis.c + $(CC) $(CFLAGS) $? + multi_canna.o: $(srcdir)/common/multi_canna.c + $(CC) $(CFLAGS) $? + multi_euctw.o: $(srcdir)/common/multi_euctw.c $(CC) $(CFLAGS) $? Index: build/acconfig.h Prereq: 8.18 *** nvi-1.79/build/acconfig.h Wed Jul 3 08:37:39 1996 --- nvi-1.79-m17n/build/acconfig.h Wed Apr 2 13:28:03 1997 *************** *** 80,82 **** --- 80,92 ---- /* Define if your sprintf returns a pointer, not a length. */ #undef SPRINTF_RET_CHARPNT + + /* Define if you need multibyte support. */ + #undef MULTIBYTE + + /* Default value for multibyte support. */ + #undef DEFAULT_ENCODING + + /* Define if you need Canna support. */ + #undef CANNA + Index: build/config.h.in *** nvi-1.79/build/config.h.in Fri Oct 11 09:17:23 1996 --- nvi-1.79-m17n/build/config.h.in Wed Aug 20 14:47:14 1997 *************** *** 112,117 **** --- 112,126 ---- /* Define if your sprintf returns a pointer, not a length. */ #undef SPRINTF_RET_CHARPNT + /* Define if you need multibyte support. */ + #undef MULTIBYTE + + /* Default value for multibyte support. */ + #undef DEFAULT_ENCODING + + /* Define if you need Canna support. */ + #undef CANNA + /* Define if you have the bsearch function. */ #undef HAVE_BSEARCH *************** *** 172,179 **** /* Define if you have the unsetenv function. */ #undef HAVE_UNSETENV - /* Define if you have the valloc function. */ - #undef HAVE_VALLOC - /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF --- 181,188 ---- /* Define if you have the unsetenv function. */ #undef HAVE_UNSETENV /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF + + /* Define if you have the header file. */ + #undef HAVE_UNISTD_H Index: build/configure *** nvi-1.79/build/configure Wed Oct 23 22:53:07 1996 --- nvi-1.79-m17n/build/configure Wed Aug 20 14:47:17 1997 *************** *** 1,8 **** #! /bin/sh # Guess values for system-dependent variables and create Makefiles. ! # Generated automatically using autoconf version 2.7 ! # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. --- 1,8 ---- #! /bin/sh # Guess values for system-dependent variables and create Makefiles. ! # Generated automatically using autoconf version 2.12 ! # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. *************** *** 14,21 **** --- 14,25 ---- ac_help="$ac_help --enable-debug Build a debugging version." ac_help="$ac_help + --enable-multibyte[=ARG] Build a multibyte version." + ac_help="$ac_help --with-x use the X Window System" ac_help="$ac_help + --enable-canna[=DIR] Build a canna version." + ac_help="$ac_help --enable-perlinterp Include a Perl interpreter in vi." ac_help="$ac_help --enable-tknvi Build a Tk/Tcl front-end for vi." *************** *** 65,70 **** --- 69,76 ---- # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= + # Maximum number of lines to put in a shell here document. + ac_max_here_lines=12 ac_prev= for ac_option *************** *** 346,352 **** verbose=yes ;; -version | --version | --versio | --versi | --vers) ! echo "configure generated by autoconf version 2.7" exit 0 ;; -with-* | --with-*) --- 352,358 ---- verbose=yes ;; -version | --version | --versio | --versi | --vers) ! echo "configure generated by autoconf version 2.12" exit 0 ;; -with-* | --with-*) *************** *** 448,458 **** done # NLS nuisances. ! # Only set LANG and LC_ALL to C if already set. ! # These must not be set unconditionally because not all systems understand ! # e.g. LANG=C (notably SCO). ! if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LANG+set}" = set; then LANG=C; export LANG; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h --- 454,467 ---- done # NLS nuisances. ! # Only set these to C if already set. These must not be set unconditionally ! # because not all systems understand e.g. LANG=C (notably SCO). ! # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! ! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi + if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi + if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi + if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h *************** *** 511,522 **** ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ! ac_cpp='echo $CPP $CPPFLAGS 1>&5; ! $CPP $CPPFLAGS' ! ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5; ! ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' ! ac_link='echo ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5; ! ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. --- 520,529 ---- ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ! ac_cpp='$CPP $CPPFLAGS' ! ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ! ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' ! cross_compiling=$ac_cv_prog_cc_cross if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. *************** *** 563,573 **** # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ! IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in --- 570,581 ---- # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 + echo "configure:574: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ! IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in *************** *** 590,596 **** ;; esac done ! IFS="$ac_save_ifs" fi if test "${ac_cv_path_install+set}" = set; then --- 598,604 ---- ;; esac done ! IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then *************** *** 618,623 **** --- 626,632 ---- fi echo $ac_n "checking host system type""... $ac_c" 1>&6 + echo "configure:630: checking host system type" >&5 host_alias=$host case "$host_alias" in *************** *** 632,640 **** esac host=`$ac_config_sub $host_alias` ! host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` ! host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` ! host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 if test "$program_transform_name" = s,x,x,; then --- 641,649 ---- esac host=`$ac_config_sub $host_alias` ! host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` ! host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` ! host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 if test "$program_transform_name" = s,x,x,; then *************** *** 658,663 **** --- 667,673 ---- echo $ac_n "checking if --enable-debug option specified""... $ac_c" 1>&6 + echo "configure:671: checking if --enable-debug option specified" >&5 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" *************** *** 676,681 **** --- 686,720 ---- fi echo "$ac_t""$vi_cv_debug" 1>&6 + echo $ac_n "checking if --enable-multibyte option specified""... $ac_c" 1>&6 + echo "configure:691: checking if --enable-multibyte option specified" >&5 + # Check whether --enable-multibyte or --disable-multibyte was given. + if test "${enable_multibyte+set}" = set; then + enableval="$enable_multibyte" + vi_cv_multibyte="yes"; vi_cv_defencoding=$enableval + else + vi_cv_multibyte="no" + fi + + if test "$vi_cv_multibyte" = yes; then + cat >> confdefs.h <<\EOF + #define MULTIBYTE 1 + EOF + + if test "$vi_cv_defencoding" = yes; then + cat >> confdefs.h <> confdefs.h <&6 + case "$host_os" in *************** *** 693,698 **** --- 732,738 ---- lynxos*) # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:736: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 708,714 **** fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc" fi fi CC="$ac_cv_prog_CC" --- 748,753 ---- *************** *** 718,725 **** --- 757,854 ---- echo "$ac_t""no" 1>&6 fi + if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. + set dummy cc; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:765: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" + if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi + fi + fi + fi + CC="$ac_cv_prog_CC" + if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } + fi + + echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 + echo "configure:813: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + + ac_ext=c + # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. + ac_cpp='$CPP $CPPFLAGS' + ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' + ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + cross_compiling=$ac_cv_prog_cc_cross + + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no + fi + rm -fr conftest* + + echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 + if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } + fi + echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 + echo "configure:847: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 + echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 + cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 + echo "configure:852: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 728,734 **** yes; #endif EOF ! if ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no --- 857,863 ---- yes; #endif EOF ! if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:861: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no *************** *** 736,764 **** fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes ! if test "${CFLAGS+set}" != set; then ! echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 ! if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ! ac_cv_prog_gcc_g=yes else ! ac_cv_prog_gcc_g=no fi rm -f conftest* fi ! echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 ! if test $ac_cv_prog_gcc_g = yes; then ! CFLAGS="-g -O" ! else ! CFLAGS="-O" ! fi fi else GCC= --- 865,898 ---- fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + if test $ac_cv_prog_gcc = yes; then GCC=yes ! ac_test_CFLAGS="${CFLAGS+set}" ! ac_save_CFLAGS="$CFLAGS" ! CFLAGS= ! echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 ! echo "configure:876: checking whether ${CC-cc} accepts -g" >&5 ! if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ! ac_cv_prog_cc_g=yes else ! ac_cv_prog_cc_g=no fi rm -f conftest* fi ! echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 ! if test "$ac_test_CFLAGS" = set; then ! CFLAGS="$ac_save_CFLAGS" ! elif test $ac_cv_prog_cc_g = yes; then ! CFLAGS="-g -O2" ! else ! CFLAGS="-O2" fi else GCC= *************** *** 766,771 **** --- 900,906 ---- fi echo $ac_n "checking for GNU C (gcc) version 2.x""... $ac_c" 1>&6 + echo "configure:904: checking for GNU C (gcc) version 2.x" >&5 ac_cv_gcc_vers=`${CC-cc} -v 2>&1 | \ grep "gcc version " | sed 's/.*version //'` ac_cv_gcc_major=`echo "$ac_cv_gcc_vers" | sed 's/\..*//'` *************** *** 826,901 **** LIBS="$ADDLIBS $LIBS" - # If we cannot run a trivial program, we must be cross compiling. - echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 - if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 - else - if test "$cross_compiling" = yes; then - ac_cv_c_cross=yes - else - cat > conftest.$ac_ext </dev/null; then - ac_cv_c_cross=no - else - ac_cv_c_cross=yes - fi - fi - rm -fr conftest* - fi - - echo "$ac_t""$ac_cv_c_cross" 1>&6 - cross_compiling=$ac_cv_c_cross - echo $ac_n "checking whether the compiler ($CC $CFLAGS $LDFLAGS) actually works""... $ac_c" 1>&6 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ! ac_cpp='echo $CPP $CPPFLAGS 1>&5; ! $CPP $CPPFLAGS' ! ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5; ! ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' ! ac_link='echo ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5; ! ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' if test "$cross_compiling" = yes; then cat > conftest.$ac_ext < conftest.$ac_ext </dev/null; then am_cv_prog_cc_works=yes else am_cv_prog_cc_works=no fi - fi rm -fr conftest* case "$am_cv_prog_cc_works" in *no) { echo "configure: error: Installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } ;; --- 961,1013 ---- LIBS="$ADDLIBS $LIBS" echo $ac_n "checking whether the compiler ($CC $CFLAGS $LDFLAGS) actually works""... $ac_c" 1>&6 + echo "configure:966: checking whether the compiler ($CC $CFLAGS $LDFLAGS) actually works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ! ac_cpp='$CPP $CPPFLAGS' ! ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ! ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' ! cross_compiling=$ac_cv_prog_cc_cross if test "$cross_compiling" = yes; then cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* am_cv_prog_cc_works=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* am_cv_prog_cc_works=no fi rm -f conftest* else ! cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then am_cv_prog_cc_works=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* am_cv_prog_cc_works=no fi rm -fr conftest* + fi + case "$am_cv_prog_cc_works" in *no) { echo "configure: error: Installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } ;; *************** *** 909,914 **** --- 1021,1027 ---- # Extract the first word of "sh", so it can be a program name with args. set dummy sh; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1025: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_shell'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 945,950 **** --- 1058,1064 ---- # Extract the first word of "sendmail", so it can be a program name with args. set dummy sendmail; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1062: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_sendmail'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 984,989 **** --- 1098,1104 ---- # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1102: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_perl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 1018,1023 **** --- 1133,1139 ---- echo $ac_n "checking for preserve directory""... $ac_c" 1>&6 + echo "configure:1137: checking for preserve directory" >&5 if eval "test \"`echo '$''{'vi_cv_path_preserve'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 1049,1054 **** --- 1165,1171 ---- # Extract the first word of "chmod", so it can be a program name with args. set dummy chmod; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1169: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_chmod'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 1080,1085 **** --- 1197,1203 ---- # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1201: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_cp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 1111,1116 **** --- 1229,1235 ---- # Extract the first word of "ln", so it can be a program name with args. set dummy ln; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1233: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_ln'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 1142,1147 **** --- 1261,1267 ---- # Extract the first word of "mkdir", so it can be a program name with args. set dummy mkdir; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1265: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_mkdir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 1173,1178 **** --- 1293,1299 ---- # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1297: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_rm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 1204,1209 **** --- 1325,1331 ---- # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1329: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_strip'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 1234,1239 **** --- 1356,1362 ---- echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 + echo "configure:1360: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= *************** *** 1248,1278 **** # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ! eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else echo "$ac_err" >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ! eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else echo "$ac_err" >&5 rm -rf conftest* CPP=/lib/cpp fi --- 1371,1407 ---- # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ! ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1381: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ! ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1398: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi *************** *** 1292,1297 **** --- 1421,1427 ---- # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 + echo "configure:1425: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then *************** *** 1299,1315 **** : fi if test "x$with_x" = xno; then ! no_x=yes else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then ! no_x= else ! if eval "test \"`echo '$''{'ac_cv_path_x'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # One or both of the vars are not set, and there is no cached value. ! no_x=yes rm -fr conftestdir if mkdir conftestdir; then cd conftestdir --- 1429,1448 ---- : fi + # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then ! # The user explicitly disabled X. ! have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then ! # Both variables are already set. ! have_x=yes else ! if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # One or both of the vars are not set, and there is no cached value. ! ac_x_includes=NO ac_x_libraries=NO rm -fr conftestdir if mkdir conftestdir; then cd conftestdir *************** *** 1319,1325 **** @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' EOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then - no_x= # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. --- 1452,1457 ---- *************** *** 1329,1335 **** ac_im_usrlibdir=$ac_im_libdir; break fi done ! # Screen out bogus values from the imake configuration. case "$ac_im_incroot" in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; --- 1461,1469 ---- ac_im_usrlibdir=$ac_im_libdir; break fi done ! # Screen out bogus values from the imake configuration. They are ! # bogus both because they are the default anyway, and because ! # using them would break gcc on systems where it needs fixed includes. case "$ac_im_incroot" in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; *************** *** 1343,1387 **** rm -fr conftestdir fi ! if test "$no_x" = yes; then ! test -z "$x_direct_test_library" && x_direct_test_library=Xt ! test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc ! test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h cat > conftest.$ac_ext < EOF ! eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* ! no_x= ac_x_includes= else echo "$ac_err" >&5 rm -rf conftest* ! for ac_dir in \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ - /usr/X11/include \ - /usr/include/X11 \ - /usr/local/X11/include \ - /usr/local/include/X11 \ - \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ --- 1477,1527 ---- rm -fr conftestdir fi ! if test "$ac_x_includes" = NO; then ! # Guess where to find include files, by looking for this one X11 .h file. ! test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h ! ! # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ! ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* ! # We can compile using X headers with no special include directory. ! ac_x_includes= else echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* ! # Look for the header file in a standard set of common directories. ! # Check X11 before X11Rn because it is often a symlink to the current release. ! for ac_dir in \ ! /usr/X11/include \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ + /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ + /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ + /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ *************** *** 1398,1453 **** ; \ do if test -r "$ac_dir/$x_direct_test_include"; then ! no_x= ac_x_includes=$ac_dir break fi done fi rm -f conftest* ! # Check for the libraries. ! # See if we find them without any special options. ! # Don't add to $LIBS permanently. ! ac_save_LIBS="$LIBS" ! LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ! LIBS="$ac_save_LIBS" ! # We can link X programs with no special library path. ! ac_x_libraries= else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="$ac_save_LIBS" # First see if replacing the include by lib works. + # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ + /usr/X11/lib \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ + /usr/lib/X11 \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ + /usr/local/X11/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ + /usr/local/lib/X11 \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ *************** *** 1458,1463 **** --- 1607,1613 ---- /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ + /lib/usr/lib/X11 \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ *************** *** 1465,1495 **** do for ac_extension in a so sl; do if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then ! no_x= ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest* ! fi ! if test "$no_x" = yes; then ! ac_cv_path_x="no_x=yes" ! else ! ac_cv_path_x="no_x= ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi ! eval "$ac_cv_path_x" fi # $with_x != no ! if test "$no_x" = yes; then ! echo "$ac_t""no" 1>&6 else test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries ! ac_cv_path_x="no_x= ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 fi --- 1615,1652 ---- do for ac_extension in a so sl; do if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then ! ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest* + fi # $ac_x_libraries = NO ! if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then ! # Didn't find X anywhere. Cache the known absence of X. ! ac_cv_have_x="have_x=no" ! else ! # Record where we found X for the cache. ! ac_cv_have_x="have_x=yes \ ! ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi ! eval "$ac_cv_have_x" fi # $with_x != no ! if test "$have_x" != yes; then ! echo "$ac_t""$have_x" 1>&6 ! no_x=yes else + # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries ! # Update the cache value to reflect the command line values. ! ac_cv_have_x="have_x=yes \ ! ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 fi *************** *** 1508,1516 **** --- 1665,1802 ---- fi fi + echo $ac_n "checking if --enable-canna option specified""... $ac_c" 1>&6 + echo "configure:1670: checking if --enable-canna option specified" >&5 + # Check whether --enable-canna or --disable-canna was given. + if test "${enable_canna+set}" = set; then + enableval="$enable_canna" + vi_cv_canna="yes"; vi_cannapath=$enableval + else + vi_cv_canna="no" + fi + + echo "$ac_t""$vi_cv_canna" 1>&6 + if test "$vi_cv_canna" = "yes"; then + if test "$vi_cv_multibyte" = "no"; then + echo "Fatal error: --enable-canna needs --enable-multibyte." + exit 1 + fi + + if test "$vi_cannapath" = "yes"; then + case "$host_os" in + bsdi2.1) + vi_cannapath="/usr/contrib/canna";; + freebsd2.2*|freebsd3*) + vi_cannapath="/usr/local";; + freebsd2*) + vi_cannapath="/usr/local/canna";; + *) + vi_cannapath="/usr/local/canna";; + esac + fi + + if test "$vi_cannapath" != "yes"; then + CFLAGS="-I$vi_cannapath/include $CFLAGS" + LDFLAGS="-L$vi_cannapath/lib $LDFLAGS" + fi + + echo $ac_n "checking for canna/jrkanji.h""... $ac_c" 1>&6 + echo "configure:1705: checking for canna/jrkanji.h" >&5 + if eval "test \"`echo '$''{'vi_cv_cannahdrcheck'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + int main() { + jrKanjiStatus ks; + ; return 0; } + EOF + if { (eval echo configure:1717: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + vi_cv_cannahdrcheck="yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + vi_cv_cannahdrcheck="no" + fi + rm -f conftest* + fi + + echo "$ac_t""$vi_cv_cannahdrcheck" 1>&6 + if test "$vi_cv_cannahdrcheck" = "no"; then + echo -n "Fatal error: no canna header in suggested path" + if test "$vi_cannapath" != "yes"; then + echo ", $vi_cannapath/include." + else + echo "." + fi + exit 1 + fi + + echo $ac_n "checking for jrKanjiControl in -lcanna""... $ac_c" 1>&6 + echo "configure:1741: checking for jrKanjiControl in -lcanna" >&5 + ac_lib_var=`echo canna'_'jrKanjiControl | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_save_LIBS="$LIBS" + LIBS="-lcanna $LIBS" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" + fi + rm -f conftest* + LIBS="$ac_save_LIBS" + + fi + if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + vi_cv_cannalibcheck="yes" + else + echo "$ac_t""no" 1>&6 + vi_cv_cannalibcheck="no" + fi + + if test "$vi_cv_cannalibcheck" = "no"; then + echo "Fatal error: no canna library in suggested path" + if test "$vi_cannapath" != "yes"; then + echo ", $vi_cannapath/lib." + else + echo "." + fi + exit 1 + fi + LIBS="-lcanna $LIBS" + cat >> confdefs.h <<\EOF + #define CANNA 1 + EOF + + fi + echo $ac_n "checking if --enable-perlinterp option specified""... $ac_c" 1>&6 + echo "configure:1800: checking if --enable-perlinterp option specified" >&5 # Check whether --enable-perlinterp or --disable-perlinterp was given. if test "${enable_perlinterp+set}" = set; then enableval="$enable_perlinterp" *************** *** 1565,1570 **** --- 1851,1857 ---- echo $ac_n "checking if --enable-tknvi option specified""... $ac_c" 1>&6 + echo "configure:1855: checking if --enable-tknvi option specified" >&5 # Check whether --enable-tknvi or --disable-tknvi was given. if test "${enable_tknvi+set}" = set; then enableval="$enable_tknvi" *************** *** 1580,1585 **** --- 1867,1873 ---- fi echo $ac_n "checking if --enable-tclinterp option specified""... $ac_c" 1>&6 + echo "configure:1871: checking if --enable-tclinterp option specified" >&5 # Check whether --enable-tclinterp or --disable-tclinterp was given. if test "${enable_tclinterp+set}" = set; then enableval="$enable_tclinterp" *************** *** 1599,1624 **** fi if test "$vi_cv_tknvi" = "yes" || test "$vi_cv_tclinterp" = "yes"; then ! echo $ac_n "checking for -ltcl""... $ac_c" 1>&6 ! ac_lib_var=`echo tcl | tr '.-/+' '___p'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ltcl -ltk -lm $LIBS" cat > conftest.$ac_ext <&6 ! echo "configure:1892: checking for main in -ltcl" >&5 ! ac_lib_var=`echo tcl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ltcl -ltk -lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi *************** *** 1645,1670 **** LIBOBJS="api.o $LIBOBJS" fi ! echo $ac_n "checking for -ltermlib""... $ac_c" 1>&6 ! ac_lib_var=`echo termlib | tr '.-/+' '___p'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ltermlib $LIBS" cat > conftest.$ac_ext <&6 ! echo "configure:1940: checking for tgetent in -ltermlib" >&5 ! ac_lib_var=`echo termlib'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ltermlib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi *************** *** 1681,1706 **** fi if test "$vi_cv_termlib" = no; then ! echo $ac_n "checking for -ltermcap""... $ac_c" 1>&6 ! ac_lib_var=`echo termcap | tr '.-/+' '___p'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&6 ! echo "configure:1982: checking for tgetent in -ltermcap" >&5 ! ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi *************** *** 1722,1727 **** --- 2024,2030 ---- fi echo $ac_n "checking if --disable-curses option specified""... $ac_c" 1>&6 + echo "configure:2028: checking if --disable-curses option specified" >&5 # Check whether --enable-curses or --disable-curses was given. if test "${enable_curses+set}" = set; then enableval="$enable_curses" *************** *** 1740,1760 **** esac echo $ac_n "checking for sys/mman.h""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_include_sys_mman'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ! eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* vi_cv_include_sys_mman=yes else echo "$ac_err" >&5 rm -rf conftest* vi_cv_include_sys_mman=no fi --- 2043,2067 ---- esac echo $ac_n "checking for sys/mman.h""... $ac_c" 1>&6 + echo "configure:2047: checking for sys/mman.h" >&5 if eval "test \"`echo '$''{'vi_cv_include_sys_mman'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ! ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:2057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* vi_cv_include_sys_mman=yes else echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_include_sys_mman=no fi *************** *** 1770,1790 **** echo "$ac_t""$vi_cv_include_sys_mman" 1>&6 echo $ac_n "checking for sys/select.h""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_include_sys_select'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ! eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* vi_cv_include_sys_select=yes else echo "$ac_err" >&5 rm -rf conftest* vi_cv_include_sys_select=no fi --- 2077,2101 ---- echo "$ac_t""$vi_cv_include_sys_mman" 1>&6 echo $ac_n "checking for sys/select.h""... $ac_c" 1>&6 + echo "configure:2081: checking for sys/select.h" >&5 if eval "test \"`echo '$''{'vi_cv_include_sys_select'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ! ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:2091: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* vi_cv_include_sys_select=yes else echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_include_sys_select=no fi *************** *** 1800,1823 **** echo "$ac_t""$vi_cv_include_sys_select" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include #include EOF ! eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes else echo "$ac_err" >&5 rm -rf conftest* ac_cv_header_stdc=no fi --- 2111,2138 ---- echo "$ac_t""$vi_cv_include_sys_select" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 + echo "configure:2115: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include #include EOF ! ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:2128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes else echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_stdc=no fi *************** *** 1826,1832 **** if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF --- 2141,2147 ---- if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF *************** *** 1844,1850 **** 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 < EOF --- 2159,2165 ---- 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 < EOF *************** *** 1864,1871 **** if test "$cross_compiling" = yes; then : else ! cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') --- 2179,2186 ---- if test "$cross_compiling" = yes; then : else ! cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') *************** *** 1876,1890 **** exit (0); } EOF ! eval $ac_link ! if test -s conftest && (./conftest; exit) 2>/dev/null; then : else ac_cv_header_stdc=no fi - fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 --- 2191,2209 ---- exit (0); } EOF ! if { (eval echo configure:2195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then : else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* ac_cv_header_stdc=no fi rm -fr conftest* fi + + fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 *************** *** 1896,1914 **** fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ! egrep "ssize_t" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_ssize_t=yes else --- 2215,2235 ---- fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 + echo "configure:2219: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include + #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ! egrep "ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_ssize_t=yes else *************** *** 1927,1984 **** fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include ! int main() { return 0; } ! int t() { #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include ! int main() { return 0; } ! int t() { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* ac_cv_c_bigendian=yes else rm -rf conftest* ac_cv_c_bigendian=no fi rm -f conftest* ! fi rm -f conftest* - if test $ac_cv_c_bigendian = unknown; then if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext <&6 + echo "configure:2252: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include ! int main() { #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif ; return 0; } EOF ! if { (eval echo configure:2270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include ! int main() { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } EOF ! if { (eval echo configure:2285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_bigendian=no fi rm -f conftest* ! else ! echo "configure: failed program was:" >&5 ! cat conftest.$ac_ext >&5 fi rm -f conftest* if test $ac_cv_c_bigendian = unknown; then if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext </dev/null; then ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi - fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_c_bigendian" 1>&6 --- 2314,2332 ---- exit (u.c[sizeof (long) - 1] == 1); } EOF ! if { (eval echo configure:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then ac_cv_c_bigendian=no else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* ac_cv_c_bigendian=yes fi rm -fr conftest* fi + + fi fi echo "$ac_t""$ac_cv_c_bigendian" 1>&6 *************** *** 2011,2025 **** fi echo $ac_n "checking for working const""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 + echo "configure:2342: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 --- 2392,2407 ---- ; return 0; } EOF ! if { (eval echo configure:2396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_const=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_c_const" 1>&6 *************** *** 2085,2112 **** fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include ! int main() { return 0; } ! int t() { struct stat s; s.st_blksize; ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* ac_cv_struct_st_blksize=yes else rm -rf conftest* ac_cv_struct_st_blksize=no fi rm -f conftest* - fi echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6 --- 2413,2441 ---- fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 + echo "configure:2417: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include ! int main() { struct stat s; s.st_blksize; ; return 0; } EOF ! if { (eval echo configure:2430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_struct_st_blksize=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6 *************** *** 2118,2136 **** fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ! egrep "mode_t" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_mode_t=yes else --- 2447,2467 ---- fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 + echo "configure:2451: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include + #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ! egrep "mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_mode_t=yes else *************** *** 2149,2167 **** fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ! egrep "off_t" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_off_t=yes else --- 2480,2500 ---- fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 + echo "configure:2484: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include + #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ! egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_off_t=yes else *************** *** 2180,2198 **** fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ! egrep "pid_t" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_pid_t=yes else --- 2513,2533 ---- fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 + echo "configure:2517: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include + #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ! egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_pid_t=yes else *************** *** 2211,2229 **** fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ! egrep "size_t" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_size_t=yes else --- 2546,2566 ---- fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 + echo "configure:2550: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include + #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ! egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_size_t=yes else *************** *** 2242,2269 **** fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include ! int main() { return 0; } ! int t() { struct tm *tp; tp->tm_sec; ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* ac_cv_struct_tm=time.h else rm -rf conftest* ac_cv_struct_tm=sys/time.h fi rm -f conftest* - fi echo "$ac_t""$ac_cv_struct_tm" 1>&6 --- 2579,2607 ---- fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 + echo "configure:2583: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include ! int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF ! if { (eval echo configure:2596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_struct_tm=sys/time.h fi rm -f conftest* fi echo "$ac_t""$ac_cv_struct_tm" 1>&6 *************** *** 2278,2297 **** for ac_func in bsearch gethostname getopt memchr memcpy memmove memset do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char $ac_func(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 2616,2637 ---- for ac_func in bsearch gethostname getopt memchr memcpy memmove memset do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:2620: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* 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(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2304,2319 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` --- 2644,2661 ---- ; return 0; } EOF ! if { (eval echo configure:2648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` *************** *** 2329,2348 **** for ac_func in bsearch gethostname getopt memchr memcpy memmove memset do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char $ac_func(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 2671,2692 ---- for ac_func in bsearch gethostname getopt memchr memcpy memmove memset do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:2675: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* 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(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2355,2397 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ! : else echo "$ac_t""no" 1>&6 LIBOBJS="$LIBOBJS ${ac_func}.o" fi - done for ac_func in mkstemp mmap snprintf strdup strerror strpbrk strtol do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char $ac_func(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 2699,2749 ---- ; return 0; } EOF ! if { (eval echo configure:2703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ! ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` ! cat >> confdefs.h <&6 LIBOBJS="$LIBOBJS ${ac_func}.o" fi done + for ac_func in mkstemp mmap snprintf strdup strerror strpbrk strtol do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:2732: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* 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(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2404,2419 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` --- 2756,2773 ---- ; return 0; } EOF ! if { (eval echo configure:2760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` *************** *** 2429,2448 **** for ac_func in mkstemp mmap snprintf strdup strerror strpbrk strtol do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char $ac_func(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 2783,2804 ---- for ac_func in mkstemp mmap snprintf strdup strerror strpbrk strtol do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:2787: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* 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(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2455,2497 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ! : else echo "$ac_t""no" 1>&6 LIBOBJS="$LIBOBJS ${ac_func}.o" fi - done for ac_func in strtoul vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char $ac_func(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 2811,2861 ---- ; return 0; } EOF ! if { (eval echo configure:2815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ! ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` ! cat >> confdefs.h <&6 LIBOBJS="$LIBOBJS ${ac_func}.o" fi done + for ac_func in strtoul vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:2844: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* 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(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2504,2519 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` --- 2868,2885 ---- ; return 0; } EOF ! if { (eval echo configure:2872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` *************** *** 2529,2548 **** for ac_func in strtoul vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char $ac_func(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 2895,2916 ---- for ac_func in strtoul vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:2899: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* 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(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2555,2598 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ! : else echo "$ac_t""no" 1>&6 LIBOBJS="$LIBOBJS ${ac_func}.o" fi - done for ac_func in select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char $ac_func(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 2923,2974 ---- ; return 0; } EOF ! if { (eval echo configure:2927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ! ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` ! cat >> confdefs.h <&6 LIBOBJS="$LIBOBJS ${ac_func}.o" fi done + for ac_func in select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:2957: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* 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(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2605,2620 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` --- 2981,2998 ---- ; return 0; } EOF ! if { (eval echo configure:2985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` *************** *** 2630,2649 **** for ac_func in setenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char $ac_func(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 3008,3029 ---- for ac_func in setenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:3012: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* 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(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2656,2671 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` --- 3036,3053 ---- ; return 0; } EOF ! if { (eval echo configure:3040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` *************** *** 2682,2701 **** for ac_func in strsep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char $ac_func(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 3064,3085 ---- for ac_func in strsep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:3068: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* 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(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2708,2723 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` --- 3092,3109 ---- ; return 0; } EOF ! if { (eval echo configure:3096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` *************** *** 2734,2753 **** for ac_func in unsetenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char $ac_func(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 3120,3141 ---- for ac_func in unsetenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:3124: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* 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(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2760,2775 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` --- 3148,3165 ---- ; return 0; } EOF ! if { (eval echo configure:3152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` *************** *** 2784,2806 **** done ! for ac_func in valloc getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char $ac_func(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 3174,3238 ---- done ! for ac_hdr in unistd.h ! do ! ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ! echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ! echo "configure:3182: checking for $ac_hdr" >&5 ! if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then ! echo $ac_n "(cached) $ac_c" 1>&6 ! else ! cat > conftest.$ac_ext < ! EOF ! ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:3192: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ! ac_err=`grep -v '^ *+' conftest.out` ! if test -z "$ac_err"; then ! rm -rf conftest* ! eval "ac_cv_header_$ac_safe=yes" ! else ! echo "$ac_err" >&5 ! echo "configure: failed program was:" >&5 ! cat conftest.$ac_ext >&5 ! rm -rf conftest* ! eval "ac_cv_header_$ac_safe=no" ! fi ! rm -f conftest* ! fi ! if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ! echo "$ac_t""yes" 1>&6 ! ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` ! cat >> confdefs.h <&6 ! fi ! done ! ! for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:3221: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* 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(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2813,2828 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` --- 3245,3262 ---- ; return 0; } EOF ! if { (eval echo configure:3249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` *************** *** 2836,2952 **** done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 ! if eval "test \"`echo '$''{'ac_cv_func_mmap'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ! ac_cv_func_mmap=no else ! cat > conftest.$ac_ext < #include #include #ifndef HAVE_GETPAGESIZE ! # include ! # ifdef EXEC_PAGESIZE ! # define getpagesize() EXEC_PAGESIZE ! # else ! # ifdef NBPG ! # define getpagesize() NBPG * CLSIZE ! # ifndef CLSIZE ! # define CLSIZE 1 ! # endif ! # else ! # ifdef NBPC ! # define getpagesize() NBPC ! # else ! # define getpagesize() PAGESIZE /* SVR4 */ ! # endif ! # endif # endif - #endif ! #ifndef HAVE_VALLOC ! # define valloc malloc ! #endif #ifdef __cplusplus ! extern "C" { void *valloc(unsigned), *malloc(unsigned); } #else ! char *valloc(), *malloc(); #endif int main() { ! char *buf1, *buf2, *buf3; ! int i = getpagesize(), j; ! int i2 = i * 2; ! int fd; ! ! buf1 = (char *)valloc(i2); ! buf2 = (char *)valloc(i); ! buf3 = (char *)malloc(i2); ! for (j = 0; j < i2; ++j) ! *(buf1 + j) = rand(); ! fd = open("conftestmmap", O_CREAT | O_RDWR, 0666); ! write(fd, buf1, i2); ! mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, fd, 0); ! for (j = 0; j < i; ++j) ! if (*(buf1 + j) != *(buf2 + j)) ! exit(1); ! lseek(fd, (long)i, 0); ! read(fd, buf2, i); /* read into mapped memory -- file should not change */ ! /* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */ ! lseek(fd, (long)0, 0); ! read(fd, buf3, i2); ! for (j = 0; j < i2; ++j) ! if (*(buf1 + j) != *(buf3 + j)) ! exit(1); ! exit(0); } EOF ! eval $ac_link ! if test -s conftest && (./conftest; exit) 2>/dev/null; then ! ac_cv_func_mmap=yes ! else ! ac_cv_func_mmap=no ! fi fi rm -fr conftest* fi ! echo "$ac_t""$ac_cv_func_mmap" 1>&6 ! if test $ac_cv_func_mmap = yes; then cat >> confdefs.h <<\EOF #define HAVE_MMAP 1 EOF fi ! ac_safe=`echo "vfork.h" | tr './\055' '___'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ! eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi --- 3270,3466 ---- done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 ! echo "configure:3274: checking for working mmap" >&5 ! if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ! ac_cv_func_mmap_fixed_mapped=no else ! cat > conftest.$ac_ext < #include #include + /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE ! # ifdef HAVE_UNISTD_H ! # include # endif ! /* Assume that all systems that can run configure have sys/param.h. */ ! # ifndef HAVE_SYS_PARAM_H ! # define HAVE_SYS_PARAM_H 1 ! # endif ! ! # ifdef _SC_PAGESIZE ! # define getpagesize() sysconf(_SC_PAGESIZE) ! # else /* no _SC_PAGESIZE */ ! # ifdef HAVE_SYS_PARAM_H ! # include ! # ifdef EXEC_PAGESIZE ! # define getpagesize() EXEC_PAGESIZE ! # else /* no EXEC_PAGESIZE */ ! # ifdef NBPG ! # define getpagesize() NBPG * CLSIZE ! # ifndef CLSIZE ! # define CLSIZE 1 ! # endif /* no CLSIZE */ ! # else /* no NBPG */ ! # ifdef NBPC ! # define getpagesize() NBPC ! # else /* no NBPC */ ! # ifdef PAGESIZE ! # define getpagesize() PAGESIZE ! # endif /* PAGESIZE */ ! # endif /* no NBPC */ ! # endif /* no NBPG */ ! # endif /* no EXEC_PAGESIZE */ ! # else /* no HAVE_SYS_PARAM_H */ ! # define getpagesize() 8192 /* punt totally */ ! # endif /* no HAVE_SYS_PARAM_H */ ! # endif /* no _SC_PAGESIZE */ ! ! #endif /* no HAVE_GETPAGESIZE */ #ifdef __cplusplus ! extern "C" { void *malloc(unsigned); } #else ! char *malloc(); #endif int main() { ! char *data, *data2, *data3; ! int i, pagesize; ! int fd; ! ! pagesize = getpagesize(); ! ! /* ! * First, make a file with some known garbage in it. ! */ ! data = malloc(pagesize); ! if (!data) ! exit(1); ! for (i = 0; i < pagesize; ++i) ! *(data + i) = rand(); ! umask(0); ! fd = creat("conftestmmap", 0600); ! if (fd < 0) ! exit(1); ! if (write(fd, data, pagesize) != pagesize) ! exit(1); ! close(fd); ! ! /* ! * Next, try to mmap the file at a fixed address which ! * already has something else allocated at it. If we can, ! * also make sure that we see the same garbage. ! */ ! fd = open("conftestmmap", O_RDWR); ! if (fd < 0) ! exit(1); ! data2 = malloc(2 * pagesize); ! if (!data2) ! exit(1); ! data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); ! if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, ! MAP_PRIVATE | MAP_FIXED, fd, 0L)) ! exit(1); ! for (i = 0; i < pagesize; ++i) ! if (*(data + i) != *(data2 + i)) ! exit(1); ! ! /* ! * Finally, make sure that changes to the mapped area ! * do not percolate back to the file as seen by read(). ! * (This is a bug on some variants of i386 svr4.0.) ! */ ! for (i = 0; i < pagesize; ++i) ! *(data2 + i) = *(data2 + i) + 1; ! data3 = malloc(pagesize); ! if (!data3) ! exit(1); ! if (read(fd, data3, pagesize) != pagesize) ! exit(1); ! for (i = 0; i < pagesize; ++i) ! if (*(data + i) != *(data3 + i)) ! exit(1); ! close(fd); ! unlink("conftestmmap"); ! exit(0); } EOF ! if { (eval echo configure:3422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then ! ac_cv_func_mmap_fixed_mapped=yes ! else ! echo "configure: failed program was:" >&5 ! cat conftest.$ac_ext >&5 ! rm -fr conftest* ! ac_cv_func_mmap_fixed_mapped=no fi rm -fr conftest* fi ! fi ! ! echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 ! if test $ac_cv_func_mmap_fixed_mapped = yes; then cat >> confdefs.h <<\EOF #define HAVE_MMAP 1 EOF fi ! ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 + echo "configure:3446: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ! ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:3456: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi *************** *** 2963,2987 **** fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 ! if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ char vfork(); ! int main() { return 0; } ! int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named --- 3477,3504 ---- fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 ! echo "configure:3481: checking for working vfork" >&5 ! if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 + echo "configure:3487: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ char vfork(); ! int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named *************** *** 2994,3009 **** ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else rm -rf conftest* eval "ac_cv_func_vfork=no" fi rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then echo "$ac_t""yes" 1>&6 : --- 3511,3528 ---- ; return 0; } EOF ! if { (eval echo configure:3515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_vfork=no" fi rm -f conftest* fi + if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then echo "$ac_t""yes" 1>&6 : *************** *** 3012,3019 **** fi else ! cat > conftest.$ac_ext < --- 3531,3538 ---- fi else ! cat > conftest.$ac_ext < *************** *** 3041,3048 **** static pid_t child; if (!child) { child = vfork (); ! if (child < 0) perror ("vfork"); if (!child) { arg = getpid(); write(-1, "", 0); --- 3560,3569 ---- static pid_t child; if (!child) { child = vfork (); ! if (child < 0) { perror ("vfork"); + _exit(2); + } if (!child) { arg = getpid(); write(-1, "", 0); *************** *** 3106,3123 **** } } EOF ! eval $ac_link ! if test -s conftest && (./conftest; exit) 2>/dev/null; then ! ac_cv_func_vfork=yes ! else ! ac_cv_func_vfork=no ! fi fi rm -fr conftest* fi ! echo "$ac_t""$ac_cv_func_vfork" 1>&6 ! if test $ac_cv_func_vfork = no; then cat >> confdefs.h <<\EOF #define vfork fork EOF --- 3627,3648 ---- } } EOF ! if { (eval echo configure:3631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then ! ac_cv_func_vfork_works=yes ! else ! echo "configure: failed program was:" >&5 ! cat conftest.$ac_ext >&5 ! rm -fr conftest* ! ac_cv_func_vfork_works=no fi rm -fr conftest* fi ! fi ! ! echo "$ac_t""$ac_cv_func_vfork_works" 1>&6 ! if test $ac_cv_func_vfork_works = no; then cat >> confdefs.h <<\EOF #define vfork fork EOF *************** *** 3134,3139 **** --- 3659,3665 ---- fi echo $ac_n "checking for fcntl/flock""... $ac_c" 1>&6 + echo "configure:3663: checking for fcntl/flock" >&5 if eval "test \"`echo '$''{'vi_cv_lock'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 3143,3179 **** irix*);; *) cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { flock(0, 0); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_lock=flock fi ! rm -f conftest* ! ;; esac if test "$vi_cv_lock" = none; then cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { fcntl(0, F_SETLK, 0); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_lock=fcntl fi rm -f conftest* - fi fi --- 3669,3707 ---- irix*);; *) cat > conftest.$ac_ext < ! int main() { flock(0, 0); ; return 0; } EOF ! if { (eval echo configure:3680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_lock=flock + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi ! rm -f conftest*;; esac if test "$vi_cv_lock" = none; then cat > conftest.$ac_ext < ! int main() { fcntl(0, F_SETLK, 0); ; return 0; } EOF ! if { (eval echo configure:3698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_lock=fcntl + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* fi fi *************** *** 3193,3236 **** echo "$ac_t""$vi_cv_lock" 1>&6 echo $ac_n "checking for ftruncate/chsize""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_ftruncate'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { ftruncate(0, 0); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_ftruncate=ftruncate else rm -rf conftest* cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { chsize(0, 0); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_ftruncate=chsize else rm -rf conftest* vi_cv_ftruncate=no fi rm -f conftest* - fi rm -f conftest* - fi if test "$vi_cv_ftruncate" = ftruncate; then --- 3721,3765 ---- echo "$ac_t""$vi_cv_lock" 1>&6 echo $ac_n "checking for ftruncate/chsize""... $ac_c" 1>&6 + echo "configure:3725: checking for ftruncate/chsize" >&5 if eval "test \"`echo '$''{'vi_cv_ftruncate'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { ftruncate(0, 0); ; return 0; } EOF ! if { (eval echo configure:3737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_ftruncate=ftruncate else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < ! int main() { chsize(0, 0); ; return 0; } EOF ! if { (eval echo configure:3752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_ftruncate=chsize else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_ftruncate=no fi rm -f conftest* fi rm -f conftest* fi if test "$vi_cv_ftruncate" = ftruncate; then *************** *** 3253,3279 **** echo "$ac_t""$vi_cv_ftruncate" 1>&6 echo $ac_n "checking for tigetstr/tigetnum""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_have_curses_tigetstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { tigetstr(0); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_have_curses_tigetstr=yes else rm -rf conftest* vi_cv_have_curses_tigetstr=no fi rm -f conftest* - fi if test "$vi_cv_have_curses_tigetstr" = yes; then --- 3782,3809 ---- echo "$ac_t""$vi_cv_ftruncate" 1>&6 echo $ac_n "checking for tigetstr/tigetnum""... $ac_c" 1>&6 + echo "configure:3786: checking for tigetstr/tigetnum" >&5 if eval "test \"`echo '$''{'vi_cv_have_curses_tigetstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { tigetstr(0); ; return 0; } EOF ! if { (eval echo configure:3798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_have_curses_tigetstr=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_have_curses_tigetstr=no fi rm -f conftest* fi if test "$vi_cv_have_curses_tigetstr" = yes; then *************** *** 3299,3325 **** else echo $ac_n "checking for addnstr""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_have_curses_addnstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { addnstr(0, 0); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_have_curses_addnstr=yes else rm -rf conftest* vi_cv_have_curses_addnstr=no fi rm -f conftest* - fi if test "$vi_cv_have_curses_addnstr" = yes; then --- 3829,3856 ---- else echo $ac_n "checking for addnstr""... $ac_c" 1>&6 + echo "configure:3833: checking for addnstr" >&5 if eval "test \"`echo '$''{'vi_cv_have_curses_addnstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { addnstr(0, 0); ; return 0; } EOF ! if { (eval echo configure:3845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_have_curses_addnstr=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_have_curses_addnstr=no fi rm -f conftest* fi if test "$vi_cv_have_curses_addnstr" = yes; then *************** *** 3331,3357 **** echo "$ac_t""$vi_cv_have_curses_addnstr" 1>&6 echo $ac_n "checking for beep""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_have_curses_beep'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { beep(); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_have_curses_beep=yes else rm -rf conftest* vi_cv_have_curses_beep=no fi rm -f conftest* - fi if test "$vi_cv_have_curses_beep" = yes; then --- 3862,3889 ---- echo "$ac_t""$vi_cv_have_curses_addnstr" 1>&6 echo $ac_n "checking for beep""... $ac_c" 1>&6 + echo "configure:3866: checking for beep" >&5 if eval "test \"`echo '$''{'vi_cv_have_curses_beep'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { beep(); ; return 0; } EOF ! if { (eval echo configure:3878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_have_curses_beep=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_have_curses_beep=no fi rm -f conftest* fi if test "$vi_cv_have_curses_beep" = yes; then *************** *** 3363,3389 **** echo "$ac_t""$vi_cv_have_curses_beep" 1>&6 echo $ac_n "checking for flash""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_have_curses_flash'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { flash(); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_have_curses_flash=yes else rm -rf conftest* vi_cv_have_curses_flash=no fi rm -f conftest* - fi if test "$vi_cv_have_curses_flash" = yes; then --- 3895,3922 ---- echo "$ac_t""$vi_cv_have_curses_beep" 1>&6 echo $ac_n "checking for flash""... $ac_c" 1>&6 + echo "configure:3899: checking for flash" >&5 if eval "test \"`echo '$''{'vi_cv_have_curses_flash'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { flash(); ; return 0; } EOF ! if { (eval echo configure:3911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_have_curses_flash=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_have_curses_flash=no fi rm -f conftest* fi if test "$vi_cv_have_curses_flash" = yes; then *************** *** 3395,3421 **** echo "$ac_t""$vi_cv_have_curses_flash" 1>&6 echo $ac_n "checking for idlok""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_have_curses_idlok'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { idlok(0, 0); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_have_curses_idlok=yes else rm -rf conftest* vi_cv_have_curses_idlok=no fi rm -f conftest* - fi if test "$vi_cv_have_curses_idlok" = yes; then --- 3928,3955 ---- echo "$ac_t""$vi_cv_have_curses_flash" 1>&6 echo $ac_n "checking for idlok""... $ac_c" 1>&6 + echo "configure:3932: checking for idlok" >&5 if eval "test \"`echo '$''{'vi_cv_have_curses_idlok'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { idlok(0, 0); ; return 0; } EOF ! if { (eval echo configure:3944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_have_curses_idlok=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_have_curses_idlok=no fi rm -f conftest* fi if test "$vi_cv_have_curses_idlok" = yes; then *************** *** 3427,3453 **** echo "$ac_t""$vi_cv_have_curses_idlok" 1>&6 echo $ac_n "checking for keypad""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_have_curses_keypad'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { keypad(0, 0); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_have_curses_keypad=yes else rm -rf conftest* vi_cv_have_curses_keypad=no fi rm -f conftest* - fi if test "$vi_cv_have_curses_keypad" = yes; then --- 3961,3988 ---- echo "$ac_t""$vi_cv_have_curses_idlok" 1>&6 echo $ac_n "checking for keypad""... $ac_c" 1>&6 + echo "configure:3965: checking for keypad" >&5 if eval "test \"`echo '$''{'vi_cv_have_curses_keypad'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { keypad(0, 0); ; return 0; } EOF ! if { (eval echo configure:3977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_have_curses_keypad=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_have_curses_keypad=no fi rm -f conftest* fi if test "$vi_cv_have_curses_keypad" = yes; then *************** *** 3459,3485 **** echo "$ac_t""$vi_cv_have_curses_keypad" 1>&6 echo $ac_n "checking for newterm""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_have_curses_newterm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { newterm(0, 0, 0); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_have_curses_newterm=yes else rm -rf conftest* vi_cv_have_curses_newterm=no fi rm -f conftest* - fi if test "$vi_cv_have_curses_newterm" = yes; then --- 3994,4021 ---- echo "$ac_t""$vi_cv_have_curses_keypad" 1>&6 echo $ac_n "checking for newterm""... $ac_c" 1>&6 + echo "configure:3998: checking for newterm" >&5 if eval "test \"`echo '$''{'vi_cv_have_curses_newterm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { newterm(0, 0, 0); ; return 0; } EOF ! if { (eval echo configure:4010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_have_curses_newterm=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_have_curses_newterm=no fi rm -f conftest* fi if test "$vi_cv_have_curses_newterm" = yes; then *************** *** 3499,3525 **** fi echo $ac_n "checking for setupterm""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_have_curses_setupterm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { setupterm(0, 0, 0); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_have_curses_setupterm=yes else rm -rf conftest* vi_cv_have_curses_setupterm=no fi rm -f conftest* - fi if test "$vi_cv_have_curses_setupterm" = yes; then --- 4035,4062 ---- fi echo $ac_n "checking for setupterm""... $ac_c" 1>&6 + echo "configure:4039: checking for setupterm" >&5 if eval "test \"`echo '$''{'vi_cv_have_curses_setupterm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { setupterm(0, 0, 0); ; return 0; } EOF ! if { (eval echo configure:4051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_have_curses_setupterm=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_have_curses_setupterm=no fi rm -f conftest* fi if test "$vi_cv_have_curses_setupterm" = yes; then *************** *** 3531,3558 **** echo "$ac_t""$vi_cv_have_curses_setupterm" 1>&6 echo $ac_n "checking for broken gettimeofday system call""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_gettimeofday'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include ! int main() { return 0; } ! int t() { gettimeofday(0, 0); ; return 0; } EOF ! if eval $ac_link; then rm -rf conftest* vi_cv_gettimeofday=okay else rm -rf conftest* vi_cv_gettimeofday=broken fi rm -f conftest* - fi if test "$vi_cv_gettimeofday" = broken; then --- 4068,4096 ---- echo "$ac_t""$vi_cv_have_curses_setupterm" 1>&6 echo $ac_n "checking for broken gettimeofday system call""... $ac_c" 1>&6 + echo "configure:4072: checking for broken gettimeofday system call" >&5 if eval "test \"`echo '$''{'vi_cv_gettimeofday'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include ! int main() { gettimeofday(0, 0); ; return 0; } EOF ! if { (eval echo configure:4085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_gettimeofday=okay else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_gettimeofday=broken fi rm -f conftest* fi if test "$vi_cv_gettimeofday" = broken; then *************** *** 3564,3590 **** echo "$ac_t""$vi_cv_gettimeofday" 1>&6 echo $ac_n "checking for System V pty calls""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_sys5_pty'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 echo $ac_n "checking for System V pty calls""... $ac_c" 1>&6 + echo "configure:4106: checking for System V pty calls" >&5 if eval "test \"`echo '$''{'vi_cv_sys5_pty'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_sys5_pty=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_sys5_pty=no fi rm -f conftest* fi if test "$vi_cv_sys5_pty" = yes; then *************** *** 3596,3622 **** echo "$ac_t""$vi_cv_sys5_pty" 1>&6 echo $ac_n "checking for revoke system call""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_revoke'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 echo $ac_n "checking for revoke system call""... $ac_c" 1>&6 + echo "configure:4139: checking for revoke system call" >&5 if eval "test \"`echo '$''{'vi_cv_revoke'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* vi_cv_revoke=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_revoke=no fi rm -f conftest* fi if test "$vi_cv_revoke" = yes; then *************** *** 3628,3654 **** echo "$ac_t""$vi_cv_revoke" 1>&6 echo $ac_n "checking for int type sprintf return value""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_sprintf_count'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext </dev/null; then vi_cv_sprintf_count=yes else vi_cv_sprintf_count=no fi - fi rm -fr conftest* fi if test "$vi_cv_sprintf_count" = no; then cat >> confdefs.h <<\EOF #define SPRINTF_RET_CHARPNT 1 --- 4168,4199 ---- echo "$ac_t""$vi_cv_revoke" 1>&6 echo $ac_n "checking for int type sprintf return value""... $ac_c" 1>&6 + echo "configure:4172: checking for int type sprintf return value" >&5 if eval "test \"`echo '$''{'vi_cv_sprintf_count'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then vi_cv_sprintf_count=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* vi_cv_sprintf_count=no fi rm -fr conftest* fi + fi + if test "$vi_cv_sprintf_count" = no; then cat >> confdefs.h <<\EOF #define SPRINTF_RET_CHARPNT 1 *************** *** 3658,3663 **** --- 4203,4209 ---- echo "$ac_t""$vi_cv_sprintf_count" 1>&6 echo $ac_n "checking if --disable-db option specified""... $ac_c" 1>&6 + echo "configure:4207: checking if --disable-db option specified" >&5 # Check whether --enable-db or --disable-db was given. if test "${enable_db+set}" = set; then enableval="$enable_db" *************** *** 3676,3681 **** --- 4222,4228 ---- esac echo $ac_n "checking if --disable-re option specified""... $ac_c" 1>&6 + echo "configure:4226: checking if --disable-re option specified" >&5 # Check whether --enable-re or --disable-re was given. if test "${enable_re+set}" = set; then enableval="$enable_re" *************** *** 3695,3721 **** echo $ac_n "checking for u_char""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_uchar'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { u_char foo; ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* vi_cv_uchar=yes else rm -rf conftest* vi_cv_uchar=no fi rm -f conftest* - fi echo "$ac_t""$vi_cv_uchar" 1>&6 --- 4242,4269 ---- echo $ac_n "checking for u_char""... $ac_c" 1>&6 + echo "configure:4246: checking for u_char" >&5 if eval "test \"`echo '$''{'vi_cv_uchar'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { u_char foo; ; return 0; } EOF ! if { (eval echo configure:4258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* vi_cv_uchar=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_uchar=no fi rm -f conftest* fi echo "$ac_t""$vi_cv_uchar" 1>&6 *************** *** 3725,3751 **** echo $ac_n "checking for u_short""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_ushort'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { u_short foo; ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* vi_cv_ushort=yes else rm -rf conftest* vi_cv_ushort=no fi rm -f conftest* - fi echo "$ac_t""$vi_cv_ushort" 1>&6 --- 4273,4300 ---- echo $ac_n "checking for u_short""... $ac_c" 1>&6 + echo "configure:4277: checking for u_short" >&5 if eval "test \"`echo '$''{'vi_cv_ushort'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { u_short foo; ; return 0; } EOF ! if { (eval echo configure:4289: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* vi_cv_ushort=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_ushort=no fi rm -f conftest* fi echo "$ac_t""$vi_cv_ushort" 1>&6 *************** *** 3755,3781 **** echo $ac_n "checking for u_int""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_uint'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { u_int foo; ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* vi_cv_uint=yes else rm -rf conftest* vi_cv_uint=no fi rm -f conftest* - fi echo "$ac_t""$vi_cv_uint" 1>&6 --- 4304,4331 ---- echo $ac_n "checking for u_int""... $ac_c" 1>&6 + echo "configure:4308: checking for u_int" >&5 if eval "test \"`echo '$''{'vi_cv_uint'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { u_int foo; ; return 0; } EOF ! if { (eval echo configure:4320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* vi_cv_uint=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_uint=no fi rm -f conftest* fi echo "$ac_t""$vi_cv_uint" 1>&6 *************** *** 3785,3811 **** echo $ac_n "checking for u_long""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_ulong'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { u_long foo; ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* vi_cv_ulong=yes else rm -rf conftest* vi_cv_ulong=no fi rm -f conftest* - fi echo "$ac_t""$vi_cv_ulong" 1>&6 --- 4335,4362 ---- echo $ac_n "checking for u_long""... $ac_c" 1>&6 + echo "configure:4339: checking for u_long" >&5 if eval "test \"`echo '$''{'vi_cv_ulong'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { u_long foo; ; return 0; } EOF ! if { (eval echo configure:4351: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* vi_cv_ulong=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* vi_cv_ulong=no fi rm -f conftest* fi echo "$ac_t""$vi_cv_ulong" 1>&6 *************** *** 3815,3857 **** echo $ac_n "checking for u_int8_t""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_uint8'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { u_int8_t foo; ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* vi_cv_uint8=yes else rm -rf conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext </dev/null; then vi_cv_uint8="unsigned char" else vi_cv_uint8=no fi - fi rm -fr conftest* fi - rm -f conftest* fi echo "$ac_t""$vi_cv_uint8" 1>&6 if test "$vi_cv_uint8" = no; then --- 4366,4413 ---- echo $ac_n "checking for u_int8_t""... $ac_c" 1>&6 + echo "configure:4370: checking for u_int8_t" >&5 if eval "test \"`echo '$''{'vi_cv_uint8'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { u_int8_t foo; ; return 0; } EOF ! if { (eval echo configure:4382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* vi_cv_uint8=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then vi_cv_uint8="unsigned char" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* vi_cv_uint8=no fi rm -fr conftest* fi fi + rm -f conftest* + fi echo "$ac_t""$vi_cv_uint8" 1>&6 if test "$vi_cv_uint8" = no; then *************** *** 3865,3922 **** echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_uint16'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { u_int16_t foo; ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* vi_cv_uint16=yes else rm -rf conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext </dev/null; then vi_cv_uint16="unsigned short" else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext </dev/null; then vi_cv_uint16="unsigned int" else vi_cv_uint16=no fi - fi rm -fr conftest* fi fi rm -fr conftest* fi - rm -f conftest* fi echo "$ac_t""$vi_cv_uint16" 1>&6 if test "$vi_cv_uint16" = no; then --- 4421,4487 ---- echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6 + echo "configure:4425: checking for u_int16_t" >&5 if eval "test \"`echo '$''{'vi_cv_uint16'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { u_int16_t foo; ; return 0; } EOF ! if { (eval echo configure:4437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* vi_cv_uint16=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then vi_cv_uint16="unsigned short" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then vi_cv_uint16="unsigned int" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* vi_cv_uint16=no fi rm -fr conftest* fi + fi rm -fr conftest* fi fi + rm -f conftest* + fi echo "$ac_t""$vi_cv_uint16" 1>&6 if test "$vi_cv_uint16" = no; then *************** *** 3930,3987 **** echo $ac_n "checking for int16_t""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_int16'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { int16_t foo; ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* vi_cv_int16=yes else rm -rf conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext </dev/null; then vi_cv_int16="short" else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext </dev/null; then vi_cv_int16="int" else vi_cv_int16=no fi - fi rm -fr conftest* fi fi rm -fr conftest* fi - rm -f conftest* fi echo "$ac_t""$vi_cv_int16" 1>&6 if test "$vi_cv_int16" = no; then --- 4495,4561 ---- echo $ac_n "checking for int16_t""... $ac_c" 1>&6 + echo "configure:4499: checking for int16_t" >&5 if eval "test \"`echo '$''{'vi_cv_int16'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { int16_t foo; ; return 0; } EOF ! if { (eval echo configure:4511: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* vi_cv_int16=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then vi_cv_int16="short" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then vi_cv_int16="int" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* vi_cv_int16=no fi rm -fr conftest* fi + fi rm -fr conftest* fi fi + rm -f conftest* + fi echo "$ac_t""$vi_cv_int16" 1>&6 if test "$vi_cv_int16" = no; then *************** *** 3995,4052 **** echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_uint32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { u_int32_t foo; ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* vi_cv_uint32=yes else rm -rf conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext </dev/null; then vi_cv_uint32="unsigned int" else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext </dev/null; then vi_cv_uint32="unsigned long" else vi_cv_uint32=no fi - fi rm -fr conftest* fi fi rm -fr conftest* fi - rm -f conftest* fi echo "$ac_t""$vi_cv_uint32" 1>&6 if test "$vi_cv_uint32" = no; then --- 4569,4635 ---- echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6 + echo "configure:4573: checking for u_int32_t" >&5 if eval "test \"`echo '$''{'vi_cv_uint32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { u_int32_t foo; ; return 0; } EOF ! if { (eval echo configure:4585: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* vi_cv_uint32=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then vi_cv_uint32="unsigned int" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then vi_cv_uint32="unsigned long" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* vi_cv_uint32=no fi rm -fr conftest* fi + fi rm -fr conftest* fi fi + rm -f conftest* + fi echo "$ac_t""$vi_cv_uint32" 1>&6 if test "$vi_cv_uint32" = no; then *************** *** 4060,4117 **** echo $ac_n "checking for int32_t""... $ac_c" 1>&6 if eval "test \"`echo '$''{'vi_cv_int32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { return 0; } ! int t() { int32_t foo; ; return 0; } EOF ! if eval $ac_compile; then rm -rf conftest* vi_cv_int32=yes else rm -rf conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext </dev/null; then vi_cv_int32="int" else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext </dev/null; then vi_cv_int32="long" else vi_cv_int32=no fi - fi rm -fr conftest* fi fi rm -fr conftest* fi - rm -f conftest* fi echo "$ac_t""$vi_cv_int32" 1>&6 if test "$vi_cv_int32" = no; then --- 4643,4709 ---- echo $ac_n "checking for int32_t""... $ac_c" 1>&6 + echo "configure:4647: checking for int32_t" >&5 if eval "test \"`echo '$''{'vi_cv_int32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < ! int main() { int32_t foo; ; return 0; } EOF ! if { (eval echo configure:4659: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* vi_cv_int32=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then vi_cv_int32="int" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else ! cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ! then vi_cv_int32="long" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* vi_cv_int32=no fi rm -fr conftest* fi + fi rm -fr conftest* fi fi + rm -f conftest* + fi echo "$ac_t""$vi_cv_int32" 1>&6 if test "$vi_cv_int32" = no; then *************** *** 4140,4150 **** # --recheck option to rerun configure. # EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | ! sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ ! >> confcache if cmp -s $cache_file confcache; then : else --- 4732,4756 ---- # --recheck option to rerun configure. # EOF + # The following way of writing the cache mishandles newlines in values, + # but we know of no workaround that is simple, portable, and efficient. + # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | ! case `(ac_space=' '; set) 2>&1` in ! *ac_space=\ *) ! # `set' does not quote correctly, so add quotes (double-quote substitution ! # turns \\\\ into \\, and sed turns \\ into \). ! sed -n \ ! -e "s/'/'\\\\''/g" \ ! -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ! ;; ! *) ! # `set' quotes correctly as required by POSIX, so do not add quotes. ! sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ! ;; ! esac >> confcache if cmp -s $cache_file confcache; then : else *************** *** 4199,4205 **** echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) ! echo "$CONFIG_STATUS generated by autoconf version 2.7" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; --- 4805,4811 ---- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) ! echo "$CONFIG_STATUS generated by autoconf version 2.12" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *************** *** 4211,4217 **** ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile port.h:port.h.in ! pathnames.h:pathnames.h.in recover:recover.in config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then ! # Support "outfile[:infile]", defaulting infile="outfile.in". case "$ac_file" in ! *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac ! # Adjust relative srcdir, etc. for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` --- 4888,4945 ---- CEOF EOF + + cat >> $CONFIG_STATUS <<\EOF + + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. + ac_file=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_cmds # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds="" + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi + EOF + cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then ! # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in ! *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac ! # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` *************** *** 4323,4328 **** --- 4967,4973 ---- [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac + echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." *************** *** 4331,4344 **** # $configure_input" ;; *) ac_comsub= ;; esac sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g ! " -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file fi; done ! rm -f conftest.subs # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. --- 4976,4991 ---- # $configure_input" ;; *) ac_comsub= ;; esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g ! " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done ! rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. *************** *** 4359,4369 **** ac_eC=' ' ac_eD='%g' ! CONFIG_HEADERS=${CONFIG_HEADERS-"config.h"} for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then ! # Support "outfile[:infile]", defaulting infile="outfile.in". case "$ac_file" in ! *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac --- 5006,5022 ---- ac_eC=' ' ac_eD='%g' ! if test "${CONFIG_HEADERS+set}" != set; then ! EOF ! cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF ! fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then ! # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in ! *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac *************** *** 4371,4377 **** echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ! cp $ac_given_srcdir/$ac_file_in conftest.in EOF --- 5024,5031 ---- echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ! ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` ! cat $ac_file_inputs > conftest.in EOF *************** *** 4383,4389 **** cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g ! s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF --- 5037,5043 ---- cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g ! s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF *************** *** 4399,4406 **** # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. - # Maximum number of lines to put in a single here document. - ac_max_here_lines=12 rm -f conftest.tail while : --- 5053,5058 ---- *************** *** 4431,4442 **** --- 5083,5104 ---- echo "$ac_file is unchanged" rm -f conftest.h else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi rm -f $ac_file mv conftest.h $ac_file fi fi; done + EOF + cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF Index: build/configure.in Prereq: 8.134 *** nvi-1.79/build/configure.in Wed Oct 23 22:52:59 1996 --- nvi-1.79-m17n/build/configure.in Wed Apr 2 13:31:31 1997 *************** *** 22,27 **** --- 22,42 ---- fi AC_MSG_RESULT($vi_cv_debug) + dnl If the user wants multibyte support. + AC_MSG_CHECKING(if --enable-multibyte option specified) + AC_ARG_ENABLE(multibyte, + [ --enable-multibyte[=ARG] Build a multibyte version.], + [vi_cv_multibyte="yes"; vi_cv_defencoding=$enableval], [vi_cv_multibyte="no"]) + if test "$vi_cv_multibyte" = yes; then + AC_DEFINE(MULTIBYTE) + if test "$vi_cv_defencoding" = yes; then + AC_DEFINE_UNQUOTED(DEFAULT_ENCODING, "none") + else + AC_DEFINE_UNQUOTED(DEFAULT_ENCODING, "${vi_cv_defencoding}") + fi + fi + AC_MSG_RESULT($vi_cv_multibyte) + dnl This is where we handle stuff that autoconf can't handle. dnl XXX dnl Don't override anything if it's already set from the environment. *************** *** 194,199 **** --- 209,279 ---- fi fi + dnl If the user wants canna support. + AC_MSG_CHECKING(if --enable-canna option specified) + AC_ARG_ENABLE(canna, + [ --enable-canna[=DIR] Build a canna version.], + [vi_cv_canna="yes"; vi_cannapath=$enableval], [vi_cv_canna="no"]) + AC_MSG_RESULT($vi_cv_canna) + if test "$vi_cv_canna" = "yes"; then + if test "$vi_cv_multibyte" = "no"; then + echo "Fatal error: --enable-canna needs --enable-multibyte." + exit 1 + fi + + dnl Some operating system include canna libraries by default. + dnl Use that pathname by default. + dnl for freebsd2.*, order DOES matter. don't bother. + if test "$vi_cannapath" = "yes"; then + case "$host_os" in + bsdi2.1) + vi_cannapath="/usr/contrib/canna";; + freebsd2.2*|freebsd3*) + vi_cannapath="/usr/local";; + freebsd2*) + vi_cannapath="/usr/local/canna";; + *) + vi_cannapath="/usr/local/canna";; + esac + fi + + if test "$vi_cannapath" != "yes"; then + CFLAGS="-I$vi_cannapath/include $CFLAGS" + LDFLAGS="-L$vi_cannapath/lib $LDFLAGS" + fi + + dnl we use AC_TRY_COMPILE not AC_CHECK_HEADER, to avoid unnecessery + dnl use of CPPFLAGS. (why?) + AC_MSG_CHECKING(for canna/jrkanji.h) + AC_CACHE_VAL(vi_cv_cannahdrcheck, [dnl + AC_TRY_COMPILE([#include ], jrKanjiStatus ks;, + [vi_cv_cannahdrcheck="yes"], [vi_cv_cannahdrcheck="no"])]) + AC_MSG_RESULT($vi_cv_cannahdrcheck) + if test "$vi_cv_cannahdrcheck" = "no"; then + echo -n "Fatal error: no canna header in suggested path" + if test "$vi_cannapath" != "yes"; then + echo ", $vi_cannapath/include." + else + echo "." + fi + exit 1 + fi + + AC_CHECK_LIB(canna, jrKanjiControl, + [vi_cv_cannalibcheck="yes"], [vi_cv_cannalibcheck="no"]) + if test "$vi_cv_cannalibcheck" = "no"; then + echo "Fatal error: no canna library in suggested path" + if test "$vi_cannapath" != "yes"; then + echo ", $vi_cannapath/lib." + else + echo "." + fi + exit 1 + fi + LIBS="-lcanna $LIBS" + AC_DEFINE(CANNA) + fi + dnl If the user wants a Perl interpreter in nvi, load it. AC_SUBST(shrpenv) AC_SUBST(vi_cv_perllib) *************** *** 722,725 **** fi AC_OUTPUT(Makefile port.h:port.h.in ! pathnames.h:pathnames.h.in recover:recover.in) --- 802,806 ---- fi AC_OUTPUT(Makefile port.h:port.h.in ! pathnames.h:pathnames.h.in recover:recover.in ! regular:regular.in qregular:qregular.in) Index: build/distrib Prereq: 8.11 *** nvi-1.79/build/distrib Wed Oct 23 22:40:49 1996 --- nvi-1.79-m17n/build/distrib Wed Apr 2 13:32:02 1997 *************** *** 2,9 **** # @(#)distrib 8.11 (Berkeley) 10/23/96 # Clean ! #make -f Makefile.in clean ! #rm -f configure config.h.in # Build autoconf structure. echo "Running autoheader" --- 2,9 ---- # @(#)distrib 8.11 (Berkeley) 10/23/96 # Clean ! make -f Makefile.in clean ! rm -f configure config.h.in # Build autoconf structure. echo "Running autoheader" *************** *** 74,79 **** --- 74,85 ---- echo "Building $f" rm -f $f sed -n "s/^ \* PUBLIC: \(.*\)/\1/p" ../vi/*.c > $f + chmod 444 $f + + f=../include/multibyte_def.h + echo "Building $f" + rm -f $f + awk -f ../common/multibyte.awk ../common/multibyte.c > $f chmod 444 $f # Build tags files. Index: build/qregular.in *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/build/qregular.in Fri Mar 28 23:41:35 1997 *************** *** 0 **** --- 1,67 ---- + #! @vi_cv_path_perl@ + + # + # Regularize multibyte text to some extent. + # Quick version; it recognizes G0/G1 designation only. + # + # Absolutely no warranty. Freely redistributable. + # copyright(c) 1997 by Jun-ichiro itojun Itoh. All rights reserved. + # + # $Id: qregular.in,v 1.3 1997/03/28 14:41:33 itojun Exp $ + # + + $variation94 = '#$@[\]^`{|}~'; + + while () { + chop; + $line = $_; + $output = ''; + + while (length($line)) { + $pos = index($line, "\033"); + if ($pos == -1) { + $output = $line; + $line = ''; + next; + } + + $output .= substr($line, 0, $pos); + $line = substr($line, $pos); + + if ($line =~ /^\033\(([\@ABCGHJKLRTYZ`fghinuwxz])([\041-\176]*)(.*)$/) { + $code = $1; + $tmp = $2; + $line = $3; + + $tmp = "\033(B" . $tmp . "\033(B"; + $tmp =~ s/([#$\@\[\\\]^{|}~]+)/\033($code$1\033(B/g; + $tmp =~ s/\033\([0-\177](\033\([0-\177])/$1/g; + + $output .= $tmp; + } elsif ($line =~ /^\033\)([\@ABCGHJKLRTYZ`fghinuwxz])([\241-\376]*)(.*)$/) { + $code = $1; + $tmp = $2; + $line = $3; + + $tmp = "\033)B" . $tmp . "\033)B"; + $tmp =~ s/([#$\@\[\\\]^{|}~]+)/\033)$code$1\033)B/g; + $tmp =~ s/\033\)[0-\177](\033\)[0-\177])/$1/g; + + $output .= $tmp; + } else { + $pos = index($line, "\033", 1); + if ($pos == -1) { + $output .= $line; + $line = ''; + } else { + $output .= substr($line, 0, $pos); + $line = substr($line, $pos); + } + } + } + + $output =~ s/\033\([0-\177](\033\([0-\177])/$1/g; + print $output . "\n"; + } + + exit 0; Index: build/regular.in *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/build/regular.in Wed Aug 20 16:29:06 1997 *************** *** 0 **** --- 1,408 ---- + #! @vi_cv_path_perl@ + + # + # Regularize multibyte text to some extent. + # + # Absolutely no warranty. Freely redistributable. + # copyright(c) 1997 by Jun-ichiro itojun Itoh. All rights reserved. + # + # $Id: regular.in,v 1.5 1997/03/28 14:41:33 itojun Exp $ + # + + # initial designation + @ig0 = @ig = ('B94', '', '', ''); + $igl = 0; + $igr = 1; + $igl1 = -1; + $igr1 = -1; + + @og = ('B94', '', '', ''); + $ogl = 0; + $ogr = 1; + $ogl1 = -1; + $ogr1 = -1; + + $variation94 = '#$@[\]^`{|}~'; + + # configurations + $eolreset = 1; + $oldstyle = 1; + $output7 = 1; + foreach $i (grep(/^-/, @ARGV)) { + if ($i eq '-ctext') { + $oldstyle = 0; + $output7 = 1; + } elsif ($i eq '-kr') { + $eolreset = 0; + } elsif ($i eq '-7') { + $output7 = 1; + } elsif ($i eq '-8') { + $output7 = 0; + } else { + print STDERR "regular: unknown option $i.\n"; + exit 1; + } + } + + if (scalar(grep(/^[^-]/, @ARGV))) { + print STDERR "regular: I take no argument.\n"; + exit 1; + } + + while () { + $line = $_; + + while (length($line)) { + ($chcode1, $chcode2) = unpack('CC', $line); + + # escape sequence + if ($consume = &parsedesig($line)) { + $line = substr($line, $consume); + next; + } + + # control code + if ($chcode1 & 0x7f < 0x20) { + $mask = &selthischarset(0, 'B94'); + print pack('C', ($chcode1 & 0x7f) | $mask); + $line = substr($line, 1); + next; + } + + # normal chars + if (&validch1(0, $chcode1)) { + if (&variation1(0, $chcode1)) { + $mask = &selthischarset(0, 'B94'); + } else { + $mask = &selcharset(0); + } + print pack('C', ($chcode1 & 0x7f) | $mask); + $line = substr($line, 1); + } elsif (&validch1(1, $chcode1)) { + if (&variation1(1, $chcode1)) { + $mask = &selthischarset(1, 'B94'); + } else { + $mask = &selcharset(1); + } + print pack('C', ($chcode1 & 0x7f) | $mask); + $line = substr($line, 1); + } elsif (&validch2(0, $chcode1, $chcode2)) { + $mask = &selcharset(0); + print pack('C', ($chcode1 & 0x7f) | $mask); + print pack('C', ($chcode2 & 0x7f) | $mask); + $line = substr($line, 2); + } elsif (&validch2(1, $chcode1, $chcode2)) { + $mask = &selcharset(1); + print pack('C', ($chcode1 & 0x7f) | $mask); + print pack('C', ($chcode2 & 0x7f) | $mask); + $line = substr($line, 2); + } else { + # unknown char. emit as is. + if ($chcode1 & 0x80) { + &selthischarset(1, 'B94'); + } else { + &selthischarset(0, 'B94'); + } + print substr($line, 0, 1); + $line = substr($line, 1); + } + + $igl1 = $igr1 = -1; + $ogl1 = $ogr1 = -1; + } + &selthischarset(0, 'B94'); + &selthischarset(1, 'B94') if ($og[1] ne ''); + &selthischarset(2, 'B94') if ($og[2] ne ''); + &selthischarset(3, 'B94') if ($og[3] ne ''); + if ($eolreset) { + @ig = @ig0; + } + $igl = 0; + $igr = 1; + $igl1 = -1; + $igr1 = -1; + } + + exit 0; + + # + # check if the character is valid as 1-byte char (94 or 96) in the charset + # designated in the input stream. + # + sub validch1 { + local($leftright, $code1) = @_; + local($curcharset, $off); + + if (($igl1, $igr1)[$leftright] == -1) { + $curcharset = $ig[($igl, $igr)[$idx]]; + } else { + $curcharset = $ig[($igl1, $igr1)[$idx]]; + } + $off = (0x00, 0x80)[$leftright]; + + if ($curcharset =~ /94$/) { + if (0x21 + $off <= $code1 && $code1 <= 0x7e + $off) { + return 1; + } else { + return 0; + } + } elsif ($curcharset =~ /96$/) { + if (0x20 + $off <= $code1 && $code1 <= 0x7f + $off) { + return 1; + } else { + return 0; + } + } else { + return 0; + } + } + + # + # check if the character is valid as 2-byte char (94x94 or 96x96) + # in the charset designated in the input stream. + # + sub validch2 { + local($leftright, $code1, $code2) = @_; + local($curcharset, $off); + + if (($igl1, $igr1)[$leftright] == -1) { + $curcharset = $ig[($igl, $igr)[$idx]]; + } else { + $curcharset = $ig[($igl1, $igr1)[$idx]]; + } + $off = (0x00, 0x80)[$leftright]; + + if ($curcharset =~ /94x$/) { + if (0x21 + $off <= $code1 && $code1 <= 0x7e + $off + && 0x21 + $off <= $code2 && $code2 <= 0x7e + $off) { + return 1; + } else { + return 0; + } + } elsif ($curcharset =~ /96x$/) { + if (0x20 + $off <= $code1 && $code1 <= 0x7f + $off + && 0x20 + $off <= $code2 && $code2 <= 0x7f + $off) { + return 1; + } else { + return 0; + } + } else { + return 0; + } + } + + # + # Parse the designation in input stream. + # + sub parsedesig { + local($line) = @_; + local($idx); + local($version, $verslen); + + if (index("\033\216\217\017\016", substr($line, 0, 1)) == -1) { + return 0; + } + + if ($line =~ /^\033\&([0-\177])/) { + $version = $1; + $verslen = length($&); + $line = substr($line, $verslen); + } else { + $version = ''; + $verslen = 0; + } + + if ($line =~ /^\033\$([\@AB])/) { + $ig[0] = $1 . $version . '94x'; + return length($&) + $verslen; + } elsif ($line =~ /^\033([\(\)*+])([0-\177])/) { + $idx = index('()*+', $1); + $ig[$idx] = $2 . $version . '94'; + return length($&) + $verslen; + } elsif ($line =~ /^\033([,-.\/])([0-\177])/) { + $idx = index(',-./', $1); + $ig[$idx] = $2 . $version . '96'; + return length($&) + $verslen; + } elsif ($line =~ /^\033\$([\(\)*+])([0-\177])/) { + $idx = index('()*+', $1); + $ig[$idx] = $2 . $version . '94x'; + return length($&) + $verslen; + } elsif ($line =~ /^\033\$([,-.\/])([0-\177])/) { + $idx = index(',-./', $1); + $ig[$idx] = $2 . $version . '96x'; + return length($&) + $verslen; + } elsif ($line =~ /\017/) { # LS0 + $igl = 0; + return length($&) + $verslen; + } elsif ($line =~ /\016/) { # LS1 + $igl = 1; + return length($&) + $verslen; + } elsif ($line =~ /\033n/) { # LS2 + $igl = 2; + return length($&) + $verslen; + } elsif ($line =~ /\033o/) { # LS3 + $igl = 3; + return length($&) + $verslen; + } elsif ($line =~ /\033~/) { # LS1R + $igr = 1; + return length($&) + $verslen; + } elsif ($line =~ /\033}/) { # LS2R + $igr = 2; + return length($&) + $verslen; + } elsif ($line =~ /\033\|/) { # LS3R + $igr = 3; + return length($&) + $verslen; + } elsif ($line =~ /\033N/) { # SS2 + $igl1 = 2; + return length($&) + $verslen; + } elsif ($line =~ /\033O/) { # SS3 + $igl1 = 3; + return length($&) + $verslen; + } elsif ($line =~ /\216/) { # SS2R + $igr1 = 2; + return length($&) + $verslen; + } elsif ($line =~ /\217/) { # SS3R + $igr1 = 3; + return length($&) + $verslen; + } + + return 0; + } + + # + # Emit designation to output stream, based on the designation in input stream. + # + sub selcharset { + local($idx) = @_; + local($curcharset, $mask); + + if (($igl1, $igr1)[$idx] == -1) { + $curcharset = $ig[($igl, $igr)[$idx]]; + } else { + $curcharset = $ig[($igl1, $igr1)[$idx]]; + } + + if ($curcharset eq $og[$ogl]) { + return 0x00; + } elsif ($curcharset eq $og[$ogr]) { + return 0x80; + } + + if ($oldstyle && $curcharset =~ /^([\@AB])94x$/) { + print "\033\$" . $1; + $og[$ogl] = $curcharset; + } elsif ($oldstyle && $curcharset eq 'B@94x') { + print "\033&\@\033\$B"; + $og[$ogl] = $curcharset; + } elsif ($curcharset =~ /^(.)94$/) { + print "\033(" . $1; + $og[$ogl] = $curcharset; + } elsif ($curcharset =~ /^(.)96$/) { + if ($output7) { + print "\033," . $1; + $og[$ogl] = $curcharset; + } else { + print "\033-" . $1; + $mask = 0x80; + $og[$ogr] = $curcharset; + } + } elsif ($curcharset =~ /^(.)94x$/) { + print "\033\$(" . $1; + $og[$ogl] = $curcharset; + } elsif ($curcharset =~ /^(.)(.)94x$/) { + print "\033&" . $2 . "\033\$(" . $1; + $og[$ogl] = $curcharset; + } elsif ($curcharset =~ /^(.)96x$/) { + if ($output7) { + print "\033\$," . $1; + $og[$ogl] = $curcharset; + } else { + print "\033\$-" . $1; + $mask = 0x80; + $og[$ogr] = $curcharset; + } + } + + return $mask; + } + + # + # Emit designation to output stream, based on the programmer's decision. + # + sub selthischarset { + local($leftright, $charset) = @_; + local($curcharset, $mask, $tmp); + + if (($ogl1, $ogr1)[$leftright] == -1) { + $curcharset = $og[($ogl, $ogr)[$leftright]]; + } else { + $curcharset = $og[($ogl1, $ogr1)[$leftright]]; + } + $mask = (0x00, 0x80)[$leftright]; + + $tmp = ($ogl, $ogr)[$leftright]; + $mask = (0x00, 0x80)[$leftright]; + if ($oldstyle && $leftright == 0 && $charset =~ /^([\@AB])94x$/) { + if ($charset ne $curcharset) { + print "\033\$" . $1; + $og[$ogl] = $charset; + } + } elsif ($oldstyle && $leftright == 0 && $charset eq 'B@94x') { + if ($charset ne $curcharset) { + print "\033&\@\033\$" . $1; + $og[$ogl] = $charset; + } + } elsif ($charset =~ /^(.)94$/) { + if ($charset ne $curcharset) { + print "\033" . ('(', ')')[$leftright] . $1; + $og[$tmp] = $charset; + } + } elsif ($charset =~ /^(.)96$/) { + if ($charset ne $curcharset) { + print "\033" . (',', '-')[$leftright] . $1; + $og[$tmp] = $charset; + } + } elsif ($charset =~ /^(.)94x$/) { + if ($charset ne $curcharset) { + print "\033\$" . ('(', ')')[$leftright] . $1; + $og[$tmp] = $charset; + } + } elsif ($charset =~ /^(.)(.)94x$/) { + if ($charset ne $curcharset) { + print "\033&" . $2; + print "\033\$" . ('(', ')')[$leftright] . $1; + $og[$tmp] = $charset; + } + } elsif ($charset =~ /^(.)96x$/) { + if ($charset ne $curcharset) { + print "\033\$" . (',', '-')[$leftright] . $1; + $og[$tmp] = $charset; + } + } + + return $mask; + } + + # + # Returns 1 if the character would better be emitted in ASCII charset. + # + sub variation1 { + local($leftright, $code) = @_; + local($curcharset); + + if (($igl1, $igr1)[$leftright] == -1) { + $curcharset = $ig[($igl, $igr)[$leftright]]; + } else { + $curcharset = $ig[($igl1, $igr1)[$leftright]]; + } + + if ($curcharset =~ /^[\@ABCGHJKLRTYZ`fghinuwxz]94$/) { + if (index($variation94, pack('C', $code & 0x7f)) == -1) { + return 1; + } else { + return 0; + } + } else { + return 0; + } + } Index: build/tags *** nvi-1.79/build/tags Wed Oct 23 22:53:13 1996 --- nvi-1.79-m17n/build/tags Wed Aug 20 14:47:25 1997 *************** *** 1,277 **** ! ABSMARK1 ../common/mark.h /^#define ABSMARK1 '\\'' \/* Absolute mark name. */ ! ABSMARK2 ../common/mark.h /^#define ABSMARK2 '`' \/* Absolute mark name. *\/$/ ! ADDITIONAL_CHARACTERS ../common/key.c /^#define ADDITIONAL_CHARACTERS 4$/ ! ADD_SPACE_GOTO ../common/mem.h /^#define ADD_SPACE_GOTO(sp, bp, blen, nlen) { \\/ ADD_SPACE_RET ../common/mem.h /^#define ADD_SPACE_RET(sp, bp, blen, nlen) { \\$/ - AGV_ALL ../ex/ex.h /^#define AGV_ALL (AGV_AT | AGV_AT_NORANGE | AGV_GL/ - AGV_AT ../ex/ex.h /^#define AGV_AT 0x01 \/* @ buffer execution. *\/$/ - AGV_AT_NORANGE ../ex/ex.h /^#define AGV_AT_NORANGE 0x02 \/* @ buffer executio/ - AGV_GLOBAL ../ex/ex.h /^#define AGV_GLOBAL 0x04 \/* global command. *\/$/ - AGV_V ../ex/ex.h /^#define AGV_V 0x08 \/* v command. *\/$/ - ARG ../ex/ex_display.c /^#define ARG "buffers"$/ - ARSIZE ../common/msg.c /^#define ARSIZE(a) sizeof(a) \/ sizeof (*a)$/ - A_ALLOCATED ../common/args.h /^#define A_ALLOCATED 0x01 \/* If allocated space. */ BINC_GOTO ../common/mem.h /^#define BINC_GOTO(sp, lp, llen, nlen) { \\$/ BINC_RET ../common/mem.h /^#define BINC_RET(sp, lp, llen, nlen) { \\$/ - BITS ../common/key.c /^#define BITS (sizeof(CHAR_T) * 8)$/ BUILD ../ex/ex_subst.c /^#define BUILD(sp, l, len) { \\$/ CALLOC ../common/mem.h /^#define CALLOC(sp, p, cast, nmemb, size) { \\$/ CALLOC_GOTO ../common/mem.h /^#define CALLOC_GOTO(sp, p, cast, nmemb, size) { / CALLOC_NOMSG ../common/mem.h /^#define CALLOC_NOMSG(sp, p, cast, nmemb, size) { / CALLOC_RET ../common/mem.h /^#define CALLOC_RET(sp, p, cast, nmemb, size) { / CBNAME ../common/cut.h /^#define CBNAME(sp, cbp, nch) { \\$/ ! CB_LMODE ../common/cut.h /^#define CB_LMODE 0x01 \/* Cut was in line mode. */ ! CHK_INTR ../vi/v_txt.c /^#define CHK_INTR \\$/ ! CHLEN ../vi/vs_relative.c /^#define CHLEN(val) (ch = *(u_char *)p++) == '\\t' / ! CH_ABBREVIATED ../common/key.h /^#define CH_ABBREVIATED 0x01 \/* Character is from/ ! CH_BSEARCH ../common/key.h /^#define CH_BSEARCH '?' \/* Backward search prompt/ ! CH_CURSOR ../common/key.h /^#define CH_CURSOR ' ' \/* Cursor character. *\/$/ ! CH_ENDMARK ../common/key.h /^#define CH_ENDMARK '$' \/* End of a range. *\/$/ ! CH_EXPROMPT ../common/key.h /^#define CH_EXPROMPT ':' \/* Ex prompt. *\/$/ ! CH_FSEARCH ../common/key.h /^#define CH_FSEARCH '\/' \/* Forward search prompt/ ! CH_HEX ../common/key.h /^#define CH_HEX '\\030' \/* Leading hex character/ ! CH_LITERAL ../common/key.h /^#define CH_LITERAL '\\026' \/* ASCII ^V. *\/$/ ! CH_MAPPED ../common/key.h /^#define CH_MAPPED 0x02 \/* Character is from a ma/ ! CH_NO ../common/key.h /^#define CH_NO 'n' \/* No. *\/$/ ! CH_NOMAP ../common/key.h /^#define CH_NOMAP 0x04 \/* Do not map the characte/ ! CH_NOT_DIGIT ../common/key.h /^#define CH_NOT_DIGIT 'a' \/* A non-isdigit() char/ ! CH_QUIT ../common/key.h /^#define CH_QUIT 'q' \/* Quit. *\/$/ ! CH_QUOTED ../common/key.h /^#define CH_QUOTED 0x08 \/* Character is already q/ ! CH_YES ../common/key.h /^#define CH_YES 'y' \/* Yes. *\/$/ ! CLEAR_EX_CMD ../ex/ex.h /^#define CLEAR_EX_CMD(cmdp) { \\$/ ! CLEAR_EX_PARSER ../ex/ex.h /^#define CLEAR_EX_PARSER(cmdp) \\$/ CLP ../cl/cl.h /^#define CLP(sp) ((CL_PRIVATE *)((sp)->gp->cl_priv/ CLR_INTERRUPT ../common/key.h /^#define CLR_INTERRUPT(sp) \\$/ - CL_IN_EX ../cl/cl.h /^#define CL_IN_EX 0x0001 \/* Currently running ex. / - CL_RENAME ../cl/cl.h /^#define CL_RENAME 0x0002 \/* X11 xterm icon\/windo/ - CL_RENAME_OK ../cl/cl.h /^#define CL_RENAME_OK 0x0004 \/* User wants the win/ - CL_SCR_EX_INIT ../cl/cl.h /^#define CL_SCR_EX_INIT 0x0008 \/* Ex screen initia/ - CL_SCR_VI_INIT ../cl/cl.h /^#define CL_SCR_VI_INIT 0x0010 \/* Vi screen initia/ - CL_SIGHUP ../cl/cl.h /^#define CL_SIGHUP 0x0020 \/* SIGHUP arrived. *\/$/ - CL_SIGINT ../cl/cl.h /^#define CL_SIGINT 0x0040 \/* SIGINT arrived. *\/$/ - CL_SIGTERM ../cl/cl.h /^#define CL_SIGTERM 0x0080 \/* SIGTERM arrived. *\// - CL_SIGWINCH ../cl/cl.h /^#define CL_SIGWINCH 0x0100 \/* SIGWINCH arrived. */ - CL_STDIN_TTY ../cl/cl.h /^#define CL_STDIN_TTY 0x0200 \/* Talking to a termi/ - CNO ../vi/vs_refresh.c /^#define CNO sp->cno \/* Current file column. */ COL_OFF ../common/util.h /^#define COL_OFF(c, stop) ((stop) - ((c) % (stop)))/ ! CSCOPE_CMD_FMT ../ex/ex_cscope.c /^#define CSCOPE_CMD_FMT "cd '%s' && exec cscope -d/ ! CSCOPE_DBFILE ../ex/ex_cscope.c /^#define CSCOPE_DBFILE "cscope.out"$/ ! CSCOPE_NLINES_FMT ../ex/ex_cscope.c /^#define CSCOPE_NLINES_FMT "cscope: %d lines%1[\\n]/ ! CSCOPE_PATHS ../ex/ex_cscope.c /^#define CSCOPE_PATHS "cscope.tpath"$/ ! CSCOPE_PROMPT ../ex/ex_cscope.c /^#define CSCOPE_PROMPT ">> "$/ ! CSCOPE_QUERIES ../ex/ex_cscope.c /^#define CSCOPE_QUERIES "sgdct efi"$/ ! CSCOPE_RE_SPACE ../ex/ex_subst.c /^#define CSCOPE_RE_SPACE "([ \\t]|\/\\\\*([^*]|\\/ ! CS_EMP ../vi/vi.h /^#define CS_EMP 1 \/* Empty line. *\/$/ ! CS_EOF ../vi/vi.h /^#define CS_EOF 2 \/* End-of-file. *\/$/ ! CS_EOL ../vi/vi.h /^#define CS_EOL 3 \/* End-of-line. *\/$/ ! CS_SOF ../vi/vi.h /^#define CS_SOF 4 \/* Start-of-file. *\/$/ ! CUT_LINEMODE ../common/cut.h /^#define CUT_LINEMODE 0x01 \/* Cut in line mode. */ ! CUT_NUMOPT ../common/cut.h /^#define CUT_NUMOPT 0x02 \/* Numeric buffer: optio/ ! CUT_NUMREQ ../common/cut.h /^#define CUT_NUMREQ 0x04 \/* Numeric buffer: requi/ ! DBG_FATAL ../common/exf.h /^#define DBG_FATAL 0x001 \/* If DNE, error message./ ! DBG_NOCACHE ../common/exf.h /^#define DBG_NOCACHE 0x002 \/* Ignore the front-end/ ! DEC ../vi/v_increment.c /^#define DEC 0$/ ! DEFAULT_NOPRINT ../common/gs.h /^#define DEFAULT_NOPRINT '\\1' \/* Emergency non-p/ ! DIVIDESTR ../vi/vs_msg.c /^#define DIVIDESTR "+=+=+=+=+=+=+=+"$/ ! DOT ../vi/vi.c /^#define DOT (&VIP(sp)->sdot)$/ ! DOTMOTION ../vi/vi.c /^#define DOTMOTION (&VIP(sp)->sdotmotion)$/ ! EC_INTERRUPT ../common/key.h /^#define EC_INTERRUPT 0x001 \/* Checking for inter/ ! EC_MAPCOMMAND ../common/key.h /^#define EC_MAPCOMMAND 0x002 \/* Apply the command/ ! EC_MAPINPUT ../common/key.h /^#define EC_MAPINPUT 0x004 \/* Apply the input map/ ! EC_MAPNODIGIT ../common/key.h /^#define EC_MAPNODIGIT 0x008 \/* Return to a digit/ ! EC_QUOTED ../common/key.h /^#define EC_QUOTED 0x010 \/* Try to quote next cha/ ! EC_RAW ../common/key.h /^#define EC_RAW 0x020 \/* Any next character. XXX/ ! EC_TIMEOUT ../common/key.h /^#define EC_TIMEOUT 0x040 \/* Timeout to next char/ ! ENDMESSAGE ../tcl_api/tcl.c /^#define ENDMESSAGE \\$/ ! ENTIRE_LINE ../common/cut.c /^#define ENTIRE_LINE 0$/ ! EQUAL ../ex/ex_tag.c /^#define EQUAL 0$/ ! EXCMD_RUNNING ../common/gs.h /^#define EXCMD_RUNNING(gp) ((gp)->ecq.lh_first->cle/ EXP ../ex/ex.h /^#define EXP(sp) ((EX_PRIVATE *)((sp)->ex_private))/ ! EXP_CSCINIT ../ex/ex.h /^#define EXP_CSCINIT 0x01 \/* Cscope initialized. / ! E_ABSMARK ../ex/ex.h /^#define E_ABSMARK 0x00040000 \/* Set the absolute / ! E_ADDR1 ../ex/ex.h /^#define E_ADDR1 0x00000001 \/* One address. *\/$/ ! E_ADDR2 ../ex/ex.h /^#define E_ADDR2 0x00000002 \/* Two addresses. *\// ! E_ADDR2_ALL ../ex/ex.h /^#define E_ADDR2_ALL 0x00000004 \/* Zero\/two addre/ ! E_ADDR2_NONE ../ex/ex.h /^#define E_ADDR2_NONE 0x00000008 \/* Zero\/two addr/ ! E_ADDR_DEF ../ex/ex.h /^#define E_ADDR_DEF 0x00080000 \/* Default addresse/ ! E_ADDR_ZERO ../ex/ex.h /^#define E_ADDR_ZERO 0x00000010 \/* 0 is a legal ad/ ! E_ADDR_ZERODEF ../ex/ex.h /^#define E_ADDR_ZERODEF 0x00000020 \/* 0 is default/ ! E_AUTOPRINT ../ex/ex.h /^#define E_AUTOPRINT 0x00000040 \/* Command always / ! E_BLIGNORE ../ex/ex.h /^#define E_BLIGNORE 0x00000800 \/* Ignore blank lin/ ! E_CLRFLAG ../ex/ex.h /^#define E_CLRFLAG 0x00000080 \/* Clear the print (/ ! E_C_BUFFER ../ex/ex.h /^#define E_C_BUFFER 0x00001 \/* Buffer name specif/ ! E_C_CARAT ../ex/ex.h /^#define E_C_CARAT 0x00002 \/* ^ flag. *\/$/ ! E_C_COUNT ../ex/ex.h /^#define E_C_COUNT 0x00004 \/* Count specified. */ ! E_C_COUNT_NEG ../ex/ex.h /^#define E_C_COUNT_NEG 0x00008 \/* Count was signe/ ! E_C_COUNT_POS ../ex/ex.h /^#define E_C_COUNT_POS 0x00010 \/* Count was signe/ ! E_C_DASH ../ex/ex.h /^#define E_C_DASH 0x00020 \/* - flag. *\/$/ ! E_C_DOT ../ex/ex.h /^#define E_C_DOT 0x00040 \/* . flag. *\/$/ ! E_C_EQUAL ../ex/ex.h /^#define E_C_EQUAL 0x00080 \/* = flag. *\/$/ ! E_C_FORCE ../ex/ex.h /^#define E_C_FORCE 0x00100 \/* ! flag. *\/$/ ! E_C_HASH ../ex/ex.h /^#define E_C_HASH 0x00200 \/* # flag. *\/$/ ! E_C_LIST ../ex/ex.h /^#define E_C_LIST 0x00400 \/* l flag. *\/$/ ! E_C_PLUS ../ex/ex.h /^#define E_C_PLUS 0x00800 \/* + flag. *\/$/ ! E_C_PRINT ../ex/ex.h /^#define E_C_PRINT 0x01000 \/* p flag. *\/$/ ! E_DELTA ../ex/ex.h /^#define E_DELTA 0x00100000 \/* Search address wit/ ! E_MODIFY ../ex/ex.h /^#define E_MODIFY 0x00200000 \/* File name expansio/ ! E_MOVETOEND ../ex/ex.h /^#define E_MOVETOEND 0x00400000 \/* Move to the end/ ! E_NAMEDISCARD ../ex/ex.h /^#define E_NAMEDISCARD 0x00001000 \/* Free\/discard/ ! E_NEWLINE ../ex/ex.h /^#define E_NEWLINE 0x00800000 \/* Found ending flags, f)$/ ! F_DEVSET ../common/exf.h /^#define F_DEVSET 0x001 \/* mdev\/minode fields in/ ! F_FIRSTMODIFY ../common/exf.h /^#define F_FIRSTMODIFY 0x002 \/* File not yet modi/ ! F_INIT ../common/util.h /^#define F_INIT(p, f) FL_INIT((p)->flags, f) \/* St/ F_ISSET ../common/util.h /^#define F_ISSET(p, f) FL_ISSET((p)->flags, f)$/ - F_MODIFIED ../common/exf.h /^#define F_MODIFIED 0x004 \/* File is currently di/ - F_MULTILOCK ../common/exf.h /^#define F_MULTILOCK 0x008 \/* Multiple processes / - F_NOLOG ../common/exf.h /^#define F_NOLOG 0x010 \/* Logging turned off. */ - F_RCV_NORM ../common/exf.h /^#define F_RCV_NORM 0x020 \/* Don't delete recover/ - F_RCV_ON ../common/exf.h /^#define F_RCV_ON 0x040 \/* Recovery is possible. / F_SET ../common/util.h /^#define F_SET(p, f) FL_SET((p)->flags, f)$/ - F_UNDO ../common/exf.h /^#define F_UNDO 0x080 \/* No change since last un/ GCLP ../cl/cl.h /^#define GCLP(gp) ((CL_PRIVATE *)gp->cl_private)$/ ! GET_SPACE_GOTO ../common/mem.h /^#define GET_SPACE_GOTO(sp, bp, blen, nlen) { \\/ GET_SPACE_RET ../common/mem.h /^#define GET_SPACE_RET(sp, bp, blen, nlen) { \\$/ ! GLOBAL_CLP ../cl/cl_main.c /^#define GLOBAL_CLP \\$/ ! GLOBAL_TKP ../tk/tk_main.c /^#define GLOBAL_TKP \\$/ ! GO_COLUMNS ../common/gs.h /^#define GO_COLUMNS 0 \/* Global options: columns./ ! GO_LINES ../common/gs.h /^#define GO_LINES 1 \/* Global options: lines. *\// ! GO_SECURE ../common/gs.h /^#define GO_SECURE 2 \/* Global options: secure. */ ! GO_TERM ../common/gs.h /^#define GO_TERM 3 \/* Global options: terminal t/ ! GREATER ../ex/ex_tag.c /^#define GREATER 1$/ GTKP ../tk/tki.h /^#define GTKP(gp) ((TK_PRIVATE *)gp->tk_private)$/ ! G_ABBREV ../common/gs.h /^#define G_ABBREV 0x0001 \/* If have abbreviations/ ! G_BELLSCHED ../common/gs.h /^#define G_BELLSCHED 0x0002 \/* Bell scheduled. */ ! G_INTERRUPTED ../common/gs.h /^#define G_INTERRUPTED 0x0004 \/* Interrupted. *\// ! G_RECOVER_SET ../common/gs.h /^#define G_RECOVER_SET 0x0008 \/* Recover system i/ ! G_SCRIPTED ../common/gs.h /^#define G_SCRIPTED 0x0010 \/* Ex script session. / ! G_SCRWIN ../common/gs.h /^#define G_SCRWIN 0x0020 \/* Scripting windows run/ ! G_SNAPSHOT ../common/gs.h /^#define G_SNAPSHOT 0x0040 \/* Always snapshot fil/ ! G_SRESTART ../common/gs.h /^#define G_SRESTART 0x0080 \/* Screen restarted. */ ! G_TMP_INUSE ../common/gs.h /^#define G_TMP_INUSE 0x0100 \/* Temporary buffer i/ ! HALFSCREEN ../vi/vi.h /^#define HALFSCREEN(sp) \/* Half text screen. */ HALFTEXT ../vi/vi.h /^#define HALFTEXT(sp) \/* Half text. *\/ \\$/ HANDLE_WEIRDNESS ../vi/vs_smap.c /^#define HANDLE_WEIRDNESS(cnt) { \\$/ ! HEXC ../vi/v_increment.c /^#define HEXC 2$/ ! HEXL ../vi/v_increment.c /^#define HEXL 3$/ ! HMAP ../vi/vi.h /^#define HMAP _HMAP(sp)$/ ! INCREMENT ../ex/ex_argv.c /^#define INCREMENT 20$/ ! INDX_HUP ../cl/cl.h /^#define INDX_HUP 0$/ ! INDX_INT ../cl/cl.h /^#define INDX_INT 1$/ ! INDX_MAX ../cl/cl.h /^#define INDX_MAX 4 \/* Original signal information/ ! INDX_TERM ../cl/cl.h /^#define INDX_TERM 2$/ ! INDX_WINCH ../cl/cl.h /^#define INDX_WINCH 3$/ ! INITMESSAGE ../tcl_api/tcl.c /^#define INITMESSAGE \\$/ INTERRUPTED ../common/key.h /^#define INTERRUPTED(sp) \\$/ ! INTERRUPT_CHECK ../common/key.h /^#define INTERRUPT_CHECK 100$/ ! INTEXT_CHECK ../vi/v_paragraph.c /^#define INTEXT_CHECK { \\$/ ! ISCMD ../vi/vi.h /^#define ISCMD(p, key) ((p) == &vikeys[key])$/ ! ISMOTION ../vi/vi.h /^#define ISMOTION(vp) (vp->rkp != NULL && F_ISSET(v/ IS_ESCAPE ../ex/ex.h /^#define IS_ESCAPE(sp, cmdp, ch) \\$/ IS_ONELINE ../vi/vi.h /^#define IS_ONELINE(sp) ((sp)->rows == 1)$/ - IS_RESTART ../vi/v_txt.c /^#define IS_RESTART 0x01 \/* Reset the incremental / - IS_RUNNING ../vi/v_txt.c /^#define IS_RUNNING 0x02 \/* Incremental search tur/ IS_SMALL ../vi/vi.h /^#define IS_SMALL(sp) ((sp)->t_minrows != (sp)->t_m/ IS_SPLIT ../vi/vi.h /^#define IS_SPLIT(sp) \\$/ KEY ../vi/vi.c /^#define KEY(key, ec_flags) { \\$/ KEYS_WAITING ../common/key.h /^#define KEYS_WAITING(sp) ((sp)->gp->i_cnt != 0)$/ - KEY_LEN ../common/gs.h /^#define KEY_LEN(sp, ch) \\$/ - KEY_NAME ../common/gs.h /^#define KEY_NAME(sp, ch) \\$/ - KEY_VAL ../common/gs.h /^#define KEY_VAL(sp, ch) \\$/ LASTLINE ../vi/vi.h /^#define LASTLINE(sp) \\$/ ! LESS ../ex/ex_tag.c /^#define LESS (-1)$/ LF_CLR ../common/util.h /^#define LF_CLR(f) FL_CLR(flags, f)$/ ! LF_INIT ../common/util.h /^#define LF_INIT(f) FL_INIT(flags, f) \/* Local var/ LF_ISSET ../common/util.h /^#define LF_ISSET(f) FL_ISSET(flags, f)$/ LF_SET ../common/util.h /^#define LF_SET(f) FL_SET(flags, f)$/ ! LINE_RESOLVE ../vi/v_txt.c /^#define LINE_RESOLVE { \\$/ ! LNO ../vi/vs_refresh.c /^#define LNO sp->lno \/* Current file line. *\/$/ ! LOG_CORRECT ../vi/v_itxt.c /^#define LOG_CORRECT { \\$/ ! LOG_CURSOR_END ../common/log.h /^#define LOG_CURSOR_END 2$/ ! LOG_CURSOR_INIT ../common/log.h /^#define LOG_CURSOR_INIT 1$/ ! LOG_ERR ../common/log.c /^#define LOG_ERR { \\$/ ! LOG_LINE_APPEND ../common/log.h /^#define LOG_LINE_APPEND 3$/ ! LOG_LINE_DELETE ../common/log.h /^#define LOG_LINE_DELETE 4$/ ! LOG_LINE_INSERT ../common/log.h /^#define LOG_LINE_INSERT 5$/ ! LOG_LINE_RESET_B ../common/log.h /^#define LOG_LINE_RESET_B 7$/ ! LOG_LINE_RESET_F ../common/log.h /^#define LOG_LINE_RESET_F 6$/ ! LOG_MARK ../common/log.h /^#define LOG_MARK 8$/ ! LOG_NOTYPE ../common/log.h /^#define LOG_NOTYPE 0$/ ! L_ADDED ../common/screen.h /^#define L_ADDED 0 \/* Added lines. *\/$/ ! L_CHANGED ../common/screen.h /^#define L_CHANGED 1 \/* Changed lines. *\/$/ ! L_DELETED ../common/screen.h /^#define L_DELETED 2 \/* Deleted lines. *\/$/ ! L_JOINED ../common/screen.h /^#define L_JOINED 3 \/* Joined lines. *\/$/ ! L_MOVED ../common/screen.h /^#define L_MOVED 4 \/* Moved lines. *\/$/ ! L_NAME ../ex/ex_tag.c /^#define L_NAME 30 \/* Name. *\/$/ ! L_SHIFT ../common/screen.h /^#define L_SHIFT 5 \/* Shift lines. *\/$/ ! L_SLOP ../ex/ex_tag.c /^#define L_SLOP 4 \/* Leading number plus trailin/ ! L_SPACE ../ex/ex_tag.c /^#define L_SPACE 5 \/* Spaces after name, before / ! L_TAG ../ex/ex_tag.c /^#define L_TAG 20 \/* Tag. *\/$/ ! L_YANKED ../common/screen.h /^#define L_YANKED 6 \/* Yanked lines. *\/$/ MALLOC ../common/mem.h /^#define MALLOC(sp, p, cast, size) { \\$/ MALLOC_GOTO ../common/mem.h /^#define MALLOC_GOTO(sp, p, cast, size) { \\$/ MALLOC_NOMSG ../common/mem.h /^#define MALLOC_NOMSG(sp, p, cast, size) { \\$/ MALLOC_RET ../common/mem.h /^#define MALLOC_RET(sp, p, cast, size) { \\$/ MAPPED_KEYS_WAITING ../common/key.h /^#define MAPPED_KEYS_WAITING(sp) \\$/ ! MAP_FILE ../ex/ex_tag.c /^#define MAP_FILE 0$/ ! MARK_DELETED ../common/mark.h /^#define MARK_DELETED 0x01 \/* Mark was deleted. */ ! MARK_USERSET ../common/mark.h /^#define MARK_USERSET 0x02 \/* User set this mark./ ! MAXCMDNAMELEN ../ex/ex.h /^#define MAXCMDNAMELEN 12 \/* Longest command name/ ! MAXHOSTNAMELEN ../common/recover.c /^#define MAXHOSTNAMELEN 1024$/ ! MAXIMUM_SCREEN_COLS ../common/options_f.c /^#define MAXIMUM_SCREEN_COLS 500$/ ! MAXIMUM_SCREEN_ROWS ../common/options_f.c /^#define MAXIMUM_SCREEN_ROWS 500$/ ! MAXNUM ../common/msg.c /^#define MAXNUM 25$/ ! MAXVIKEY ../vi/vi.h /^#define MAXVIKEY 126 \/* List of vi commands. *\// ! MAX_ABBREVIATION_EXPANSION ../vi/v_txt.c /^#define MAX_ABBREVIATION_EXPANSION 256$/ ! MAX_BIT_SEQ ../common/gs.h /^#define MAX_BIT_SEQ 128 \/* Max + 1 fast check ch/ ! MAX_CHARACTER_COLUMNS ../common/key.h /^#define MAX_CHARACTER_COLUMNS 4$/ ! MAX_CHAR_T ../common/key.h /^#define MAX_CHAR_T 0xff$/ ! MAX_FAST_KEY ../common/gs.h /^#define MAX_FAST_KEY 254 \/* Max fast check chara/ ! MEGABYTE ../ex/ex_source.c /^#define MEGABYTE 1048576$/ MEMMOVE ../common/mem.h /^#define MEMMOVE(p, t, len) memmove(p, t, (len) * s/ MEMSET ../common/mem.h /^#define MEMSET(p, value, len) memset(p, value, (le/ ! MINIMUM_SCREEN_COLS ../common/screen.h /^#define MINIMUM_SCREEN_COLS 20$/ ! MINIMUM_SCREEN_ROWS ../common/screen.h /^#define MINIMUM_SCREEN_ROWS 1$/ ! MINREAD ../ex/ex_script.c /^#define MINREAD 1024$/ ! MODESIZE ../vi/vs_refresh.c /^#define MODESIZE 9$/ ! MSTAT_SHOWLAST ../common/msg.h /^#define MSTAT_SHOWLAST 0x01 \/* Show the line numb/ ! MSTAT_TRUNCATE ../common/msg.h /^#define MSTAT_TRUNCATE 0x02 \/* Truncate the file / Mcl_main ../cl/cl_main.c /^main(argc, argv)$/ Mtk_main ../tk/tk_main.c /^main(argc, argv)$/ NADD_SLONG ../common/util.h /^#define NADD_SLONG(sp, v1, v2) \\$/ --- 1,128 ---- ! ABSMARK1 ../common/mark.h 41 ! ABSMARK2 ../common/mark.h 42 ! ADD_SPACE_GOTO ../common/mem.h /^#define ADD_SPACE_GOTO(sp, bp, blen, nlen) { \\$/ ADD_SPACE_RET ../common/mem.h /^#define ADD_SPACE_RET(sp, bp, blen, nlen) { \\$/ BINC_GOTO ../common/mem.h /^#define BINC_GOTO(sp, lp, llen, nlen) { \\$/ BINC_RET ../common/mem.h /^#define BINC_RET(sp, lp, llen, nlen) { \\$/ BUILD ../ex/ex_subst.c /^#define BUILD(sp, l, len) { \\$/ CALLOC ../common/mem.h /^#define CALLOC(sp, p, cast, nmemb, size) { \\$/ CALLOC_GOTO ../common/mem.h /^#define CALLOC_GOTO(sp, p, cast, nmemb, size) { / CALLOC_NOMSG ../common/mem.h /^#define CALLOC_NOMSG(sp, p, cast, nmemb, size) { / CALLOC_RET ../common/mem.h /^#define CALLOC_RET(sp, p, cast, nmemb, size) { / CBNAME ../common/cut.h /^#define CBNAME(sp, cbp, nch) { \\$/ ! CH_BSEARCH ../common/key.h 154 ! CH_CURSOR ../common/key.h 155 ! CH_ENDMARK ../common/key.h 156 ! CH_EXPROMPT ../common/key.h 157 ! CH_FSEARCH ../common/key.h 158 ! CH_HEX ../common/key.h 159 ! CH_LITERAL ../common/key.h 160 ! CH_NO ../common/key.h 161 ! CH_NOT_DIGIT ../common/key.h 162 ! CH_QUIT ../common/key.h 163 ! CH_YES ../common/key.h 164 CLP ../cl/cl.h /^#define CLP(sp) ((CL_PRIVATE *)((sp)->gp->cl_priv/ CLR_INTERRUPT ../common/key.h /^#define CLR_INTERRUPT(sp) \\$/ COL_OFF ../common/util.h /^#define COL_OFF(c, stop) ((stop) - ((c) % (stop)))/ ! CSCOPE_DBFILE ../ex/ex_cscope.c 39 ! CSCOPE_PATHS ../ex/ex_cscope.c 40 ! CS_INVALID ../common/multibyte.h 209 ! CS_NONE ../common/multibyte.h 208 ! CS_RAW ../common/multibyte.h /^#define CS_RAW(x) (CS_RAW0 <= (x) && (x) <= CS_RAW/ ! CUT_LINEMODE ../common/cut.h 75 ! CUT_NUMOPT ../common/cut.h 76 ! CUT_NUMREQ ../common/cut.h 77 ! DBG_FATAL ../common/exf.h 67 ! DBG_NOCACHE ../common/exf.h 68 ! DOT ../vi/vi.c 55 ! DOTMOTION ../vi/vi.c 56 ! EC_INTERRUPT ../common/key.h 183 ! EC_MAPCOMMAND ../common/key.h 184 ! EC_MAPINPUT ../common/key.h 185 ! EC_MAPNODIGIT ../common/key.h 186 ! EC_QUOTED ../common/key.h 187 ! EC_RAW ../common/key.h 188 ! EC_TIMEOUT ../common/key.h 189 ! ENDMESSAGE ../tcl_api/tcl.c 49 ! EQUAL ../ex/ex_tag.c 1246 EXP ../ex/ex.h /^#define EXP(sp) ((EX_PRIVATE *)((sp)->ex_private))/ ! FALSE ../cl/cl.h 81 ! FINDHELP ../ex/ex_cscope.c 54 FL_CLR ../common/util.h /^#define FL_CLR(l, f) ((l) &= ~(f))$/ ! FL_INIT ../common/util.h /^#define FL_INIT(l, f) (l) = (f) \/* Specific flags/ FL_ISSET ../common/util.h /^#define FL_ISSET(l, f) ((l) & (f))$/ FL_SET ../common/util.h /^#define FL_SET(l, f) ((l) |= (f))$/ FREE_SPACE ../common/mem.h /^#define FREE_SPACE(sp, bp, blen) { \\$/ ! FS_ALL ../common/exf.h 71 ! FS_APPEND ../common/exf.h 72 ! FS_FORCE ../common/exf.h 73 ! FS_OPENERR ../common/exf.h 74 ! FS_POSSIBLE ../common/exf.h 75 ! FS_SETALT ../common/exf.h 76 F_CLR ../common/util.h /^#define F_CLR(p, f) FL_CLR((p)->flags, f)$/ ! F_INIT ../common/util.h /^#define F_INIT(p, f) FL_INIT((p)->flags, f) \/* Str/ F_ISSET ../common/util.h /^#define F_ISSET(p, f) FL_ISSET((p)->flags, f)$/ F_SET ../common/util.h /^#define F_SET(p, f) FL_SET((p)->flags, f)$/ GCLP ../cl/cl.h /^#define GCLP(gp) ((CL_PRIVATE *)gp->cl_private)$/ ! GET_SPACE_GOTO ../common/mem.h /^#define GET_SPACE_GOTO(sp, bp, blen, nlen) { \\$/ GET_SPACE_RET ../common/mem.h /^#define GET_SPACE_RET(sp, bp, blen, nlen) { \\$/ ! GLOBAL_CLP ../cl/cl_main.c 292 ! GLOBAL_TKP ../tk/tk_main.c 315 ! GREATER ../ex/ex_tag.c 1247 GTKP ../tk/tki.h /^#define GTKP(gp) ((TK_PRIVATE *)gp->tk_private)$/ ! HALFSCREEN ../vi/vi.h /^#define HALFSCREEN(sp) \/* Half text screen. *\/ / HALFTEXT ../vi/vi.h /^#define HALFTEXT(sp) \/* Half text. *\/ \\$/ HANDLE_WEIRDNESS ../vi/vs_smap.c /^#define HANDLE_WEIRDNESS(cnt) { \\$/ ! INITMESSAGE ../tcl_api/tcl.c 46 INTERRUPTED ../common/key.h /^#define INTERRUPTED(sp) \\$/ ! INTERRUPT_CHECK ../common/key.h 174 ! INTEXT_CHECK ../vi/v_paragraph.c 30 IS_ESCAPE ../ex/ex.h /^#define IS_ESCAPE(sp, cmdp, ch) \\$/ IS_ONELINE ../vi/vi.h /^#define IS_ONELINE(sp) ((sp)->rows == 1)$/ IS_SMALL ../vi/vi.h /^#define IS_SMALL(sp) ((sp)->t_minrows != (sp)->t_m/ IS_SPLIT ../vi/vi.h /^#define IS_SPLIT(sp) \\$/ KEY ../vi/vi.c /^#define KEY(key, ec_flags) { \\$/ + KEY0 ../vi/vi.c /^#define KEY0(key, ec_flags) { \\$/ KEYS_WAITING ../common/key.h /^#define KEYS_WAITING(sp) ((sp)->gp->i_cnt != 0)$/ LASTLINE ../vi/vi.h /^#define LASTLINE(sp) \\$/ ! LESS ../ex/ex_tag.c 1248 LF_CLR ../common/util.h /^#define LF_CLR(f) FL_CLR(flags, f)$/ ! LF_INIT ../common/util.h /^#define LF_INIT(f) FL_INIT(flags, f) \/* Local vari/ LF_ISSET ../common/util.h /^#define LF_ISSET(f) FL_ISSET(flags, f)$/ LF_SET ../common/util.h /^#define LF_SET(f) FL_SET(flags, f)$/ ! LOG_CORRECT ../vi/v_itxt.c 55 ! LOG_CURSOR_END ../common/log.h 14 ! LOG_CURSOR_INIT ../common/log.h 13 ! LOG_ERR ../common/log.c 72 ! LOG_LINE_APPEND ../common/log.h 15 ! LOG_LINE_DELETE ../common/log.h 16 ! LOG_LINE_INSERT ../common/log.h 17 ! LOG_LINE_RESET_B ../common/log.h 19 ! LOG_LINE_RESET_F ../common/log.h 18 ! LOG_MARK ../common/log.h 20 ! LOG_NOTYPE ../common/log.h 12 MALLOC ../common/mem.h /^#define MALLOC(sp, p, cast, size) { \\$/ MALLOC_GOTO ../common/mem.h /^#define MALLOC_GOTO(sp, p, cast, size) { \\$/ MALLOC_NOMSG ../common/mem.h /^#define MALLOC_NOMSG(sp, p, cast, size) { \\$/ MALLOC_RET ../common/mem.h /^#define MALLOC_RET(sp, p, cast, size) { \\$/ MAPPED_KEYS_WAITING ../common/key.h /^#define MAPPED_KEYS_WAITING(sp) \\$/ ! MAXCMDNAMELEN ../ex/ex.h 37 ! MAXVIKEY ../vi/vi.h 151 ! MAX_CHARACTER_COLUMNS ../common/key.h 29 ! MAX_CHAR_T ../common/key.h 26 ! MAX_MULTI_BLEN ../common/multibyte.h 213 ! MAX_MULTI_LEN ../common/multibyte.h 214 ! MB_JOIN ../common/multibyte.h 125 ! MB_MULTIBYTE ../common/multibyte.h 122 ! MB_RAW ../common/multibyte.h 124 ! MB_SKIP ../common/multibyte.h 123 MEMMOVE ../common/mem.h /^#define MEMMOVE(p, t, len) memmove(p, t, (len) * s/ MEMSET ../common/mem.h /^#define MEMSET(p, value, len) memset(p, value, (le/ ! MINIMUM_SCREEN_COLS ../common/screen.h 25 ! MINIMUM_SCREEN_ROWS ../common/screen.h 24 ! MSTAT_SHOWLAST ../common/msg.h 64 ! MSTAT_TRUNCATE ../common/msg.h 65 ! MULTIBYTE_VERSION ../ex/mversion.h 1 Mcl_main ../cl/cl_main.c /^main(argc, argv)$/ Mtk_main ../tk/tk_main.c /^main(argc, argv)$/ NADD_SLONG ../common/util.h /^#define NADD_SLONG(sp, v1, v2) \\$/ *************** *** 282,289 **** NIL ../perl_api/perlsfio.c /^#define NIL(type) ((type)0)$/ NNFITS ../common/util.h /^#define NNFITS(min, cur, add) \\$/ NPFITS ../common/util.h /^#define NPFITS(max, cur, add) \\$/ - OCNO ../vi/vs_refresh.c /^#define OCNO vip->ocno \/* Remembered file column/ - OCTAL ../vi/v_increment.c /^#define OCTAL 4$/ OG_CLR ../common/options.h /^#define OG_CLR(gp, o) ((gp)->opts[(o)].o_cur.val)/ OG_D_STR ../common/options.h /^#define OG_D_STR(gp, o) ((gp)->opts[(o)].o_def.st/ OG_D_VAL ../common/options.h /^#define OG_D_VAL(gp, o) ((gp)->opts[(o)].o_def.va/ --- 133,138 ---- *************** *** 291,510 **** OG_SET ../common/options.h /^#define OG_SET(gp, o) ((gp)->opts[(o)].o_cur.val)/ OG_STR ../common/options.h /^#define OG_STR(gp, o) ((gp)->opts[(o)].o_cur.str)/ OG_VAL ../common/options.h /^#define OG_VAL(gp, o) ((gp)->opts[(o)].o_cur.val)/ ! OI ../common/options.c /^#define OI(indx, str) { \\$/ ! OLNO ../vi/vs_refresh.c /^#define OLNO vip->olno \/* Remembered file line. / ! ONE_FOR_EOF ../cl/cl_read.c /^#define ONE_FOR_EOF 1$/ ! OOBLNO ../common/mark.h /^#define OOBLNO 0 \/* Out-of-band line number. */ ! OPT_ADISP ../common/options.h /^#define OPT_ADISP 0x001 \/* Always display the op/ ! OPT_ALWAYS ../common/options.h /^#define OPT_ALWAYS 0x002 \/* Always call the supp/ ! OPT_GLOBAL ../common/options.h /^#define OPT_GLOBAL 0x01 \/* Option is global. *\// ! OPT_NDISP ../common/options.h /^#define OPT_NDISP 0x004 \/* Never display the opt/ ! OPT_NOSAVE ../common/options.h /^#define OPT_NOSAVE 0x008 \/* Mkexrc command doesn/ ! OPT_NOSET ../common/options.h /^#define OPT_NOSET 0x010 \/* Option may not be set/ ! OPT_NOUNSET ../common/options.h /^#define OPT_NOUNSET 0x020 \/* Option may not be u/ ! OPT_NOZERO ../common/options.h /^#define OPT_NOZERO 0x040 \/* Option may not be se/ ! OPT_SELECTED ../common/options.h /^#define OPT_SELECTED 0x02 \/* Selected for displa/ ! OS_DEF ../common/options.h /^#define OS_DEF 0x01 \/* Set the default value. */ ! OS_NOFREE ../common/options.h /^#define OS_NOFREE 0x02 \/* Don't free the old str/ ! OS_STR ../common/options.h /^#define OS_STR 0x04 \/* Set to string argument. / ! OS_STRDUP ../common/options.h /^#define OS_STRDUP 0x08 \/* Copy then set to strin/ ! OUTCH ../ex/ex_subst.c /^#define OUTCH(ch, nltrans) { \\$/ ! O_CLR ../common/options.h /^#define O_CLR(sp, o) o_set(sp, o, 0, NULL, 0)$/ ! O_D_CLR ../common/options.h /^#define O_D_CLR(sp, o) o_set(sp, o, OS_DEF, NULL,/ ! O_D_ISSET ../common/options.h /^#define O_D_ISSET(sp, o) O_D_VAL(sp, o)$/ ! O_D_SET ../common/options.h /^#define O_D_SET(sp, o) o_set(sp, o, OS_DEF, NULL,/ ! O_D_STR ../common/options.h /^#define O_D_STR(sp, o) O_V(sp, o, o_def.str)$/ ! O_D_VAL ../common/options.h /^#define O_D_VAL(sp, o) O_V(sp, o, o_def.val)$/ ! O_ISSET ../common/options.h /^#define O_ISSET(sp, o) O_VAL(sp, o)$/ ! O_NUMBER_FMT ../vi/vi.h /^#define O_NUMBER_FMT "%7lu " \/* O_NUMBER format/ ! O_NUMBER_LENGTH ../vi/vi.h /^#define O_NUMBER_LENGTH 8$/ ! O_SET ../common/options.h /^#define O_SET(sp, o) o_set(sp, o, 0, NULL, 1)$/ ! O_STR ../common/options.h /^#define O_STR(sp, o) O_V(sp, o, o_cur.str)$/ O_V ../common/options.h /^#define O_V(sp, o, fld) \\$/ ! O_VAL ../common/options.h /^#define O_VAL(sp, o) O_V(sp, o, o_cur.val)$/ ! PROMPTCHAR ../ex/ex.h /^#define PROMPTCHAR ':' \/* Prompt using a colon. / QREM ../common/key.c /^#define QREM(len) { \\$/ ! RCV_EMAIL ../common/exf.h /^#define RCV_EMAIL 0x01 \/* Send the user email, IF/ ! RCV_ENDSESSION ../common/exf.h /^#define RCV_ENDSESSION 0x02 \/* End the file sessi/ ! RCV_PERIOD ../common/exf.h /^#define RCV_PERIOD 120 \/* Sync every two minutes/ ! RCV_PRESERVE ../common/exf.h /^#define RCV_PRESERVE 0x04 \/* Preserve backup file/ ! RCV_SNAPSHOT ../common/exf.h /^#define RCV_SNAPSHOT 0x08 \/* Snapshot the recover/ REALLOC ../common/mem.h /^#define REALLOC(sp, p, cast, size) { \\$/ - REM ../common/msg.c /^#define REM (blen - mlen)$/ - RE_C_CSCOPE ../common/screen.h /^#define RE_C_CSCOPE 0x0001 \/* Compile cscope pat/ - RE_C_SEARCH ../common/screen.h /^#define RE_C_SEARCH 0x0002 \/* Compile search rep/ - RE_C_SILENT ../common/screen.h /^#define RE_C_SILENT 0x0004 \/* No error messages./ - RE_C_SUBST ../common/screen.h /^#define RE_C_SUBST 0x0008 \/* Compile substitute / - RE_C_TAG ../common/screen.h /^#define RE_C_TAG 0x0010 \/* Compile ctag pattern./ - RE_WSTART ../common/screen.h /^#define RE_WSTART "[[:<:]]" \/* Ex\/vi: not-in-wor/ - RE_WSTOP ../common/screen.h /^#define RE_WSTOP "[[:>:]]"$/ RLNO ../cl/cl.h /^#define RLNO(sp, lno) (sp)->woff + (lno)$/ ! SCNO ../vi/vs_refresh.c /^#define SCNO vip->sc_col \/* Current screen colum/ ! SCREEN_COLS ../vi/vi.h /^#define SCREEN_COLS(sp) \/* Screen columns. *\// ! SC_ARGNOFREE ../common/screen.h /^#define SC_ARGNOFREE 0x00002000 \/* Argument list / ! SC_ARGRECOVER ../common/screen.h /^#define SC_ARGRECOVER 0x00004000 \/* Argument list/ ! SC_AT_SET ../common/screen.h /^#define SC_AT_SET 0x00008000 \/* Last at buffer se/ ! SC_COMEDIT ../common/screen.h /^#define SC_COMEDIT 0x00010000 \/* Colon command-li/ ! SC_EX ../common/screen.h /^#define SC_EX 0x00000001 \/* Ex editor. *\/$/ ! SC_EXIT ../common/screen.h /^#define SC_EXIT 0x00000200 \/* Exiting (not force/ ! SC_EXIT_FORCE ../common/screen.h /^#define SC_EXIT_FORCE 0x00000400 \/* Exiting (forc/ ! SC_EX_GLOBAL ../common/screen.h /^#define SC_EX_GLOBAL 0x00020000 \/* Ex: executing / ! SC_EX_SILENT ../common/screen.h /^#define SC_EX_SILENT 0x00040000 \/* Ex: batch scri/ ! SC_EX_WAIT_NO ../common/screen.h /^#define SC_EX_WAIT_NO 0x00080000 \/* Ex: don't wai/ ! SC_EX_WAIT_YES ../common/screen.h /^#define SC_EX_WAIT_YES 0x00100000 \/* Ex: do wa/ ! SC_FSWITCH ../common/screen.h /^#define SC_FSWITCH 0x00000800 \/* Switch underlyin/ ! SC_READONLY ../common/screen.h /^#define SC_READONLY 0x00200000 \/* Persistent read/ ! SC_RE_SEARCH ../common/screen.h /^#define SC_RE_SEARCH 0x00400000 \/* Search RE has / ! SC_RE_SUBST ../common/screen.h /^#define SC_RE_SUBST 0x00800000 \/* Substitute RE h/ ! SC_SCRIPT ../common/screen.h /^#define SC_SCRIPT 0x01000000 \/* Shell script wind/ ! SC_SCR_CENTER ../common/screen.h /^#define SC_SCR_CENTER 0x00000080 \/* Center the li/ ! SC_SCR_EX ../common/screen.h /^#define SC_SCR_EX 0x00000004 \/* Screen is in ex m/ ! SC_SCR_EXWROTE ../common/screen.h /^#define SC_SCR_EXWROTE 0x00000010 \/* Ex overwrite/ ! SC_SCR_REDRAW ../common/screen.h /^#define SC_SCR_REDRAW 0x00000040 \/* Refresh. *\/$/ ! SC_SCR_REFORMAT ../common/screen.h /^#define SC_SCR_REFORMAT 0x00000020 \/* Reformat (r/ ! SC_SCR_TOP ../common/screen.h /^#define SC_SCR_TOP 0x00000100 \/* Top the line if / ! SC_SCR_VI ../common/screen.h /^#define SC_SCR_VI 0x00000008 \/* Screen is in vi m/ ! SC_SSWITCH ../common/screen.h /^#define SC_SSWITCH 0x00001000 \/* Switch screens. / ! SC_STATUS ../common/screen.h /^#define SC_STATUS 0x02000000 \/* Welcome message. / ! SC_STATUS_CNT ../common/screen.h /^#define SC_STATUS_CNT 0x04000000 \/* Welcome messa/ ! SC_TINPUT ../common/screen.h /^#define SC_TINPUT 0x08000000 \/* Doing text input./ ! SC_TINPUT_INFO ../common/screen.h /^#define SC_TINPUT_INFO 0x10000000 \/* Doing text i/ ! SC_VI ../common/screen.h /^#define SC_VI 0x00000002 \/* Vi editor. *\/$/ ! SDEC ../vi/v_increment.c /^#define SDEC 1$/ ! SEARCH_CSCOPE ../common/screen.h /^#define SEARCH_CSCOPE 0x0001 \/* Search for a csc/ ! SEARCH_EOL ../common/screen.h /^#define SEARCH_EOL 0x0002 \/* Offset past EOL is / ! SEARCH_FILE ../common/screen.h /^#define SEARCH_FILE 0x0004 \/* Search the entire / ! SEARCH_INCR ../common/screen.h /^#define SEARCH_INCR 0x0008 \/* Search incremental/ ! SEARCH_MSG ../common/screen.h /^#define SEARCH_MSG 0x0010 \/* Display search mess/ ! SEARCH_PARSE ../common/screen.h /^#define SEARCH_PARSE 0x0020 \/* Parse the search / ! SEARCH_SET ../common/screen.h /^#define SEARCH_SET 0x0040 \/* Set search directio/ ! SEARCH_TAG ../common/screen.h /^#define SEARCH_TAG 0x0080 \/* Search for a tag pa/ ! SEARCH_WMSG ../common/screen.h /^#define SEARCH_WMSG 0x0100 \/* Display search-wra/ ! SEQ_FUNCMAP ../common/seq.h /^#define SEQ_FUNCMAP 0x01 \/* If unresolved functi/ ! SEQ_NOOVERWRITE ../common/seq.h /^#define SEQ_NOOVERWRITE 0x02 \/* Don't replace ex/ ! SEQ_SCREEN ../common/seq.h /^#define SEQ_SCREEN 0x04 \/* If screen specific. */ ! SEQ_USERDEF ../common/seq.h /^#define SEQ_USERDEF 0x08 \/* If user defined. *\// ! SETSIG ../tk/tk_main.c /^#define SETSIG(signal, handler, off) { \\$/ ! SHELLECHO ../ex/ex_argv.c /^#define SHELLECHO "echo "$/ ! SHELLOFFSET ../ex/ex_argv.c /^#define SHELLOFFSET (sizeof(SHELLECHO) - 1)$/ ! SHIFT ../common/key.c /^#define SHIFT (BITS - BITS % 3)$/ ! SIGBLOCK ../common/gs.h /^#define SIGBLOCK \\$/ ! SIGUNBLOCK ../common/gs.h /^#define SIGUNBLOCK \\$/ ! SINGLE_CHAR_COMMANDS ../ex/ex.c /^#define SINGLE_CHAR_COMMANDS "\\004!#&*<=>@~"$/ ! SIZE_HMAP ../vi/vi.h /^#define SIZE_HMAP(sp) (VIP(sp)->srows + 1)$/ SKIP_PAST_NEWLINE ../ex/ex_tag.c /^#define SKIP_PAST_NEWLINE(p, back) while (p < back/ SMAP_CACHE ../vi/vi.h /^#define SMAP_CACHE(smp) ((smp)->c_ecsize != 0)$/ SMAP_FLUSH ../vi/vi.h /^#define SMAP_FLUSH(smp) ((smp)->c_ecsize = 0)$/ ! STANDARD_TAB ../common/key.h /^#define STANDARD_TAB 6$/ ! SUB_FIRST ../ex/ex_subst.c /^#define SUB_FIRST 0x01 \/* The 'r' flag isn't rea/ ! SUB_MUSTSETR ../ex/ex_subst.c /^#define SUB_MUSTSETR 0x02 \/* The 'r' flag is req/ ! TABCH ../vi/vs_line.c /^#define TABCH '-'$/ TAB_OFF ../vi/vi.h /^#define TAB_OFF(c) COL_OFF((c), O_VAL(sp, O_TABSTO/ ! TAB_RESET ../vi/vs_relative.c /^#define TAB_RESET { \\$/ ! TAGF_ERR ../ex/tag.h /^#define TAGF_ERR 0x01 \/* Error occurred. *\/$/ ! TAGF_ERR_WARN ../ex/tag.h /^#define TAGF_ERR_WARN 0x02 \/* Error reported. *\// ! TAG_CSCOPE ../ex/tag.h /^#define TAG_CSCOPE 0x01 \/* Cscope tag. *\/$/ ! TCC ../tcl_api/tcl.c /^#define TCC(name, function) { \\$/ ! TEMPORARY_FILE_STRING ../common/gs.h /^#define TEMPORARY_FILE_STRING "\/tmp" \/* Default / ! TERM_PUSH_SHIFT ../common/key.c /^#define TERM_PUSH_SHIFT 30$/ TKP ../tk/tki.h /^#define TKP(sp) ((TK_PRIVATE *)((sp)->gp->tk_priv/ ! TK_LLINE_IV ../tk/tki.h /^#define TK_LLINE_IV 0x0001 \/* Last line is in inv/ ! TK_SCR_VI_INIT ../tk/tki.h /^#define TK_SCR_VI_INIT 0x0002 \/* Vi screen initia/ ! TK_SIGHUP ../tk/tki.h /^#define TK_SIGHUP 0x0004 \/* SIGHUP arrived. *\/$/ ! TK_SIGINT ../tk/tki.h /^#define TK_SIGINT 0x0008 \/* SIGINT arrived. *\/$/ ! TK_SIGTERM ../tk/tki.h /^#define TK_SIGTERM 0x0010 \/* SIGTERM arrived. *\// ! TK_SIGWINCH ../tk/tki.h /^#define TK_SIGWINCH 0x0020 \/* SIGWINCH arrived. */ ! TMAP ../vi/vi.h /^#define TMAP _TMAP(sp)$/ ! TOPMASK ../common/key.c /^#define TOPMASK (BITS % 3 == 2 ? 3 : 1) << (BITS -/ ! TRACE ../common/util.c /^TRACE(sp, fmt, va_alist)$/ ! TRUE ../cl/cl.h /^#define TRUE 1$/ ! TXT_ADDNEWLINE ../common/key.h /^#define TXT_ADDNEWLINE 0x00000001 \/* Replay start/ ! TXT_AICHARS ../common/key.h /^#define TXT_AICHARS 0x00000002 \/* Leading autoind/ ! TXT_ALTWERASE ../common/key.h /^#define TXT_ALTWERASE 0x00000004 \/* Option: altwe/ ! TXT_APPENDEOL ../common/key.h /^#define TXT_APPENDEOL 0x00000008 \/* Appending aft/ ! TXT_AUTOINDENT ../common/key.h /^#define TXT_AUTOINDENT 0x00000010 \/* Autoindent s/ ! TXT_BACKSLASH ../common/key.h /^#define TXT_BACKSLASH 0x00000020 \/* Backslashes e/ ! TXT_BEAUTIFY ../common/key.h /^#define TXT_BEAUTIFY 0x00000040 \/* Only printable/ ! TXT_BS ../common/key.h /^#define TXT_BS 0x00000080 \/* Backspace returns t/ ! TXT_CEDIT ../common/key.h /^#define TXT_CEDIT 0x00000100 \/* Can return TERM_C/ ! TXT_CNTRLD ../common/key.h /^#define TXT_CNTRLD 0x00000200 \/* Control-D is a c/ ! TXT_CNTRLT ../common/key.h /^#define TXT_CNTRLT 0x00000400 \/* Control-T is an / ! TXT_CR ../common/key.h /^#define TXT_CR 0x00000800 \/* CR returns the buff/ ! TXT_DOTTERM ../common/key.h /^#define TXT_DOTTERM 0x00001000 \/* Leading '.' ter/ ! TXT_EMARK ../common/key.h /^#define TXT_EMARK 0x00002000 \/* End of replacemen/ ! TXT_EOFCHAR ../common/key.h /^#define TXT_EOFCHAR 0x00004000 \/* ICANON set, ret/ ! TXT_ESCAPE ../common/key.h /^#define TXT_ESCAPE 0x00008000 \/* Escape returns t/ ! TXT_FILEC ../common/key.h /^#define TXT_FILEC 0x00010000 \/* Option: filec. */ ! TXT_INFOLINE ../common/key.h /^#define TXT_INFOLINE 0x00020000 \/* Editing the in/ ! TXT_MAPINPUT ../common/key.h /^#define TXT_MAPINPUT 0x00040000 \/* Apply the inpu/ ! TXT_NLECHO ../common/key.h /^#define TXT_NLECHO 0x00080000 \/* Echo the newline/ ! TXT_NUMBER ../common/key.h /^#define TXT_NUMBER 0x00100000 \/* Number the line./ ! TXT_OVERWRITE ../common/key.h /^#define TXT_OVERWRITE 0x00200000 \/* Overwrite cha/ ! TXT_PROMPT ../common/key.h /^#define TXT_PROMPT 0x00400000 \/* Display a prompt/ ! TXT_RECORD ../common/key.h /^#define TXT_RECORD 0x00800000 \/* Record for repla/ ! TXT_REPLACE ../common/key.h /^#define TXT_REPLACE 0x01000000 \/* Replace; don't / ! TXT_REPLAY ../common/key.h /^#define TXT_REPLAY 0x02000000 \/* Replay the last / ! TXT_RESOLVE ../common/key.h /^#define TXT_RESOLVE 0x04000000 \/* Resolve the tex/ ! TXT_SEARCHINCR ../common/key.h /^#define TXT_SEARCHINCR 0x08000000 \/* Incremental / ! TXT_SHOWMATCH ../common/key.h /^#define TXT_SHOWMATCH 0x10000000 \/* Option: showm/ ! TXT_TTYWERASE ../common/key.h /^#define TXT_TTYWERASE 0x20000000 \/* Option: ttywe/ ! TXT_WRAPMARGIN ../common/key.h /^#define TXT_WRAPMARGIN 0x40000000 \/* Option: wrap/ ! UNMAP_TST ../vi/v_txt.c /^#define UNMAP_TST \\$/ ! UPDATE_CURSOR ../vi/vs_refresh.c /^#define UPDATE_CURSOR 0x01 \/* Update the cursor/ UPDATE_POSITION ../vi/v_txt.c /^#define UPDATE_POSITION(sp, tp) { \\$/ ! UPDATE_SCREEN ../vi/vs_refresh.c /^#define UPDATE_SCREEN 0x02 \/* Flush to screen. / ! USAGE ../cl/cl_funcs.c /^#define USAGE "\\$/ ! VC_BUFFER ../vi/vi.h /^#define VC_BUFFER 0x00000200 \/* The buffer was se/ ! VC_C1RESET ../vi/vi.h /^#define VC_C1RESET 0x00000400 \/* Reset C1SET flag/ ! VC_C1SET ../vi/vi.h /^#define VC_C1SET 0x00000800 \/* Count 1 was set. */ ! VC_C2SET ../vi/vi.h /^#define VC_C2SET 0x00001000 \/* Count 2 was set. */ ! VC_ISDOT ../vi/vi.h /^#define VC_ISDOT 0x00002000 \/* Command was the do/ VIP ../vi/vi.h /^#define VIP(sp) ((VI_PRIVATE *)((sp)->vi_private))/ ! VIP_CUR_INVALID ../vi/vi.h /^#define VIP_CUR_INVALID 0x0001 \/* Cursor position/ ! VIP_DIVIDER ../vi/vi.h /^#define VIP_DIVIDER 0x0002 \/* Divider line was di/ ! VIP_N_EX_PAINT ../vi/vi.h /^#define VIP_N_EX_PAINT 0x0004 \/* Clear and repain/ ! VIP_N_EX_REDRAW ../vi/vi.h /^#define VIP_N_EX_REDRAW 0x0008 \/* Schedule SC_SCR/ ! VIP_N_REFRESH ../vi/vi.h /^#define VIP_N_REFRESH 0x0010 \/* Repaint (from SMA/ ! VIP_N_RENUMBER ../vi/vi.h /^#define VIP_N_RENUMBER 0x0020 \/* Renumber screen / ! VIP_RCM_LAST ../vi/vi.h /^#define VIP_RCM_LAST 0x0040 \/* Cursor drawn to th/ ! VIP_S_MODELINE ../vi/vi.h /^#define VIP_S_MODELINE 0x0080 \/* Skip next modeli/ ! VIP_S_REFRESH ../vi/vi.h /^#define VIP_S_REFRESH 0x0100 \/* Skip next refresh/ ! VI_FHEADER ../common/recover.c /^#define VI_FHEADER "X-vi-recover-file: "$/ VI_INIT_IGNORE ../tk/tki.h /^#define VI_INIT_IGNORE(sp) \\$/ ! VI_PHEADER ../common/recover.c /^#define VI_PHEADER "X-vi-recover-path: "$/ ! VI_SCR_CFLUSH ../vi/vi.h /^#define VI_SCR_CFLUSH(vip) vip->ss_lno = OOBLNO$/ ! VI_VERSION ../ex/version.h /^#define VI_VERSION \\$/ ! VMC ../common/msg.c /^#define VMC "VI_MESSAGE_CATALOG"$/ ! VM_CMDFAILED ../vi/vi.h /^#define VM_CMDFAILED 0x00000001 \/* Command failed/ ! VM_COMMASK ../vi/vi.h /^#define VM_COMMASK 0x0000000f \/* Mask for VM flag/ ! VM_CUTREQ ../vi/vi.h /^#define VM_CUTREQ 0x00000002 \/* Always cut into n/ ! VM_LDOUBLE ../vi/vi.h /^#define VM_LDOUBLE 0x00000004 \/* Doubled command / ! VM_LMODE ../vi/vi.h /^#define VM_LMODE 0x00000008 \/* Motion is line ori/ ! VM_RCM ../vi/vi.h /^#define VM_RCM 0x00000010 \/* Use relative cursor/ ! VM_RCM_MASK ../vi/vi.h /^#define VM_RCM_MASK 0x000001f0 \/* Mask for RCM fl/ ! VM_RCM_SET ../vi/vi.h /^#define VM_RCM_SET 0x00000020 \/* RCM: set to curr/ ! VM_RCM_SETFNB ../vi/vi.h /^#define VM_RCM_SETFNB 0x00000040 \/* RCM: set to f/ ! VM_RCM_SETLAST ../vi/vi.h /^#define VM_RCM_SETLAST 0x00000080 \/* RCM: set to / ! VM_RCM_SETNNB ../vi/vi.h /^#define VM_RCM_SETNNB 0x00000100 \/* RCM: set to n/ ! V_ABS ../vi/vi.h /^#define V_ABS 0x00004000 \/* Absolute movement, s/ ! V_ABS_C ../vi/vi.h /^#define V_ABS_C 0x00008000 \/* V_ABS: if the line/ ! V_ABS_L ../vi/vi.h /^#define V_ABS_L 0x00010000 \/* V_ABS: if the line/ ! V_CHAR ../vi/vi.h /^#define V_CHAR 0x00020000 \/* Character (required/ ! V_CNT ../vi/vi.h /^#define V_CNT 0x00040000 \/* Count (optional, lea/ ! V_DOT ../vi/vi.h /^#define V_DOT 0x00080000 \/* On success, sets dot/ ! V_KEYW ../vi/vi.h /^#define V_KEYW 0x00100000 \/* Cursor referenced w/ ! V_MOTION ../vi/vi.h /^#define V_MOTION 0x00200000 \/* Motion (required, / ! V_MOVE ../vi/vi.h /^#define V_MOVE 0x00400000 \/* Command defines mov/ ! V_OBUF ../vi/vi.h /^#define V_OBUF 0x00800000 \/* Buffer (optional, l/ ! V_RBUF ../vi/vi.h /^#define V_RBUF 0x01000000 \/* Buffer (required, t/ ! V_SECURE ../vi/vi.h /^#define V_SECURE 0x02000000 \/* Permission denied / ! WMTSPACE ../vi/v_txt.c /^#define WMTSPACE wmt.offset + wmt.owrite + wmt.ins/ ! XTERM_RENAME ../cl/cl.h /^#define XTERM_RENAME "\\033]0;%s\\007"$/ ! _HMAP ../vi/vi.h /^#define _HMAP(sp) (VIP(sp)->h_smap)$/ ! _TMAP ../vi/vi.h /^#define _TMAP(sp) (VIP(sp)->t_smap)$/ ! __INUSE1 ../ex/ex.h /^#define __INUSE1 0xfffff800 \/* Same name space as/ ! __INUSE2 ../ex/ex.h /^#define __INUSE2 0x000004ff \/* Same name space as/ ! __NL_ARGMAX ../common/msg.c /^#define __NL_ARGMAX 20 \/* Set to 9 by System V. / addnstr ../cl/cl_bsd.c /^addnstr(s, n)$/ api_aline ../common/api.c /^api_aline(sp, lno, line, len)$/ api_dline ../common/api.c /^api_dline(sp, lno)$/ --- 140,220 ---- OG_SET ../common/options.h /^#define OG_SET(gp, o) ((gp)->opts[(o)].o_cur.val)/ OG_STR ../common/options.h /^#define OG_STR(gp, o) ((gp)->opts[(o)].o_cur.str)/ OG_VAL ../common/options.h /^#define OG_VAL(gp, o) ((gp)->opts[(o)].o_cur.val)/ ! OS_DEF ../common/options.h 46 ! OS_NOFREE ../common/options.h 47 ! OS_STR ../common/options.h 48 ! OS_STRDUP ../common/options.h 49 ! O_NUMBER_FMT ../vi/vi.h 340 ! O_NUMBER_LENGTH ../vi/vi.h 341 O_V ../common/options.h /^#define O_V(sp, o, fld) \\$/ ! PROMPTCHAR ../ex/ex.h 12 QREM ../common/key.c /^#define QREM(len) { \\$/ ! RCV_EMAIL ../common/exf.h 79 ! RCV_ENDSESSION ../common/exf.h 80 ! RCV_PRESERVE ../common/exf.h 81 ! RCV_SNAPSHOT ../common/exf.h 82 REALLOC ../common/mem.h /^#define REALLOC(sp, p, cast, size) { \\$/ RLNO ../cl/cl.h /^#define RLNO(sp, lno) (sp)->woff + (lno)$/ ! SCREEN_COLS ../vi/vi.h /^#define SCREEN_COLS(sp) \/* Screen columns. *\/ \\/ ! SI ../common/multibyte.h 35 ! SIGBLOCK ../common/gs.h 239 ! SIGUNBLOCK ../common/gs.h 241 SKIP_PAST_NEWLINE ../ex/ex_tag.c /^#define SKIP_PAST_NEWLINE(p, back) while (p < back/ SMAP_CACHE ../vi/vi.h /^#define SMAP_CACHE(smp) ((smp)->c_ecsize != 0)$/ SMAP_FLUSH ../vi/vi.h /^#define SMAP_FLUSH(smp) ((smp)->c_ecsize = 0)$/ ! SO ../common/multibyte.h 34 ! SS2 ../common/multibyte.h 36 ! SS3 ../common/multibyte.h 37 ! STANDARD_TAB ../common/key.h 151 ! SUB_FIRST ../ex/ex_subst.c 32 ! SUB_MUSTSETR ../ex/ex_subst.c 33 ! TABCH ../vi/vs_line.c 29 TAB_OFF ../vi/vi.h /^#define TAB_OFF(c) COL_OFF((c), O_VAL(sp, O_TABSTO/ ! TEMPORARY_FILE_STRING ../common/gs.h 12 TKP ../tk/tki.h /^#define TKP(sp) ((TK_PRIVATE *)((sp)->gp->tk_priv/ ! TRACE ../common/util.c /^TRACE(SCR *sp, const char *fmt, ...)$/ ! TRUE ../cl/cl.h 78 ! TXT_ADDNEWLINE ../common/key.h 192 ! TXT_AICHARS ../common/key.h 193 ! TXT_ALTWERASE ../common/key.h 194 ! TXT_APPENDEOL ../common/key.h 195 ! TXT_AUTOINDENT ../common/key.h 196 ! TXT_BACKSLASH ../common/key.h 197 ! TXT_BEAUTIFY ../common/key.h 198 ! TXT_BS ../common/key.h 199 ! TXT_CEDIT ../common/key.h 200 ! TXT_CNTRLD ../common/key.h 201 ! TXT_CNTRLT ../common/key.h 202 ! TXT_CR ../common/key.h 203 ! TXT_DOTTERM ../common/key.h 204 ! TXT_EMARK ../common/key.h 205 ! TXT_EOFCHAR ../common/key.h 206 ! TXT_ESCAPE ../common/key.h 207 ! TXT_FILEC ../common/key.h 208 ! TXT_INFOLINE ../common/key.h 209 ! TXT_MAPINPUT ../common/key.h 210 ! TXT_NLECHO ../common/key.h 211 ! TXT_NUMBER ../common/key.h 212 ! TXT_OVERWRITE ../common/key.h 213 ! TXT_PROMPT ../common/key.h 214 ! TXT_RECORD ../common/key.h 215 ! TXT_REPLACE ../common/key.h 216 ! TXT_REPLAY ../common/key.h 217 ! TXT_RESOLVE ../common/key.h 218 ! TXT_SEARCHINCR ../common/key.h 219 ! TXT_SHOWMATCH ../common/key.h 220 ! TXT_TTYWERASE ../common/key.h 221 ! TXT_WRAPMARGIN ../common/key.h 222 ! UNMAP_TST ../vi/v_txt.c 234 ! UPDATE_CURSOR ../vi/vs_refresh.c 30 UPDATE_POSITION ../vi/v_txt.c /^#define UPDATE_POSITION(sp, tp) { \\$/ ! UPDATE_SCREEN ../vi/vs_refresh.c 31 VIP ../vi/vi.h /^#define VIP(sp) ((VI_PRIVATE *)((sp)->vi_private))/ ! VI_FHEADER ../common/recover.c 109 VI_INIT_IGNORE ../tk/tki.h /^#define VI_INIT_IGNORE(sp) \\$/ ! VI_PHEADER ../common/recover.c 110 ! VI_VERSION ../ex/version.h 1 ! XTERM_RENAME ../cl/cl.h 70 addnstr ../cl/cl_bsd.c /^addnstr(s, n)$/ api_aline ../common/api.c /^api_aline(sp, lno, line, len)$/ api_dline ../common/api.c /^api_dline(sp, lno)$/ *************** *** 543,552 **** --- 253,287 ---- b_search ../common/search.c /^b_search(sp, fm, rm, ptrn, plen, eptrn, flags)$/ bdisplay ../ex/ex_display.c /^bdisplay(sp)$/ beep ../cl/cl_bsd.c /^beep()$/ + big5_display ../common/multi_big5.c /^big5_display(sp, e, name, p)$/ + big5_keyinput ../common/multi_big5.c /^big5_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbu/ + big5_to_int ../common/multi_big5.c /^big5_to_int(sp, e, dst, pdlen, src, slen, pflags, / + big5toiso2022 ../common/multi_big5.c /^big5toiso2022(class, dst, src)$/ binary_search ../ex/ex_tag.c /^binary_search(string, front, back)$/ binc ../common/util.c /^binc(sp, bp, bsizep, min)$/ bword ../vi/v_word.c /^bword(sp, vp, type)$/ + callcharset ../common/multi_iso2022.c /^callcharset(cs, e, ht, state, prefer)$/ + canna_beep ../common/multi_canna.c /^canna_beep()$/ + canna_echoback ../common/multi_canna.c /^canna_echoback(sp)$/ + canna_enabled ../common/multi_canna.c /^canna_enabled(sp)$/ + canna_end ../common/multi_canna.c /^canna_end(sp)$/ + canna_fenceactive ../common/multi_canna.c /^canna_fenceactive(sp)$/ + canna_force_off ../common/multi_canna.c /^canna_force_off(sp)$/ + canna_force_on ../common/multi_canna.c /^canna_force_on(sp)$/ + canna_init ../common/multi_canna.c /^canna_init(sp)$/ + canna_inject ../common/multi_canna.c /^canna_inject(sp, arg)$/ + canna_keyinput ../common/multi_canna.c /^canna_keyinput(sp, e, kbuf, kbuflen, intbuf, pintb/ + canna_modeline ../common/multi_canna.c /^canna_modeline(sp)$/ + canna_modelinesw ../common/multi_canna.c /^canna_modelinesw(sp, x)$/ + canna_off ../common/multi_canna.c /^canna_off(sp)$/ + canna_on ../common/multi_canna.c /^canna_on(sp)$/ + canna_puteucjpstr ../common/multi_canna.c /^canna_puteucjpstr(sp, p0, len, mode)$/ + canna_puteucjpstr3 ../common/multi_canna.c /^canna_puteucjpstr3(sp, p, len, revpos, revlen, mod/ + canna_setmode ../common/multi_canna.c /^canna_setmode(sp, mode, drop)$/ + canna_setserver ../common/multi_canna.c /^canna_setserver(sp, name)$/ + canna_updatemodeline ../common/multi_canna.c /^canna_updatemodeline(sp)$/ cb_rotate ../common/cut.c /^cb_rotate(sp)$/ + charset ../common/multibyte.h /^#define charset(ch) charsettab[(ch) & 0x7f]$/ cl_addstr ../cl/cl_funcs.c /^cl_addstr(sp, str, len)$/ cl_attr ../cl/cl_funcs.c /^cl_attr(sp, attribute, on)$/ cl_baud ../cl/cl_funcs.c /^cl_baud(sp, ratep)$/ *************** *** 566,571 **** --- 301,307 ---- cl_insertln ../cl/cl_funcs.c /^cl_insertln(sp)$/ cl_keyval ../cl/cl_funcs.c /^cl_keyval(sp, val, chp, dnep)$/ cl_move ../cl/cl_funcs.c /^cl_move(sp, lno, cno)$/ + cl_multi_conv ../cl/cl_read.c /^cl_multi_conv(sp, clp, buf, blen)$/ cl_omesg ../cl/cl_term.c /^cl_omesg(sp, clp, on)$/ cl_optchange ../cl/cl_term.c /^cl_optchange(sp, opt, str, valp)$/ cl_pfmap ../cl/cl_term.c /^cl_pfmap(sp, stype, from, flen, to, tlen)$/ *************** *** 590,595 **** --- 326,333 ---- cs_fblank ../vi/getc.c /^cs_fblank(sp, csp)$/ cs_fspace ../vi/getc.c /^cs_fspace(sp, csp)$/ cs_init ../vi/getc.c /^cs_init(sp, csp)$/ + cs_multi_next ../vi/getc.c /^cs_multi_next(sp, csp)$/ + cs_multi_prev ../vi/getc.c /^cs_multi_prev(sp, csp)$/ cs_next ../vi/getc.c /^cs_next(sp, csp)$/ cs_prev ../vi/getc.c /^cs_prev(sp, csp)$/ csc_file ../ex/ex_cscope.c /^csc_file(sp, csc, name, dirp, dlenp, isolderp)$/ *************** *** 605,610 **** --- 343,349 ---- ctag_search ../ex/ex_tag.c /^ctag_search(sp, search, slen, tag)$/ ctag_sfile ../ex/ex_tag.c /^ctag_sfile(sp, tfp, tqp, tname)$/ ctag_slist ../ex/ex_tag.c /^ctag_slist(sp, tag)$/ + ctext_recommendation ../common/multi_iso2022.c /^ctext_recommendation(cs, e)$/ cut ../common/cut.c /^cut(sp, namep, fm, tm, flags)$/ cut_close ../common/cut.c /^cut_close(gp)$/ cut_line ../common/cut.c /^cut_line(sp, lno, fcno, clen, cbp)$/ *************** *** 618,639 **** db_insert ../common/line.c /^db_insert(sp, lno, p, len)$/ db_last ../common/line.c /^db_last(sp, lnop)$/ db_set ../common/line.c /^db_set(sp, lno, p, len)$/ del ../common/delete.c /^del(sp, fm, tm, lmode)$/ - e_asp ../common/key.h /^#define e_asp _u_event._e_str.asp$/ - e_c ../common/key.h /^#define e_c _u_event._e_ch.c$/ - e_ch ../common/key.h /^#define e_ch _u_event._e_ch \/* !!! The structure/ - e_cno ../common/key.h /^#define e_cno _u_event._e_mark.cno1$/ - e_csp ../common/key.h /^#define e_csp _u_event._e_str.csp$/ - e_fcno ../common/key.h /^#define e_fcno _u_event._e_mark.cno1$/ - e_flags ../common/key.h /^#define e_flags _u_event._e_ch.flags$/ - e_flno ../common/key.h /^#define e_flno _u_event._e_mark.lno1 \/* Text regi/ - e_len ../common/key.h /^#define e_len _u_event._e_str.len$/ - e_lno ../common/key.h /^#define e_lno _u_event._e_mark.lno1 \/* Single loc/ e_memcmp ../common/seq.c /^e_memcmp(p1, ep, n)$/ - e_tcno ../common/key.h /^#define e_tcno _u_event._e_mark.cno2$/ - e_tlno ../common/key.h /^#define e_tlno _u_event._e_mark.lno2$/ - e_value ../common/key.h /^#define e_value _u_event._e_ch.value$/ editor ../common/main.c /^editor(gp, argc, argv)$/ eword ../vi/v_word.c /^eword(sp, vp, type)$/ ex ../ex/ex.c /^ex(spp)$/ ex_N_edit ../ex/ex_edit.c /^ex_N_edit(sp, cmdp, frp, attach)$/ --- 357,376 ---- db_insert ../common/line.c /^db_insert(sp, lno, p, len)$/ db_last ../common/line.c /^db_last(sp, lnop)$/ db_set ../common/line.c /^db_set(sp, lno, p, len)$/ + dbdelline ../common/multibyte.c /^dbdelline(sp, l)$/ + dbgetline ../common/multibyte.c /^dbgetline(sp, l, pp, plen)$/ + dbsetline ../common/multibyte.c /^dbsetline(sp, l, p, len)$/ del ../common/delete.c /^del(sp, fm, tm, lmode)$/ e_memcmp ../common/seq.c /^e_memcmp(p1, ep, n)$/ editor ../common/main.c /^editor(gp, argc, argv)$/ + euc_display ../common/multi_euc.c /^euc_display(sp, e, name, p)$/ + euc_keyinput ../common/multi_euc.c /^euc_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbuf/ + euc_recommendation ../common/multi_euc.c /^euc_recommendation(cs, e)$/ + euc_to_int ../common/multi_euc.c /^euc_to_int(sp, e, dst, pdlen, src, slen, pflags, s/ + eucjp_display ../common/multi_eucjp.c /^eucjp_display(sp, e, name, p)$/ + euctw_display ../common/multi_euctw.c /^euctw_display(sp, e, name, p)$/ + euctw_keyinput ../common/multi_euctw.c /^euctw_keyinput(sp, e, kbuf, kbuflen, intbuf, pintb/ + euctw_to_int ../common/multi_euctw.c /^euctw_to_int(sp, e, dst, pdlen, src, slen, pflags,/ eword ../vi/v_word.c /^eword(sp, vp, type)$/ ex ../ex/ex.c /^ex(spp)$/ ex_N_edit ../ex/ex_edit.c /^ex_N_edit(sp, cmdp, frp, attach)$/ *************** *** 697,703 **** ex_preserve ../ex/ex_preserve.c /^ex_preserve(sp, cmdp)$/ ex_prev ../ex/ex_args.c /^ex_prev(sp, cmdp)$/ ex_print ../ex/ex_print.c /^ex_print(sp, cmdp, fp, tp, flags)$/ ! ex_printf ../ex/ex_print.c /^ex_printf(sp, fmt, va_alist)$/ ex_put ../ex/ex_put.c /^ex_put(sp, cmdp)$/ ex_puts ../ex/ex_print.c /^ex_puts(sp, str)$/ ex_quit ../ex/ex_quit.c /^ex_quit(sp, cmdp)$/ --- 434,440 ---- ex_preserve ../ex/ex_preserve.c /^ex_preserve(sp, cmdp)$/ ex_prev ../ex/ex_args.c /^ex_prev(sp, cmdp)$/ ex_print ../ex/ex_print.c /^ex_print(sp, cmdp, fp, tp, flags)$/ ! ex_printf ../ex/ex_print.c /^ex_printf(SCR *sp, const char *fmt, ...)$/ ex_put ../ex/ex_put.c /^ex_put(sp, cmdp)$/ ex_puts ../ex/ex_print.c /^ex_puts(sp, str)$/ ex_quit ../ex/ex_quit.c /^ex_quit(sp, cmdp)$/ *************** *** 756,762 **** --- 493,504 ---- exrc_isok ../ex/ex_init.c /^exrc_isok(sp, sbp, path, rootown, rootid)$/ exwr ../ex/ex_write.c /^exwr(sp, cmdp, cmd)$/ f_altwerase ../common/options_f.c /^f_altwerase(sp, op, str, valp)$/ + f_canna ../common/options_f.c /^f_canna(sp, op, str, valp)$/ + f_cannaserver ../common/options_f.c /^f_cannaserver(sp, op, str, valp)$/ f_columns ../common/options_f.c /^f_columns(sp, op, str, valp)$/ + f_displayencoding ../common/options_f.c /^f_displayencoding(sp, op, str, valp)$/ + f_fileencoding ../common/options_f.c /^f_fileencoding(sp, op, str, valp)$/ + f_inputencoding ../common/options_f.c /^f_inputencoding(sp, op, str, valp)$/ f_lines ../common/options_f.c /^f_lines(sp, op, str, valp)$/ f_lisp ../common/options_f.c /^f_lisp(sp, op, str, valp)$/ f_msgcat ../common/options_f.c /^f_msgcat(sp, op, str, valp)$/ *************** *** 798,812 **** h_int ../cl/cl_main.c /^h_int(signo)$/ h_term ../cl/cl_main.c /^h_term(signo)$/ h_winch ../cl/cl_main.c /^h_winch(signo)$/ idlok ../cl/cl_bsd.c /^idlok(win, bf)$/ inc_buf ../vi/v_put.c /^inc_buf(sp, vp)$/ inc_err ../vi/v_increment.c /^inc_err(sp, nret)$/ inword ../vi/vi.h /^#define inword(ch) (isalnum(ch) || (ch) == '_')$/ io ../vi/v_itxt.c /^io(sp, vp, cmd)$/ ! isblank ../common/key.h /^#define isblank(ch) ((ch) == ' ' || (ch) == '\\t')/ ! ishex ../vi/v_increment.c /^#define ishex(c) (isdigit(c) || strchr("abcdefABCD/ ! isoctal ../vi/v_increment.c /^#define isoctal(c) (isdigit(c) && (c) != '8' && (c/ keypad ../cl/cl_bsd.c /^keypad(a, on)$/ lcmp ../cl/cl_bsd.c /^lcmp(a, b)$/ linear_search ../ex/ex_tag.c /^linear_search(string, front, back)$/ log_backward ../common/log.c /^log_backward(sp, rp)$/ --- 540,580 ---- h_int ../cl/cl_main.c /^h_int(signo)$/ h_term ../cl/cl_main.c /^h_term(signo)$/ h_winch ../cl/cl_main.c /^h_winch(signo)$/ + hz_to_int ../common/multi_hz.c /^hz_to_int(sp, e, dst, pdlen, src, slen, pflags, st/ idlok ../cl/cl_bsd.c /^idlok(win, bf)$/ inc_buf ../vi/v_put.c /^inc_buf(sp, vp)$/ inc_err ../vi/v_increment.c /^inc_err(sp, nret)$/ + int_to_big5 ../common/multi_big5.c /^int_to_big5(sp, e, dst, pdlen, src, slen, pflags, / + int_to_euc ../common/multi_euc.c /^int_to_euc(sp, e, dst, pdlen, src, slen, pflags, s/ + int_to_eucjp ../common/multi_eucjp.c /^int_to_eucjp(sp, e, dst, pdlen, src, slen, pflags,/ + int_to_euctw ../common/multi_euctw.c /^int_to_euctw(sp, e, dst, pdlen, src, slen, pflags,/ + int_to_hz ../common/multi_hz.c /^int_to_hz(sp, e, dst, pdlen, src, slen, pflags, st/ + int_to_iso2022 ../common/multi_iso2022.c /^int_to_iso2022(sp, e, dst, pdlen, src, slen, pflag/ + int_to_iso2022kr ../common/multi_iso2022.c /^int_to_iso2022kr(sp, e, dst, pdlen, src, slen, pfl/ + int_to_none ../common/multi_none.c /^int_to_none(sp, e, dst, pdlen, src, slen, pflags, / + int_to_sjis ../common/multi_sjis.c /^int_to_sjis(sp, e, dst, pdlen, src, slen, pflags, / inword ../vi/vi.h /^#define inword(ch) (isalnum(ch) || (ch) == '_')$/ io ../vi/v_itxt.c /^io(sp, vp, cmd)$/ ! isbig5mb1 ../common/multibyte.h /^#define isbig5mb1(c) (0xa1 <= (c) && (c) <= 0xfe)$/ ! isbig5mb2 ../common/multibyte.h /^#define isbig5mb2(c) ((0x40 <= (c) && (c) <= 0x7e)/ ! isblank ../common/key.h /^#define isblank(ch) ((ch) == ' ' || (ch) == '\\t')$/ ! ischarset ../common/multibyte.h /^#define ischarset(ch) (((ch) & 0x80) && ((ch) < CS/ ! isecma ../common/multibyte.h /^#define isecma(c) (0x30 <= (c) && (c) <= 0x7f)$/ ! iseuckanji ../common/multibyte.h /^#define iseuckanji(c) (0xa1 <= (c) && (c) <= 0xfe)/ ! isjishankana ../common/multibyte.h /^#define isjishankana(c) (0xa1 <= (c) && (c) <= 0xd/ ! iso2022_keyinput ../common/multi_iso2022.c /^iso2022_keyinput(sp, e, kbuf, kbuflen, intbuf, pin/ ! iso2022_to_int ../common/multi_iso2022.c /^iso2022_to_int(sp, e, dst, pdlen, src, slen, pflag/ ! iso2022cn_recommendation ../common/multi_iso2022.c /^iso2022cn_recommendation(cs, e)$/ ! iso2022jp_recommendation ../common/multi_iso2022.c /^iso2022jp_recommendation(cs, e)$/ ! iso2022kr_recommendation ../common/multi_iso2022.c /^iso2022kr_recommendation(cs, e)$/ ! iso2022kr_to_int ../common/multi_iso2022.c /^iso2022kr_to_int(sp, e, dst, pdlen, src, slen, pfl/ ! iso2022tobig5 ../common/multi_big5.c /^iso2022tobig5(dst, class, src)$/ ! issjiskanji1 ../common/multibyte.h /^#define issjiskanji1(c) ((0x81 <= (c) && (c) <= 0x/ ! issjiskanji2 ../common/multibyte.h /^#define issjiskanji2(c) ((0x40 <= (c) && (c) <= 0x/ ! jis0208_chclass ../common/multi_chclass.c /^jis0208_chclass(p, ctxt)$/ ! jistosjis ../common/multi_sjis.c /^jistosjis(dst, src)$/ keypad ../cl/cl_bsd.c /^keypad(a, on)$/ + ksc5601_chclass ../common/multi_chclass.c /^ksc5601_chclass(p, ctxt)$/ lcmp ../cl/cl_bsd.c /^lcmp(a, b)$/ linear_search ../ex/ex_tag.c /^linear_search(string, front, back)$/ log_backward ../common/log.c /^log_backward(sp, rp)$/ *************** *** 835,847 **** msg_open ../common/msg.c /^msg_open(sp, file)$/ msg_print ../common/msg.c /^msg_print(sp, s, needfree)$/ msghandler ../tcl_api/tcl.c /^msghandler(sp, mtype, msg, len)$/ ! msgq ../common/msg.c /^msgq(sp, mt, fmt, va_alist)$/ msgq_status ../common/msg.c /^msgq_status(sp, lno, flags)$/ msgq_str ../common/msg.c /^msgq_str(sp, mtype, str, fmt)$/ newterm ../cl/cl_bsd.c /^newterm(a, b, c)$/ nget_slong ../common/util.c /^nget_slong(valp, p, endp, base)$/ nget_uslong ../common/util.c /^nget_uslong(valp, p, endp, base)$/ nonblank ../common/util.c /^nonblank(sp, lno, cnop)$/ noprev ../vi/v_ch.c /^noprev(sp)$/ notfound ../vi/v_ch.c /^notfound(sp, ch)$/ o_set ../common/options.c /^o_set(sp, opt, flags, str, val)$/ --- 603,648 ---- msg_open ../common/msg.c /^msg_open(sp, file)$/ msg_print ../common/msg.c /^msg_print(sp, s, needfree)$/ msghandler ../tcl_api/tcl.c /^msghandler(sp, mtype, msg, len)$/ ! msgq ../common/msg.c /^msgq(SCR *sp, mtype_t mt, const char *fmt, ...)$/ msgq_status ../common/msg.c /^msgq_status(sp, lno, flags)$/ msgq_str ../common/msg.c /^msgq_str(sp, mtype, str, fmt)$/ + multi_Wordbound ../common/multibyte.c /^multi_Wordbound(c1, c2, forward)$/ + multi_back ../common/multibyte.c /^multi_back(sp, p0, p)$/ + multi_byte ../common/multibyte.c /^multi_byte(sp, p)$/ + multi_byte_c ../common/multibyte.c /^multi_byte_c(sp, arg)$/ + multi_chclass ../common/multi_chclass.c /^multi_chclass(p, ctxt)$/ + multi_cnvfinish ../common/multibyte.c /^multi_cnvfinish(sp, extra)$/ + multi_cnvstart ../common/multibyte.c /^multi_cnvstart(sp, encoding)$/ + multi_ext2int_region ../common/multibyte.c /^multi_ext2int_region(sp, mstart, mend, opt, autode/ + multi_ext2int_text ../common/multibyte.c /^multi_ext2int_text(sp, tiqh, opt)$/ + multi_findencoding ../common/multibyte.c /^multi_findencoding(p)$/ + multi_fix ../common/multibyte.c /^multi_fix(sp, p0, p)$/ + multi_initstate ../common/multibyte.c /^multi_initstate(sp, e, state)$/ + multi_int2ext ../common/multibyte.c /^multi_int2ext(sp, p0, len, ilen, extra)$/ + multi_int2extlen ../common/multibyte.c /^multi_int2extlen(sp, p0, len, pflags, extra)$/ + multi_isencoding ../common/multibyte.c /^multi_isencoding(p, opt)$/ + multi_isnone ../common/multibyte.c /^multi_isnone(sp, ch)$/ + multi_iswestern ../common/multibyte.c /^multi_iswestern(sp, ch)$/ + multi_keyinput ../common/multibyte.c /^multi_keyinput(sp, kbuf, pkbuflen, intbuf, pintbuf/ + multi_keyinput_resetstate ../common/multibyte.c /^multi_keyinput_resetstate(sp)$/ + multi_len ../common/multibyte.c /^multi_len(sp, p)$/ + multi_len_c ../common/multibyte.c /^multi_len_c(sp, arg)$/ + multi_name ../common/multibyte.c /^multi_name(sp, p)$/ + multi_predict_big5 ../common/multibyte.c /^multi_predict_big5(sp, p, len)$/ + multi_predict_euc ../common/multibyte.c /^multi_predict_euc(sp, p, len)$/ + multi_predict_euctw ../common/multibyte.c /^multi_predict_euctw(sp, p, len)$/ + multi_predict_hz ../common/multibyte.c /^multi_predict_hz(sp, p, len)$/ + multi_predict_iso2022 ../common/multibyte.c /^multi_predict_iso2022(sp, p, len)$/ + multi_predict_region ../common/multibyte.c /^multi_predict_region(sp, mstart, mend, ename, auto/ + multi_predict_sjis ../common/multibyte.c /^multi_predict_sjis(sp, p, len)$/ + multi_rawname ../common/multibyte.c /^multi_rawname(sp, p)$/ + multi_wordbound ../common/multibyte.c /^multi_wordbound(c1, c2, forward)$/ newterm ../cl/cl_bsd.c /^newterm(a, b, c)$/ nget_slong ../common/util.c /^nget_slong(valp, p, endp, base)$/ nget_uslong ../common/util.c /^nget_uslong(valp, p, endp, base)$/ nonblank ../common/util.c /^nonblank(sp, lno, cnop)$/ + none_keyinput ../common/multi_none.c /^none_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbu/ + none_to_int ../common/multi_none.c /^none_to_int(sp, e, dst, pdlen, src, slen, pflags, / noprev ../vi/v_ch.c /^noprev(sp)$/ notfound ../vi/v_ch.c /^notfound(sp, ch)$/ o_set ../common/options.c /^o_set(sp, opt, flags, str, val)$/ *************** *** 858,868 **** --- 659,673 ---- opts_search ../common/options.c /^opts_search(name)$/ opts_set ../common/options.c /^opts_set(sp, argv, usage)$/ parse ../ex/ex_cscope.c /^parse(sp, csc, tqp, matchesp)$/ + parsecharset ../common/multi_iso2022.c /^parsecharset(p, len, hcs, pgroup)$/ perr ../cl/cl_main.c /^perr(name, msg)$/ proc_wait ../ex/ex_shell.c /^proc_wait(sp, pid, cmd, silent, okpipe)$/ ptym_open ../ex/ex_script.c /^ptym_open(pts_name)$/ ptys_open ../ex/ex_script.c /^ptys_open(fdm, pts_name)$/ put ../common/put.c /^put(sp, cbp, namep, cp, rp, append)$/ + rawdelline ../common/multibyte.c /^rawdelline(sp, l)$/ + rawgetline ../common/multibyte.c /^rawgetline(sp, l, pp, plen)$/ + rawsetline ../common/multibyte.c /^rawsetline(sp, l, p, len)$/ rcv_copy ../common/recover.c /^rcv_copy(sp, wfd, fname)$/ rcv_email ../common/recover.c /^rcv_email(sp, fname)$/ rcv_gets ../common/recover.c /^rcv_gets(buf, len, fd)$/ *************** *** 889,894 **** --- 694,700 ---- search_busy ../common/search.c /^search_busy(sp, btype)$/ search_init ../common/search.c /^search_init(sp, dir, ptrn, plen, epp, flags)$/ search_msg ../common/search.c /^search_msg(sp, msg)$/ + selcharset ../common/multi_iso2022.c /^selcharset(cs, e, ht, pmask, state, prefer)$/ seq_close ../common/seq.c /^seq_close(gp)$/ seq_delete ../common/seq.c /^seq_delete(sp, input, ilen, stype)$/ seq_dump ../common/seq.c /^seq_dump(sp, stype, isname)$/ *************** *** 906,911 **** --- 712,721 ---- sig_end ../cl/cl_main.c /^sig_end(gp)$/ sig_init ../cl/cl_main.c /^sig_init(gp, sp)$/ sigmsg ../ex/ex_shell.c /^sigmsg(signo)$/ + sjis_display ../common/multi_sjis.c /^sjis_display(sp, e, name, p)$/ + sjis_keyinput ../common/multi_sjis.c /^sjis_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbu/ + sjis_to_int ../common/multi_sjis.c /^sjis_to_int(sp, e, dst, pdlen, src, slen, pflags, / + sjistojis ../common/multi_sjis.c /^sjistojis(dst, src)$/ sscr_check ../ex/ex_script.c /^sscr_check(sp)$/ sscr_end ../ex/ex_script.c /^sscr_end(sp)$/ sscr_exec ../ex/ex_script.c /^sscr_exec(sp, lno)$/ *************** *** 951,956 **** --- 761,767 ---- text_free ../common/cut.c /^text_free(tp)$/ text_init ../common/cut.c /^text_init(sp, p, len, total_len)$/ text_lfree ../common/cut.c /^text_lfree(headp)$/ + tigetnum ../cl/cl_bsd.c /^tigetnum(name)$/ tigetstr ../cl/cl_bsd.c /^tigetstr(name)$/ tk_addstr ../tk/tk_funcs.c /^tk_addstr(sp, str, len)$/ tk_attr ../tk/tk_funcs.c /^tk_attr(sp, attribute, on)$/ *************** *** 995,1000 **** --- 806,812 ---- txt_fc_col ../vi/v_txt.c /^txt_fc_col(sp, argc, argv)$/ txt_hex ../vi/v_txt.c /^txt_hex(sp, tp)$/ txt_insch ../vi/v_txt.c /^txt_insch(sp, tp, chp, flags)$/ + txt_insmbch ../vi/v_txt.c /^txt_insmbch(sp, tp, chp, flags)$/ txt_isrch ../vi/v_txt.c /^txt_isrch(sp, vp, tp, is_flagsp)$/ txt_map_end ../vi/v_txt.c /^txt_map_end(sp)$/ txt_map_init ../vi/v_txt.c /^txt_map_init(sp)$/ *************** *** 1053,1058 **** --- 865,873 ---- v_exaddr ../vi/v_search.c /^v_exaddr(sp, vp, dir)$/ v_exec_ex ../vi/v_ex.c /^v_exec_ex(sp, vp, exp)$/ v_exmode ../vi/v_ex.c /^v_exmode(sp, vp)$/ + v_fep_force_off ../common/multibyte.c /^v_fep_force_off(sp)$/ + v_fep_off ../common/multibyte.c /^v_fep_off(sp)$/ + v_fep_on ../common/multibyte.c /^v_fep_on(sp)$/ v_filter ../vi/v_ex.c /^v_filter(sp, vp)$/ v_first ../vi/v_left.c /^v_first(sp, vp)$/ v_fmark ../vi/v_mark.c /^v_fmark(sp, vp)$/ *************** *** 1070,1080 **** --- 885,898 ---- v_isempty ../vi/v_util.c /^v_isempty(p, len)$/ v_join ../vi/v_ex.c /^v_join(sp, vp)$/ v_key ../vi/vi.c /^v_key(sp, command_events, evp, ec_flags)$/ + v_key_blen ../common/key.c /^v_key_blen(sp, ch)$/ v_key_cmp ../common/key.c /^v_key_cmp(ap, bp)$/ v_key_ilookup ../common/key.c /^v_key_ilookup(sp)$/ v_key_init ../common/key.c /^v_key_init(sp)$/ v_key_len ../common/key.c /^v_key_len(sp, ch)$/ + v_key_len1 ../common/key.c /^v_key_len1(sp, ch)$/ v_key_name ../common/key.c /^v_key_name(sp, ach)$/ + v_key_name1 ../common/key.c /^v_key_name1(sp, ach)$/ v_key_val ../common/key.c /^v_key_val(sp, ch)$/ v_keyval ../common/key.c /^v_keyval(sp, val, name)$/ v_keyword ../vi/vi.c /^v_keyword(sp)$/ Index: cl/cl.h Prereq: 10.19 *** nvi-1.79/cl/cl.h Wed Oct 23 22:29:51 1996 --- nvi-1.79-m17n/cl/cl.h Sun Dec 29 18:03:33 1996 *************** *** 12,17 **** --- 12,23 ---- typedef struct _cl_private { CHAR_T ibuf[256]; /* Input keys. */ + #ifdef MULTIBYTE + CHAR_T mbbuf[20]; /* Multibyte backup key buffer. */ + size_t mbbuflen; + int mbstate; + #endif + int eof_count; /* EOF count. */ struct termios orig; /* Original terminal values. */ Index: cl/cl_funcs.c Prereq: 10.50 *** nvi-1.79/cl/cl_funcs.c Wed Oct 23 22:29:51 1996 --- nvi-1.79-m17n/cl/cl_funcs.c Fri Feb 21 23:09:26 1997 *************** *** 35,46 **** --- 35,54 ---- * cl_addstr -- * Add len bytes from the string at the cursor, advancing the cursor. * + * PUBLIC: #ifndef MULTIBYTE * PUBLIC: int cl_addstr __P((SCR *, const char *, size_t)); + * PUBLIC: #else + * PUBLIC: int cl_addstr __P((SCR *, const CHAR_T *, size_t)); + * PUBLIC: #endif */ int cl_addstr(sp, str, len) SCR *sp; + #ifndef MULTIBYTE const char *str; + #else + const CHAR_T *str; + #endif size_t len; { CL_PRIVATE *clp; *************** *** 61,68 **** --- 69,104 ---- (void)standout(); } + #ifndef MULTIBYTE if (addnstr(str, len) == ERR) return (1); + #else + { + size_t i, j; + CHAR_T *p; + + i = 0; + while (i < len) { + /* output non multibyte chars by bulk */ + j = 0; + while (i + j < len && KEY_BLEN(sp, str[i + j]) == 1) + j++; + if (j) { + if (addnstr(&str[i], j) == ERR) + return 1; + i += j; + } + + /* output single multibyte char */ + if (i < len && 1 < KEY_BLEN(sp, str[i])) { + p = multi_name(sp, &str[i]); + if (addnstr(p, strlen(p)) == ERR) + return 1; + i += KEY_BLEN(sp, str[i]); + } + } + } + #endif if (iv) (void)standend(); *************** *** 301,306 **** --- 337,343 ---- mvchgat(RLNO(sp, LASTLINE(sp)), 0, -1, A_NORMAL, 0, NULL); #else for (lno = RLNO(sp, LASTLINE(sp)), col = spcnt = 0;;) { + #ifndef MULTIBYTE (void)move(lno, col); ch = winch(stdscr); if (isblank(ch)) *************** *** 311,316 **** --- 348,357 ---- (void)addch(' '); (void)addch(ch); } + #else + /* XXX non-portable */ + stdscr->lines[lno]->line[col].attr &= ~__STANDOUT; + #endif /*MULTIBYTE*/ if (++col >= sp->cols) break; } Index: cl/cl_main.c Prereq: 10.36 *** nvi-1.79/cl/cl_main.c Tue Oct 15 04:04:53 1996 --- nvi-1.79-m17n/cl/cl_main.c Sun Dec 29 18:46:51 1996 *************** *** 257,262 **** --- 257,267 ---- /* Initialize the list of curses functions. */ cl_func_std(gp); + #ifdef MULTIBYTE + clp->mbbuflen = 0; + clp->mbstate = 0; + #endif /*MULTIBYTE*/ + return (clp); } Index: cl/cl_read.c Prereq: 10.15 *** nvi-1.79/cl/cl_read.c Wed Sep 25 09:49:51 1996 --- nvi-1.79-m17n/cl/cl_read.c Fri May 23 13:53:09 1997 *************** *** 38,43 **** --- 38,76 ---- static input_t cl_read __P((SCR *, u_int32_t, CHAR_T *, size_t, int *, struct timeval *)); static int cl_resize __P((SCR *, size_t, size_t)); + #ifdef MULTIBYTE + static void cl_multi_conv __P((SCR *, CL_PRIVATE *, CHAR_T *, int *)); + #endif + + #ifdef MULTIBYTE + static void + cl_multi_conv(sp, clp, buf, blen) + SCR *sp; + CL_PRIVATE *clp; + CHAR_T *buf; + int *blen; + { + CHAR_T t[sizeof(clp->ibuf)]; /*XXX*/ + size_t i; + int j; + size_t jinc; + + i = 0; + j = 0; + while (i < *blen) { + clp->mbbuf[clp->mbbuflen++] = buf[i++]; + if (sizeof(clp->mbbuf) <= clp->mbbuflen) + abort(); + multi_keyinput(sp, clp->mbbuf, &clp->mbbuflen, &t[j], &jinc, + &clp->mbstate); + if (jinc) + j += jinc; + clp->mbbuf[clp->mbbuflen] = '\0'; + } + memcpy(buf, t, j); + *blen = j; + } + #endif /*MULTIBYTE*/ /* * cl_event -- *************** *** 56,61 **** --- 89,99 ---- CL_PRIVATE *clp; size_t lines, columns; int changed, nr; + #ifdef MULTIBYTE + int ms0; + + ms0 = ms; + #endif /* * Queue signal based events. We never clear SIGHUP or SIGTERM events, *************** *** 66,73 **** if (F_ISSET(clp, CL_SIGINT)) { F_CLR(clp, CL_SIGINT); evp->e_event = E_INTERRUPT; ! } else evp->e_event = E_TIMEOUT; return (0); } if (F_ISSET(clp, CL_SIGHUP | CL_SIGTERM | CL_SIGWINCH)) { --- 104,125 ---- if (F_ISSET(clp, CL_SIGINT)) { F_CLR(clp, CL_SIGINT); evp->e_event = E_INTERRUPT; ! #ifdef CANNA ! if (canna_enabled(sp)) ! canna_force_off(sp); ! #endif /*CANNA*/ ! #ifdef MULTIBYTE ! /* re-initialize the state. */ ! clp->mbbuflen = 0; ! clp->mbstate = 0; ! #endif /*MULTIBYTE*/ ! } else { ! #ifdef MULTIBYTE ! evp->e_csp = NULL; ! evp->e_len = 0; ! #endif /*MULTIBYTE*/ evp->e_event = E_TIMEOUT; + } return (0); } if (F_ISSET(clp, CL_SIGHUP | CL_SIGTERM | CL_SIGWINCH)) { *************** *** 92,97 **** --- 144,152 ---- } } + #ifdef MULTIBYTE + again: + #endif /* Set timer. */ if (ms == 0) tp = NULL; *************** *** 102,110 **** } /* Read input characters. */ switch (cl_read(sp, LF_ISSET(EC_QUOTED | EC_RAW), ! clp->ibuf, sizeof(clp->ibuf), &nr, tp)) { case INP_OK: evp->e_csp = clp->ibuf; evp->e_len = nr; evp->e_event = E_STRING; --- 157,205 ---- } /* Read input characters. */ + #ifndef MULTIBYTE switch (cl_read(sp, LF_ISSET(EC_QUOTED | EC_RAW), ! clp->ibuf, sizeof(clp->ibuf), &nr, tp)) ! #else ! /* ! * In multibyte environment, it is possible that the raw bytes ! * to be expanded by external->internal code conversion. ! * Prepare for that by dividing buffer size by 2. ! */ ! switch (cl_read(sp, LF_ISSET(EC_QUOTED | EC_RAW), ! clp->ibuf, sizeof(clp->ibuf) / 2, &nr, tp)) ! #endif /*MULTIBYTE*/ ! { case INP_OK: + #ifdef MULTIBYTE + cl_multi_conv(sp, clp, &clp->ibuf[0], &nr); + if (!nr) { + /* + * Sorry we must cheat here... + * + * 1. If we have timeout value, and keys were eaten + * by multibyte processor, we must cheat as if + * we got a timeout. + * 2. If we have escape in multibyte buffer, + * we have to set timeout so that we can recognize + * single escape and escape sequence. + */ + if (ms0) { + evp->e_csp = NULL; + evp->e_len = 0; + evp->e_event = E_TIMEOUT; + break; + } + + if (clp->mbbuflen) { + if (clp->mbbuf[clp->mbbuflen - 1] == '\033') + ms = O_VAL(sp, O_ESCAPETIME); + else + ms = O_VAL(sp, O_KEYTIME) * 100; + } + goto again; + } + #endif /*MULTIBYTE*/ evp->e_csp = clp->ibuf; evp->e_len = nr; evp->e_event = E_STRING; *************** *** 118,123 **** --- 213,225 ---- case INP_INTR: goto retest; case INP_TIMEOUT: + #ifdef MULTIBYTE + /* Flush multibyte input buffer if necessery */ + memcpy(clp->ibuf, clp->mbbuf, clp->mbbuflen); + evp->e_csp = clp->ibuf; + evp->e_len = clp->mbbuflen; + clp->mbbuflen = 0; + #endif /*MULTIBYTE*/ evp->e_event = E_TIMEOUT; break; default: Index: common/cut.c Prereq: 10.10 *** nvi-1.79/common/cut.c Fri Oct 18 22:34:34 1996 --- nvi-1.79-m17n/common/cut.c Mon Nov 25 00:20:22 1996 *************** *** 144,155 **** --- 144,171 ---- if (cut_line(sp, lno, 0, 0, cbp)) goto cut_line_err; } else { + #ifdef MULTIBYTE + CHAR_T *p; + + /* Get the line. */ + if (db_get(sp, fm->lno, DBG_FATAL, &p, NULL)) + return (1); + #endif /*MULTIBYTE*/ + /* * Get the first line. A length of 0 causes cut_line * to cut from the MARK to the end of the line. */ + #ifndef MULTIBYTE if (cut_line(sp, fm->lno, fm->cno, fm->lno != tm->lno ? ENTIRE_LINE : (tm->cno - fm->cno) + 1, cbp)) + #else + if (cut_line(sp, fm->lno, fm->cno, + fm->lno != tm->lno + ? ENTIRE_LINE + : (tm->cno - fm->cno) + KEY_BLEN(sp, p[tm->cno]), + cbp)) + #endif /*MULTIBYTE*/ goto cut_line_err; /* Get the intermediate lines. */ *************** *** 158,165 **** --- 174,187 ---- goto cut_line_err; /* Get the last line. */ + #ifndef MULTIBYTE if (tm->lno != fm->lno && cut_line(sp, lno, 0, tm->cno + 1, cbp)) + #else + if (tm->lno != fm->lno && + cut_line(sp, lno, 0, tm->cno + KEY_BLEN(sp, p[tm->cno]), + cbp)) + #endif /*MULTIBYTE*/ goto cut_line_err; } Index: common/cut.h Prereq: 10.5 *** nvi-1.79/common/cut.h Sun Apr 28 00:25:58 1996 --- nvi-1.79-m17n/common/cut.h Wed Feb 19 23:52:32 1997 *************** *** 26,32 **** /* Lines/blocks of text. */ struct _text { /* Text: a linked list of lines. */ CIRCLEQ_ENTRY(_text) q; /* Linked list of text structures. */ ! char *lb; /* Line buffer. */ size_t lb_len; /* Line buffer length. */ size_t len; /* Line length. */ --- 26,32 ---- /* Lines/blocks of text. */ struct _text { /* Text: a linked list of lines. */ CIRCLEQ_ENTRY(_text) q; /* Linked list of text structures. */ ! CHAR_T *lb; /* Line buffer. */ size_t lb_len; /* Line buffer length. */ size_t len; /* Line length. */ Index: common/delete.c Prereq: 10.12 *** nvi-1.79/common/delete.c Wed Oct 23 22:30:50 1996 --- nvi-1.79-m17n/common/delete.c Fri Feb 21 23:05:27 1997 *************** *** 39,45 **** --- 39,49 ---- { recno_t lno; size_t blen, len, nlen, tlen; + #ifndef MULTIBYTE char *bp, *p; + #else + CHAR_T *bp, *p; + #endif int eof, rval; bp = NULL; *************** *** 90,104 **** --- 94,120 ---- /* Case 3 -- delete within a single line. */ if (tm->lno == fm->lno) { + #ifdef MULTIBYTE + int tmchlen; + #endif if (db_get(sp, fm->lno, DBG_FATAL, &p, &len)) return (1); GET_SPACE_RET(sp, bp, blen, len); if (fm->cno != 0) memcpy(bp, p, fm->cno); + #ifndef MULTIBYTE memcpy(bp + fm->cno, p + (tm->cno + 1), len - (tm->cno + 1)); if (db_set(sp, fm->lno, bp, len - ((tm->cno - fm->cno) + 1))) goto err; + #else + tmchlen = KEY_BLEN(sp, p[tm->cno]); + memcpy(bp + fm->cno, p + (tm->cno + tmchlen), + len - (tm->cno + tmchlen)); + if (db_set(sp, fm->lno, + bp, len - ((tm->cno - fm->cno) + tmchlen))) + goto err; + #endif /*MULTIBYTE*/ goto done; } *************** *** 117,130 **** /* Copy the end partial line into place. */ if (db_get(sp, tm->lno, DBG_FATAL, &p, &len)) goto err; ! if (len != 0 && tm->cno != len - 1) { /* * XXX * We can overflow memory here, if the total length is greater * than SIZE_T_MAX. The only portable way I've found to test * is depending on the overflow being less than the value. */ nlen = (len - (tm->cno + 1)) + tlen; if (tlen > nlen) { msgq(sp, M_ERR, "002|Line length overflow"); goto err; --- 133,159 ---- /* Copy the end partial line into place. */ if (db_get(sp, tm->lno, DBG_FATAL, &p, &len)) goto err; ! #ifndef MULTIBYTE ! if (len != 0 && tm->cno != len - 1) ! #else ! if (len != 0 && tm->cno != len - multi_back(sp, p, &p[len])) ! #endif ! { ! #ifdef MULTIBYTE ! int tmchlen; ! tmchlen = KEY_BLEN(sp, p[tm->cno]); ! #endif /* * XXX * We can overflow memory here, if the total length is greater * than SIZE_T_MAX. The only portable way I've found to test * is depending on the overflow being less than the value. */ + #ifndef MULTIBYTE nlen = (len - (tm->cno + 1)) + tlen; + #else + nlen = (len - (tm->cno + tmchlen)) + tlen; + #endif if (tlen > nlen) { msgq(sp, M_ERR, "002|Line length overflow"); goto err; *************** *** 134,141 **** --- 163,176 ---- } else ADD_SPACE_RET(sp, bp, blen, nlen); + #ifndef MULTIBYTE memcpy(bp + tlen, p + (tm->cno + 1), len - (tm->cno + 1)); tlen += len - (tm->cno + 1); + #else + memcpy(bp + tlen, p + (tm->cno + tmchlen), + len - (tm->cno + tmchlen)); + tlen += len - (tm->cno + tmchlen); + #endif /*MULTIBYTE*/ } /* Set the current line. */ Index: common/exf.c Prereq: 10.49 *** nvi-1.79/common/exf.c Fri Oct 11 10:33:55 1996 --- nvi-1.79-m17n/common/exf.c Fri Feb 21 23:43:19 1997 *************** *** 135,140 **** --- 135,143 ---- size_t psize; int fd, exists, open_err, readonly; char *oname, tname[MAXPATHLEN]; + #ifdef MULTIBYTE + int notranslation; + #endif open_err = readonly = 0; *************** *** 145,155 **** --- 148,174 ---- * because the named file doesn't exist. So, move boldly forward, * presuming that there's an error message the user will get to see. */ + #ifdef MULTIBYTE + /* + * We must keep in mind that recovery file must NOT be translated + * into internal expression. For that, we remember it by FR_RECOVER2. + */ + #endif /*MULTIBYTE*/ if (F_ISSET(frp, FR_RECOVER)) { F_CLR(frp, FR_RECOVER); + #ifdef MULTIBYTE + F_SET(frp, FR_RECOVER2); + #endif return (rcv_read(sp, frp)); } + #ifdef MULTIBYTE + /* + * frp->flags will be cleared by the next sentence... + */ + notranslation = F_ISSET(frp, FR_RECOVER2) ? 1 : 0; + #endif /*MULTIBYTE*/ + /* * Required FRP initialization; the only flag we keep is the * cursor information. *************** *** 402,407 **** --- 421,441 ---- ++ep->refcnt; sp->ep = ep; sp->frp = frp; + + #ifdef MULTIBYTE + if (!notranslation) { + /* + * Convert all lines into internal structure. + */ + MARK start, end; + + db_last(sp, &end.lno); + start.lno = (end.lno == 0 ? 0 : 1); + start.cno = end.cno = 0; + multi_ext2int_region(sp, &start, &end, O_FILEENCODING, + O_STR(sp, O_AUTODETECT), 0, 1); + } + #endif /*MULTIBYTE*/ /* Set the initial cursor position, queue initial command. */ file_cinit(sp); Index: common/gs.h Prereq: 10.34 *** nvi-1.79/common/gs.h Wed Sep 25 09:51:24 1996 --- nvi-1.79-m17n/common/gs.h Fri Feb 21 23:04:21 1997 *************** *** 35,40 **** --- 35,43 ---- #define FR_TMPEXIT 0x0040 /* Modified temporary file, no exit. */ #define FR_TMPFILE 0x0080 /* If file has no name. */ #define FR_UNLOCKED 0x0100 /* File couldn't be locked. */ + #ifdef MULTIBYTE + #define FR_RECOVER2 0x0200 /* File is being recovered. */ + #endif u_int16_t flags; }; *************** *** 75,81 **** --- 78,95 ---- #define GO_LINES 1 /* Global options: lines. */ #define GO_SECURE 2 /* Global options: secure. */ #define GO_TERM 3 /* Global options: terminal type. */ + #ifndef MULTIBYTE OPTION opts[GO_TERM + 1]; + #else + #define GO_DISPLAYENCODING 4 /* Global options: display encoding. */ + # ifndef CANNA + OPTION opts[GO_DISPLAYENCODING + 1]; + # else + #define GO_CANNA 5 /* Global options: canna enabled? */ + #define GO_CANNASERVER 6 /* Global options: canna server. */ + OPTION opts[GO_CANNASERVER + 1]; + # endif + #endif /*MULTIBYTE*/ DB *msg; /* Message catalog DB. */ MSGH msgq; /* User message list. */ *************** *** 114,129 **** --- 128,165 ---- LIST_HEAD(_seqh, _seq) seqq; /* Linked list of maps, abbrevs. */ bitstr_t bit_decl(seqb, MAX_BIT_SEQ); + #ifndef MULTIBYTE #define MAX_FAST_KEY 254 /* Max fast check character.*/ + #else + #define MAX_FAST_KEY 127 + #endif + #ifndef MULTIBYTE #define KEY_LEN(sp, ch) \ ((unsigned char)(ch) <= MAX_FAST_KEY ? \ sp->gp->cname[(unsigned char)ch].len : v_key_len(sp, ch)) #define KEY_NAME(sp, ch) \ ((unsigned char)(ch) <= MAX_FAST_KEY ? \ sp->gp->cname[(unsigned char)ch].name : v_key_name(sp, ch)) + #else + #define KEY_LEN(sp, ch) \ + ((unsigned char)(ch) <= MAX_FAST_KEY \ + ? sp->gp->cname[(unsigned char)ch].len \ + : v_key_len1(sp, (unsigned char)ch)) + #define KEY_NAME(sp, ch) \ + ((unsigned char)(ch) <= MAX_FAST_KEY \ + ? sp->gp->cname[(unsigned char)ch].name \ + : v_key_name1(sp, (unsigned char)ch)) + #define KEY_BLEN(sp, ch) \ + ((unsigned char)(ch) <= MAX_FAST_KEY \ + ? sp->gp->cname[(unsigned char)ch].blen \ + : v_key_blen(sp, (unsigned char)ch)) + #endif /*MULTIBYTE*/ struct { CHAR_T name[MAX_CHARACTER_COLUMNS + 1]; u_int8_t len; + #ifdef MULTIBYTE + u_int8_t blen; + #endif } cname[MAX_FAST_KEY + 1]; /* Fast lookup table. */ #define KEY_VAL(sp, ch) \ Index: common/key.c Prereq: 10.33 *** nvi-1.79/common/key.c Wed Sep 25 09:51:24 1996 --- nvi-1.79-m17n/common/key.c Sun Dec 29 22:26:00 1996 *************** *** 206,211 **** --- 206,212 ---- v_key_ilookup(sp) SCR *sp; { + #ifndef MULTIBYTE CHAR_T ch, *p, *t; GS *gp; size_t len; *************** *** 214,219 **** --- 215,231 ---- for (p = gp->cname[ch].name, t = v_key_name(sp, ch), len = gp->cname[ch].len = sp->clen; len--;) *p++ = *t++; + #else + CHAR_T ch, *p, *t; + GS *gp; + size_t len; + + for (gp = sp->gp, ch = 0; ch <= MAX_FAST_KEY; ++ch) + for (p = gp->cname[ch].name, t = v_key_name(sp, ch), + len = gp->cname[ch].len = sp->clen, + gp->cname[ch].blen = v_key_blen(sp, ch); len--;) + *p++ = *t++; + #endif /*MULTIBYTE*/ } /* *************** *** 232,237 **** --- 244,271 ---- return (sp->clen); } + #ifdef MULTIBYTE + /* + * v_key_len1 -- + * Return the length of the string that will display the key. + * This routine is the backup for the KEY_LEN() macro. + * + * PUBLIC: size_t v_key_len1 __P((SCR *, ARG_CHAR_T)); + */ + size_t + v_key_len1(sp, ch) + SCR *sp; + ARG_CHAR_T ch; + { + if (1 < KEY_BLEN(sp, ch)) { + sp->clen = multi_len_c(sp, ch); + return sp->clen; + } + (void)v_key_name(sp, ch); + return (sp->clen); + } + #endif /*MULTIBYTE*/ + /* * v_key_name -- * Return the string that will display the key. This routine *************** *** 244,249 **** --- 278,284 ---- SCR *sp; ARG_CHAR_T ach; { + /* XXX we can't use CHAR_T here */ static const CHAR_T hexdigit[] = "0123456789abcdef"; static const CHAR_T octdigit[] = "01234567"; CHAR_T ch, *chp, mask; *************** *** 295,301 **** #define SHIFT (BITS - BITS % 3) #define TOPMASK (BITS % 3 == 2 ? 3 : 1) << (BITS - BITS % 3) sp->cname[0] = '\\'; ! sp->cname[1] = octdigit[(ch & TOPMASK) >> SHIFT]; shift = SHIFT - 3; for (len = 2, mask = 7 << (SHIFT - 3), cnt = BITS / 3; cnt-- > 0; mask >>= 3, shift -= 3) --- 330,336 ---- #define SHIFT (BITS - BITS % 3) #define TOPMASK (BITS % 3 == 2 ? 3 : 1) << (BITS - BITS % 3) sp->cname[0] = '\\'; ! sp->cname[1] = (CHAR_T)octdigit[(ch & TOPMASK) >> SHIFT]; shift = SHIFT - 3; for (len = 2, mask = 7 << (SHIFT - 3), cnt = BITS / 3; cnt-- > 0; mask >>= 3, shift -= 3) *************** *** 313,318 **** --- 348,403 ---- return (sp->cname); } + #ifdef MULTIBYTE + /* + * v_key_name1 -- + * Return the string that will display the key. This routine + * is the backup for the KEY_NAME() macro. + * + * PUBLIC: CHAR_T *v_key_name1 __P((SCR *, ARG_CHAR_T)); + */ + CHAR_T * + v_key_name1(sp, ach) + SCR *sp; + ARG_CHAR_T ach; + { + CHAR_T ch; + size_t len; + + ch = ach; + if (1 < multi_byte_c(sp, ch)) { + /* it is illegal to grab display form by KEY_NAME. + * here we define sentinel code for it. + */ + int i; + len = multi_len_c(sp, ch); + for (i = 0; i < len; i++) + sp->cname[i] = 'X'; + sp->cname[sp->clen = len] = '\0'; + return (sp->cname); + } + + return v_key_name(sp, ach); + } + + /* + * v_key_blen -- + * Return the length of the string in the edit buffer. + * If the character is single-byte(ASCII and whatever) it returns 1. + * In other cases, it might return 2 or 3. + * This routine is the backup for the KEY_LEN() macro. + * + * PUBLIC: size_t v_key_blen __P((SCR *, ARG_CHAR_T)); + */ + size_t + v_key_blen(sp, ch) + SCR *sp; + ARG_CHAR_T ch; + { + return (multi_byte_c(sp, ch)); + } + #endif /*MULTIBYTE*/ + /* * v_key_val -- * Fill in the value for a key. This routine is the backup *************** *** 579,584 **** --- 664,679 ---- return (1); case E_TIMEOUT: istimeout = 1; + #ifdef MULTIBYTE + /* + * XXX + * dirty hack to flush multibyte keybuffer. + */ + argp->e_event = E_STRING; + if (argp->e_len && v_event_append(sp, argp)) + return 1; + argp->e_event = E_TIMEOUT; + #endif /*MULTIBYTE*/ break; case E_INTERRUPT: /* Set the global interrupt flag. */ Index: common/msg.c Prereq: 10.48 *** nvi-1.79/common/msg.c Mon Sep 16 04:57:29 1996 --- nvi-1.79-m17n/common/msg.c Mon Feb 17 00:10:54 1997 *************** *** 604,609 **** --- 604,623 ---- p += len; needsep = 1; } + #ifdef MULTIBYTE + t = O_STR(sp, O_AUTODETECT); + if (t && strlen(t) && t[strlen(t) - 1] == '+') { + if (needsep) { + *p++ = ','; + *p++ = ' '; + } + t = O_STR(sp, O_FILEENCODING); + len = strlen(t); + memcpy(p, t, len); + p += len; + needsep = 1; + } + #endif /*MULTIBYTE*/ if (needsep) { *p++ = ':'; *p++ = ' '; Index: common/multi_big5.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multi_big5.c Wed Apr 2 16:54:22 1997 *************** *** 0 **** --- 1,300 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_big5.c,v 1.1 1997/02/02 02:34:16 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + /* + * Derived code: + * + * The code for handling Big5 as iso-2022-* has been derived from + * Mule(multilingual Emacs) by handa@etl.go.jp. + */ + + #include "config.h" + + #ifdef MULTIBYTE + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "../common/common.h" + #include "multibyte.h" + + static void iso2022tobig5 __P((CHAR_T *, int, CHAR_T *)); + static void big5toiso2022 __P((int *, CHAR_T *, CHAR_T *)); + + static void + iso2022tobig5(dst, class, src) + CHAR_T *dst; + int class; + CHAR_T *src; + { + u_int tmp; + + tmp = (src[0] - 0x21) * (0xff - 0xa1) + (src[1] - 0x21); + + if (class == 2) + tmp += (0xff - 0xa1 + 0x7f - 0x40) * (0xc9 - 0xa1); + dst[0] = tmp / (0xff - 0xa1 + 0x7f - 0x40) + 0xa1; + dst[1] = tmp % (0xff - 0xa1 + 0x7f - 0x40); + dst[1] += (dst[1] < 0x3f ? 0x40 : 0x62); + } + + static void + big5toiso2022(class, dst, src) + int *class; + CHAR_T *dst; + CHAR_T *src; + { + u_int tmp; + + tmp = (src[0] - 0xa1) * (0xff - 0xa1 + 0x7f - 0x40); + tmp += src[1] - (src[1] < 0x7f ? 0x40 : 0x62); + if (src[0] < 0xc9) + *class = 1; + else { + *class = 2; + tmp -= (0xff - 0xa1 + 0x7f - 0x40) * (0xc9 - 0xa1); + } + dst[0] = tmp / (0xff - 0xa1) + 0x21; + dst[1] = tmp % (0xff - 0xa1) + 0x21; + } + + int + big5_to_int(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + int ch; + + q = dst; + p = src; + if (pflags) + FL_INIT(*pflags, 0); + + for (i = 0; i < slen; i++) { + if (i + 1 < slen && isbig5mb1(p[0]) && isbig5mb2(p[1])) { + /* + * supposedly big5. + */ + if (dst) { + big5toiso2022(&ch, &q[1], &p[0]); + q[0] = (ch == 1 ? CS_BIG5_1 : CS_BIG5_2); + q += 3; + p += 2; + } else { + q += 3; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + + /* + * ASCII and other binary chars. + */ + if (p[0] & 0x80) { + if (dst) { + *q++ = CS_RAW0 + v_key_len(sp, p[0]); + *q++ = *p++ & 0x7f; + } else { + q += 2; + p++; + } + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_RAW); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + + int + int_to_big5(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + u_short ch; + + if (pflags) + FL_INIT(*pflags, 0); + q = dst; + p = src; + + for (i = 0; i < slen; i++) { + if (CS_RAW(p[0])) { + if (dst) { + *q++ = p[1] | 0x80; + p += 2; + } else { + q++; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (p[0] == CS_BIG5_1 || p[0] == CS_BIG5_2) { + if (dst) { + iso2022tobig5(&q[0], + p[0] == CS_BIG5_1 ? 1 : 2, &p[1]); + q += 2; + p += 3; + } else { + q += 2; + p += 3; + } + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + + if (p[0] & 0x80) { + /* + * Unknown encoding. Simply skip them. + */ + p += charset(p[0]).blen; + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_SKIP); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + + void + big5_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbuflen, pstate, pconsumed) + SCR *sp; + ENCODING const *e; + CHAR_T *kbuf; + size_t kbuflen; + CHAR_T *intbuf; + size_t *pintbuflen; + int *pstate; + size_t *pconsumed; + { + size_t i; + size_t j; + size_t consumed; + int ch; + + i = j = consumed = 0; + while (i < kbuflen) { + /* + * Kanji cases. + */ + if (i + 1 < kbuflen + && isbig5mb1(kbuf[i]) && isbig5mb2(kbuf[i + 1])) { + big5toiso2022(&ch, &intbuf[j + 1], &kbuf[i]); + intbuf[j] = (ch == 1 ? CS_BIG5_1 : CS_BIG5_2); + j += 3; + i += 2; + *pstate = 0; + consumed += 2; + } else if (i + 1 == kbuflen && isbig5mb1(kbuf[i])) { + /* + * Only the firstbyte is available. + * Keep this kanji char till next round. + */ + i++; + *pstate = 1; + } + + /* + * Non-kanji cases. + */ + else if (kbuf[i] & 0x80) { + intbuf[j++] = CS_RAW0 + v_key_len(sp, kbuf[i]); + intbuf[j++] = kbuf[i] & 0x7f; + i++; + *pstate = 0; + consumed++; + } else { + intbuf[j++] = kbuf[i++]; + *pstate = 0; + consumed++; + } + } + *pintbuflen = j; + *pconsumed = consumed; + } + + int + big5_display(sp, e, name, p) + SCR *sp; + ENCODING const *e; + CHAR_T *name; + CHAR_T *p; + { + u_short ch; + + if (p[0] == CS_BIG5_1 || p[0] == CS_BIG5_2) { + iso2022tobig5(&name[0], p[0] == CS_BIG5_1 ? 1 : 2, &p[1]); + return 1; + } + return 0; + } + + #endif /*MULTIBYTE*/ Index: common/multi_canna.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multi_canna.c Tue Apr 8 23:22:43 1997 *************** *** 0 **** --- 1,1008 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_canna.c,v 1.24 1997/04/08 06:53:25 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + /* + * Derived code: + * + * Canna support code was originally implemented by Nobuyuki Koganemaru + * for jelvis. + */ + /* + * Known bugs: + * - sometimes dumps core if you do screen resize while canna fence is on + * - while in ex, it won't work since ex is implemented by COOKED mode console. + */ + + #include "config.h" + + #ifdef MULTIBYTE + #ifdef CANNA + + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include + + #include "../common/common.h" + #include "../vi/vi.h" + #include "multibyte.h" + + static void canna_beep __P((void)); + static void canna_setmode __P((SCR *, int, int)); + static void canna_updatemodeline __P((SCR *)); + static void canna_echoback __P((SCR *)); + static void canna_inject __P((SCR *, ARG_CHAR_T)); + static void canna_puteucjpstr3 __P((SCR *, char *, size_t, size_t, size_t, + int)); + static void canna_puteucjpstr __P((SCR *, char *, size_t, int)); + + + static struct { + int init; /* initialized flag */ + + /* canna fence on/off */ + int mode; + int keepmode; + + /* fence string. */ + size_t fencelen; + size_t fencelenmax; + int fenceloc; + #define FENCE_CURSOR 0 + #define FENCE_MODELINE 1 + #define FENCE_BOTTOM 2 + + size_t oldfencefrow; + size_t oldfencetrow; + size_t oldfencex; + size_t oldfencey; + + /* modeline string. */ + size_t modelinemax; /* width got from cannaserver */ + size_t modelinelen; + char *modeline; /* not CHAR_T. */ + + int modelinesw; /* 1: modeline is ours + * 0: msg on modeline, don't overwrite + */ + + /* guideline string. */ + #define GUIDELINEMAX 100 + size_t guidelinemax; + size_t guidelinelen; + char *guideline; /* not CHAR_T. */ + size_t guidelinerevstart; + size_t guidelinerevlen; + size_t guidelinewidth; /* width registered with cannaserver */ + + /* canna server communication buffer. */ + #define INBUFMAX 1024 + u_char inbuf[INBUFMAX]; + #define OUTBUFMAX 1024 + CHAR_T outbuf[OUTBUFMAX]; + size_t outhead; + size_t outtail; + #define C_OUTSIZE() (cannastate.outtail - cannastate.outhead) + #define C_OUTGET() (cannastate.outbuf[cannastate.outhead++]) + #define C_OUTPUT(c) { cannastate.outbuf[cannastate.outtail++] = (c); } + #define C_OUTCLEAN() { \ + if (cannastate.outtail == cannastate.outhead) \ + cannastate.outtail = cannastate.outhead = 0; \ + } + + int errorbell; + jrKanjiStatus ks; + jrKanjiStatusWithValue ksv; + } cannastate; + + void + canna_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbuflen, pstate, pconsumed) + SCR *sp; + ENCODING const *e; + CHAR_T *kbuf; + size_t kbuflen; + CHAR_T *intbuf; + size_t *pintbuflen; + int *pstate; + size_t *pconsumed; + { + size_t i; + size_t j; + size_t consumed; + int ch; + int ilen; + + i = j = consumed = 0; + while (i < kbuflen) { + canna_inject(sp, kbuf[i]); + i++; + consumed++; + } + + while (C_OUTSIZE()) { + intbuf[j++] = C_OUTGET(); + } + C_OUTCLEAN(); + + *pintbuflen = j; + *pconsumed = consumed; + } + + /*------------------------------------------------------------*/ + + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: int canna_enabled __P((SCR *)); + * PUBLIC: #endif + */ + int + canna_enabled(sp) + SCR *sp; + { + return cannastate.mode; + } + + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: int canna_fenceactive __P((SCR *)); + * PUBLIC: #endif + */ + int + canna_fenceactive(sp) + SCR *sp; + { + return cannastate.fencelen; + } + + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: void canna_on __P((SCR *)); + * PUBLIC: #endif + */ + void + canna_on(sp) + SCR *sp; + { + if (cannastate.keepmode) + canna_setmode(sp, 1, 0); + } + + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: void canna_off __P((SCR *)); + * PUBLIC: #endif + */ + void + canna_off(sp) + SCR *sp; + { + cannastate.keepmode = cannastate.mode; + canna_setmode(sp, 0, 0); + } + + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: void canna_force_on __P((SCR *)); + * PUBLIC: #endif + */ + void + canna_force_on(sp) + SCR *sp; + { + canna_setmode(sp, 1, 0); + } + + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: void canna_force_off __P((SCR *)); + * PUBLIC: #endif + */ + void + canna_force_off(sp) + SCR *sp; + { + canna_setmode(sp, 0, 1); + } + + /*------------------------------------------------------------*/ + + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: int canna_init __P((SCR *)); + * PUBLIC: #endif + */ + int + canna_init(sp) + SCR *sp; + { + int r; + + /* + * Attempt to connect to canna server. + */ + r = jrKanjiControl(0, KC_INITIALIZE, (char *)0); + if (r != 0) + return 1; + + /* + * disallow JIS x0201-right. + */ + jrKanjiControl(0, KC_INHIBITHANKAKUKANA, (char *)1); + + /* + * Register my name to canna server. + */ + { + char myname[30]; + (void)snprintf(myname, sizeof(myname), "nvi (pid=%lu)\n", (u_long)getpid()); + jrKanjiControl(0, KC_SETAPPNAME, myname); + } + + /* + * modeline set-up. + */ + cannastate.modelinemax + = (size_t)jrKanjiControl(0, KC_QUERYMAXMODESTR, (char *)0); + if (cannastate.modeline) { + REALLOC(sp, cannastate.modeline, u_char *, + cannastate.modelinemax); + } else { + MALLOC_RET(sp, cannastate.modeline, u_char *, + cannastate.modelinemax); + } + cannastate.modeline[cannastate.modelinelen = 0] = '\0'; + + /* + * guideline setup + */ + cannastate.guidelinemax = GUIDELINEMAX; + if (!cannastate.guideline) { + MALLOC_RET(sp, cannastate.guideline, u_char *, + cannastate.guidelinemax); + } + cannastate.guideline[cannastate.guidelinelen = 0] = '\0'; + cannastate.guidelinerevstart = 0; + cannastate.guidelinerevlen = 0; + cannastate.guidelinewidth = 0; + jrKanjiControl(0, KC_SETWIDTH, (char *)cannastate.guidelinewidth); + + /* + * bind beep function + */ + { + extern void (*jrBeepFunc)(); + + jrBeepFunc = canna_beep; + jrKanjiControl(0, KC_SETUNDEFKEYFUNCTION, kc_normal); + } + + /* + * initial mode setup + */ + cannastate.mode = cannastate.keepmode = 0; + + /* + * initial server setup + */ + canna_setserver(sp, O_STR(sp, O_CANNASERVER)); + + cannastate.init = 1; + return 0; + } + + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: int canna_end __P((SCR *)); + * PUBLIC: #endif + */ + int + canna_end(sp) + SCR *sp; + { + int r; + + /* + * unbind beep function + */ + { + extern void (*jrBeepFunc)(); + + jrBeepFunc = NULL; + } + + /* + * Attempt to disconnect from canna server. + */ + r = jrKanjiControl(0, KC_FINALIZE, (char *)0); + if (r != 0) + return 1; + + /* + * finalize modeline. + */ + if (cannastate.modeline) + free(cannastate.modeline); + cannastate.modeline = NULL; + cannastate.modelinelen = 0; + + /* + * finalize guideline. + */ + if (cannastate.guideline) + free(cannastate.guideline); + cannastate.guideline = NULL; + cannastate.guidelinelen = 0; + cannastate.guidelinewidth = 0; + + /* + * mode finalize, for safety. + */ + cannastate.mode = cannastate.keepmode = 0; + + cannastate.init = 0; + return 0; + } + + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: void canna_setserver __P((SCR *, char *)); + * PUBLIC: #endif + */ + void + canna_setserver(sp, name) + SCR *sp; + char *name; + { + jrKanjiControl(0, KC_DISCONNECTSERVER, (char *)0); + jrKanjiControl(0, KC_SETSERVERNAME, name); + } + + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: int canna_modelinesw __P((SCR *, int)); + * PUBLIC: #endif + */ + int + canna_modelinesw(sp, x) + SCR *sp; + int x; + { + cannastate.modelinesw = x; + } + + /* + * Will be called from vs_modeline(). + * + * PUBLIC: #ifdef CANNA + * PUBLIC: int canna_modeline __P((SCR *)); + * PUBLIC: #endif + */ + int + canna_modeline(sp) + SCR *sp; + { + GS *gp; + int x, y; + int maxch; + + if (!cannastate.mode) + return 0; + if (! (cannastate.modelinelen || cannastate.guidelinelen)) + return 0; + + gp = sp->gp; + + if (cannastate.fenceloc == FENCE_MODELINE) { + size_t fenceend; + + (void)gp->scr_move(sp, LASTLINE(sp), 0); + if (cannastate.modelinelen + && cannastate.modelinelen < sp->cols) { + canna_puteucjpstr(sp, cannastate.modeline, + cannastate.modelinelen, 0); + } + fenceend = cannastate.modelinemax + cannastate.fencelen; + if (fenceend < sp->cols) { + (void)gp->scr_move(sp, LASTLINE(sp), fenceend); + (void)gp->scr_clrtoeol(sp); + } + return sp->cols; + } + + (void)gp->scr_move(sp, LASTLINE(sp), 0); + #if 0 + (void)gp->scr_clrtoeol(sp); + #endif + + maxch = 0; + + if (cannastate.modelinelen && cannastate.modelinelen < sp->cols) { + canna_puteucjpstr(sp, cannastate.modeline, + cannastate.modelinelen, 0); + maxch = cannastate.modelinemax; + } + + if (cannastate.guidelinelen + && cannastate.modelinemax + cannastate.guidelinelen < sp->cols) { + (void)gp->scr_move(sp, LASTLINE(sp), cannastate.modelinemax); + + canna_puteucjpstr3(sp, cannastate.guideline, + cannastate.guidelinelen, cannastate.guidelinerevstart, + cannastate.guidelinerevlen, 0); + maxch = cannastate.modelinemax + cannastate.guidelinelen; + } + + return maxch; + } + + /*------------------------------------------------------------*/ + + static void + canna_beep() + { + cannastate.errorbell = 1; + } + + static void + canna_setmode(sp, mode, drop) + SCR *sp; + int mode; + int drop; + { + VI_PRIVATE *vip; + + vip = VIP(sp); + + if (mode) { + if (cannastate.mode) + return; + + /* switch canna mode */ + cannastate.ksv.ks = &cannastate.ks; + cannastate.ksv.buffer = cannastate.inbuf; + cannastate.ksv.bytes_buffer = sizeof(cannastate.inbuf); + cannastate.ksv.val = CANNA_MODE_HenkanMode; + jrKanjiControl(0, KC_CHANGEMODE, (char *)&cannastate.ksv); + cannastate.outhead = cannastate.outtail = 0; + + /* obtain modeline */ + jrKanjiControl(0, KC_QUERYMODE, (char *)cannastate.modeline); + cannastate.modelinelen = strlen(cannastate.modeline); + + /* initialize fence */ + cannastate.fencelen = cannastate.fencelenmax = 0; + cannastate.oldfencefrow = cannastate.oldfencetrow = 0; + cannastate.oldfencex = cannastate.oldfencey = 999999; /*XXX*/ + cannastate.fenceloc = FENCE_CURSOR; + } else { + if (!cannastate.mode) + return; + + /* obtain kakutei string */ + cannastate.ksv.ks = &cannastate.ks; + cannastate.ksv.buffer = cannastate.inbuf; + cannastate.ksv.bytes_buffer = sizeof(cannastate.inbuf); + jrKanjiControl(0, KC_KAKUTEI, (char *)&cannastate.ksv); + if (!drop && 0 < cannastate.ksv.val) { + size_t i; + size_t ilen; + + ilen = cannastate.ksv.val; + for (i = 0; i < ilen; i++) { + if (i + 1 < ilen + && iseuckanji(cannastate.inbuf[i])) { + C_OUTPUT(CS_JISX0208_1983); + C_OUTPUT(cannastate.inbuf[i+0] & 0x7f); + C_OUTPUT(cannastate.inbuf[i+1] & 0x7f); + i++; + } else if (i + 1 < ilen + && cannastate.inbuf[i] == SS2) { + C_OUTPUT(CS_JISX0201_RIGHT); + C_OUTPUT(cannastate.inbuf[i+1] & 0x7f); + i++; + } else if (i + 2 < ilen + && cannastate.inbuf[i] == SS3) { + C_OUTPUT(CS_JISX0212_1990); + C_OUTPUT(cannastate.inbuf[i+1] & 0x7f); + C_OUTPUT(cannastate.inbuf[i+2] & 0x7f); + i += 2; + } else if (cannastate.inbuf[i] & 0x80) { + C_OUTPUT(CS_RAW0 + v_key_len(sp, + cannastate.inbuf[i])); + C_OUTPUT(cannastate.inbuf[i] & 0x7f); + } else { + C_OUTPUT(cannastate.inbuf[i]); + } + } + } + } + + cannastate.mode = mode; + + if (F_ISSET(sp, SC_SCR_VI) && !IS_ONELINE(sp) + && !F_ISSET(vip, VIP_S_MODELINE) && !F_ISSET(sp, SC_TINPUT_INFO)) { + if (cannastate.modelinesw) { + /* update modeline */ + canna_updatemodeline(sp); + (void)sp->gp->scr_refresh(sp, 0); + } + } + } + + static void + canna_updatemodeline(sp) + SCR *sp; + { + GS *gp; + size_t x, y; + + gp = sp->gp; + (void)gp->scr_cursor(sp, &y, &x); + + vs_modeline(sp); + (void)gp->scr_move(sp, y, x); + } + + /* + * XXX The code assumes that canna returns fence in euc-jp. + */ + static void + canna_echoback(sp) + SCR *sp; + { + GS *gp; + VI_PRIVATE *vip; + + gp = sp->gp; + vip = VIP(sp); + + /* repaint the fence. */ + { + size_t ofencelen; + size_t nfencelen; + + ofencelen = cannastate.fencelen; + if (cannastate.ks.length < 0) + goto nofencechange; + else if (0 < cannastate.ks.length) { + /* plus two for surrounding chars (pipe mark) */ + nfencelen = cannastate.ks.length + 2; + } else + nfencelen = 0; + + if (F_ISSET(sp, SC_SCR_VI)) { + /* vi mode, on screen/status line. */ + size_t x, y; + size_t nx, ny; + int fenceloc; + int fencemove; + int fencerepaint; + + (void)gp->scr_cursor(sp, &y, &x); + + fencemove = fencerepaint = 0; + + /* reset */ + if (nfencelen == 0) + cannastate.fenceloc = FENCE_CURSOR; + + /* guess the location first. */ + switch (cannastate.fenceloc) { + case FENCE_CURSOR: + fenceloc = FENCE_CURSOR; + if (!F_ISSET(sp, SC_TINPUT_INFO) + && sp->cols < x + nfencelen) { + fenceloc = FENCE_MODELINE; + fencemove++; + fencerepaint++; + } else if (F_ISSET(sp, SC_TINPUT_INFO) + && sp->cols < x + nfencelen + + (y == LASTLINE(sp) ? 1 : 0)) { + fenceloc = FENCE_BOTTOM; + fencemove++; + fencerepaint++; + } + break; + case FENCE_MODELINE: + fenceloc = FENCE_MODELINE; + break; + case FENCE_BOTTOM: + fenceloc = FENCE_BOTTOM; + break; + } + + /* + * fence repaint checks. + * 1. if fence shrinked, repaint is necessery. + * 2. if the cursor has moved from the previous position, + * repaint is necessery. + */ + if (nfencelen < ofencelen) + fencerepaint++; + if (ofencelen + && (cannastate.oldfencex != x || cannastate.oldfencey != y)) + fencerepaint++; + + /* + * If we are making input on the modeline, and we hit the + * last char (fencemove), need to scroll the line to make room. + */ + if (fencemove && fenceloc == FENCE_BOTTOM + && y == LASTLINE(sp)) { + TEXT *tp; + size_t i; + size_t scno; + size_t slen; + size_t colinc; + size_t ocno; + + tp = sp->tiq.cqh_first; + if (tp == (TEXT *)&sp->tiq) + abort(); /*XXX*/ + + /* append fake space chars to make room. */ + scno = vs_columns(sp, tp->lb, tp->lno, &tp->cno, NULL); + slen = vs_columns(sp, tp->lb, tp->lno, &tp->len, NULL); + if (scno / sp->cols != slen / sp->cols) + colinc = 1; + else { + colinc = ((slen / sp->cols) + 1) * sp->cols; + colinc -= scno; + colinc += 2; /*for safety */ + } + BINC_GOTO(sp, tp->lb, tp->lb_len, tp->len + colinc); + if (0) { + alloc_err: + abort(); + } + for (i = 0; i < colinc; i++) { + tp->lb[tp->len] = ' '; + ++tp->len; + ++tp->owrite; + } + + /* + * move cursor to the end, and refresh the screen once. + */ + ocno = tp->cno; + sp->cno = tp->cno = tp->len - 1; + tp->owrite -= (tp->cno - ocno); + (void)vs_change(sp, tp->lno, LINE_RESET); + (void)vs_refresh(sp, 0); + + /* backup cursor. */ + tp->owrite += (tp->cno - ocno); + sp->cno = tp->cno = ocno; + (void)vs_refresh(sp, 0); + + /* forget about fake spacing. */ + tp->len -= colinc; + tp->owrite -= colinc; + + /* remember new cursor position. */ + (void)gp->scr_cursor(sp, &y, &x); + + /* repaint was already done. */ + fencerepaint = 0; + } + + /* + * repaint underlying chars, or clear old fence, if needed. + */ + if (fencerepaint) { + switch (cannastate.fenceloc) { + case FENCE_CURSOR: + { + if (cannastate.fencelenmax) { + EVENT ev; + ev.e_event = E_REPAINT; + ev.e_flno = cannastate.oldfencefrow; + ev.e_tlno = cannastate.oldfencetrow; + (void)vs_repaint(sp, &ev); + cannastate.fencelenmax = 0; + } + + /* remember new cursor position. */ + (void)gp->scr_cursor(sp, &y, &x); + break; + } + + case FENCE_MODELINE: + case FENCE_BOTTOM: + (void)gp->scr_move(sp, cannastate.oldfencey, + cannastate.oldfencex); + (void)gp->scr_clrtoeol(sp); + (void)gp->scr_move(sp, y, x); + break; + } + + /* repaint was already done. */ + fencerepaint = 0; + } + + /* + * move cursor to new fence location. + */ + switch (fenceloc) { + case FENCE_CURSOR: + nx = x; + ny = y; + break; + case FENCE_MODELINE: + ny = LASTLINE(sp); + nx = cannastate.modelinemax; + (void)gp->scr_move(sp, ny, nx); + break; + case FENCE_BOTTOM: + ny = LASTLINE(sp); + nx = 0; + (void)gp->scr_move(sp, ny, nx); + break; + } + + /* + * paint the new fence. + */ + if (nfencelen) { + if (nfencelen) + (void)gp->scr_addstr(sp, "|", 1); + canna_puteucjpstr3(sp, cannastate.ks.echoStr, + cannastate.ks.length, cannastate.ks.revPos, + cannastate.ks.revLen, 0); + if (nfencelen) { + if (cannastate.ks.length + == cannastate.ks.revPos) { + (void)gp->scr_attr(sp, SA_INVERSE, 1); + (void)gp->scr_addstr(sp, "|", 1); + (void)gp->scr_attr(sp, SA_INVERSE, 0); + } else + (void)gp->scr_addstr(sp, "|", 1); + } + (void)gp->scr_move(sp, y, x); + } + + (void)gp->scr_refresh(sp, 0); + + /* + * try to remember old fence location for redraw. + * XXX how should we deal with scrolling? + */ + cannastate.oldfencefrow = ny + 1; + if (sp->rows < cannastate.oldfencefrow) + cannastate.oldfencefrow = sp->rows; + cannastate.oldfencetrow = ny + 1; + cannastate.oldfencetrow + += (nx + cannastate.fencelenmax) / sp->cols; + if (sp->rows < cannastate.oldfencetrow) + cannastate.oldfencetrow = sp->rows; + cannastate.oldfencex = nx; + cannastate.oldfencey = ny; + + cannastate.fenceloc = fenceloc; + } else { + /* ex mode. we can't use curses routines. */ + /* XXX some optimization would be nice */ + size_t i; + + /* erase the old fence. */ + for (i = 0; i < ofencelen; i++) + (void)printf("\b \b"); + + /* repaint the fence. */ + if (nfencelen) { + (void)printf("|"); + canna_puteucjpstr3(sp, cannastate.ks.echoStr, + cannastate.ks.length, cannastate.ks.revPos, + cannastate.ks.revLen, 1); + (void)printf("|"); + } + } + + cannastate.fencelen = nfencelen; + if (cannastate.fencelenmax < nfencelen) + cannastate.fencelenmax = nfencelen; + } + + nofencechange:; + + /* modeline */ + if (cannastate.ks.info & KanjiModeInfo) { + strcpy(cannastate.modeline, cannastate.ks.mode); + cannastate.modelinelen = strlen(cannastate.modeline); + } + + /* guideline */ + if (cannastate.ks.info & KanjiGLineInfo) { + memcpy(cannastate.guideline, cannastate.ks.gline.line, + cannastate.ks.gline.length); + cannastate.guidelinelen = cannastate.ks.gline.length; + cannastate.guidelinerevstart = cannastate.ks.gline.revPos; + cannastate.guidelinerevlen = cannastate.ks.gline.revLen; + } + + if (F_ISSET(sp, SC_SCR_VI) && !IS_ONELINE(sp) + && !F_ISSET(vip, VIP_S_MODELINE) && !F_ISSET(sp, SC_TINPUT_INFO)) { + if (cannastate.modelinesw) { + /* update modeline */ + canna_updatemodeline(sp); + (void)gp->scr_refresh(sp, 0); + } + } + } + + static void + canna_inject(sp, arg) + SCR *sp; + ARG_CHAR_T arg; + { + CHAR_T c; + int ilen; + + c = arg; + + /* set guidelinewidth */ + { + int nwidth; + if (F_ISSET(sp, SC_SCR_VI) && !F_ISSET(sp, SC_TINPUT_INFO)) { + nwidth = sp->cols; + nwidth -= cannastate.modelinemax; + } else + nwidth = 0; + if (nwidth != cannastate.guidelinewidth) { + jrKanjiControl(0, KC_SETWIDTH, (char *)nwidth); + cannastate.guidelinewidth = nwidth; + } + } + + cannastate.errorbell = 0; + ilen = jrKanjiString(0, c, (char *)cannastate.inbuf, + sizeof(cannastate.inbuf), &cannastate.ks); + if (ilen < 0) { + /* XXX bark something */ + return; + } + + canna_echoback(sp); + + if (cannastate.errorbell && F_ISSET(sp, SC_SCR_VI)) + (void)sp->gp->scr_bell(sp); + + if (0 < ilen) { + size_t i; + for (i = 0; i < ilen; i++) { + if (i + 1 < ilen && iseuckanji(cannastate.inbuf[i])) { + C_OUTPUT(CS_JISX0208_1983); + C_OUTPUT(cannastate.inbuf[i + 0] & 0x7f); + C_OUTPUT(cannastate.inbuf[i + 1] & 0x7f); + i++; + } else if (i + 1 < ilen && cannastate.inbuf[i] == SS2) { + C_OUTPUT(CS_JISX0201_RIGHT); + C_OUTPUT(cannastate.inbuf[i+1] & 0x7f); + i++; + } else if (i + 2 < ilen && cannastate.inbuf[i] == SS3) { + C_OUTPUT(CS_JISX0212_1990); + C_OUTPUT(cannastate.inbuf[i+1] & 0x7f); + C_OUTPUT(cannastate.inbuf[i+2] & 0x7f); + i += 2; + } else if (cannastate.inbuf[i] & 0x80) { + C_OUTPUT(CS_RAW0 + v_key_len(sp, + cannastate.inbuf[i])); + C_OUTPUT(cannastate.inbuf[i] & 0x7f); + } else { + C_OUTPUT(cannastate.inbuf[i]); + } + } + } + } + + static void + canna_puteucjpstr3(sp, p, len, revpos, revlen, mode) + SCR *sp; + char *p; + size_t len; + size_t revpos; + size_t revlen; + int mode; /* 0: vi 1: ex */ + { + GS *gp; + + gp = sp->gp; + canna_puteucjpstr(sp, p, revpos, mode); + (void)gp->scr_attr(sp, SA_INVERSE, 1); + canna_puteucjpstr(sp, p + revpos, revlen, mode); + (void)gp->scr_attr(sp, SA_INVERSE, 0); + canna_puteucjpstr(sp, p + revpos + revlen, len - revpos - revlen, mode); + } + + static void + canna_puteucjpstr(sp, p0, len, mode) + SCR *sp; + char *p0; + size_t len; + int mode; /* 0: vi 1: ex */ + { + GS *gp; + size_t col; + u_char *p; + u_char name[4]; + + gp = sp->gp; + + p = (u_char *)p0; + col = 0; + while (col < len) { + if (col + 1 < len && iseuckanji(*p)) { + name[0] = CS_JISX0208_1983; + name[1] = *p++ & 0x7f; + name[2] = *p++ & 0x7f; + name[3] = '\0'; + if (mode) + (void)printf("%s", name); + else + (void)gp->scr_addstr(sp, name, 3); + col += 2; + } else if (col + 1 < len && *p == SS2) { + p++; + name[0] = CS_JISX0201_RIGHT; + name[1] = *p++ & 0x7f; + name[2] = '\0'; + if (mode) + (void)printf("%s", name); + else + (void)gp->scr_addstr(sp, name, 2); + col += 2; /*XXX*/ + } else if (col + 2 < len && *p == SS3) { + p++; + name[0] = CS_JISX0212_1990; + name[1] = *p++ & 0x7f; + name[2] = *p++ & 0x7f; + name[3] = '\0'; + if (mode) + (void)printf("%s", name); + else + (void)gp->scr_addstr(sp, name, 3); + col += 3; /*XXX*/ + } else if (*p & 0x80) { + name[0] = CS_RAW0 + v_key_len(sp, *p); + name[1] = *p++ & 0x7f; + name[2] = '\0'; + if (mode) + (void)printf("%s", name); + else + (void)gp->scr_addstr(sp, name, 2); + col++; + } else { + name[0] = *p++; + name[1] = '\0'; + if (mode) + (void)printf("%s", name); + else + (void)gp->scr_addstr(sp, name, 1); + col++; + } + } + } + #endif /*CANNA*/ + #endif /*MULTIBYTE*/ Index: common/multi_chclass.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multi_chclass.c Wed Apr 2 16:54:23 1997 *************** *** 0 **** --- 1,200 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_chclass.c,v 1.2 1997/02/15 04:22:44 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + /* + * Derived code: + * + * The code to determine KSC5601 character class was implemented by + * kjlee@sgi.co.jp. + */ + + #include "config.h" + + #ifdef MULTIBYTE + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "../common/common.h" + #include "multibyte.h" + + /* + * Returns character class for the character pointed to by p. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: u_int multi_chclass __P((CHAR_T *, u_int)); + * PUBLIC: #endif + */ + u_int + multi_chclass(p, ctxt) + CHAR_T *p; + u_int ctxt; + { + u_int class; + + if (ischarset(p[0]) && !CS_RAW(p[0])) { + class = (u_int)p[0] << 8; + if (charset(p[0]).chclass) + class = (*charset(p[0]).chclass)(p, ctxt); + } else + class = (u_short)CS_NONE << 8; + return class; + } + + /* + * Functions that are dependent to character set. + */ + u_int + jis0208_chclass(p, ctxt) + CHAR_T *p; + u_int ctxt; + { + #define START_MARK 0x2121 + #define START_ALPHA 0x2330 + #define START_HIRAGANA 0x2421 + #define START_KATAKANA 0x2521 + #define START_GREEK 0x2621 + #define START_KANJI 0x3021 + + #define CLASS_MARK 0 + #define CLASS_ALPHA 5 + #define CLASS_HIRAGANA 1 + #define CLASS_KATAKANA 10 + #define CLASS_GREEK 5 + #define CLASS_KANJI 20 + #define CLASS_NONKANJI 100 + + u_short ch; + u_int class; + size_t i; + static u_short ch_kanji[] = { + 0x2137, 0x2138, 0x2139, 0x213a, + }; + static u_short ch_kana[] = { + 0x2133, 0x2134, 0x2135, 0x2136, 0x213c, 0x2141, + }; + + class = (u_int)p[0] << 8; + ch = ((u_short)p[1] << 8) | p[2]; + + for (i = 0; i < sizeof(ch_kanji); i++) { + if (ch == ch_kanji[i]) + return class | CLASS_KANJI; + } + for (i = 0; i < sizeof(ch_kana); i++) { + if (ch == ch_kana[i]) { + if ((ctxt & 0xff) == CLASS_HIRAGANA) + return class | CLASS_HIRAGANA; + else + return class | CLASS_KATAKANA; + } + } + + if (ch < START_ALPHA) + return class | CLASS_MARK; + if (ch < START_HIRAGANA) + return class | CLASS_ALPHA; + if (ch < START_KATAKANA) + return class | CLASS_HIRAGANA; + if (ch < START_GREEK) + return class | CLASS_KATAKANA; + if (ch < START_KANJI) + return class | CLASS_GREEK; + return class | CLASS_KANJI; + + #undef START_MARK + #undef START_ALPHA + #undef START_HIRAGANA + #undef START_KATAKANA + #undef START_GREEK + #undef START_KANJI + + #undef CLASS_MARK + #undef CLASS_ALPHA + #undef CLASS_HIRAGANA + #undef CLASS_KATAKANA + #undef CLASS_GREEK + #undef CLASS_KANJI + #undef CLASS_NONKANJI + } + + u_int + ksc5601_chclass(p, ctxt) + CHAR_T *p; + u_int ctxt; + { + #define START_MARK 0x2121 + #define START_ALPHA 0x2330 + #define START_HIRAGANA 0x2a21 + #define START_KATAKANA 0x2b21 + #define START_GREEK 0x2c21 + #define START_KOREAN 0x3021 + #define START_KANJI 0x4a21 + + #define CLASS_MARK 0 + #define CLASS_ALPHA 5 + #define CLASS_HIRAGANA 1 + #define CLASS_KATAKANA 10 + #define CLASS_GREEK 5 + #define CLASS_KOREAN 15 + #define CLASS_KANJI 20 + #define CLASS_NONKANJI 100 + + u_short ch; + u_int class; + size_t i; + + class = (u_int)p[0] << 8; + ch = ((u_short)p[1] << 8) | p[2]; + + if (ch < START_ALPHA) + return class | CLASS_MARK; + if (ch < START_HIRAGANA) + return class | CLASS_ALPHA; + if (ch < START_KATAKANA) + return class | CLASS_HIRAGANA; + if (ch < START_GREEK) + return class | CLASS_KATAKANA; + if (ch < START_KOREAN) + return class | CLASS_GREEK; + if (ch < START_KANJI) + return class | CLASS_KOREAN; + return class | CLASS_KANJI; + + #undef START_MARK + #undef START_ALPHA + #undef START_HIRAGANA + #undef START_KATAKANA + #undef START_GREEK + #undef START_KANJI + + #undef CLASS_MARK + #undef CLASS_ALPHA + #undef CLASS_HIRAGANA + #undef CLASS_KATAKANA + #undef CLASS_GREEK + #undef CLASS_KANJI + #undef CLASS_NONKANJI + } + #endif /*MULTIBYTE*/ Index: common/multi_euc.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multi_euc.c Wed Aug 20 16:32:44 1997 *************** *** 0 **** --- 1,432 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_euc.c,v 1.2 1997/08/20 07:32:43 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + + #include "config.h" + + #ifdef MULTIBYTE + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "../common/common.h" + #include "multibyte.h" + + #if 0 + int + euc_to_int(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + + /* sanity check. */ + if (ischarset(e->initg0)) { + if (charset(e->initg0).type != CS94) + abort(); + } + if (ischarset(e->initg1)) { + if (charset(e->initg1).type != CS9494) + abort(); + } + if (ischarset(e->initg2)) { + if (charset(e->initg2).type != CS94) + abort(); + } + if (ischarset(e->initg3)) { + if (charset(e->initg3).type != CS9494) + abort(); + } + + q = dst; + p = src; + if (pflags) + FL_INIT(*pflags, 0); + + for (i = 0; i < slen; i++) { + if (i + 1 < slen && iseuckanji(p[0]) && iseuckanji(p[1])) { + if (!ischarset(e->initg1)) + goto raw; + + if (dst) { + *q++ = e->initg1; + *q++ = *p++ & 0x7f; + *q++ = *p++ & 0x7f; + } else { + q += 3; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (i + 1 < slen && p[0] == 0x8e && iseuckanji(p[1])) { + if (!ischarset(e->initg2)) + goto raw; + + if (dst) { + p++; + *q++ = e->initg2; + *q++ = *p++ & 0x7f; + } else { + q += 2; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (i + 2 < slen && p[0] == 0x8f + && iseuckanji(p[1]) && iseuckanji(p[2])) { + if (!ischarset(e->initg3)) + goto raw; + + if (dst) { + p++; + *q++ = e->initg3; + *q++ = *p++ & 0x7f; + *q++ = *p++ & 0x7f; + } else { + q += 3; + p += 3; + } + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + + raw: + /* + * ASCII and other binary encodings. + */ + if (p[0] & 0x80) { + if (dst) { + *q++ = CS_RAW0 + v_key_len(sp, *p); + *q++ = *p & 0x7f; + p++; + } else { + q += 2; + p++; + } + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_RAW); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + #endif + + #if 0 + int + int_to_euc(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + + /* sanity check. */ + if (ischarset(e->initg0)) { + if (charset(e->initg0).type != CS94) + abort(); + } + if (ischarset(e->initg1)) { + if (charset(e->initg1).type != CS9494) + abort(); + } + if (ischarset(e->initg2)) { + if (charset(e->initg2).type != CS94) + abort(); + } + if (ischarset(e->initg3)) { + if (charset(e->initg3).type != CS9494) + abort(); + } + + if (pflags) + FL_INIT(*pflags, 0); + q = dst; + p = src; + + for (i = 0; i < slen; i++) { + if (CS_RAW(p[0])) { + if (dst) { + *q++ = p[1] | 0x80; + p += 2; + } else { + q++; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_RAW); + continue; + } + if (ischarset(e->initg1) && p[0] == e->initg1) { + /* + * If we're using euc-jp, there's no distinction + * between JIS0208 variants. + */ + if (dst) { + p++; + *q++ = *p++ | 0x80; + *q++ = *p++ | 0x80; + } else { + q += 2; + p += 3; + } + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (ischarset(e->initg2) && p[0] == e->initg2) { + if (dst) { + p++; + *q++ = 0x8e; + *q++ = *p++ | 0x80; + } else { + q += 2; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (ischarset(e->initg3) && p[0] == e->initg3) { + if (dst) { + p++; + *q++ = 0x8f; + *q++ = *p++ | 0x80; + *q++ = *p++ | 0x80; + } else { + q += 3; + p += 3; + } + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (p[0] & 0x80) { + /* + * Unknown encoding. Simply skip them. + */ + p += charset(p[0]).blen; + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_SKIP); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + #endif + + int + euc_recommendation(cs, e) + CHARSET const *cs; + ENCODING const *e; + { + CHAR_T ch; + + if (cs == NULL) + return 0; + + ch = CS_RAW0 + (cs - charsettab); + if (ch == e->initg1) + return 1; + if (ch == e->initg2) + return 2; + if (ch == e->initg3) + return 3; + if (!ischarset(e->initg2) && (cs->type == CS94 || cs->type == CS96)) + return 2; + if (!ischarset(e->initg3) && (cs->type == CS9494 || cs->type == CS9696)) + return 3; + + /* don't mix them up with GR chars... */ + return 0; + } + + #if 0 + void + euc_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbuflen, pstate, pconsumed) + SCR *sp; + ENCODING const *e; + CHAR_T *kbuf; + size_t kbuflen; + CHAR_T *intbuf; + size_t *pintbuflen; + int *pstate; + size_t *pconsumed; + { + size_t i; + size_t j; + size_t consumed; + + i = j = consumed = 0; + while (i < kbuflen) { + /* + * Kanji cases. + */ + if (ischarset(e->initg1) && i + 1 < kbuflen + && iseuckanji(kbuf[i]) && iseuckanji(kbuf[i + 1])) { + /* + * we got G1 char. + */ + intbuf[j++] = e->initg1; + intbuf[j++] = kbuf[i++] & 0x7f; + intbuf[j++] = kbuf[i++] & 0x7f; + *pstate = 0; + consumed += 2; + } else if (ischarset(e->initg2) && i + 1 < kbuflen + && kbuf[i] == 0x8e && iseuckanji(kbuf[i + 1])) { + /* + * we got G2 char. + */ + intbuf[j++] = e->initg2; + intbuf[j++] = kbuf[i + 1] & 0x7f; + i += 2; + *pstate = 0; + consumed += 2; + } else if (ischarset(e->initg3) && i + 2 < kbuflen + && kbuf[i] == 0x8f + && iseuckanji(kbuf[i + 1]) && iseuckanji(kbuf[i + 2])) { + /* + * we got G3 char. + */ + intbuf[j++] = e->initg3; + intbuf[j++] = kbuf[i + 1] & 0x7f; + intbuf[j++] = kbuf[i + 2] & 0x7f; + i += 3; + *pstate = 0; + consumed += 3; + } else if (i + 1 == kbuflen && iseuckanji(kbuf[i])) { + /* + * Only the firstbyte for G1 char is available. + * Keep this kanji char till next round. + */ + i++; + *pstate = 1; + } else if (i + 1 == kbuflen && kbuf[i] == 0x8e) { + /* + * Only the firstbyte for G2 char is available. + * Keep this kanji char till next round. + */ + i++; + *pstate = 2; + } else if (i + 1 == kbuflen && kbuf[i] == 0x8f) { + /* + * Only the firstbyte for G3 char is available. + * Keep this kanji char till next round. + */ + i++; + *pstate = 3; + } else if (i + 2 == kbuflen + && kbuf[i] == 0x8f && iseuckanji(kbuf[i + 1])) { + /* + * Only the 1st and 2nd byte for G3 char is available. + * Keep this kanji char till next round. + */ + i += 2; + *pstate = 4; + } + + /* + * Non-kanji cases. + */ + else if (kbuf[i] & 0x80) { + intbuf[j++] = CS_RAW0 + v_key_len(sp, kbuf[i]); + intbuf[j++] = kbuf[i] & 0x7f; + i++; + *pstate = 0; + consumed++; + } else { + intbuf[j++] = kbuf[i++]; + *pstate = 0; + consumed++; + } + } + *pintbuflen = j; + *pconsumed = consumed; + } + #endif + + int + euc_display(sp, e, name, p) + SCR *sp; + ENCODING const *e; + CHAR_T *name; + CHAR_T *p; + { + if (ischarset(e->initg1) && p[0] == e->initg1) { + name[0] = p[1] | 0x80; + name[1] = p[2] | 0x80; + name[2] = '\0'; + return 1; + } + return 0; + } + #endif /*MULTIBYTE*/ Index: common/multi_eucjp.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multi_eucjp.c Wed Aug 20 16:33:36 1997 *************** *** 0 **** --- 1,158 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_eucjp.c,v 1.5 1997/08/20 07:33:35 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + + #include "config.h" + + #ifdef MULTIBYTE + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "../common/common.h" + #include "multibyte.h" + + #if 0 + int + int_to_eucjp(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + + if (pflags) + FL_INIT(*pflags, 0); + q = dst; + p = src; + + for (i = 0; i < slen; i++) { + if (CS_RAW(p[0])) { + if (dst) { + *q++ = p[1] | 0x80; + p += 2; + } else { + q++; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_RAW); + continue; + } + if (p[0] == CS_JISX0208_1983 || p[0] == CS_JISX0208_1978) { + /* + * If we're using euc-jp, there's no distinction + * between JIS0208 variants. + */ + if (dst) { + p++; + *q++ = *p++ | 0x80; + *q++ = *p++ | 0x80; + } else { + q += 2; + p += 3; + } + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (p[0] == CS_JISX0201_RIGHT) { + if (dst) { + p++; + *q++ = 0x8e; + *q++ = *p++ | 0x80; + } else { + q += 2; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (p[0] == CS_JISX0212_1990) { + if (dst) { + p++; + *q++ = 0x8f; + *q++ = *p++ | 0x80; + *q++ = *p++ | 0x80; + } else { + q += 3; + p += 3; + } + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (p[0] & 0x80) { + /* + * Unknown encoding. Simply skip them. + */ + p += charset(p[0]).blen; + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_SKIP); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + #endif + + int + eucjp_display(sp, e, name, p) + SCR *sp; + ENCODING const *e; + CHAR_T *name; + CHAR_T *p; + { + if (p[0] == CS_JISX0208_1983 || p[0] == CS_JISX0208_1978) { + name[0] = p[1] | 0x80; + name[1] = p[2] | 0x80; + name[2] = '\0'; + return 1; + } + return 0; + } + #endif /*MULTIBYTE*/ Index: common/multi_euctw.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multi_euctw.c Wed Apr 2 16:54:25 1997 *************** *** 0 **** --- 1,371 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_euctw.c,v 1.1 1997/03/30 04:10:15 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + + #include "config.h" + + #ifdef MULTIBYTE + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "../common/common.h" + #include "multibyte.h" + + int + euctw_to_int(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + static CHAR_T cnstab[] = { + 0, /*0xa0*/ + CS_CNS11643_1, CS_CNS11643_2, + CS_CNS11643_3, CS_CNS11643_4, + CS_CNS11643_5, CS_CNS11643_6, + CS_CNS11643_7 + }; + #define iscnscode(x) \ + (0xa0 <= (x) \ + && (x) < 0xa0 + sizeof(cnstab)/sizeof(cnstab[0]) \ + && cnstab[(x) - 0xa0]) + #define cnscode(x) cnstab[(x) - 0xa0] + + q = dst; + p = src; + if (pflags) + FL_INIT(*pflags, 0); + + for (i = 0; i < slen; i++) { + if (i + 1 < slen && iseuckanji(p[0]) && iseuckanji(p[1])) { + if (dst) { + *q++ = CS_CNS11643_1; + *q++ = *p++ & 0x7f; + *q++ = *p++ & 0x7f; + } else { + q += 3; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (i + 3 < slen && p[0] == 0x8e && iscnscode(p[1]) + && iseuckanji(p[2]) && iseuckanji(p[3])) { + if (dst) { + p++; + *q++ = cnscode(*p); p++; + *q++ = *p++ & 0x7f; + *q++ = *p++ & 0x7f; + } else { + q += 3; + p += 4; + } + i += 3; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + + raw: + /* + * ASCII and other binary encodings. + */ + if (p[0] & 0x80) { + if (dst) { + *q++ = CS_RAW0 + v_key_len(sp, *p); + *q++ = *p & 0x7f; + p++; + } else { + q += 2; + p++; + } + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_RAW); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + #undef iscnscode + #undef cnscode + } + + int + int_to_euctw(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + static CHAR_T cnstab[] = { + CS_CNS11643_1, CS_CNS11643_2, + CS_CNS11643_3, CS_CNS11643_4, + CS_CNS11643_5, CS_CNS11643_6, + CS_CNS11643_7 + }; + static CHAR_T cnscode[] = { + 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7 + }; + int cnsidx; + + if (pflags) + FL_INIT(*pflags, 0); + q = dst; + p = src; + + for (i = 0; i < slen; i++) { + if (CS_RAW(p[0])) { + if (dst) { + *q++ = p[1] | 0x80; + p += 2; + } else { + q++; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_RAW); + continue; + } + if (p[0] == CS_CNS11643_1) { + if (dst) { + p++; + *q++ = *p++ | 0x80; + *q++ = *p++ | 0x80; + } else { + q += 2; + p += 3; + } + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + + /* + * special processing for G2 charsets.... + */ + cnsidx = -1; + { + size_t t; + for (t = 0; + t < sizeof(cnscode)/sizeof(cnscode[0]); + t++) { + if (p[0] == cnstab[t]) { + cnsidx = t; + break; + } + } + } + if (cnsidx != -1) { + if (dst) { + p++; + *q++ = cnscode[cnsidx]; + *q++ = *p++ | 0x80; + *q++ = *p++ | 0x80; + } else { + q += 3; + p += 2; + } + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + + if (p[0] & 0x80) { + /* + * Unknown encoding. Simply skip them. + */ + p += charset(p[0]).blen; + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_SKIP); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + + void + euctw_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbuflen, pstate, pconsumed) + SCR *sp; + ENCODING const *e; + CHAR_T *kbuf; + size_t kbuflen; + CHAR_T *intbuf; + size_t *pintbuflen; + int *pstate; + size_t *pconsumed; + { + size_t i; + size_t j; + size_t consumed; + static CHAR_T cnstab[] = { + 0, /*0xa0*/ + CS_CNS11643_1, CS_CNS11643_2, + CS_CNS11643_3, CS_CNS11643_4, + CS_CNS11643_5, CS_CNS11643_6, + CS_CNS11643_7 + }; + #define iscnscode(x) \ + (0xa0 <= (x) \ + && (x) < sizeof(cnstab)/sizeof(cnstab[0]) \ + && cnstab[(x) - 0xa0]) + #define cnscode(x) cnstab[(x) - 0xa0] + + i = j = consumed = 0; + while (i < kbuflen) { + /* + * Kanji cases. + */ + if (i + 1 < kbuflen + && iseuckanji(kbuf[i]) && iseuckanji(kbuf[i + 1])) { + /* + * we got G1 char. + */ + intbuf[j++] = CS_CNS11643_1; + intbuf[j++] = kbuf[i++] & 0x7f; + intbuf[j++] = kbuf[i++] & 0x7f; + *pstate = 0; + consumed += 2; + } else if (i + 2 < kbuflen + && kbuf[i] == 0x8e && iscnscode(kbuf[i + 1]) + && iseuckanji(kbuf[i + 2]) && iseuckanji(kbuf[i + 3])) { + /* + * we got G2 char. + */ + intbuf[j++] = cnscode(kbuf[i + 1]); + intbuf[j++] = kbuf[i + 2] & 0x7f; + intbuf[j++] = kbuf[i + 3] & 0x7f; + i += 4; + *pstate = 0; + consumed += 4; + } else if (i + 1 == kbuflen && iseuckanji(kbuf[i])) { + /* + * Only the firstbyte for G1 char is available. + * Keep this kanji char till next round. + */ + i++; + *pstate = 1; + } else if (i + 1 == kbuflen && kbuf[i] == 0x8e) { + /* + * Only the firstbyte for G2 char is available. + * Keep this kanji char till next round. + */ + i++; + *pstate = 2; + } else if (i + 2 == kbuflen && kbuf[i] == 0x8e + && iscnscode(kbuf[i + 1])) { + /* + * Only the first/second byte for G2 char are + * available. + * keep them till next round. + */ + i += 2; + *pstate = 3; + } else if (i + 3 == kbuflen && kbuf[i] == 0x8e + && iscnscode(kbuf[i + 1]) && iseuckanji(kbuf[i + 2])) { + /* + * Only the first/second/third byte for G2 char are + * available. + * keep them till next round. + */ + i += 3; + *pstate = 4; + } + + /* + * Non-kanji cases. + */ + else if (kbuf[i] & 0x80) { + intbuf[j++] = CS_RAW0 + v_key_len(sp, kbuf[i]); + intbuf[j++] = kbuf[i] & 0x7f; + i++; + *pstate = 0; + consumed++; + } else { + intbuf[j++] = kbuf[i++]; + *pstate = 0; + consumed++; + } + } + *pintbuflen = j; + *pconsumed = consumed; + #undef iscnscode + #undef cnscode + } + + int + euctw_display(sp, e, name, p) + SCR *sp; + ENCODING const *e; + CHAR_T *name; + CHAR_T *p; + { + if (p[0] == CS_CNS11643_1) { + name[0] = p[1] | 0x80; + name[1] = p[2] | 0x80; + name[2] = '\0'; + return 1; + } + return 0; + } + #endif /*MULTIBYTE*/ Index: common/multi_hz.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multi_hz.c Wed Apr 2 16:54:26 1997 *************** *** 0 **** --- 1,261 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_hz.c,v 1.2 1997/04/02 04:25:12 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + + #include "config.h" + + #ifdef MULTIBYTE + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "../common/common.h" + #include "multibyte.h" + + int + hz_to_int(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + u_short ch; + CHAR_T cs; + + q = dst; + p = src; + if (pflags) + FL_INIT(*pflags, 0); + cs = CS_NONE; + + for (i = 0; i < slen; i++) { + if (p[0] == '~') { + if (i + 1 < slen && p[1] == '~') { + /* + * Double tilde: escapes single tilde + */ + p += 2; + if (dst) + *q++ = '~'; + else + q++; + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (i + 1 < slen && p[1] == '{' && cs == CS_NONE) { + /* + * tilde open-bracket: enter HZ + */ + p += 2; + cs = CS_GB2312; + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (i + 1 < slen && p[1] == '}' && cs == CS_GB2312) { + /* + * tilde close: enter ASCII + */ + p += 2; + cs = CS_NONE; + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (i + 1 == slen) { + /* + * tilde on EOL: join the line to the next one + */ + p++; + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_JOIN); + continue; + } + } + if (cs == CS_GB2312) { + if (! (0x21 <= p[0] && p[0] <= 0x7e + && 0x21 <= p[1] && p[1] <= 0x7e)) + goto raw; + + if (dst) { + *q++ = cs; + *q++ = *p++; + *q++ = *p++; + } else { + q += 3; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + + raw: + /* + * ASCII and other binary chars. + */ + if (p[0] & 0x80) { + if (dst) { + *q++ = CS_RAW0 + v_key_len(sp, p[0]); + *q++ = *p++ & 0x7f; + } else { + q += 2; + p++; + } + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_RAW); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + + int + int_to_hz(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + u_short ch; + CHAR_T cs; + + if (pflags) + FL_INIT(*pflags, 0); + q = dst; + p = src; + cs = CS_NONE; + + for (i = 0; i < slen; i++) { + if (p[0] == CS_GB2312) { + if (cs != CS_NONE) { + if (dst) { + *q++ = '~'; + *q++ = '{'; + } else + q += 2; + cs = CS_GB2312; + } + + if (dst) { + p++; + *q++ = *p++; + *q++ = *p++; + } else { + p += 3; + q += 2; + } + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if ((p[0] & 0x80) && !CS_RAW(p[0])) { + /* + * Unknown encoding. Simply skip them. + */ + p += charset(p[0]).blen; + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_SKIP); + continue; + } + + if (cs != CS_NONE) { + if (dst) { + *q++ = '~'; + *q++ = '}'; + } else + q += 2; + cs = CS_NONE; + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + } + + if (CS_RAW(p[0])) { + if (dst) { + *q++ = p[1] | 0x80; + p += 2; + } else { + q++; + p += 2; + } + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_RAW); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (cs != CS_NONE) { + if (dst) { + *q++ = '~'; + *q++ = '}'; + } else + q += 2; + cs = CS_NONE; + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + #endif /*MULTIBYTE*/ Index: common/multi_iso2022.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multi_iso2022.c Wed Aug 20 16:32:47 1997 *************** *** 0 **** --- 1,1654 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_iso2022.c,v 1.11 1997/08/20 07:32:43 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + * + * Would like to thank Jungshik Shin for letting + * me know about iso-2022-kr twists. + */ + + #include "config.h" + + #ifdef MULTIBYTE + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "../common/common.h" + #include "multibyte.h" + + static int parsecharset __P((CHAR_T *, size_t, CHARSET const **, int *)); + static int callcharset __P((CHARSET const *, ENCODING const *, CHAR_T **, + ISO2022STATE *, int)); + static void selcharset __P((CHARSET const *, ENCODING const *, CHAR_T **, + CHAR_T *, ISO2022STATE *, int)); + + /* + * Parse charset designation. + * Returns 0 <= x if it is proper charset designation. + * Otherwise returns -1. + * If it detects unsupported designation, it returns 0. + * The caller must make a proper check for this case. + */ + static int + parsecharset(p, len, hcs, pgroup) + CHAR_T *p; + size_t len; + CHARSET const **hcs; + int *pgroup; + { + size_t i; + CSTYPE cstype; + CHAR_T version; + CHAR_T ch; + int csok; + int mb; + int advance; + + if (! (1 <= len && p[0] == '\033')) + return -1; + + i = 1; + version = 0; + if (4 <= len && p[i] == '&' && isecma(p[i + 1]) && p[i + 2] == '\033') { + version = p[i + 1]; + i += 3; + } + + csok = 0; + mb = 0; + for (/*nothing*/; i < len; i++) { + switch (p[i]) { + case '$': + if (csok) + goto fail; + if (pgroup) + *pgroup = 0; + cstype = CS94; + mb = 1; + break; + case '(': + if (csok) + goto fail; + if (pgroup) + *pgroup = 0; + cstype = CS94; + csok = 1; + break; + case ')': + if (csok) + goto fail; + if (pgroup) + *pgroup = 1; + cstype = CS94; + csok = 1; + break; + case '*': + if (csok) + goto fail; + if (pgroup) + *pgroup = 2; + cstype = CS94; + csok = 1; + break; + case '+': + if (csok) + goto fail; + if (pgroup) + *pgroup = 3; + cstype = CS94; + csok = 1; + break; + case ',': + if (csok) + goto fail; + if (pgroup) + *pgroup = 0; + cstype = CS96; + csok = 1; + break; + case '-': + if (csok) + goto fail; + if (pgroup) + *pgroup = 1; + cstype = CS96; + csok = 1; + break; + case '.': + if (csok) + goto fail; + if (pgroup) + *pgroup = 2; + cstype = CS96; + csok = 1; + break; + case '/': + if (csok) + goto fail; + if (pgroup) + *pgroup = 3; + cstype = CS96; + csok = 1; + break; + default: + if (!csok && !mb) + goto fail; + ch = p[i++]; + if (!isecma(ch)) + goto fail; + advance = i; + goto found; + } + } + + fail: + /* + * The string is not a proper charset designator. + */ + return -1; + + found: + /* + * The string is properly-formatted charset designator. + */ + if (mb) { + if (cstype == CS94) + cstype = CS9494; + else + cstype = CS9696; + } + + /* + * ASCII (CS_NONE) is hardcoded here. + */ + if (cstype == CS94 && ch == 'B') { + if (hcs) + *hcs = NULL; + return advance; + } + + for (i = 0; charsettab[i].name; i++) { + if (! charsettab[i].enter) + continue; + if (charsettab[i].enter != ch) + continue; + if (charsettab[i].type != cstype) + continue; + if (charsettab[i].version != version) + continue; + + if (hcs) + *hcs = &charsettab[i]; + return advance; + } + + /* + * Unsupported charset was properly designated. We treat it as + * invalid designation. + */ + if (hcs) + *hcs = NULL; + advance = 0; + return advance; + } + + /* + * designate specified charset to some of G0/1/2/3. + * NOTE: it does not emit single shift/locking shift. + */ + static int + callcharset(cs, e, ht, state, prefer) + CHARSET const *cs; + ENCODING const *e; + CHAR_T **ht; + ISO2022STATE *state; + int prefer; + { + static CHAR_T sequence[30]; + CSTYPE type; + int group; + char finalchar; + char versionchar; + char *d; + char designation[4]; + size_t i; + size_t j; + int sanity; + + *ht = sequence; + i = 0; + sanity = 0; + + /* + * policy: + * - avoid using ESC , x when possible. + */ + + /* + * If the encoding-supplied function works, use that. + */ + if (e->recommendation && prefer == -1) + prefer = (*e->recommendation)(cs, e); + + again: + if (10 < sanity++) + return -1; + + sequence[i] = '\0'; + + /* + * 1. + * Do we already have the charset on G0/1/2/3, and there's no + * preferred location? If so, we don't need to designate that again. + */ + for (j = 0; j < e->maxcharset; j++) { + if (state->charsets[j] == cs && (prefer == -1 || prefer == j)) + return j; + } + + /* + * 2. + * Invoke the target character set onto G0/1/2/3. + * The most tricky part is, how to choose G0/1/2/3. + */ + + /* + * 2.1. + * Understand on which table (G0/1/2/3) we can map it. + * Note that we would like to avoid ESC , x (96 chars charset on G0) + * when possible. + */ + if (cs == NULL) { + type = CS94; + finalchar = 'B'; + versionchar = '\0'; + } else { + type = cs->type; + finalchar = cs->enter; + versionchar = cs->version; + } + + switch (type) { + case CS94: + d = "()*+"; + break; + case CS96: + if (prefer != 0 && 1 < e->maxcharset) + d = "\0-./"; + else + d = ",-./"; + break; + case CS9494: + case CS9696: + if (cs->oldstyle && !F_ISSET(e, E_NOOLDSTYLE)) + d = "\001)*+"; + else + d = "()*+"; + break; + } + + /* + * 2.2. + * Omit designations that are not available for us. + */ + memcpy(designation, d, 4); + for (j = e->maxcharset; j < 4; j++) + designation[j] = '\0'; + + #if 0 + if (!(e->shifttype & S_0)) + designation[0] = '\0'; + #endif + if (1 == e->maxside && !(e->shifttype & S_1)) + designation[1] = '\0'; + if (!(e->shifttype & S_2)) + designation[2] = '\0'; + if (!(e->shifttype & S_3)) + designation[3] = '\0'; + + /* + * 2.3. + * If the caller prefers some of G0/1/2/3, and it is impossible, + * guess it automatically. + */ + if (prefer != -1 && designation[prefer] == '\0') + prefer = -1; + + /* + * 2.4. + * Make a guess. + */ + if (prefer == -1) { + CHAR_T tcs; + + /* + * If the target charset is listed on the initial mapping, + * that location is preferred. + */ + for (j = 0; j < e->maxcharset; j++) { + if (designation[j] == '\0') + continue; + + switch (j) { + case 0: + tcs = e->initg0; + break; + case 1: + tcs = e->initg1; + break; + case 2: + tcs = e->initg2; + break; + case 3: + tcs = e->initg3; + break; + } + if (ischarset(tcs) && (cs == &charset(tcs))) { + prefer = j; + goto guessed; + } else if (tcs == CS_NONE && cs == NULL) { + prefer = j; + goto guessed; + } + } + + /* + * Last resort. Use the slot available. + */ + for (j = 0; j <= 4; j++) { + if (designation[j]) { + prefer = j; + goto guessed; + } + } + } + + /* + * seems to me that the encoding specification is invalid. + * bark. + */ + if (prefer == -1) + return -1; + + guessed: + /* + * 3. emit the designation. + */ + group = prefer; + if (state->charsets[group] == cs) + goto again; + + if (versionchar) { + sequence[i++] = '\033'; + sequence[i++] = '&'; + sequence[i++] = versionchar; + } + + sequence[i++] = '\033'; + + if (type == CS9494 || type == CS9696) + sequence[i++] = '$'; + + if (designation[group] == '\0') + return -1; + else if (designation[group] == '\001') + ; /*skip it*/ + else + sequence[i++] = designation[group]; + + sequence[i++] = finalchar; + + state->charsets[group] = cs; + + goto again; + } + + /* + * emit iso2022 charset designation, including locking shifts. + */ + static void + selcharset(cs, e, ht, pmask, state, prefer) + CHARSET const *cs; + ENCODING const *e; + CHAR_T **ht; + CHAR_T *pmask; + ISO2022STATE *state; + int prefer; + { + #define GLcharset (state->charsets[state->gl]) + #define GRcharset (state->charsets[state->gr]) + static CHAR_T sequence[30]; + size_t i; + int group; + int sanity; + int shifttype; + size_t j; + int singleshift; + + *pmask = 0x00; + sanity = 0; + singleshift = 0; + + /* + * policy: + * - avoid locking shift when possible. + */ + + /* + * 1. + * designte the charset to somewhere. + */ + group = callcharset(cs, e, ht, state, prefer); + + strcpy(sequence, *ht); + *ht = sequence; + i = strlen(sequence); + sequence[i] = '\0'; + + again: + /* XXX bad idea... */ + if (10 < sanity++) + abort(); + + /* + * 2. + * if the specified charset is on GL/GR plane, we are done. + */ + if (singleshift) + return; + if (group == state->gl && 1 <= e->maxside && GLcharset == cs) + return; + if (group == state->gr && 2 <= e->maxside && GRcharset == cs) { + *pmask = 0x80; + return; + } + + /* + * 3. + * we already have the target charset on G0/1/2/3, and they are + * not on GL/GR plane. + * use locking shift or single shift. + */ + shifttype = e->shifttype; + switch (group) { + case 0: shifttype &= S_0; break; + case 1: shifttype &= S_1; break; + case 2: shifttype &= S_2; break; + case 3: shifttype &= S_3; break; + } + + if (! shifttype) + abort(); + + j = 1; + while (!(j & shifttype)) + j = j << 1; + + switch (j) { + case S_LS0: /*0F*/ + sequence[i++] = SI; + state->gl = 0; + break; + case S_LS1: /*0E*/ + sequence[i++] = SO; + state->gl = 1; + break; + case S_LS2: /*ESC n*/ + sequence[i++] = '\033'; + sequence[i++] = 'n'; + state->gl = 2; + break; + case S_LS3: /*ESC o*/ + sequence[i++] = '\033'; + sequence[i++] = 'o'; + state->gl = 3; + break; + case S_SS2: /*ESC N*/ + sequence[i++] = '\033'; + sequence[i++] = 'N'; + singleshift = 1; + *pmask = 0x00; + break; + case S_SS3: /*ESC O*/ + sequence[i++] = '\033'; + sequence[i++] = 'O'; + singleshift = 1; + *pmask = 0x00; + break; + case S_LS1R: /*ESC ~*/ + sequence[i++] = '\033'; + sequence[i++] = '~'; + state->gr = 1; + break; + case S_LS2R: /*ESC }*/ + sequence[i++] = '\033'; + sequence[i++] = '}'; + state->gr = 2; + break; + case S_LS3R: /*ESC |*/ + sequence[i++] = '\033'; + sequence[i++] = '|'; + state->gr = 3; + break; + case S_SS2R: /*8E*/ + sequence[i++] = 0x8e; + singleshift = 1; + *pmask = 0x80; + break; + case S_SS3R: /*8F*/ + sequence[i++] = 0x8f; + singleshift = 1; + *pmask = 0x80; + break; + default: + abort(); + } + sequence[i] = '\0'; + + goto again; + + #undef GLcharset + #undef GRcharset + } + + + /* + * generic ISO-2022-* parser. supports 8bit input to some extent. + */ + int + iso2022_to_int(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + CHARSET const *cs; + int group; + int advance; + + ISO2022STATE t; + int singlegl = 0; + int singlegr = 0; + #define GLcharset (state->charsets[(singlegl ? singlegl : state->gl)]) + #define GRcharset (state->charsets[(singlegr ? singlegr : state->gr)]) + + group = -1; + advance = -1; + + /* + * XXX + * G0 and G1, GL and GR charset will be re-initialized at SOL. + */ + if (!state) { + state = &t; /*XXX*/ + multi_initstate(sp, e, state); + } else { + if (F_ISSET(e, E_SOLRESET)) + multi_initstate(sp, e, state); + } + + q = dst; + p = src; + if (pflags) + FL_INIT(*pflags, 0); + + for (i = 0; i < slen; i++) { + if (p[0] == '\033' + && 0 <= (advance = parsecharset(p, slen - i, &cs, &group))) { + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + state->charsets[group] = cs; + if (advance) { + i += (advance - 1);/*plus one more at for loop*/ + p += advance; + continue; + } + + /* + * Unsupported charset. + */ + goto raw; + } + + /* + * locking shift + */ + if (p[0] == SI) { + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + state->gl = 0; + p++; + continue; + } + if (p[0] == SO) { + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + state->gl = 1; + p++; + continue; + } + if (i + 1 < slen && p[0] == '\033' && strchr("no", p[1])) { + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + state->gl = p[1] - 'n' + 2; + p += 2; + i++; + continue; + } + if (i + 1 < slen && p[0] == '\033' && strchr("~}|", p[1])) { + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + state->gr = 3 - (p[1] - '|'); + p += 2; + i++; + continue; + } + + /* + * single shift + */ + if (i + 1 < slen && p[0] == '\033' && strchr("NO", p[1])) { + singlegl = p[1] - 'N' + 2; + p += 2; + i += 2; + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + /* fall through... */ + } else if (p[0] == 0x8e || p[0] == 0x8f) { + singlegl = p[0] - 0x8e + 2; + singlegr = p[0] - 0x8e + 2; + p++; + i++; + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + /* fall through... */ + } + + /* + * ASCII mode chars. + */ + if ((p[0] & 0x80) == 0x00 && GLcharset == NULL) + goto raw; + if ((p[0] & 0x80) && GRcharset == NULL) + goto raw; + + if (p[0] & 0x80) { + /* + * character range check. + */ + switch (GRcharset->type) { + case CS9696: + if (i + 1 < slen) { + if (0xa0 <= p[0] && p[0] <= 0xff + && 0xa0 <= p[1] && p[1] <= 0xff) + break; + } + goto raw; + case CS9494: + if (i + 1 < slen) { + if (0xa1 <= p[0] && p[0] <= 0xfe + && 0xa1 <= p[1] && p[1] <= 0xfe) + break; + } + goto raw; + case CS96: + if (0xa0 <= p[0] && p[0] <= 0xff) + break; + goto raw; + case CS94: + if (0xa1 <= p[0] && p[0] <= 0xfe) + break; + goto raw; + } + + if (GRcharset->type == CS9494 + || GRcharset->type == CS9696) { + if (dst) { + *q++ = CS_RAW0 + (GRcharset - charsettab); + *q++ = *p++ & 0x7f; + *q++ = *p++ & 0x7f; + } else { + q += 3; + p += 2; + } + i++; /*plus one more at for loop*/ + } else { + if (dst) { + *q++ = CS_RAW0 + (GRcharset - charsettab); + *q++ = *p++ & 0x7f; + } else { + q += 2; + p++; + } + } + } else { + /* + * character range check. + */ + switch (GLcharset->type) { + case CS9696: + if (i + 1 < slen) { + if (0x20 <= p[0] && p[0] <= 0x7f + && 0x20 <= p[1] && p[1] <= 0x7f) + break; + } + goto raw; + case CS9494: + if (i + 1 < slen) { + if (0x21 <= p[0] && p[0] <= 0x7e + && 0x21 <= p[1] && p[1] <= 0x7e) + break; + } + goto raw; + case CS96: + if (0x20 <= p[0] && p[0] <= 0x7f) + break; + goto raw; + case CS94: + if (0x21 <= p[0] && p[0] <= 0x7e) + break; + goto raw; + } + + if (GLcharset->type == CS9494 + || GLcharset->type == CS9696) { + if (dst) { + *q++ = CS_RAW0 + (GLcharset - charsettab); + *q++ = *p++ & 0x7f; + *q++ = *p++ & 0x7f; + } else { + q += 3; + p += 2; + } + i++; /*plus one more at for loop*/ + } else { + if (dst) { + *q++ = CS_RAW0 + (GLcharset - charsettab); + *q++ = *p++ & 0x7f; + } else { + q += 2; + p++; + } + } + } + + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + singlegl = singlegr = 0; + continue; + + raw: + if (p[0] & 0x80) { + if (dst) { + *q++ = CS_RAW0 + v_key_len(sp, p[0]); + *q++ = *p++ & 0x7f; + } else { + q += 2; + p++; + } + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_RAW); + singlegl = singlegr = 0; + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + singlegl = singlegr = 0; + } + + if (pdlen) + *pdlen = q - dst; + return 0; + #undef GLcharset + #undef GRcharset + } + + /* + * generic iso-2022-* generator. + */ + int + int_to_iso2022(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + CHAR_T *t; + size_t i; + CHAR_T mask; + CHARSET const *cs; + + ISO2022STATE tstate; + #define GLcharset state->charsets[state->gl] + #define GRcharset state->charsets[state->gr] + + /* + * XXX + * G0 and G1, GL and GR charset will be re-initialized at SOL. + */ + if (!state) { + state = &tstate; /*XXX*/ + multi_initstate(sp, e, state); + } else { + if (F_ISSET(e, E_SOLRESET)) + multi_initstate(sp, e, state); + } + + q = dst; + p = src; + if (pflags) + FL_INIT(*pflags, 0); + for (i = 0; i < slen; i++) { + if ((p[0] & 0x80) == 0x00) + goto raw; + + if (CS_RAW(p[0])) + goto raw; + + if (p[0] & 0x80) { + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + cs = &charset(p[0]); + selcharset(cs, e, &t, &mask, state, -1); + while (t && *t) { + if (dst) + *q++ = *t++; + else { + t++; + q++; + } + } + if (dst) { + size_t j; + + for (j = 1; j < cs->blen; j++) + *q++ = (p[j] & 0x7f) | mask; + p += cs->blen; + i += (cs->blen - 1); + } else { + p += cs->blen; + q += (cs->blen - 1); + i += (cs->blen - 1); + } + continue; + } + + raw: + if (CS_RAW(p[0])) { + if (1 < e->maxside) + selcharset(NULL, e, &t, &mask, state, 1); + else + t = NULL; + } else + selcharset(NULL, e, &t, &mask, state, 0); + if (t && *t && pflags) + FL_SET(*pflags, MB_MULTIBYTE); + while (t && *t) { + if (dst) + *q++ = *t++; + else { + t++; + q++; + } + } + + if (CS_RAW(p[0])) { + if (dst) { + *q++ = p[1] | 0x80; + p += 2; + } else { + q++; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_RAW); + continue; + } + + if (dst) + *q++ = (*p++ & 0x7f) | mask; + else { + q++; + p++; + } + } + + if (state->gl != 0) { + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + if (dst) + *q++ = SI; + else + *q++; + state->gl = 0; + } + if (e && F_ISSET(e, E_EOLRESET)) { + /* + * Reset GR designation, if necessery. + * + * XXX will this do, for sure? + */ + if (2 <= e->maxcharset && 2 <= e->maxside) { + if (ischarset(e->initg1)) + cs = &charset(e->initg1); + else + cs = NULL; + selcharset(cs, e, &t, &mask, state, 1); + } + + /* + * If something other than initial charsets is designated + * to G2/3, we reset them. + * G0 is omitted here since G0 will be designated later. + */ + for (i = 1; i < e->maxcharset; i++) { + switch (i) { + case 0: + if (ischarset(e->initg0)) + cs = &charset(e->initg0); + else + cs = NULL; + break; + case 1: + if (ischarset(e->initg1)) + cs = &charset(e->initg1); + else + cs = NULL; + break; + case 2: + if (ischarset(e->initg2)) + cs = &charset(e->initg2); + else + cs = NULL; + break; + case 3: + if (ischarset(e->initg3)) + cs = &charset(e->initg3); + else + cs = NULL; + break; + } + + if (state->charsets[i] != cs) { + callcharset(cs, e, &t, state, i); + while (t && *t) { + if (dst) + *q++ = *t++; + else { + t++; + q++; + } + } + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + } + } + } + + /* + * should always return to ASCII on EOL + */ + selcharset(NULL, e, &t, &mask, state, 0); + while (t && *t) { + if (dst) + *q++ = *t++; + else { + t++; + q++; + } + } + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + + if (pdlen) + *pdlen = q - dst; + return 0; + #undef GLcharset + #undef GRcharset + } + + /* + * special treatment for iso-2022-kr. + * it must remove lines with KSC5601 designation only. + */ + int + iso2022kr_to_int(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + int ret; + + ret = iso2022_to_int(sp, e, dst, pdlen, src, slen, pflags, state); + if (slen == 4 && strncmp(src, "\033$)C", 4) == 0) { + if (pdlen) + *pdlen = 0; + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_JOIN); + } + return ret; + } + + /* + * Special treatment for iso-2022-kr. + * KSC5601 designation must appear at the beginning of the line. + */ + int + int_to_iso2022kr(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + size_t i; + CHAR_T *p; + CHAR_T *t; + size_t offset; + CHARSET const *cs; + int needdesig; + int ret; + + if (!state) + goto standard; + if (state->charsets[1] == &charset(CS_KSC5601)) + goto standard; + + t = NULL; + needdesig = 0; + p = src; + for (i = 0; i < slen; i++) { + if (p[0] & 0x80) { + cs = &charset(p[0]); + if (p[0] == CS_KSC5601) { + needdesig++; + break; + } else { + p += cs->blen; + i += (cs->blen - 1); /*one more at loop*/ + } + } else + p++; + } + if (!needdesig) + goto standard; + + /* + * we need a KSC5601 designation at the beginning of the line. + * + * XXX + * very dirty hack. + */ + callcharset(cs, e, &t, state, -1); + offset = 0; + if (t) { + /* compute the length of the designation. */ + p = t; + while (*p++) + offset++; + + /* copy the designation into the buffer. */ + if (dst) { + p = t; + while (*p) + dst[p - t] = *p++; + } + } + + ret = int_to_iso2022(sp, e, dst ? dst + offset : NULL, pdlen, + src, slen, pflags, state); + if (pdlen) + *pdlen += offset; + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + + return ret; + + standard: + return int_to_iso2022(sp, e, dst, pdlen, src, slen, pflags, state); + } + + + /* + * Returns the recommended plane (G0/1/2/3) to map the specified charset. + */ + int + iso2022cn_recommendation(cs, e) + CHARSET const *cs; + ENCODING const *e; + { + CHAR_T ch; + + if (cs == NULL) + return 0; + + ch = CS_RAW0 + (cs - charsettab); + switch (ch) { + case CS_GB2312: + case CS_ISO_IR165: + case CS_CNS11643_1: + return 1; + + case CS_CNS11643_2: + return 2; + + case CS_CNS11643_3: + case CS_CNS11643_4: + case CS_CNS11643_5: + case CS_CNS11643_6: + case CS_CNS11643_7: + return 3; + } + + return 0; + } + + int + iso2022jp_recommendation(cs, e) + CHARSET const *cs; + ENCODING const *e; + { + if (cs == NULL) + return 0; + + switch (cs->type) { + case CS94: + case CS9494: + return 0; + case CS96: + case CS9696: + return 2; + } + } + + int + iso2022kr_recommendation(cs, e) + CHARSET const *cs; + ENCODING const *e; + { + CHAR_T ch; + + if (cs == NULL) + return 0; + + ch = CS_RAW0 + (cs - charsettab); + if (ch == CS_KSC5601) + return 1; + + return 0; + } + + int + ctext_recommendation(cs, e) + CHARSET const *cs; + ENCODING const *e; + { + CHAR_T ch; + + if (cs == NULL) + return 0; + + /* exceptions */ + ch = CS_RAW0 + (cs - charsettab); + switch (ch) { + case CS_NONE: + case CS_JISX0201_LEFT: /* XXX should it be listed? */ + return 0; + case CS_JISX0201_RIGHT: + return 1; + } + + /* general rules */ + switch (cs->type) { + case CS94: + case CS9494: + break; + case CS96: + case CS9696: + return 1; + } + + return -1; + } + + + void + iso2022_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbuflen, pstate, pconsumed) + SCR *sp; + ENCODING const *e; + CHAR_T *kbuf; + size_t kbuflen; + CHAR_T *intbuf; + size_t *pintbuflen; + int *pstate; + size_t *pconsumed; + { + size_t i; + size_t j; + size_t consumed; + + size_t sequencelen; + int group; + CHARSET const *cs; + size_t advance; + + struct { + u_int g0:7; + u_int g1:7; + u_int g2:7; + u_int g3:7; + u_int gl:2; + u_int gr:2; + } packedform; + + ISO2022STATE isostate; + int singlegl; + int singlegr; + #define GLcharset (isostate.charsets[(singlegl ? singlegl : isostate.gl)]) + #define GRcharset (isostate.charsets[(singlegr ? singlegr : isostate.gr)]) + + /* + * grab state information + */ + { + /* sanity */ + if (sizeof(packedform) != sizeof(int)) + abort(); + + if (*pstate == 0) + multi_initstate(sp, e, &isostate); + else { + int *t; + CHAR_T ch; + #define X(x) ((x) ? (0x80 | (x)) : (x)) + + t = (int *)&packedform; + + *t = *pstate; + ch = X(packedform.g0); + isostate.charsets[0] = ischarset(ch) ? &charset(ch) : NULL; + ch = X(packedform.g1); + isostate.charsets[1] = ischarset(ch) ? &charset(ch) : NULL; + ch = X(packedform.g2); + isostate.charsets[2] = ischarset(ch) ? &charset(ch) : NULL; + ch = X(packedform.g3); + isostate.charsets[3] = ischarset(ch) ? &charset(ch) : NULL; + isostate.gl = packedform.gl; + isostate.gr = packedform.gr; + #undef X + } + } + + singlegl = singlegr = 0; + i = j = consumed = 0; + while (i < kbuflen) { + /* + * designation + */ + if (kbuf[i] == '\033') { + if (i + 1 == kbuflen) { + i = kbuflen; + continue; + } + + /* + * 2 chars sequences - locking shift + */ + if (strchr("no", kbuf[i + 1])) { + isostate.gl = kbuf[i + 1] - 'n' + 2; + i += 2; + consumed += 2; + continue; + } + if (strchr("~}|", kbuf[i + 1])) { + isostate.gr = 3 - (kbuf[i + 1] - '|'); + i += 2; + consumed += 2; + continue; + } + + if (i + 2 == kbuflen) { + i = kbuflen; + continue; + } + + /* + * 3 chars sequences + */ + if (kbuf[i + 1] == '$' && isecma(kbuf[i + 2])) { + sequencelen = 3; + goto tryit; + } + if (strchr("()*+,-./", kbuf[i + 1]) + && isecma(kbuf[i + 2])) { + sequencelen = 3; + goto tryit; + } + + if (i + 3 == kbuflen) { + i = kbuflen; + continue; + } + + /* + * single shift - ESC N and ESC O + * Don't consume that till the actual char has come. + * In this sense, single shift can be regarded as + * 3 chars sequence, or 4 chars sequence. + */ + if (strchr("NO", kbuf[i + 1])) { + cs = isostate.charsets[kbuf[i + 1] - 'N' + 2]; + switch (cs->type) { + case CS94: + case CS96: + if (i + 3 < kbuflen) { + i = kbuflen; + continue; + } + break; + case CS9494: + case CS9696: + if (i + 4 < kbuflen) { + i = kbuflen; + continue; + } + break; + } + singlegl = kbuf[i + 1] - 'N' + 2; + i += 2; + consumed += 2; + goto characters; + } + + if (i + 4 == kbuflen) { + i = kbuflen; + continue; + } + + /* + * 4 chars sequence + */ + if (kbuf[i + 1] == '$' && strchr("()*+", kbuf[i + 2]) + && isecma(kbuf[i + 3])) { + sequencelen = 4; + tryit: + if (0 <= (advance = parsecharset(&kbuf[i], + sequencelen, &cs, &group))) { + isostate.charsets[group] = cs; + if (advance) { + /* supported charset */ + i += advance; + consumed += advance; + continue; + } else { + /* unsupported charset */ + goto raw; + } + } + } + } + + /* + * locking shift + */ + if (kbuf[i] == SI) { + isostate.gl = 0; + i++; + consumed++; + continue; + } + if (kbuf[i] == SO) { + isostate.gl = 1; + i++; + consumed++; + continue; + } + if (kbuf[i] == 0x8e || kbuf[i] == 0x8f) { + cs = isostate.charsets[kbuf[i] - 0x8e + 2]; + switch (cs->type) { + case CS94: + case CS96: + if (i + 1 < kbuflen) { + i = kbuflen; + continue; + } + break; + case CS9494: + case CS9696: + if (i + 2 < kbuflen) { + i = kbuflen; + continue; + } + break; + } + + singlegl = singlegr = kbuf[i] - 0x8e + 2; + i++; + consumed++; + /* fall through */ + } + + characters: + /* + * ASCII mode chars. + */ + if ((kbuf[i] & 0x80) == 0x00 && GLcharset == NULL) + goto raw; + if ((kbuf[i] & 0x80) && GRcharset == NULL) + goto raw; + + /* + * multibyte cases + */ + if (kbuf[i] & 0x80) { + /* + * character range check. + */ + switch (GRcharset->type) { + case CS9696: + if (i + 1 < kbuflen) { + if (0xa0 <= kbuf[i] && kbuf[i] <= 0xff + && 0xa0 <= kbuf[i + 1] + && kbuf[i + 1] <= 0xff) + break; + else + goto raw; + } else { + i = kbuflen; + continue; + } + case CS9494: + if (i + 1 < kbuflen) { + if (0xa1 <= kbuf[i] && kbuf[i] <= 0xfe + && 0xa1 <= kbuf[i + 1] + && kbuf[i + 1] <= 0xfe) + break; + else + goto raw; + } else { + i = kbuflen; + continue; + } + case CS96: + if (0xa0 <= kbuf[i] && kbuf[i] <= 0xff) + break; + goto raw; + case CS94: + if (0xa1 <= kbuf[i] && kbuf[i] <= 0xfe) + break; + goto raw; + } + + if (GRcharset->type == CS9494 + || GRcharset->type == CS9696) { + intbuf[j++] + = CS_RAW0 + (GRcharset - charsettab); + intbuf[j++] = kbuf[i++] & 0x7f; + intbuf[j++] = kbuf[i++] & 0x7f; + consumed += 2; + } else { + intbuf[j++] + = CS_RAW0 + (GRcharset - charsettab); + intbuf[j++] = kbuf[i++] & 0x7f; + consumed++; + } + } else { + /* + * character range check. + */ + switch (GLcharset->type) { + case CS9696: + if (i + 1 < kbuflen) { + if (0x20 <= kbuf[i] && kbuf[i] <= 0x7f + && 0x20 <= kbuf[i + 1] + && kbuf[i + 1] <= 0x7f) + break; + else + goto raw; + } else { + i = kbuflen; + continue; + } + case CS9494: + if (i + 1 < kbuflen) { + if (0x21 <= kbuf[i] && kbuf[i] <= 0x7e + && 0x21 <= kbuf[i + 1] + && kbuf[i + 1] <= 0x7e) + break; + else + goto raw; + } else { + i = kbuflen; + continue; + } + case CS96: + if (0x20 <= kbuf[i] && kbuf[i] <= 0x7f) + break; + goto raw; + case CS94: + if (0x21 <= kbuf[i] && kbuf[i] <= 0x7e) + break; + goto raw; + } + + if (GLcharset->type == CS9494 + || GLcharset->type == CS9696) { + intbuf[j++] + = CS_RAW0 + (GLcharset - charsettab); + intbuf[j++] = kbuf[i++] & 0x7f; + intbuf[j++] = kbuf[i++] & 0x7f; + consumed += 2; + } else { + intbuf[j++] + = CS_RAW0 + (GLcharset - charsettab); + intbuf[j++] = kbuf[i++] & 0x7f; + consumed++; + } + } + + singlegl = singlegr = 0; + continue; + + raw: + if (kbuf[i] & 0x80) { + intbuf[j++] = CS_RAW0 + v_key_len(sp, kbuf[i]); + intbuf[j++] = kbuf[i] & 0x7f; + i++; + singlegl = singlegr = 0; + consumed++; + continue; + } + + /* initialize state information, if we got control chars. */ + if (strchr("\r\n", kbuf[i])) { + if (e && F_ISSET(e, E_SOLRESET)) + multi_initstate(sp, e, &isostate); + } + + intbuf[j++] = kbuf[i++] & 0x7f; + singlegl = singlegr = 0; + consumed++; + } + + /* + * pack state information + */ + { + int *t; + + if (isostate.charsets[0]) + packedform.g0 = isostate.charsets[0] - charsettab; + else + packedform.g0 = 0x00; + if (isostate.charsets[1]) + packedform.g1 = isostate.charsets[1] - charsettab; + else + packedform.g1 = 0x00; + if (isostate.charsets[2]) + packedform.g2 = isostate.charsets[2] - charsettab; + else + packedform.g2 = 0x00; + if (isostate.charsets[3]) + packedform.g3 = isostate.charsets[3] - charsettab; + else + packedform.g3 = 0x00; + packedform.gl = isostate.gl; + packedform.gr = isostate.gr; + + t = (int *)&packedform; + + *pstate = *t; + } + *pintbuflen = j; + *pconsumed = consumed; + #undef GLcharset + #undef GRcharset + } + #endif /*MULTIBYTE*/ Index: common/multi_none.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multi_none.c Wed Apr 2 16:54:26 1997 *************** *** 0 **** --- 1,176 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_none.c,v 1.1 1997/02/02 02:34:16 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + + #include "config.h" + + #ifdef MULTIBYTE + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "../common/common.h" + #include "multibyte.h" + + int + none_to_int(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + + q = dst; + p = src; + if (pflags) + FL_INIT(*pflags, 0); + + for (i = 0; i < slen; i++) { + if (p[0] & 0x80) { + if (dst) { + *q++ = CS_RAW0 + v_key_len(sp, *p); + *q++ = *p & 0x7f; + p++; + } else { + q += 2; + p++; + } + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + + int + int_to_none(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + + if (pflags) + FL_INIT(*pflags, 0); + q = dst; + p = src; + + for (i = 0; i < slen; i++) { + if (CS_RAW(p[0])) { + if (dst) { + *q++ = p[1] | 0x80; + p += 2; + } else { + q++; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } else if (p[0] & 0x80) { + /* + * Unknown encoding. Simply skip them. + */ + p += charset(p[0]).blen; + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_SKIP); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + + void + none_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbuflen, pstate, pconsumed) + SCR *sp; + ENCODING const *e; + CHAR_T *kbuf; + size_t kbuflen; + CHAR_T *intbuf; + size_t *pintbuflen; + int *pstate; + size_t *pconsumed; + { + size_t i; + size_t j; + size_t consumed; + + i = j = consumed = 0; + while (i < kbuflen) { + /* + * Non-kanji cases. + */ + if (kbuf[i] & 0x80) { + intbuf[j++] = CS_RAW0 + v_key_len(sp, kbuf[i]); + intbuf[j++] = kbuf[i] & 0x7f; + i++; + *pstate = 0; + consumed++; + } else { + intbuf[j++] = kbuf[i++]; + *pstate = 0; + consumed++; + } + } + *pintbuflen = j; + *pconsumed = consumed; + } + #endif /*MULTIBYTE*/ Index: common/multi_sjis.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multi_sjis.c Wed Aug 20 16:32:44 1997 *************** *** 0 **** --- 1,340 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_sjis.c,v 1.4 1997/08/20 07:32:43 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + + #include "config.h" + + #ifdef MULTIBYTE + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "../common/common.h" + #include "multibyte.h" + + static void jistosjis __P((CHAR_T *, CHAR_T *)); + static void sjistojis __P((CHAR_T *, CHAR_T *)); + + static void + jistosjis(dst, src) + CHAR_T *dst; + CHAR_T *src; + { + CHAR_T high; + CHAR_T low; + + high = src[0]; + low = src[1]; + if (high & 1) + low += 0x1f; + else + low += 0x7d; + if (low >= 0x7f) + low++; + high = (high - 0x21 >> 1) + 0x81; + if (high > 0x9f) + high += 0x40; + dst[0] = high; + dst[1] = low; + } + + static void + sjistojis(dst, src) + CHAR_T *dst; + CHAR_T *src; + { + CHAR_T high; + CHAR_T low; + + high = src[0]; + low = src[1]; + if (high <= 0x9f) + high -= 0x71; + else + high -= 0xb1; + high = high * 2 + 1; + if (low > 0x7f) + low--; + if (low >= 0x9e) { + low -= 0x7d; + high++; + } else + low -= 0x1f; + dst[0] = high; + dst[1] = low; + } + + int + sjis_to_int(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + u_short ch; + + q = dst; + p = src; + if (pflags) + FL_INIT(*pflags, 0); + + for (i = 0; i < slen; i++) { + if (i + 1 < slen && issjiskanji1(p[0]) && issjiskanji2(p[1])) { + /* + * supposedly sjis. + */ + if (dst) { + q[0] = CS_JISX0208_1983; + sjistojis(&q[1], &p[0]); + q += 3; + p += 2; + } else { + q += 3; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (isjishankana(p[0])) { + if (dst) { + *q++ = CS_JISX0201_RIGHT; + *q++ = *p++ & 0x7f; + } else { + q += 2; + p += 1; + } + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + + /* + * ASCII and other binary chars. + */ + if (p[0] & 0x80) { + if (dst) { + *q++ = CS_RAW0 + v_key_len(sp, p[0]); + *q++ = *p++ & 0x7f; + } else { + q += 2; + p++; + } + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_RAW); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + + int + int_to_sjis(sp, e, dst, pdlen, src, slen, pflags, state) + SCR *sp; + ENCODING const *e; + CHAR_T *dst; + size_t *pdlen; + CHAR_T *src; + size_t slen; + int *pflags; + ISO2022STATE *state; + { + CHAR_T *p; + CHAR_T *q; + size_t i; + u_short ch; + + if (pflags) + FL_INIT(*pflags, 0); + q = dst; + p = src; + + for (i = 0; i < slen; i++) { + if (CS_RAW(p[0])) { + if (dst) { + *q++ = p[1] | 0x80; + p += 2; + } else { + q++; + p += 2; + } + i++; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (p[0] == CS_JISX0208_1990 || p[0] == CS_JISX0208_1983 + || p[0] == CS_JISX0208_1978) { + /* + * If we're using sjis, there's no distinction + * between JIS0208 variants. + */ + if (dst) { + jistosjis(&q[0], &p[1]); + q += 2; + p += 3; + } else { + q += 2; + p += 3; + } + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (p[0] == CS_JISX0201_RIGHT) { + if (dst) { + p++; + *q++ = 0x80 | *p++; + } else { + q += 1; + p += 2; + } + i += 1; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE); + continue; + } + if (p[0] & 0x80) { + /* + * Unknown encoding. Simply skip them. + */ + p += charset(p[0]).blen; + i += 2; /*plus one at for loop*/ + if (pflags) + FL_SET(*pflags, MB_MULTIBYTE|MB_SKIP); + continue; + } + + if (dst) + *q++ = *p++; + else { + q++; + p++; + } + } + + if (pdlen) + *pdlen = q - dst; + return 0; + } + + void + sjis_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbuflen, pstate, pconsumed) + SCR *sp; + ENCODING const *e; + CHAR_T *kbuf; + size_t kbuflen; + CHAR_T *intbuf; + size_t *pintbuflen; + int *pstate; + size_t *pconsumed; + { + size_t i; + size_t j; + size_t consumed; + u_short ch; + + i = j = consumed = 0; + while (i < kbuflen) { + /* + * Kanji cases. + */ + if (i + 1 < kbuflen + && issjiskanji1(kbuf[i]) && issjiskanji2(kbuf[i + 1])) { + intbuf[j] = CS_JISX0208_1983; + sjistojis(&intbuf[j + 1], &kbuf[i]); + j += 3; + i += 2; + *pstate = 0; + consumed += 2; + } else if (i + 1 == kbuflen && issjiskanji1(kbuf[i])) { + /* + * Only the firstbyte is available. + * Keep this kanji char till next round. + */ + i++; + *pstate = 1; + } + + /* + * Non-kanji cases. + */ + else if (kbuf[i] & 0x80) { + intbuf[j++] = CS_RAW0 + v_key_len(sp, kbuf[i]); + intbuf[j++] = kbuf[i] & 0x7f; + i++; + *pstate = 0; + consumed++; + } else { + intbuf[j++] = kbuf[i++]; + *pstate = 0; + consumed++; + } + } + *pintbuflen = j; + *pconsumed = consumed; + } + + int + sjis_display(sp, e, name, p) + SCR *sp; + ENCODING const *e; + CHAR_T *name; + CHAR_T *p; + { + u_short ch; + + if (p[0] == CS_JISX0208_1990 || p[0] == CS_JISX0208_1983 + || p[0] == CS_JISX0208_1978) { + jistosjis(&name[0], &p[1]); + name[2] = '\0'; + return 1; + } + if (p[0] == CS_JISX0201_RIGHT) { + name[0] = p[1] | 0x80; + name[1] = '\0'; + return 1; + } + return 0; + } + #endif /*MULTIBYTE*/ Index: common/multibyte.awk *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multibyte.awk Sun Feb 2 11:34:38 1997 *************** *** 0 **** --- 1,12 ---- + # @(#)options.awk 10.1 (Berkeley) 6/8/95 + + BEGIN { + cur = 128; # 0x80 + } + /^\/\* CS_[0-9A-Z_]*/ { + printf("#define %s 0x%02x\n", $2, cur++); + next; + } + END { + printf("#define CS_MAX 0x%02x\n", cur); + } Index: common/multibyte.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multibyte.c Wed Aug 20 16:32:46 1997 *************** *** 0 **** --- 1,2332 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multibyte.c,v 1.25 1997/08/20 07:32:43 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + /* + * Derived code: + * + * The code for handling Big5 as iso-2022-* has been derived from + * Mule(multilingual Emacs) by handa@etl.go.jp. + * The code to determine KSC5601 character class was implemented by + * kjlee@sgi.co.jp. + * Canna support code was originally implemented by Nobuyuki Koganemaru + * for jelvis. + */ + + #include "config.h" + + #ifdef MULTIBYTE + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "../common/common.h" + #include "multibyte.h" + + /* + * Static functions. + */ + + static ENCODING const *multi_findencoding __P((const char *)); + static int rawgetline __P((SCR *, recno_t, CHAR_T **, size_t *)); + static int dbgetline __P((SCR *, recno_t, CHAR_T **, size_t *)); + static int rawsetline __P((SCR *, recno_t, CHAR_T *, size_t)); + static int dbsetline __P((SCR *, recno_t, CHAR_T *, size_t)); + static int rawdelline __P((SCR *, recno_t)); + static int dbdelline __P((SCR *, recno_t)); + + /* + * Charset/encoding table. Will be accessed by multibyte routines. + */ + CHARSET const charsettab[] = { + /* + * Raw (US-ASCII) charsets + * This meant to be ISO646 IRV 1991 for left half (GL), and binary chars + * for right half (GR). + */ + /* CS_RAW0 */ + { "raw bits", 2, 0, NULL, CS96, 0, 0, }, + /* CS_RAW1 */ + { "raw bits", 2, 1, NULL, CS96, 0, 0, }, + /* CS_RAW2 */ + { "raw bits", 2, 2, NULL, CS96, 0, 0, }, + /* CS_RAW3 */ + { "raw bits", 2, 3, NULL, CS96, 0, 0, }, + /* CS_RAW4 */ + { "raw bits", 2, 4, NULL, CS96, 0, 0, }, + /* CS_RAW5 */ + { "raw bits", 2, 5, NULL, CS96, 0, 0, }, + /* CS_RAW6 */ + { "raw bits", 2, 6, NULL, CS96, 0, 0, }, + /* CS_RAW7 */ + { "raw bits", 2, 7, NULL, CS96, 0, 0, }, + /* + * 94x94 charsets + */ + /* CS_JISX0208_1978 */ + { "JIS x0208.1978", 3, 2, jis0208_chclass, CS9494, '@', '\0', 1, 0, }, + /* CS_GB2312 */ + { "GB2312-80", 3, 2, NULL, CS9494, 'A', '\0', 1, 0, }, + /* CS_JISX0208_1983 */ + { "JIS x0208.1983", 3, 2, jis0208_chclass, CS9494, 'B', '\0', 1, 0, }, + /* CS_JISX0208_1990 */ + { "JIS x0208.1990", 3, 2, jis0208_chclass, CS9494, 'B', '@', 1, 0, }, + /* CS_KSC5601 */ + { "KSC5601 1987", 3, 2, ksc5601_chclass, CS9494, 'C', '\0', 0, 0, }, + /* CS_JISX0212_1990 */ + { "JIS x0212.1990", 3, 2, NULL, CS9494, 'D', '\0', 0, 0, }, + /* CS_ISO_IR165 */ + { "ISO IR-165", 3, 2, NULL, CS9494, 'E', '\0', 0, 0, }, + /* CS_CNS11643_1 */ + { "CNS11643-1992-1", 3, 2, NULL, CS9494, 'G', '\0', 0, 0, }, + /* CS_CNS11643_2 */ + { "CNS11643-1992-2", 3, 2, NULL, CS9494, 'H', '\0', 0, 0, }, + /* CS_CNS11643_3 */ + { "CNS11643-1992-3", 3, 2, NULL, CS9494, 'I', '\0', 0, 0, }, + /* CS_CNS11643_4 */ + { "CNS11643-1992-4", 3, 2, NULL, CS9494, 'J', '\0', 0, 0, }, + /* CS_CNS11643_5 */ + { "CNS11643-1992-5", 3, 2, NULL, CS9494, 'K', '\0', 0, 0, }, + /* CS_CNS11643_6 */ + { "CNS11643-1992-6", 3, 2, NULL, CS9494, 'L', '\0', 0, 0, }, + /* CS_CNS11643_7 */ + { "CNS11643-1992-7", 3, 2, NULL, CS9494, 'M', '\0', 0, 0, }, + /* CS_BIG5_1 */ + { "Big5-1", 3, 2, NULL, CS9494, '0', '\0', 0, 0, }, + /* CS_BIG5_2 */ + { "Big5-2", 3, 2, NULL, CS9494, '1', '\0', 0, 0, }, + /* + * 94 charsets + * Note that ASCII (\033(B) has been hardcoded as CS_NONE. + */ + /* CS_IRV */ + { "IRV 1983", 2, 1, NULL, CS94, '@', '\0', 0, 1, }, + /* CS_UK */ + { "UK", 2, 1, NULL, CS94, 'A', '\0', 0, 1, }, + /* CS_SWEDISH */ + { "Swedish", 2, 1, NULL, CS94, 'C', '\0', 0, 1, }, + /* CS_NORWEGIAN */ + { "Norwegian", 2, 1, NULL, CS94, 'E', '\0', 0, 1, }, + /* CS_JISX0201_RIGHT */ + { "JIS x0201 right", 2, 1, NULL, CS94, 'I', '\0', 0, 0, }, + /* CS_JISX0201_LEFT */ + { "JIS x0201 left", 2, 1, NULL, CS94, 'J', '\0', 0, 1, }, + /* CS_GERMAN */ + { "German", 2, 1, NULL, CS94, 'K', '\0', 0, 1, }, + /* CS_FRENCH */ + { "French", 2, 1, NULL, CS94, 'R', '\0', 0, 1, }, + /* CS_ITALIAN */ + { "Italian", 2, 1, NULL, CS94, 'Y', '\0', 0, 1, }, + /* CS_SPANISH */ + { "Spanish", 2, 1, NULL, CS94, 'Z', '\0', 0, 1, }, + /* + * 96 charsets + */ + /* CS_LATIN1 */ + { "Latin1", 2, 1, NULL, CS96, 'A', '\0', 0, 1, }, + /* CS_LATIN2 */ + { "Latin2", 2, 1, NULL, CS96, 'B', '\0', 0, 1, }, + /* CS_LATIN3 */ + { "Latin3", 2, 1, NULL, CS96, 'C', '\0', 0, 1, }, + /* CS_LATIN4 */ + { "Latin4", 2, 1, NULL, CS96, 'D', '\0', 0, 1, }, + /* CS_GREEK */ + { "Greek", 2, 1, NULL, CS96, 'F', '\0', 0, 1, }, + /* CS_ARABIC */ + { "Arabic", 2, 1, NULL, CS96, 'G', '\0', 0, 1, }, + /* CS_HEBREW */ + { "Hebrew", 2, 1, NULL, CS96, 'H', '\0', 0, 1, }, + /* CS_CYRILLIC */ + { "Cyrillic", 2, 1, NULL, CS96, 'L', '\0', 0, 1, }, + /* CS_LATIN5R */ + { "Latin5", 2, 1, NULL, CS96, 'M', '\0', 0, 1, }, + /* CS_THAI */ + { "Thai", 2, 1, NULL, CS96, 'T', '\0', 0, 1, }, + /* CS_LATIN6 */ + { "Latin6", 2, 1, NULL, CS96, 'V', '\0', 0, 1, }, + /* CS_LATIN6ADD */ + { "Latin6 add", 2, 1, NULL, CS96, 'X', '\0', 0, 1, }, + /* termination */ + { NULL, }, + }; + + /* options: maxcharset/maxside/shifttype/flags */ + ENCODING const encodingtab[] = { + /* XXX none has to be the first item. */ + { "none", + none_to_int, int_to_none, none_keyinput, NULL }, + + /* iso-2022 encodings */ + { "euc-jp-1978", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, eucjp_display, + CS_NONE, CS_JISX0208_1978, CS_JISX0201_RIGHT, CS_JISX0212_1990, + 4, 2, S_EUC, euc_recommendation, + E_SOLRESET, }, + { "euc-jp", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, eucjp_display, + CS_NONE, CS_JISX0208_1983, CS_JISX0201_RIGHT, CS_JISX0212_1990, + 4, 2, S_EUC, euc_recommendation, + E_SOLRESET, }, + { "euc-jp-1983", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, eucjp_display, + CS_NONE, CS_JISX0208_1983, CS_JISX0201_RIGHT, CS_JISX0212_1990, + 4, 2, S_EUC, euc_recommendation, + E_SOLRESET, }, + { "euc-jp-1990", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, eucjp_display, + CS_NONE, CS_JISX0208_1990, CS_JISX0201_RIGHT, CS_JISX0212_1990, + 4, 2, S_EUC, euc_recommendation, + E_SOLRESET, }, + { "euc-cn", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, euc_display, + CS_NONE, CS_GB2312, CS_INVALID, CS_INVALID, + 4, 2, S_EUC, euc_recommendation, + E_SOLRESET, }, + { "euc-kr", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, euc_display, + CS_NONE, CS_KSC5601, CS_INVALID, CS_INVALID, + 4, 2, S_EUC, euc_recommendation, + E_SOLRESET, }, + { "iso-8859-1", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_LATIN1, CS_INVALID, CS_INVALID, + 2, 2, S_NONE, NULL, + E_SOLRESET|E_EOLRESET, }, + { "iso-8859-2", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_LATIN2, CS_INVALID, CS_INVALID, + 2, 2, S_NONE, NULL, + E_SOLRESET|E_EOLRESET, }, + { "iso-8859-3", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_LATIN3, CS_INVALID, CS_INVALID, + 2, 2, S_NONE, NULL, + E_SOLRESET|E_EOLRESET, }, + { "iso-8859-4", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_LATIN4, CS_INVALID, CS_INVALID, + 2, 2, S_NONE, NULL, + E_SOLRESET|E_EOLRESET, }, + { "iso-8859-7", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_GREEK, CS_INVALID, CS_INVALID, + 2, 2, S_NONE, NULL, + E_SOLRESET|E_EOLRESET, }, + { "iso-8859-8", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_HEBREW, CS_INVALID, CS_INVALID, + 2, 2, S_NONE, NULL, + E_SOLRESET|E_EOLRESET, }, + { "iso-8859-9", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_LATIN5R, CS_INVALID, CS_INVALID, + 2, 2, S_NONE, NULL, + E_SOLRESET|E_EOLRESET, }, + { "latin1", /* same as iso-8859-1 */ + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_LATIN1, CS_INVALID, CS_INVALID, + 2, 2, S_NONE, NULL, + E_SOLRESET|E_EOLRESET, }, + { "latin2", /* same as iso-8859-2 */ + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_LATIN2, CS_INVALID, CS_INVALID, + 2, 2, S_NONE, NULL, + E_SOLRESET|E_EOLRESET, }, + { "iso-2022-7-1", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_INVALID, CS_INVALID, CS_INVALID, + 1, 1, S_NONE, NULL, + E_SOLRESET|E_EOLRESET, }, + { "iso-2022-7-2", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_NONE, CS_INVALID, CS_INVALID, + 2, 1, S_SEVEN, NULL, + E_SOLRESET|E_EOLRESET, }, + { "iso-2022-8-2", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_NONE, CS_INVALID, CS_INVALID, + 2, 2, S_EIGHT, NULL, + E_SOLRESET|E_EOLRESET, }, + { "iso-2022-jp", /* same as iso-2022-jp-2 */ + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_INVALID, CS_INVALID, CS_INVALID, + 3, 1, S_SS2, iso2022jp_recommendation, + E_SOLRESET|E_EOLRESET, }, + { "iso-2022-jp-2", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_INVALID, CS_INVALID, CS_INVALID, + 3, 1, S_SS2, iso2022jp_recommendation, + E_SOLRESET|E_EOLRESET, }, + { "iso-2022-kr", + iso2022kr_to_int, int_to_iso2022kr, iso2022_keyinput, NULL, + CS_NONE, CS_INVALID, CS_INVALID, CS_INVALID, + 2, 1, S_SI|S_SO, iso2022kr_recommendation, + 0, }, + { "iso-2022-cn", /* same as iso-2022-cn-ext */ + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_INVALID, CS_INVALID, CS_INVALID, + 4, 1, S_SI|S_SO|S_SS2|S_SS3, iso2022cn_recommendation, + E_SOLRESET|E_EOLRESET, }, + { "iso-2022-cn-ext", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_INVALID, CS_INVALID, CS_INVALID, + 4, 1, S_SI|S_SO|S_SS2|S_SS3, iso2022cn_recommendation, + E_SOLRESET|E_EOLRESET, }, + { "ctext", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, NULL, + CS_NONE, CS_LATIN1, CS_INVALID, CS_INVALID, + 2, 2, S_NONE, ctext_recommendation, + E_SOLRESET|E_EOLRESET|E_NOOLDSTYLE, }, + + /* non iso-2022 encodings */ + { "sjis", + sjis_to_int, int_to_sjis, sjis_keyinput, sjis_display}, + { "hz", + hz_to_int, int_to_hz, NULL, NULL }, + { "big5", + big5_to_int, int_to_big5, big5_keyinput, big5_display}, + { "euc-tw", + euctw_to_int, int_to_euctw, euctw_keyinput, euc_display }, + { NULL }, + }; + + /*------------------------------------------------------------*/ + + /* + * Support function to scan forward/backward multibyte chars. + */ + + /* + * checks if here lies multibyte char. + * if it is non-multibyte char, returns 1 for safety. + * so that you can do + * p += multi_byte(*p); + * instead of + * p++; + * in non-multibyte implementation. + * + * KEY_BLEN(sp, ch) uses this function. You should use KEY_BLEN(sp, ch) + * for daily use. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_byte_c __P((SCR *, ARG_CHAR_T)); + * PUBLIC: #endif + */ + int + multi_byte_c(sp, arg) + SCR *sp; + ARG_CHAR_T arg; + { + CHAR_T ch; + + ch = arg & 0xff; + if (ischarset(ch)) + return charset(ch).blen; + else + return 1; + } + + /* + * checks if here lies multibyte char. + * if it is non-multibyte char, returns 1 for safety. + * so that you can do + * p += multi_byte(p); + * instead of + * p++; + * in non-multibyte implementation. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_byte __P((SCR *, const CHAR_T *)); + * PUBLIC: #endif + */ + int + multi_byte(sp, p) + SCR *sp; + const CHAR_T *p; + { + if (ischarset(p[0])) + return charset(p[0]).blen; + else + return 1; + } + + /* + * Check if we're stepping on the non-justified byte. (inbetween + * multibyte character code) + * + * Since we know the maximum byte-length of multibyte char + * beforehand, the loops in multi_fix() are relatively short. + * (less than five) + * Worst case would be that we're on the non-multibyte line. + * In that case, we have to scan backward, and then scan forward. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_fix __P((SCR *, const CHAR_T *, const CHAR_T *)); + * PUBLIC: #endif + */ + int + multi_fix(sp, p0, p) + SCR *sp; + const CHAR_T *p0; + const CHAR_T *p; + { + int i; + int count; + + /* + * Easy cases. If we're on the first charcter of the line, + * we're done. If we're stepping on the first byte (that designates + * character set) of the multibyte char, we're done too. + */ + if (! (p0 < p)) + return 0; + if (ischarset(p[0])) + return 0; + + /* + * Scan backward for the first byte of multibyte char. + */ + i = p - p0 - 1; + count = 1; + while (0 < i && count <= MAX_MULTI_BLEN) { + if (ischarset(p0[i])) + break; + count++; + i--; + } + + /* + * If we didn't find any multibyte char, that means we're not + * stepping on multibyte char. + */ + if (!ischarset(p0[i])) + return 0; + + /* + * Hard case. We found multibyte char, and we don't know whether + * our current position (p) is on multibyte char or not. + * We scan forward to find the multibyte (or singlebyte) + * character we're stepping on. + */ + while (0 < count) { + if (ischarset(p0[i])) { + if (count < charset(p0[i]).blen) + break; + count -= charset(p0[i]).blen; + i += charset(p0[i]).blen; + } else { + count--; + i++; + } + } + + return count; + } + + /* + * Returns number of bytes to be subtracted to go 1 char backward. + * p -= multi_back(sp, p0, p); + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_back __P((SCR *, const CHAR_T *, const CHAR_T *)); + * PUBLIC: #endif + */ + int + multi_back(sp, p0, p) + SCR *sp; + const CHAR_T *p0; + const CHAR_T *p; + { + int mf; + + if (p0 < p) { + if (mf = multi_fix(sp, p0, p)) + return mf; + else if (mf = multi_fix(sp, p0, p - 1)) + return mf + 1; + else + return 1; + } else + return 1; + } + + /* + * Returns number of columns to be occupied by the current character. + * You can use KEY_LEN(sp, ch) for daily use. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_len_c __P((SCR *, ARG_CHAR_T)); + * PUBLIC: #endif + */ + int + multi_len_c(sp, arg) + SCR *sp; + ARG_CHAR_T arg; + { + CHAR_T ch; + + ch = arg & 0xff; + if (ischarset(ch)) + return charset(ch).len; + else { + /* for safety */ + return KEY_LEN(sp, ch); + } + } + + /* + * Returns number of columns to be occupied by the current character. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_len __P((SCR *, const CHAR_T *)); + * PUBLIC: #endif + */ + int + multi_len(sp, p) + SCR *sp; + const CHAR_T *p; + { + if (ischarset(p[0])) + return charset(p[0]).len; + else { + /* for safety */ + return KEY_LEN(sp, p[0]); + } + } + + /* + * Returns actual text to be displayed. + * Relevant to KEY_NAME(sp, ch) for singlebyte chars. + * Text will not be preserved if you call multi_name() again. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: CHAR_T *multi_name __P((SCR *, const CHAR_T *)); + * PUBLIC: #endif + */ + CHAR_T * + multi_name(sp, p) + SCR *sp; + const CHAR_T *p; + { + static CHAR_T name[30]; + char *ename; + ENCODING const *e; + + /* Easy ones first. */ + if (!(p[0] & 0x80)) + return KEY_NAME(sp, p[0]); + if (CS_RAW(p[0])) + return v_key_name(sp, p[1] | 0x80); + + /* Plugin functions for supporting each encoding */ + ename = O_STR(sp, O_DISPLAYENCODING); + e = multi_findencoding(ename); + if (!e) + e = &encodingtab[0]; + if (e->display && e->display(sp, e, name, p)) + return name; + + /* if would like to skip undisplayable ones... */ + if (O_ISSET(sp, O_SKIPDISPLAY)) { + size_t i; + + for (i = 0; i < KEY_LEN(sp, p[0]); i++) + name[i] = '?'; + name[i] = '\0'; + return name; + } + + /* try iso-2022-* G0 designation */ + if (ischarset(p[0])) { + CHARSET const *cs; + size_t i, j; + + cs = &charset(p[0]); + i = 0; + + if (cs->version) { + name[i++] = '\033'; + name[i++] = '&'; + name[i++] = cs->version; + } + + name[i++] = '\033'; + switch (cs->type) { + case CS94: + name[i++] = '('; + break; + case CS96: + name[i++] = ','; + break; + case CS9494: + case CS9696: + name[i++] = '$'; + if (F_ISSET(e, E_NOOLDSTYLE) || !cs->oldstyle) + name[i++] = '('; + break; + } + name[i++] = cs->enter; + + for (j = 1; j < charset(p[0]).blen; j++) + name[i++] = p[j]; + name[i] = '\0'; + return name; + } + + /* for safety */ + return KEY_NAME(sp, p[0]); + } + + /* + * Returns the character in internal encoding. For use in ex_print() and + * other rountines. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: CHAR_T *multi_rawname __P((SCR *, const CHAR_T *)); + * PUBLIC: #endif + */ + CHAR_T * + multi_rawname(sp, p) + SCR *sp; + const CHAR_T *p; + { + static CHAR_T name[MAX_MULTI_BLEN + 1]; + size_t blen; + size_t i; + + if (!ischarset(p[0])) { + name[0] = p[0]; + name[1] = '\0'; + return name; + } + + blen = charset(p[0]).blen; + for (i = 0; i < blen; i++) + name[i] = p[i]; + name[i] = '\0'; + return name; + } + + /*------------------------------------------------------------*/ + + /* + * Returns 1 if it is ASCII (CS_NONE) or binary (CS_RAW) chars. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_isnone __P((SCR *, ARG_CHAR_T)); + * PUBLIC: #endif + */ + int + multi_isnone(sp, ch) + SCR *sp; + ARG_CHAR_T ch; + { + ch &= 0xff; + if (ch & 0x80) { + if (CS_RAW(ch)) + return 1; + else + return 0; + } else + return 1; + } + + /* + * Returns 1 if it is western charset. (word divided by space) + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_iswestern __P((SCR *, ARG_CHAR_T)); + * PUBLIC: #endif + */ + int + multi_iswestern(sp, ch) + SCR *sp; + ARG_CHAR_T ch; + { + ch &= 0xff; + if (ch & 0x80) + return charset(ch).western; + else + return 1; + } + + /* + * Wordbound recogntion. (for "W" command) + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_Wordbound __P((u_int, u_int, int)); + * PUBLIC: #endif + */ + int + multi_Wordbound(c1, c2, forward) + u_int c1; + u_int c2; + int forward; + { + /* + * if it is just beginning, we don't bother. + */ + if (c1 == 0) + return 0; + + /* + * if they are in different character set, we've hit word boundary. + */ + if ((c1 & 0xff00) != (c2 & 0xff00)) + return 1; + + /* + * if we are going forward and next char is stronger, we've hit + * word boundary. + * if we are going backward, and lefthandside char is weaker, + * we've hit word boundary. + */ + if (forward) { + if ((c1 & 0xff) < (c2 & 0xff)) + return 1; + } else { + if ((c1 & 0xff) > (c2 & 0xff)) + return 1; + } + + return 0; + } + + /* + * Wordbound recogntion. (for "w" command) + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_wordbound __P((u_int, u_int, int)); + * PUBLIC: #endif + */ + int + multi_wordbound(c1, c2, forward) + u_int c1; + u_int c2; + int forward; + { + /* + * if it is just beginning, we don't bother. + */ + if (c1 == 0) + return 0; + + /* + * if they are in different character set, we've hit word boundary. + */ + if ((c1 & 0xff00) != (c2 & 0xff00)) + return 1; + + /* + * if they are in the same character set, and they are in different + * character class, we've hit word boundary. + */ + if ((c1 & 0xff) != (c2 & 0xff)) + return 1; + + return 0; + } + + /*------------------------------------------------------------*/ + + /* + * encoding autodetection routines. + * + * XXX + * logic is not very robust against line with binary garbages. + * how should we treat escape sequences that are not iso-2022-* designation? + * (such as ansi cursor movement) + */ + + static int multi_predict_iso2022 __P((SCR *, CHAR_T *, size_t)); + static int multi_predict_euc __P((SCR *, CHAR_T *, size_t)); + static int multi_predict_euctw __P((SCR *, CHAR_T *, size_t)); + static int multi_predict_sjis __P((SCR *, CHAR_T *, size_t)); + static int multi_predict_big5 __P((SCR *, CHAR_T *, size_t)); + static int multi_predict_hz __P((SCR *, CHAR_T *, size_t)); + + static int + multi_predict_iso2022(sp, p, len) + SCR *sp; + CHAR_T *p; + size_t len; + { + size_t i; + int ret; + int cstype[4]; + int gl, gr; + int gl1, gr1; + int tmp, mask; + + ret = 0; + cstype[0] = 94; /*ASCII*/ + cstype[1] = cstype[2] = cstype[3] = -1; + gl = 0; + gr = 1; + gl1 = gr1 = -1; + + i = 0; + while (i < len) { + /* + * If we have some designation, it must be iso-2022-*. + * it means that the string is iso-2022-*. + */ + if (i + 2 < len && p[i] == '\033' + && p[i + 1] == '$' && strchr("@AB", p[i + 2])) { + cstype[0] = 9494; + ret = 1; + i += 3; + continue; + } + if (i + 2 < len && p[i] == '\033' + && strchr("()*+,-./", p[i + 1]) && isecma(p[i + 2])) { + if (p[i + 1] < ',') + cstype[p[i + 1] - '('] = 94; + else + cstype[p[i + 1] - ','] = 96; + ret = 1; + i += 3; + continue; + } + if (i + 3 < len && p[i] == '\033' && p[i + 1] == '$' + && strchr("()*+,-./", p[i + 2]) && isecma(p[i + 3])) { + if (p[i + 2] < ',') + cstype[p[i + 2] - '('] = 9494; + else + cstype[p[i + 2] - ','] = 9696; + ret = 1; + i += 4; + continue; + } + + /* + * locking shift. there must be designation first. + * we don't take it as an evidence for iso-2022-*. + */ + if (p[i] == SI) { + if (cstype[0] < 0) + return -1; + + i++; + continue; + } + if (p[i] == SO) { + if (cstype[1] < 0) + return -1; + + i++; + continue; + } + if (i + 1 < len && p[i] == '\033' && strchr("no", p[i + 1])) { + gl = p[i + 1] - 'n' + 2; + if (cstype[gl] < 0) + return -1; + + i += 2; + continue; + } + if (i + 1 < len && p[i] == '\033' && strchr("~}|", p[i + 1])) { + gr = 3 - (p[i + 1] - '|'); + if (cstype[gr] < 0) + return -1; + + i += 2; + continue; + } + + /* + * single shift. there must be designation first. + * we don't take it as an evidence for iso-2022-*. + */ + if (i + 1 < len && p[i] == '\033' && strchr("NO", p[i + 1])) { + gl1 = p[i + 1] - 'N' + 2; + if (cstype[gl1] < 0) + return -1; + + i += 2; + continue; + } + if (p[i] == SS2 || p[i] == SS3) { + gl1 = gr1 = p[i] - SS2 + 2; + if (cstype[gl1] < 0) + return -1; + + i++; + continue; + } + + /* + * check for standard chars. + * if there are properly designated standard chars, it must be + * ok to take it as iso-2022-* string. + * + * XXX + * the logic simply skips improperly designated standard chars. + * how should we treat it? + */ + if (p[i] & 0x80) { + tmp = (gr1 < 0) ? gr : gr1; + mask = 0x80; + } else { + tmp = (gl1 < 0) ? gl : gl1; + mask = 0x00; + } + + switch (cstype[tmp]) { + case -1: + return -1; + case 94: + if (0x21 + mask <= p[i] && p[i] <= 0xfe + mask) { + ret = 1; + i++; + } else + i++; + break; + case 96: + if (0x20 + mask <= p[i] && p[i] <= 0xff + mask) { + ret = 1; + i++; + } else + i++; + break; + case 9494: + if (i + 1 < len + && 0x21 + mask <= p[i+0] && p[i+0] <= 0xfe + mask + && 0x21 + mask <= p[i+1] && p[i+1] <= 0xfe + mask) { + ret = 1; + i += 2; + } else + i++; + break; + case 9696: + if (i + 1 < len + && 0x20 + mask <= p[i+0] && p[i+0] <= 0xff + mask + && 0x20 + mask <= p[i+1] && p[i+1] <= 0xff + mask) { + ret = 1; + i += 2; + } else + i++; + break; + } + + gl1 = gr1 = -1; + } + + return ret; + } + + static int + multi_predict_euc(sp, p, len) + SCR *sp; + CHAR_T *p; + size_t len; + { + size_t i; + int ret; + + ret = 0; + i = 0; + while (i < len) { + /* + * If we have some designation other than SS2/SS3, + * it will never be euc string. + */ + if (i + 2 < len && p[i] == '\033' + && p[i + 1] == '$' && strchr("@AB", p[i + 2])) + return -1; + if (i + 2 < len && p[i] == '\033' + && strchr("()*+,-./", p[i + 1]) && isecma(p[i + 2])) + return -1; + if (i + 3 < len && p[i] == '\033' && p[i + 1] == '$' + && strchr("()*+,-./", p[i + 2]) && isecma(p[i + 3])) + return -1; + if (i + 1 < len && p[i] == '\033' + && strchr("NOno~}|", p[i + 1])) + return -1; + if (p[i] == SO || p[i] == SI) + return -1; + + /* + * if we see euc bytes, this line can be euc string. + * if we see firstbyte of euc char, and secondbyte does not + * match, it is not an euc string. + */ + if (iseuckanji(p[i])) { + if (i + 1 < len && iseuckanji(p[i + 1])) { + ret = 1; + i += 2; + continue; + } + + return -1; + } + + /* + * if we see SS2, and the next byte is valid, it is euc string. + */ + if (p[i] == SS2) { + if (i + 1 < len && iseuckanji(p[i + 1])) { + ret = 1; + i += 2; + continue; + } + + return -1; + } + + /* + * if we see SS3, and the next bytes are valid, + * it is euc string. + */ + if (p[i] == SS3) { + if (i + 2 < len + && iseuckanji(p[i + 1]) && iseuckanji(p[i + 2])) { + ret = 1; + i += 3; + continue; + } + + return -1; + } + + i++; + } + return ret; + } + + static int + multi_predict_euctw(sp, p, len) + SCR *sp; + CHAR_T *p; + size_t len; + { + size_t i; + int ret; + + ret = 0; + i = 0; + while (i < len) { + /* + * If we have some designation other than SS2, + * it will never be euc-tw string. + */ + if (i + 2 < len && p[i] == '\033' + && p[i + 1] == '$' && strchr("@AB", p[i + 2])) + return -1; + if (i + 2 < len && p[i] == '\033' + && strchr("()*+,-./", p[i + 1]) && isecma(p[i + 2])) + return -1; + if (i + 3 < len && p[i] == '\033' && p[i + 1] == '$' + && strchr("()*+,-./", p[i + 2]) && isecma(p[i + 3])) + return -1; + if (i + 1 < len && p[i] == '\033' + && strchr("NOno~}|", p[i + 1])) + return -1; + if (p[i] == SO || p[i] == SI || p[i] == SS3) + return -1; + + /* + * if we see euc bytes, this line can be euc string. + * if we see firstbyte of euc-tw char, and secondbyte does not + * match, it is not an euc-tw string. + */ + if (iseuckanji(p[i])) { + if (i + 1 < len && iseuckanji(p[i + 1])) { + ret = 1; + i += 2; + continue; + } + + return -1; + } + + /* + * if we see SS2, and the next three bytes are valid, + * it is euc-tw string. + */ + if (p[i] == SS2) { + if (i + 3 < len && iseuckanji(p[i + 1]) + && iseuckanji(p[i + 2]) && iseuckanji(p[i + 3])) { + ret = 1; + i += 4; + continue; + } + + return -1; + } + + i++; + } + return ret; + } + + static int + multi_predict_sjis(sp, p, len) + SCR *sp; + CHAR_T *p; + size_t len; + { + size_t i; + int ret; + + ret = 0; + i = 0; + while (i < len) { + /* + * If we have some designation, it will never be + * sjis string. + */ + if (i + 2 < len && p[i] == '\033' + && p[i + 1] == '$' && strchr("@AB", p[i + 2])) + return -1; + if (i + 2 < len && p[i] == '\033' + && strchr("()*+,-./", p[i + 1]) && isecma(p[i + 2])) + return -1; + if (i + 3 < len && p[i] == '\033' && p[i + 1] == '$' + && strchr("()*+,-./", p[i + 2]) && isecma(p[i + 3])) + return -1; + if (i + 1 < len && p[i] == '\033' && strchr("NOno~}|", p[i + 1])) + return -1; + if (p[i] == SO || p[i] == SI) + return -1; + /* + * don't check SS2 and SS3, they are part of issjissjis1(). + * (thanks serow-san) + */ + + /* + * if we see sjis bytes, this line can be sjis string. + * if we see firstbyte of sjis char, and secondbyte does not + * match, it is not an sjis string. + */ + if (issjiskanji1(p[i])) { + if (i + 1 < len && issjiskanji2(p[i + 1])) { + ret = 1; + i += 2; + continue; + } + + return -1; + } + + i++; + } + return ret; + } + + static int + multi_predict_big5(sp, p, len) + SCR *sp; + CHAR_T *p; + size_t len; + { + size_t i; + int ret; + + ret = 0; + i = 0; + while (i < len) { + /* + * If we have some designation, it will never be + * big5 string. + */ + if (i + 2 < len && p[i] == '\033' + && p[i + 1] == '$' && strchr("@AB", p[i + 2])) + return -1; + if (i + 2 < len && p[i] == '\033' + && strchr("()*+,-./", p[i + 1]) && isecma(p[i + 2])) + return -1; + if (i + 3 < len && p[i] == '\033' && p[i + 1] == '$' + && strchr("()*+,-./", p[i + 2]) && isecma(p[i + 3])) + return -1; + if (i + 1 < len && p[i] == '\033' + && strchr("NOno~}|", p[i + 1])) + return -1; + if (p[i] == SO || p[i] == SI) + return -1; + if (p[i] == SS2 || p[i] == SS3) + return -1; + + /* + * if we see big5 bytes, this line can be big5 string. + * if we see firstbyte of big5 char, and secondbyte does not + * match, it is not an big5 string. + */ + if (isbig5mb1(p[i])) { + if (i + 1 < len && isbig5mb2(p[i + 1])) { + ret = 1; + i += 2; + continue; + } + + return -1; + } + + i++; + } + return ret; + } + + static int + multi_predict_hz(sp, p, len) + SCR *sp; + CHAR_T *p; + size_t len; + { + size_t i; + int ret; + + ret = 0; + i = 0; + while (i < len) { + /* + * hz is 7bit code. + */ + if (p[i] & 0x80) + return -1; + + /* + * If we have some designation, it will never be + * hz string. + */ + if (i + 2 < len && p[i] == '\033' + && p[i + 1] == '$' && strchr("@AB", p[i + 2])) + return -1; + if (i + 2 < len && p[i] == '\033' + && strchr("()*+,-./", p[i + 1]) && isecma(p[i + 2])) + return -1; + if (i + 3 < len && p[i] == '\033' && p[i + 1] == '$' + && strchr("()*+,-./", p[i + 2]) && isecma(p[i + 3])) + return -1; + if (i + 1 < len && p[i] == '\033' && strchr("NOno~}|", p[i + 1])) + return -1; + if (p[i] == SO || p[i] == SI) + return -1; + if (p[i] == SS2 || p[i] == SS3) + return -1; + + /* + * if we see /~[{}~]/ or /~$/, this line can be hz string. + * if there's ~ in other cases, it will not be hz string. + */ + if (p[i] == '~') { + if (i == len - 1) { + ret = 1; + i++; + continue; + } + if (i + 1 < len && strchr("{}~", p[i + 1])) { + ret = 1; + i += 2; + continue; + } + + return -1; + } + + i++; + } + return ret; + } + + /* + * encoding detection table. + * number of elements in func[] and name[] must match. + */ + struct _detecttab { + char *key; + int (*func[10])(); + char *name[10]; + } detecttab[] = { + { "jp", + { multi_predict_iso2022, + multi_predict_euc, + multi_predict_sjis, + NULL, }, + { "iso-2022-jp", + "euc-jp", + "sjis", + NULL, }, }, + { "cn", + { multi_predict_iso2022, + multi_predict_euc, + multi_predict_big5, + multi_predict_hz, + NULL, }, + { "iso-2022-cn", + "euc-cn", + "big5", + "hz", + NULL, }, }, + { "tw", + { multi_predict_iso2022, + multi_predict_euctw, + multi_predict_big5, + multi_predict_hz, + NULL, }, + { "iso-2022-cn", + "euc-tw", + "big5", + "hz", + NULL, }, }, + { "kr", + { multi_predict_iso2022, + multi_predict_euc, + NULL, }, + { "iso-2022-kr", + "euc-kr", + NULL, }, }, + { NULL, + { NULL, }, + { NULL, }, }, + }; + + /* + * Encoding type prediction by scanning backing database. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: char *multi_predict_region __P((SCR *, MARK *, MARK *, char *, char *, int)); + * PUBLIC: #endif + */ + char * + multi_predict_region(sp, mstart, mend, ename, autodetect, mode) + SCR *sp; + MARK *mstart; + MARK *mend; + char *ename; + char *autodetect; + int mode; + { + /* + * configuration paramter. + * If it is undefined, try to search all the way + */ + /* #define PREDICT_MAXLINES 100 */ + + recno_t start; + recno_t end; + recno_t l; + CHAR_T *p; + size_t i; + size_t len; + + struct _detecttab *dt; + + int maybe; + int try; + int maxfunc; + + int (*reader)(); + + reader = (mode ? dbgetline : rawgetline); + + start = mstart->lno; + end = mend->lno; + if (start == 0 || end < start) + return ename; + #ifdef PREDICT_MAXLINES + if (start + PREDICT_MAXLINES < end) + end = start + PREDICT_MAXLINES; + #endif + + /* find out detecttab */ + for (dt = detecttab; dt->key; dt++) { + if (strncmp(autodetect, dt->key, strlen(dt->key)) == 0) + break; + } + if (!dt->key) + return ename; + + maybe = 0; + for (i = 0; dt->func[i]; i++) + maybe |= (1 << i); + maxfunc = i; + + for (l = start; l <= end; l++) { + if ((*reader)(sp, l, &p, &len)) + break; + if (len == 0) + continue; + + try = maybe; + for (i = 0; i < maxfunc; i++) { + if (!(try & (1 << i))) + continue; + switch ((*dt->func[i])(sp, p, len)) { + case -1: + /* remove this code. */ + maybe &= ~(1 << i); + break; + case 0: + /* leave it as is. */ + break; + case 1: + /* add this code. */ + maybe |= (1 << i); /*XXX no effect */ + break; + } + } + + /* no codedetection succeed. */ + if (maybe == 0) + return ename; + + for (i = 0; i < maxfunc; i++) { + if (maybe == (1 << i)) + return dt->name[i]; + } + } + + return ename; + + #undef PREDICT_MAXLINES + } + #if 0 + { + /* + * configuration paramter. + * If it is undefined, try to search all the way + */ + /* #define PREDICT_MAXLINES 100 */ + + recno_t start; + recno_t end; + recno_t l; + + CHAR_T *p; + size_t i; + size_t len; + #define AD_ISO2022 0x01 + #define AD_EUC 0x02 + #define AD_SJIS 0x04 + #define AD_BIG5 0x08 + #define AD_HZ 0x10 + #define AD_JP 0x07 + #define AD_CN 0x1b + #define AD_KR 0x03 + #define AD_UNKNOWN 0x1f + int state; + int try; + int again; + int (*reader)(); + int siso, ss2ss3, jp, jpnew, kr, cn, hz; + int iso2022skip, hzskip; + + reader = (mode ? dbgetline : rawgetline); + + start = mstart->lno; + end = mend->lno; + if (start == 0 || end < start) + return ename; + #ifdef PREDICT_MAXLINES + if (start + PREDICT_MAXLINES < end) + end = start + PREDICT_MAXLINES; + #endif + if (strncmp(autodetect, "jp", 2) == 0) + state = AD_JP; + else if (strncmp(autodetect, "cn", 2) == 0) + state = AD_CN; + else if (strncmp(autodetect, "kr", 2) == 0) + state = AD_KR; + else + return ename; + + siso = ss2ss3 = jp = jpnew = kr = cn = hz = 0; + iso2022skip = hzskip = 0; + for (l = start; l < end; l++) { + if ((*reader)(sp, l, &p, &len)) + break; + if (len == 0) + continue; + + i = 0; + while (state && i < len) { + if (state & AD_ISO2022) { + if (!iso2022skip && p[i] == '\033') { + if (i + 2 < len && p[i + 1] == '$' + && strchr("AB@", p[i + 2])) { + state = AD_ISO2022; + iso2022skip = 2; + + if (strchr("B@", p[i + 2])) + jp++; + else + cn++; + } else if (i + 2 < len + && strchr("()*+,-./", p[i + 1]) + && isecma(p[i + 2])) { + state = AD_ISO2022; + iso2022skip = 2; + } else if (i + 3 < len + && p[i + 1] == '$' + && strchr("()*+,-./", p[i + 2]) + && isecma(p[i + 3])) { + state = AD_ISO2022; + iso2022skip = 3; + + if (strchr("AEGHIJKLM", p[i + 3])) + cn++; + else if (strchr("@BD", + p[i + 3])) { + jpnew++; + jp++; + } + else if (strchr("C", p[i + 3])) + kr++; + } else if (i + 1 < len + && strchr("NO", p[i + 1])) { + state = AD_ISO2022; + iso2022skip = 1; + + ss2ss3++; + } + } else if (!iso2022skip + && strchr("\016\017", p[i])) { + state = AD_ISO2022; + + siso++; + } else if (iso2022skip) + iso2022skip--; + } + + if (state & AD_HZ) { + if (!hzskip && p[i] == '~') { + if (i + 1 < len + && strchr("{}~", p[i + 1])) { + hz++; + hzskip = 1; + } else if (i + 1 == len) + hz++; + } else if (hzskip) + hzskip--; + } + + if (state & (AD_EUC | AD_SJIS | AD_BIG5)) { + try = 0; + + if (i + 1 < len + && iseuckanji(p[i]) && iseuckanji(p[i + 1])) { + try |= AD_EUC; + } else if (i + 1 < len && p[i] == 0x8e + && iseuckanji(p[i + 1])) { + try |= AD_EUC; + } else if (i + 2 < len && p[i] == 0x8f + && iseuckanji(p[i + 1]) + && iseuckanji(p[i + 2])) { + try |= AD_EUC; + } + + if (i + 1 < len + && issjiskanji1(p[i]) && issjiskanji2(p[i + 1])) { + try |= AD_SJIS; + } + + if (i + 1 < len + && isbig5mb1(p[i]) && isbig5mb2(p[i + 1])) { + try |= AD_BIG5; + } + + switch (try & state) { + case AD_EUC: + state = AD_EUC; + goto breakbreak; + case AD_SJIS: + state = AD_SJIS; + goto breakbreak; + case AD_BIG5: + state = AD_BIG5; + goto breakbreak; + case 0: + if (try) + goto breakbreak; + else + break; + default: + state &= try; + i++; + break; + } + } + + i++; + } + } + breakbreak:; + + switch (state) { + case AD_ISO2022: + if (jpnew) + return "ctext"; + else if (!jp && kr && !cn && siso && !ss2ss3) + return "iso-2022-kr"; + else if (!siso && !ss2ss3) + else + return "iso-2022-7-1"; + case AD_SJIS: + return "sjis"; + case AD_BIG5: + return "big5"; + case AD_EUC: + if (strcmp(autodetect, "jp") == 0) + return "euc-jp"; + else if (strcmp(autodetect, "cn") == 0) + return "euc-cn"; + else if (strcmp(autodetect, "kr") == 0) + return "euc-kr"; + /* fall through */ + default: + if ((state & AD_HZ) && hz) + return "hz"; + else + return ename; + } + #undef AD_ISO2022 + #undef AD_EUC + #undef AD_SJIS + #undef AD_BIG5 + #undef AD_UNKNOWN + + #undef PREDICT_MAXLINES + } + #endif + + /*------------------------------------------------------------*/ + + /* + * Perform code conversion from external to internal, over TEXT structure. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_ext2int_text __P((SCR *, TEXTH *, int)); + * PUBLIC: #endif + */ + int + multi_ext2int_text(sp, tiqh, opt) + SCR *sp; + TEXTH *tiqh; + int opt; + { + char *ename; + ENCODING const *e; + TEXT *tp; + CHAR_T *np; + size_t nlen; + size_t ilen; + int flags; + ISO2022STATE tstate; + ISO2022STATE *pstate; + + /* + * Even if there's no encoding specified, we have to convert + * chars that are 0x80 <= ch <= 0xff. + */ + ename = O_STR(sp, opt); + if (!ename || !ename[0]) + ename = "none"; + e = multi_findencoding(ename); + if (!e) + e = &encodingtab[0]; + if (!e->toint) + abort(); /*XXX*/ + + pstate = multi_cnvstart(sp, ename); + GET_SPACE_RET(sp, np, nlen, 256); + for (tp = tiqh->cqh_first; tp != (TEXT *)tiqh; tp = tp->q.cqe_next) { + tstate = *pstate; + (*e->toint)(sp, e, NULL, &ilen, tp->lb, tp->len, &flags, &tstate); + if (!LF_ISSET(MB_MULTIBYTE)) + continue; + if (nlen < ilen) + ADD_SPACE_RET(sp, np, nlen, ilen); + if (tp->lb_len < ilen) + BINC_RET(sp, tp->lb, tp->lb_len, ilen); + (*e->toint)(sp, e, np, &ilen, tp->lb, tp->len, NULL, pstate); + memcpy(tp->lb, np, ilen); + tp->len = ilen; + } + multi_cnvfinish(sp, pstate); + FREE_SPACE(sp, np, nlen); + return 0; + } + + /*------------------------------------------------------------*/ + + /* + * Perform code conversion from external to internal, over some range of + * database. The variable "mode" controls how to access the database. + */ + + static int + rawgetline(sp, l, pp, plen) + SCR *sp; + recno_t l; + CHAR_T **pp; + size_t *plen; + { + EXF *ep; + DBT key, data; + + if (!sp || !(ep = sp->ep)) + abort(); + + key.data = &l; + key.size = sizeof(l); + switch (ep->db->get(ep->db, &key, &data, 0)) { + case -1: + /* something wrong happened. */ + return 1; + case 1: + /* this line seems to be empty. */ + if (pp) + *pp = NULL; + if (plen) + *plen = 0; + return 0; + } + + if (pp) + *pp = data.data; + if (plen) + *plen = data.size; + return 0; + } + + static int + dbgetline(sp, l, pp, plen) + SCR *sp; + recno_t l; + CHAR_T **pp; + size_t *plen; + { + return db_get(sp, l, DBG_FATAL, pp, plen); + } + + static int + rawsetline(sp, l, p, len) + SCR *sp; + recno_t l; + CHAR_T *p; + size_t len; + { + EXF *ep; + DBT key, data; + + if (!sp || !(ep = sp->ep)) + abort(); + + /* XXX don't log the update */ + + key.data = &l; + key.size = sizeof(l); + data.data = p; + data.size = len; + SIGBLOCK; + if (ep->db->put(ep->db, &key, &data, 0) == -1) + abort(); /*XXX*/ + SIGUNBLOCK; + + /* invalidate the line cache */ + ep->c_lno = OOBLNO; + + return 0; + } + + static int + dbsetline(sp, l, p, len) + SCR *sp; + recno_t l; + CHAR_T *p; + size_t len; + { + return db_set(sp, l, p, len); + } + + static int + rawdelline(sp, l) + SCR *sp; + recno_t l; + { + EXF *ep; + DBT key, data; + + if (!sp || !(ep = sp->ep)) + abort(); + + if (mark_insdel(sp, LINE_DELETE, l)) + return 1; + if (ex_g_insdel(sp, LINE_DELETE, l)) + return 1; + + /* XXX don't log the update */ + + key.data = &l; + key.size = sizeof(l); + SIGBLOCK; + if (ep->db->del(ep->db, &key, 0) == -1) + abort(); /*XXX*/ + SIGUNBLOCK; + + /* invalidate the line cache, update the line# cache. */ + ep->c_lno = OOBLNO; + if (ep->c_nlines != OOBLNO) + ep->c_nlines--; + + /* updates of modify flag supressed */ + + return 0; + } + + static int + dbdelline(sp, l) + SCR *sp; + recno_t l; + { + return db_delete(sp, l); + } + + /* + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_ext2int_region __P((SCR *, MARK *, MARK *, int, char *, int, int)); + * PUBLIC: #endif + */ + int + multi_ext2int_region(sp, mstart, mend, opt, autodetect, mode, update) + SCR *sp; + MARK *mstart; + MARK *mend; + int opt; + char *autodetect; + int mode; + int update; + { + ENCODING const *e; + recno_t start; + recno_t end; + recno_t l; + + char *ename; + + CHAR_T *op; + size_t olen; + CHAR_T *np; + size_t nlen; + size_t ilen; + int flags; + ISO2022STATE *pstate; + ISO2022STATE tstate; + + /* join */ + recno_t joinline; + size_t joincnt; + + int (*reader)(); + int (*writer)(); + int (*deleter)(); + + reader = (mode ? dbgetline : rawgetline); + writer = (mode ? dbsetline : rawsetline); + deleter = (mode ? dbdelline : rawdelline); + + /* + * Even if there's no encoding specified, we have to convert + * chars that are 0x80 <= ch <= 0xff. + */ + ename = O_STR(sp, opt); + if (!ename || !ename[0]) + ename = "none"; + + /* + * Try autodetect the encoding. + */ + if (autodetect) { + ename = multi_predict_region(sp, mstart, mend, ename, + autodetect, mode); + } + e = multi_findencoding(ename); + if (!e) + e = &encodingtab[0]; + if (!e->toint) + abort(); /*XXX*/ + + start = mstart->lno; + end = mend->lno; + if (start == 0 || end < start) + return 1; /*parameter problem*/ + GET_SPACE_RET(sp, np, nlen, 256); + joinline = 0; + joincnt = 0; + pstate = multi_cnvstart(sp, ename); + for (l = start; l <= end; l++) { + if ((*reader)(sp, l, &op, &olen)) + abort(); + if (olen == 0) + continue; + + tstate = *pstate; + (*e->toint)(sp, e, NULL, &ilen, op, olen, &flags, &tstate); + if (!LF_ISSET(MB_MULTIBYTE|MB_JOIN) && !joinline) + continue; + if (nlen < ilen) + ADD_SPACE_RET(sp, np, nlen, ilen); + (*e->toint)(sp, e, np, &ilen, op, olen, &flags, pstate); + if (!joinline) { + if (flags & MB_JOIN) + joinline = l; + if ((*writer)(sp, l, np, ilen)) + abort(); + continue; + } + + /* join the line */ + if ((*reader)(sp, joinline, &op, &olen)) + abort(); + if (nlen < olen + ilen) + ADD_SPACE_RET(sp, np, nlen, olen + ilen); + memcpy(np + olen, np, ilen); + memcpy(np, op, olen); + if ((*writer)(sp, joinline, np, olen + ilen)) + abort(); + if (flags & MB_JOIN) + ; /* continue to join */ + else + joinline = 0; /* join finished */ + + if ((*deleter)(sp, l)) + abort(); + l--; + end--; + joincnt++; + } + multi_cnvfinish(sp, pstate); + FREE_SPACE(sp, np, nlen); + + if (joincnt) + mend->lno -= joincnt; + + /* + * update by autodetected encoding. + */ + if (update && autodetect && strlen(autodetect) + && autodetect[strlen(autodetect) - 1] == '+') { + ARGS *argv[2], a, b; + char buf[1024]; + + a.bp = buf; + b.bp = NULL; + a.len = b.len = 0; + argv[0] = &a; + argv[1] = &b; + + snprintf(buf, sizeof(buf), "%s=%s", optlist[opt].name, ename); + a.len = strlen(buf); + opts_set(sp, argv, NULL); + } + return 0; + } + + /*------------------------------------------------------------*/ + + /* + * Conversion state management. + */ + + /* + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: void *multi_cnvstart __P((SCR *, char *)); + * PUBLIC: #endif + */ + void * + multi_cnvstart(sp, encoding) + SCR *sp; + char *encoding; + { + ISO2022STATE *p; + ENCODING const *e; + + e = multi_findencoding(encoding); + if (!e) + e = &encodingtab[0]; + p = (ISO2022STATE *)malloc(sizeof(ISO2022STATE)); + multi_initstate(sp, e, p); + return (void *)p; + } + + /* + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: void multi_cnvfinish __P((SCR *, void *)); + * PUBLIC: #endif + */ + void + multi_cnvfinish(sp, extra) + SCR *sp; + void *extra; + { + free(extra); + } + + /* + * State initialization. Only accessible to multi_*.c so we don't include + * public header description. + */ + void + multi_initstate(sp, e, state) + SCR *sp; + ENCODING const *e; + ISO2022STATE *state; + { + state->charsets[0] = (CHARSET *) NULL; + state->charsets[1] = (CHARSET *) NULL; + state->charsets[2] = (CHARSET *) NULL; + state->charsets[3] = (CHARSET *) NULL; + state->gl = 0; + state->gr = 1; + if (e) { + if (ischarset(e->initg0)) + state->charsets[0] = &charset(e->initg0); + if (ischarset(e->initg1)) + state->charsets[1] = &charset(e->initg1); + if (ischarset(e->initg2)) + state->charsets[2] = &charset(e->initg2); + if (ischarset(e->initg3)) + state->charsets[3] = &charset(e->initg3); + } + } + + /*------------------------------------------------------------*/ + + /* + * Character set conversion, from internal to external. + * Will be treated in per-line manner. + */ + + /* + * Obtain the size of the memory region for holding result of multi_int2ext(). + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_int2extlen __P((SCR *, CHAR_T *, size_t, int *, void *)); + * PUBLIC: #endif + */ + int + multi_int2extlen(sp, p0, len, pflags, extra) + SCR *sp; + CHAR_T *p0; + size_t len; + int *pflags; + void *extra; + { + size_t i; + size_t ilen; + ENCODING const *e; + ISO2022STATE tstate; + ISO2022STATE *state; + char *ename; + + state = extra; + if (pflags) + FL_INIT(*pflags, 0); + + /* If we don't know which encoding to use, do nothing. */ + if (!sp) + return len; + + ename = O_STR(sp, O_FILEENCODING); + e = multi_findencoding(ename); + + if (!e) + return len; + if (!e->fromint) + return len; + + /* use copy of state since i don't wanna bother it */ + if (!state) + multi_initstate(sp, e, &tstate); + else + tstate = *state; + + (*e->fromint)(sp, e, NULL, &ilen, p0, len, pflags, &tstate); + + return ilen; + } + + /* + * Converts specified region into external expression. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_int2ext __P((SCR *, CHAR_T *, size_t, size_t, void *)); + * PUBLIC: #endif + */ + int + multi_int2ext(sp, p0, len, ilen, extra) + SCR *sp; + CHAR_T *p0; + size_t len; + size_t ilen; + void *extra; + { + size_t i; + CHAR_T *t0; + size_t tlen; + CHAR_T *p; + CHAR_T *q; + ENCODING const *e; + size_t newlen; + ISO2022STATE *state; + char *ename; + + state = extra; + + /* If we don't know which encoding to use, do nothing. */ + if (!sp) + return 0; + + ename = O_STR(sp, O_FILEENCODING); + e = multi_findencoding(ename); + + if (!e) + return 0; + if (!e->fromint) + return 0; + + GET_SPACE_RET(sp, t0, tlen, ilen); + (*e->fromint)(sp, e, t0, &newlen, p0, len, NULL, state); + if (ilen != newlen) + abort(); + memcpy(p0, t0, newlen); + FREE_SPACE(sp, t0, tlen); + + return 0; + } + + /*------------------------------------------------------------*/ + + /* + * keyboard input entrypoint. + */ + + /* + * dirty cheat to pass SCR* to encoding conversion code inside db routines. + */ + static int keyinput_stateinit = 1; + + /* + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: void multi_keyinput_stateinit __P((SCR *)); + * PUBLIC: #endif + */ + void + multi_keyinput_resetstate(sp) + SCR *sp; + { + keyinput_stateinit = 1; + } + + /* + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: void multi_keyinput __P((SCR *, CHAR_T *, size_t *, CHAR_T *, size_t *, int *)); + * PUBLIC: #endif + */ + void + multi_keyinput(sp, kbuf, pkbuflen, intbuf, pintbuflen, pstate) + SCR *sp; + CHAR_T *kbuf; + size_t *pkbuflen; + CHAR_T *intbuf; + size_t *pintbuflen; + int *pstate; + { + size_t i; + size_t ilen; + ENCODING const *e; + size_t consumed; + + /* If we don't know which encoding to use, do nothing. */ + if (!sp) { + fail: memcpy(intbuf, kbuf, *pkbuflen); + *pintbuflen = *pkbuflen; + *pstate = 0; + return; + } + e = multi_findencoding(O_STR(sp, O_INPUTENCODING)); + + if (!e) + goto fail; + if (!e->keyinput) + goto fail; + + if (keyinput_stateinit) { + *pstate = 0; + keyinput_stateinit = 0; + } + + #ifdef CANNA + if (O_ISSET(sp, O_CANNA) + && kbuf[0] == O_STR(sp, O_CANNAKEY)[0]) { + if (canna_enabled(sp) && !canna_fenceactive(sp)) { + canna_force_off(sp); + + /* consume control-O. */ + memmove(kbuf, kbuf + 1, *pkbuflen - 1); + *pkbuflen = *pkbuflen - 1; + } else if (!canna_enabled(sp)) { + canna_force_on(sp); + + /* consume control-O. */ + memmove(kbuf, kbuf + 1, *pkbuflen - 1); + *pkbuflen = *pkbuflen - 1; + } + } + #endif + + #ifndef CANNA + (*e->keyinput)(sp, e, kbuf, *pkbuflen, intbuf, pintbuflen, + pstate, &consumed); + #else + if (canna_enabled(sp)) { + canna_keyinput(sp, e, kbuf, *pkbuflen, intbuf, pintbuflen, + pstate, &consumed); + } else { + (*e->keyinput)(sp, e, kbuf, *pkbuflen, intbuf, pintbuflen, + pstate, &consumed); + } + #endif /*CANNA*/ + if (consumed == 0) + ; /*nothing*/ + else if (consumed < *pkbuflen) { + memmove(kbuf, kbuf + consumed, *pkbuflen - consumed); + *pkbuflen = *pkbuflen - consumed; + } else + *pkbuflen = 0; + } + + /*------------------------------------------------------------*/ + + /* + * encoding type table manipulation. + */ + + /* + * Returns 1 if p holds the name of valid encoding type. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int multi_isencoding __P((const char *, int)); + * PUBLIC: #endif + */ + int + multi_isencoding(p, opt) + const char *p; + int opt; + { + size_t i; + + for (i = 0; encodingtab[i].name; i++) { + if (strcmp(p, encodingtab[i].name) == 0) { + switch (opt) { + case O_FILEENCODING: + if (encodingtab[i].toint + && encodingtab[i].fromint) + return 1; + break; + case O_DISPLAYENCODING: + return 1; + case O_INPUTENCODING: + if (encodingtab[i].keyinput) + return 1; + break; + } + return 0; + } + } + return 0; + } + + /* + * Returns pointer to the encoding table entry (ENCODING *) + * for the encoding type name held by p. + */ + static ENCODING const * + multi_findencoding(p) + const char *p; + { + size_t i; + size_t n; + char *pp; + + n = (pp = strchr(p, ';')) ? pp - p : 0; + for (i = 0; encodingtab[i].name; i++) { + if (strcmp(p, encodingtab[i].name) == 0) + return &encodingtab[i]; + if (n && strncmp(p, encodingtab[i].name, n) == 0 + && strlen(encodingtab[i].name) == n) + return &encodingtab[i]; + } + return NULL; + } + + /*------------------------------------------------------------*/ + + /* + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: void v_fep_on __P((SCR *)); + * PUBLIC: #endif + */ + void + v_fep_on(sp) + SCR *sp; + { + #ifdef CANNA + if (O_ISSET(sp, O_CANNA) && O_ISSET(sp, O_CANNACTRL)) + canna_on(sp); + #endif /*CANNA*/ + } + + /* + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: void v_fep_off __P((SCR *)); + * PUBLIC: #endif + */ + void + v_fep_off(sp) + SCR *sp; + { + #ifdef CANNA + if (O_ISSET(sp, O_CANNA) && O_ISSET(sp, O_CANNACTRL)) + canna_off(sp); + #endif /*CANNA*/ + } + + /* + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: void v_fep_force_off __P((SCR *)); + * PUBLIC: #endif + */ + void + v_fep_force_off(sp) + SCR *sp; + { + #ifdef CANNA + if (O_ISSET(sp, O_CANNA) && O_ISSET(sp, O_CANNACTRL)) + canna_force_off(sp); + #endif /*CANNA*/ + } + + #endif /*MULTIBYTE*/ + Index: common/multibyte.h *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/multibyte.h Wed Aug 20 16:33:35 1997 *************** *** 0 **** --- 1,224 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multibyte.h,v 1.11 1997/08/20 07:33:35 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + /* + * Misc entries that are publically available + */ + + /* + * check for various charsets. + */ + #define iseuckanji(c) (0xa1 <= (c) && (c) <= 0xfe) + #define issjiskanji1(c) ((0x81 <= (c) && (c) <= 0x9f) || (0xe0 <= (c) && (c) <= 0xfc)) + #define issjiskanji2(c) ((0x40 <= (c) && (c) <= 0x7e) || (0x80 <= (c) && (c) <= 0xfc)) + #define isjishankana(c) (0xa1 <= (c) && (c) <= 0xdf) + #define isbig5mb1(c) (0xa1 <= (c) && (c) <= 0xfe) + #define isbig5mb2(c) ((0x40 <= (c) && (c) <= 0x7e) || (0xa1 <= (c) && (c) <= 0xfe)) + + /* + * designation. + */ + #define isecma(c) (0x30 <= (c) && (c) <= 0x7f) + #define SO '\016' + #define SI '\017' + #define SS2 ((u_char)'\216') + #define SS3 ((u_char)'\217') + + /* + * local type declarations. + */ + enum _cstype { CS94, CS96, CS9494, CS9696 }; + typedef enum _cstype CSTYPE; + + struct _charset { + char *name; /* readable name */ + int blen; /* length in buffer including flagbyte */ + int len; /* width in appearance */ + + /* mostly generic */ + u_int (*chclass)(); /* function to get character class */ + enum _cstype type; /* size of charset: 94/96/94x94/96x96 */ + + /* specific to iso-2022-* */ + char enter; /* last char of designation */ + char version; /* version character */ + char oldstyle; /* old style: ESC $ x not ESC $ ( x */ + char western; /* western: need space between words */ + }; + typedef struct _charset CHARSET; + + struct _encoding { + char *name; + int (*toint)(); + int (*fromint)(); + void (*keyinput)(); + int (*display)(); + + /* for iso-2022-* and euc-* */ + CHAR_T initg0; + CHAR_T initg1; + CHAR_T initg2; + CHAR_T initg3; + + /* for iso-2022-* */ + int maxcharset; /* 1: G0 only 2: G0 and G1 ... */ + int maxside; /* 1: GL only 2: GL and GR */ + int shifttype; /* preferred shift type */ + #define S_SI 0x0001 /*0F*/ + #define S_SO 0x0002 /*0E*/ + #define S_LS0 0x0001 /*0F*/ + #define S_LS1 0x0002 /*0E*/ + #define S_LS2 0x0004 /*ESC n*/ + #define S_LS3 0x0008 /*ESC o*/ + #define S_SS2 0x0010 /*ESC N*/ + #define S_SS3 0x0020 /*ESC O*/ + #define S_LS1R 0x0200 /*ESC ~*/ + #define S_LS2R 0x0400 /*ESC }*/ + #define S_LS3R 0x0800 /*ESC |*/ + #define S_SS2R 0x1000 /*8E*/ + #define S_SS3R 0x2000 /*8F*/ + #define S_NONE 0x0000 + #define S_0 0x0001 + #define S_1 0x0202 + #define S_2 0x1414 + #define S_3 0x2828 + #define S_SEVEN_LOCK 0x000f + #define S_SEVEN_SINGLE 0x0030 + #define S_SEVEN 0x003f + #define S_EIGHT_LOCK 0x0e00 + #define S_EIGHT_SINGLE 0x3000 + #define S_EIGHT 0x3e00 + #define S_ALL 0x3e3f + #define S_EUC 0x3000 + int (*recommendation)(); + int flags; + #define E_SOLRESET 0x0001 /* reset designation at begin of line */ + #define E_EOLRESET 0x0002 /* reset designations at end of line */ + #define E_NOOLDSTYLE 0x0004 /* should use ESC $ ( B for ESC $ [@AB] */ + }; + typedef struct _encoding ENCODING; + + struct _iso2022state { + CHARSET const *charsets[4]; + int gl; + int gr; + }; + typedef struct _iso2022state ISO2022STATE; + + /* + * multibyte flags. + */ + #define MB_MULTIBYTE 0x01 /* conversion contains multibyte char */ + #define MB_SKIP 0x02 /* conversion contains unencodable char */ + #define MB_RAW 0x04 /* conversion ocntains raw binary char */ + #define MB_JOIN 0x08 /* should join the line to the next line */ + + /* + * global vars. + */ + /* multibyte.c */ + extern ENCODING const encodingtab[]; + extern CHARSET const charsettab[]; + + /* + * function prototypes. + * + * We don't provide "PUBLIC:" comments since they shouldn't be reachable from + * other functions. + */ + + /* multibyte.c */ + void multi_initstate __P((SCR *, ENCODING const *, ISO2022STATE *)); + + /* multi_chclass.c */ + u_int jis0208_chclass __P((CHAR_T *, u_int)); + u_int ksc5601_chclass __P((CHAR_T *, u_int)); + + /* multi_big5.c */ + int big5_to_int __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + int int_to_big5 __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + void big5_keyinput __P((SCR *, ENCODING const *, CHAR_T *, size_t, CHAR_T *, size_t *, int *, size_t *)); + int big5_display __P((SCR *, ENCODING const *, CHAR_T *, CHAR_T *)); + + /* multi_euc.c */ + #if 0 + int euc_to_int __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + int int_to_euc __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + #endif + int euc_recommendation __P((CHARSET const *, ENCODING const *)); + #if 0 + void euc_keyinput __P((SCR *, ENCODING const *, CHAR_T *, size_t, CHAR_T *, size_t *, int *, size_t *)); + #endif + int euc_display __P((SCR *, ENCODING const *, CHAR_T *, CHAR_T *)); + + /* multi_eucjp.c */ + #if 0 + int int_to_eucjp __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + #endif + int eucjp_display __P((SCR *, ENCODING const *, CHAR_T *, CHAR_T *)); + + /* multi_euctw.c */ + int euctw_to_int __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + int int_to_euctw __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + void euctw_keyinput __P((SCR *, ENCODING const *, CHAR_T *, size_t, CHAR_T *, size_t *, int *, size_t *)); + int euctw_display __P((SCR *, ENCODING const *, CHAR_T *, CHAR_T *)); + + /* multi_hz.c */ + int hz_to_int __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + int int_to_hz __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + + /* multi_iso2022.c */ + int iso2022_to_int __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + int int_to_iso2022 __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + int iso2022kr_to_int __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + int int_to_iso2022kr __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + int iso2022cn_recommendation __P((CHARSET const *, ENCODING const *)); + int iso2022jp_recommendation __P((CHARSET const *, ENCODING const *)); + int iso2022kr_recommendation __P((CHARSET const *, ENCODING const *)); + int ctext_recommendation __P((CHARSET const *, ENCODING const *)); + void iso2022_keyinput __P((SCR *, ENCODING const *, CHAR_T *, size_t, CHAR_T *, size_t *, int *, size_t *)); + + /* multi_none.c */ + int none_to_int __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + int int_to_none __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + void none_keyinput __P((SCR *, ENCODING const *, CHAR_T *, size_t, CHAR_T *, size_t *, int *, size_t *)); + + /* multi_sjis.c */ + int sjis_to_int __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + int int_to_sjis __P((SCR *, ENCODING const *, CHAR_T *, size_t *, CHAR_T *, size_t, int *, ISO2022STATE *)); + void sjis_keyinput __P((SCR *, ENCODING const *, CHAR_T *, size_t, CHAR_T *, size_t *, int *, size_t *)); + int sjis_display __P((SCR *, ENCODING const *, CHAR_T *, CHAR_T *)); + + /* multi_quail.c */ + void quail_keyinput __P((SCR *, ENCODING const *, CHAR_T *, size_t, CHAR_T *, size_t *, int *, size_t *)); + + #ifdef CANNA + /* multi_canna.c */ + void canna_keyinput __P((SCR *, ENCODING const *, CHAR_T *, size_t, CHAR_T *, size_t *, int *, size_t *)); + #endif + + /* + * Charset id. + */ + #define CS_NONE 0x00 + #define CS_INVALID 0x01 + #define CS_RAW(x) (CS_RAW0 <= (x) && (x) <= CS_RAW7) + #include "multibyte_def.h" + + #define MAX_MULTI_BLEN 3 + #define MAX_MULTI_LEN 7 + + #define ischarset(ch) (((ch) & 0x80) && ((ch) < CS_MAX)) + #define charset(ch) charsettab[(ch) & 0x7f] Index: common/options.c Prereq: 10.51 *** nvi-1.79/common/options.c Tue Oct 15 03:56:29 1996 --- nvi-1.79-m17n/common/options.c Thu Feb 20 00:40:55 1997 *************** *** 46,51 **** --- 46,57 ---- OPTLIST const optlist[] = { /* O_ALTWERASE 4.4BSD */ {"altwerase", f_altwerase, OPT_0BOOL, 0}, + /* O_AUTODETECT MULTIBYTE */ + #ifdef MULTIBYTE + {"autodetect", NULL, OPT_STR, 0}, + #else + {"autodetect", NULL, OPT_STR, OPT_NDISP|OPT_NOSAVE}, + #endif /* O_AUTOINDENT 4BSD */ {"autoindent", NULL, OPT_0BOOL, 0}, /* O_AUTOPRINT 4BSD */ *************** *** 56,61 **** --- 62,91 ---- {"backup", NULL, OPT_STR, 0}, /* O_BEAUTIFY 4BSD */ {"beautify", NULL, OPT_0BOOL, 0}, + /* O_CANNA CANNA */ + #ifdef CANNA + {"canna", f_canna, OPT_0BOOL, 0}, + #else + {"canna", NULL, OPT_0BOOL, OPT_NDISP|OPT_NOSAVE|OPT_NOSET}, + #endif + /* O_CANNACTRL CANNA */ + #ifdef CANNA + {"cannactrl", NULL, OPT_0BOOL, 0}, + #else + {"cannactrl", NULL, OPT_0BOOL, OPT_NDISP|OPT_NOSAVE|OPT_NOSET}, + #endif + /* O_CANNAKEY CANNA */ + #ifdef CANNA + {"cannakey", NULL, OPT_STR, 0}, + #else + {"cannakey", NULL, OPT_STR, OPT_NDISP|OPT_NOSAVE}, + #endif + /* O_CANNASERVER CANNA */ + #ifdef CANNA + {"cannaserver", f_cannaserver, OPT_STR, 0}, + #else + {"cannaserver", NULL, OPT_STR, OPT_NDISP|OPT_NOSAVE}, + #endif /* O_CDPATH 4.4BSD */ {"cdpath", NULL, OPT_STR, 0}, /* O_CEDIT 4.4BSD */ *************** *** 66,71 **** --- 96,107 ---- {"comment", NULL, OPT_0BOOL, 0}, /* O_DIRECTORY 4BSD */ {"directory", NULL, OPT_STR, 0}, + /* O_DISPLAYENCODING MULTIBYTE */ + #ifdef MULTIBYTE + {"displayencoding",f_displayencoding, OPT_STR, 0}, + #else + {"displayencoding",NULL, OPT_STR, OPT_NDISP|OPT_NOSAVE}, + #endif /* O_EDCOMPATIBLE 4BSD */ {"edcompatible",NULL, OPT_0BOOL, 0}, /* O_ESCAPETIME 4.4BSD */ *************** *** 76,83 **** --- 112,131 ---- {"exrc", NULL, OPT_0BOOL, 0}, /* O_EXTENDED 4.4BSD */ {"extended", f_recompile, OPT_0BOOL, 0}, + /* O_FEPKEY MULTIBYTE */ + #ifdef MULTIBYTE + {"fepkey", NULL, OPT_STR, 0}, + #else + {"fepkey", NULL, OPT_STR, OPT_NDISP|OPT_NOSAVE}, + #endif /* O_FILEC 4.4BSD */ {"filec", NULL, OPT_STR, 0}, + /* O_FILEENCODING MULTIBYTE */ + #ifdef MULTIBYTE + {"fileencoding",f_fileencoding, OPT_STR, 0}, + #else + {"fileencoding", NULL, OPT_STR, OPT_NDISP|OPT_NOSAVE}, + #endif /* O_FLASH HPUX */ {"flash", NULL, OPT_1BOOL, 0}, /* O_HARDTABS 4BSD */ *************** *** 86,91 **** --- 134,145 ---- {"iclower", f_recompile, OPT_0BOOL, 0}, /* O_IGNORECASE 4BSD */ {"ignorecase", f_recompile, OPT_0BOOL, 0}, + /* O_INPUTENCODING MULTIBYTE */ + #ifdef MULTIBYTE + {"inputencoding",f_inputencoding,OPT_STR, 0}, + #else + {"inputencoding", NULL, OPT_STR, OPT_NDISP|OPT_NOSAVE}, + #endif /* O_KEYTIME 4.4BSD */ {"keytime", NULL, OPT_NUM, 0}, /* O_LEFTRIGHT 4.4BSD */ *************** *** 173,178 **** --- 227,238 ---- {"showmode", NULL, OPT_0BOOL, 0}, /* O_SIDESCROLL 4.4BSD */ {"sidescroll", NULL, OPT_NUM, OPT_NOZERO}, + /* O_SKIPDISPLAY MULTIBYTE */ + #ifdef MULTIBYTE + {"skipdisplay", f_reformat, OPT_0BOOL, 0}, + #else + {"skipdisplay", f_reformat, OPT_0BOOL, OPT_NDISP|OPT_NOSAVE|OPT_NOSET}, + #endif /* O_SLOWOPEN 4BSD */ {"slowopen", NULL, OPT_0BOOL, 0}, /* O_SOURCEANY 4BSD (undocumented) *************** *** 235,251 **** --- 295,323 ---- } OABBREV; static OABBREV const abbrev[] = { + #ifdef MULTIBYTE + {"ad", O_AUTODETECT}, /* MULTIBYTE */ + #endif {"ai", O_AUTOINDENT}, /* 4BSD */ {"ap", O_AUTOPRINT}, /* 4BSD */ {"aw", O_AUTOWRITE}, /* 4BSD */ {"bf", O_BEAUTIFY}, /* 4BSD */ {"co", O_COLUMNS}, /* 4.4BSD */ {"dir", O_DIRECTORY}, /* 4BSD */ + #ifdef MULTIBYTE + {"de", O_DISPLAYENCODING}, /* MULTIBYTE */ + #endif {"eb", O_ERRORBELLS}, /* 4BSD */ {"ed", O_EDCOMPATIBLE}, /* 4BSD */ {"ex", O_EXRC}, /* System V (undocumented) */ + #ifdef MULTIBYTE + {"fe", O_FILEENCODING}, /* MULTIBYTE */ + #endif {"ht", O_HARDTABS}, /* 4BSD */ {"ic", O_IGNORECASE}, /* 4BSD */ + #ifdef MULTIBYTE + {"ie", O_INPUTENCODING}, /* MULTIBYTE */ + #endif {"li", O_LINES}, /* 4.4BSD */ {"modelines", O_MODELINE}, /* HPUX */ {"nu", O_NUMBER}, /* 4BSD */ *************** *** 254,259 **** --- 326,334 ---- {"re", O_REDRAW}, /* O'Reilly */ {"ro", O_READONLY}, /* 4BSD (undocumented) */ {"scr", O_SCROLL}, /* 4BSD (undocumented) */ + #ifdef MULTIBYTE + {"sd", O_SKIPDISPLAY}, /* MULTIBYTE */ + #endif {"sect", O_SECTIONS}, /* O'Reilly */ {"sh", O_SHELL}, /* 4BSD */ {"slow", O_SLOWOPEN}, /* 4BSD */ *************** *** 325,330 **** --- 400,418 ---- if (o_set(sp, O_SECURE, 0, NULL, GO_SECURE)) goto err; F_SET(&sp->opts[O_SECURE], OPT_GLOBAL); + #ifdef MULTIBYTE + if (o_set(sp, O_DISPLAYENCODING, 0, NULL, GO_DISPLAYENCODING)) + goto err; + F_SET(&sp->opts[O_DISPLAYENCODING], OPT_GLOBAL); + #endif /*MULTIBYTE*/ + #ifdef CANNA + if (o_set(sp, O_CANNA, 0, NULL, GO_CANNA)) + goto err; + F_SET(&sp->opts[O_CANNA], OPT_GLOBAL); + if (o_set(sp, O_CANNASERVER, 0, NULL, GO_CANNASERVER)) + goto err; + F_SET(&sp->opts[O_CANNASERVER], OPT_GLOBAL); + #endif /*CANNA*/ /* Initialize string values. */ (void)snprintf(b1, sizeof(b1), *************** *** 362,367 **** --- 450,470 ---- OI(O_TABSTOP, "tabstop=8"); (void)snprintf(b1, sizeof(b1), "tags=%s", _PATH_TAGS); OI(O_TAGS, b1); + #ifdef MULTIBYTE + OI(O_FEPKEY, "fepkey=/?aioAIO"); + (void)snprintf(b1, sizeof(b1), "autodetect=%s", "off"); + OI(O_FILEENCODING, b1); + (void)snprintf(b1, sizeof(b1), "displayencoding=%s", DEFAULT_ENCODING); + OI(O_DISPLAYENCODING, b1); + (void)snprintf(b1, sizeof(b1), "fileencoding=%s", DEFAULT_ENCODING); + OI(O_FILEENCODING, b1); + (void)snprintf(b1, sizeof(b1), "inputencoding=%s", DEFAULT_ENCODING); + OI(O_INPUTENCODING, b1); + #endif /*MULTIBYTE*/ + #ifdef CANNA + (void)snprintf(b1, sizeof(b1), "cannakey=%c", 'O' & 0x1f); + OI(O_CANNAKEY, b1); + #endif /* * XXX *************** *** 450,457 **** --- 553,567 ---- OPTLIST const *op; OPTION *spo; u_long value, turnoff; + #ifndef MULTIBYTE int ch, equals, nf, nf2, offset, qmark, rval; char *endp, *name, *p, *sep, *t; + #else + CHAR_T ch; + int equals, nf, nf2, offset, qmark, rval; + char *name, *p, *t; + CHAR_T *endp, *sep; + #endif disp = NO_DISPLAY; for (rval = 0; argv[0]->len != 0; ++argv) { Index: common/options_f.c Prereq: 10.25 *** nvi-1.79/common/options_f.c Sat Jul 13 07:23:37 1996 --- nvi-1.79-m17n/common/options_f.c Sun Feb 2 04:18:00 1997 *************** *** 365,367 **** --- 365,516 ---- *valp = 1; return (0); } + + #ifdef MULTIBYTE + /* + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int f_fileencoding __P((SCR *, OPTION *, char *, u_long *)); + * PUBLIC: #endif + */ + int + f_fileencoding(sp, op, str, valp) + SCR *sp; + OPTION *op; + char *str; + u_long *valp; + { + int nf, nf2; + char *p, *t; + char keep; + size_t len; + + if (multi_isencoding(str, O_FILEENCODING)) + return 0; + + p = msg_print(sp, "fileencoding", &nf); + t = msg_print(sp, "illegal value", &nf2); + msgq(sp, M_ERR, "036|set: %s option: %s", p, t); + if (nf) + FREE_SPACE(sp, p, 0); + if (nf2) + FREE_SPACE(sp, t, 0); + return 1; + } + + /* + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int f_displayencoding __P((SCR *, OPTION *, char *, u_long *)); + * PUBLIC: #endif + */ + int + f_displayencoding(sp, op, str, valp) + SCR *sp; + OPTION *op; + char *str; + u_long *valp; + { + int nf, nf2; + char *p, *t; + + if (multi_isencoding(str, O_DISPLAYENCODING)) { + /* + * We need to redraw the entire screen. + */ + F_SET(sp, SC_SCR_REFORMAT); + return 0; + } + + p = msg_print(sp, "displayencoding", &nf); + t = msg_print(sp, "illegal value", &nf2); + msgq(sp, M_ERR, "036|set: %s option: %s", p, t); + if (nf) + FREE_SPACE(sp, p, 0); + if (nf2) + FREE_SPACE(sp, t, 0); + return 1; + } + + /* + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int f_inputencoding __P((SCR *, OPTION *, char *, u_long *)); + * PUBLIC: #endif + */ + int + f_inputencoding(sp, op, str, valp) + SCR *sp; + OPTION *op; + char *str; + u_long *valp; + { + int nf, nf2; + char *p, *t; + + if (multi_isencoding(str, O_INPUTENCODING)) { + multi_keyinput_resetstate(sp); + return 0; + } + + p = msg_print(sp, "inputencoding", &nf); + t = msg_print(sp, "illegal value", &nf2); + msgq(sp, M_ERR, "036|set: %s option: %s", p, t); + if (nf) + FREE_SPACE(sp, p, 0); + if (nf2) + FREE_SPACE(sp, t, 0); + return 1; + } + #endif /*MULTIBYTE*/ + + #ifdef CANNA + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: int f_canna __P((SCR *, OPTION *, char *, u_long *)); + * PUBLIC: #endif + */ + int + f_canna(sp, op, str, valp) + SCR *sp; + OPTION *op; + char *str; + u_long *valp; + { + int nf, nf2; + char *p, *t; + + /* + * Note that *valp means "turning off". + */ + if (!*valp) { + if (canna_init(sp)) + goto err; + } else + canna_end(sp); + return 0; + + err:; + p = msg_print(sp, "canna", &nf); + t = msg_print(sp, "canna not available", &nf2); + msgq(sp, M_ERR, "036|set: %s option: %s", p, t); + if (nf) + FREE_SPACE(sp, p, 0); + if (nf2) + FREE_SPACE(sp, t, 0); + return 1; + } + + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: int f_cannaserver __P((SCR *, OPTION *, char *, u_long *)); + * PUBLIC: #endif + */ + int + f_cannaserver(sp, op, str, valp) + SCR *sp; + OPTION *op; + char *str; + u_long *valp; + { + canna_setserver(sp, str); + return 0; + } + #endif /*CANNA*/ Index: common/put.c Prereq: 10.11 *** nvi-1.79/common/put.c Tue Sep 24 08:34:18 1996 --- nvi-1.79-m17n/common/put.c Fri Feb 21 23:06:33 1997 *************** *** 45,50 **** --- 45,53 ---- size_t blen, clen, len; int rval; char *bp, *p, *t; + #ifdef MULTIBYTE + CHAR_T *p0; + #endif if (cbp == NULL) if (namep == NULL) { *************** *** 119,130 **** lno = cp->lno; if (db_get(sp, lno, DBG_FATAL, &p, &len)) return (1); GET_SPACE_RET(sp, bp, blen, tp->len + len + 1); t = bp; /* Original line, left of the split. */ ! if (len > 0 && (clen = cp->cno + (append ? 1 : 0)) > 0) { memcpy(bp, p, clen); p += clen; t += clen; --- 122,141 ---- lno = cp->lno; if (db_get(sp, lno, DBG_FATAL, &p, &len)) return (1); + #ifdef MULTIBYTE + p0 = p; + #endif GET_SPACE_RET(sp, bp, blen, tp->len + len + 1); t = bp; /* Original line, left of the split. */ ! #ifndef MULTIBYTE ! if (len > 0 && (clen = cp->cno + (append ? 1 : 0)) > 0) ! #else ! if (len > 0 && (clen = cp->cno + (append ? KEY_BLEN(sp, p0[cp->cno]) : 0)) > 0) ! #endif ! { memcpy(bp, p, clen); p += clen; t += clen; *************** *** 137,143 **** --- 148,158 ---- } /* Calculate length left in the original line. */ + #ifndef MULTIBYTE clen = len == 0 ? 0 : len - (cp->cno + (append ? 1 : 0)); + #else + clen = len == 0 ? 0 : len - (cp->cno + (append ? KEY_BLEN(sp, p0[cp->cno]) : 0)); + #endif /* * !!! *************** *** 153,159 **** --- 168,178 ---- * behavior, and expect POSIX.2 to do so as well. */ rp->lno = lno; + #ifndef MULTIBYTE rp->cno = len == 0 ? 0 : sp->cno + (append && tp->len ? 1 : 0); + #else + rp->cno = len == 0 ? 0 : sp->cno + (append && tp->len ? KEY_BLEN(sp, p0[sp->cno]) : 0); + #endif /* * If no more lines in the CB, append the rest of the original Index: common/screen.h Prereq: 10.24 *** nvi-1.79/common/screen.h Wed Oct 23 22:31:07 1996 --- nvi-1.79-m17n/common/screen.h Fri Feb 21 22:59:27 1997 *************** *** 119,130 **** --- 119,142 ---- /* Ex/vi: RE information. */ dir_t searchdir; /* Last file search direction. */ regex_t re_c; /* Search RE: compiled form. */ + #ifndef MULTIBYTE char *re; /* Search RE: uncompiled form. */ + #else + CHAR_T *re; /* Search RE: uncompiled form. */ + #endif size_t re_len; /* Search RE: uncompiled length. */ regex_t subre_c; /* Substitute RE: compiled form. */ + #ifndef MULTIBYTE char *subre; /* Substitute RE: uncompiled form. */ + #else + CHAR_T *subre; /* Substitute RE: uncompiled form. */ + #endif size_t subre_len; /* Substitute RE: uncompiled length). */ + #ifndef MULTIBYTE char *repl; /* Substitute replacement. */ + #else + CHAR_T *repl; /* Substitute replacement. */ + #endif size_t repl_len; /* Substitute replacement length.*/ size_t *newl; /* Newline offset array. */ size_t newl_len; /* Newline array size. */ Index: common/search.c Prereq: 10.25 *** nvi-1.79/common/search.c Mon Jul 1 05:12:50 1996 --- nvi-1.79-m17n/common/search.c Fri Feb 21 23:07:12 1997 *************** *** 46,52 **** --- 46,57 ---- { recno_t lno; int delim; + #ifndef MULTIBYTE char *p, *t; + #else + char *t; + CHAR_T *p; + #endif /* If the file is empty, it's a fast search. */ if (sp->lno <= 1) { *************** *** 114,119 **** --- 119,137 ---- ++p; --plen; } + #ifdef MULTIBYTE + { + size_t advance; + + if (1 < (advance = KEY_BLEN(sp, *p))) { + advance--; + while (advance--) { + *t++ = *p++; + plen--; + } + } + } + #endif /*MULTIBYTE*/ } if (epp != NULL) *epp = p; *************** *** 156,162 **** --- 174,184 ---- regmatch_t match[1]; size_t coff, len; int cnt, eval, rval, wrapped; + #ifndef MULTIBYTE char *l; + #else + CHAR_T *l; + #endif if (search_init(sp, FORWARD, ptrn, plen, eptrn, flags)) return (1); *************** *** 195,202 **** } lno = 1; } ! } else coff = fm->cno + 1; } btype = BUSY_ON; --- 217,229 ---- } lno = 1; } ! } else { ! #ifndef MULTIBYTE coff = fm->cno + 1; + #else + coff = fm->cno + KEY_BLEN(sp, l[fm->cno]); + #endif + } } btype = BUSY_ON; *************** *** 268,275 **** * "c?$"). Not all that sure this gets it right, there * are lots of strange cases. */ ! if (!LF_ISSET(SEARCH_EOL) && rm->cno >= len) rm->cno = len != 0 ? len - 1 : 0; rval = 0; break; --- 295,309 ---- * "c?$"). Not all that sure this gets it right, there * are lots of strange cases. */ ! if (!LF_ISSET(SEARCH_EOL) && rm->cno >= len) { ! #ifndef MULTIBYTE rm->cno = len != 0 ? len - 1 : 0; + #else + rm->cno = len != 0 + ? len - multi_back(sp, l, &l[len]) + : 0; + #endif /*MULTIBYTE*/ + } rval = 0; break; *************** *** 318,323 **** --- 352,360 ---- if (LF_ISSET(SEARCH_INCR)) { lno = fm->lno; coff = fm->cno + 1; + #ifdef MULTIBYTE + /* the statement is multibyte safe. (see the comment above) */ + #endif } else { if (fm->cno == 0) { if (fm->lno == 1 && !O_ISSET(sp, O_WRAPSCAN)) { *************** *** 429,437 **** rm->lno = lno; /* See comment in f_search(). */ ! if (!LF_ISSET(SEARCH_EOL) && last >= len) rm->cno = len != 0 ? len - 1 : 0; ! else rm->cno = last; rval = 0; break; --- 466,479 ---- rm->lno = lno; /* See comment in f_search(). */ ! if (!LF_ISSET(SEARCH_EOL) && last >= len) { ! #ifndef MULTIBYTE rm->cno = len != 0 ? len - 1 : 0; ! #else ! rm->cno = len != 0 ! ? len - multi_back(sp, l, &l[len]) : 0; ! #endif /*MULTIBYTE*/ ! } else rm->cno = last; rval = 0; break; Index: common/seq.c Prereq: 10.10 *** nvi-1.79/common/seq.c Sun Apr 28 00:25:59 1996 --- nvi-1.79-m17n/common/seq.c Thu Feb 20 00:41:29 1997 *************** *** 342,348 **** --- 342,352 ---- CHAR_T *p; SEQ *qp; size_t olen; + #ifndef MULTIBYTE int ch; + #else + CHAR_T ch; + #endif /* Write a sequence command for all keys the user defined. */ for (qp = sp->gp->seqq.lh_first; qp != NULL; qp = qp->q.le_next) { Index: common/test/multi_quail.c *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/common/test/multi_quail.c Mon Feb 17 23:34:53 1997 *************** *** 0 **** --- 1,2751 ---- + /* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multibyte.c,v 1.1 1996/12/30 13:51:21 itojun Exp $ + * + * Freely redistributable, reusable, unless otherwise noted in accompanying + * document. (for example, redistribution is prohibited during alpha-test + * period) + * Absolutely no warranty. + * + * The code is based on: + * jelvis japanization patch by Jun-ichiro Itoh + * nvi 1.03 japanization patch by Yoshitaka Tokugawa + */ + + #include "config.h" + + #ifdef MULTIBYTE + + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + + #include "../common/common.h" + #include "multibyte.h" + + struct _dict { + char *name; + CHAR_T charset; + char *str; + }; + typedef struct _dict DICT; + + static DICT quaildict[] = { + #if 0 + /*hangul*/ + { "r", CS_KSC5601, "$!" }, + { "s", CS_KSC5601, "$$" }, + { "e", CS_KSC5601, "$\'" }, + { "f", CS_KSC5601, "$)" }, + { "a", CS_KSC5601, "$1" }, + { "q", CS_KSC5601, "$2" }, + { "t", CS_KSC5601, "$5" }, + { "d", CS_KSC5601, "$7" }, + { "w", CS_KSC5601, "$8" }, + { "c", CS_KSC5601, "$:" }, + { "z", CS_KSC5601, "$;" }, + { "x", CS_KSC5601, "$<" }, + { "v", CS_KSC5601, "$=" }, + { "g", CS_KSC5601, "$>" }, + + { "R", CS_KSC5601, "$\"" }, + { "E", CS_KSC5601, "$(" }, + { "Q", CS_KSC5601, "$3" }, + { "W", CS_KSC5601, "$9" }, + { "T", CS_KSC5601, "$6" }, + { "P", CS_KSC5601, "$F" }, + + { "k", CS_KSC5601, "$?" }, + { "i", CS_KSC5601, "$A" }, + { "j", CS_KSC5601, "$C" }, + { "p", CS_KSC5601, "$D" }, + { "u", CS_KSC5601, "$E" }, + { "h", CS_KSC5601, "$G" }, + { "y", CS_KSC5601, "$K" }, + { "n", CS_KSC5601, "$L" }, + { "b", CS_KSC5601, "$P" }, + { "m", CS_KSC5601, "$Q" }, + { "l", CS_KSC5601, "$S" }, + { "o", CS_KSC5601, "$@" }, + { "O", CS_KSC5601, "@g" }, + + { "rk", CS_KSC5601, "0!" }, + { "rkr", CS_KSC5601, "0\"" }, + { "rks", CS_KSC5601, "0#" }, + { "rke", CS_KSC5601, "0$" }, + { "rkf", CS_KSC5601, "0%" }, + { "rkfr", CS_KSC5601, "0&" }, + { "rkfa", CS_KSC5601, "0\'" }, + { "rka", CS_KSC5601, "0(" }, + { "rkq", CS_KSC5601, "0)" }, + { "rkqt", CS_KSC5601, "0*" }, + { "rkt", CS_KSC5601, "0+" }, + { "rkT", CS_KSC5601, "0," }, + { "rkd", CS_KSC5601, "0-" }, + { "rkw", CS_KSC5601, "0." }, + { "rkc", CS_KSC5601, "0/" }, + { "rkx", CS_KSC5601, "00" }, + { "rkv", CS_KSC5601, "01" }, + { "rkg", CS_KSC5601, "02" }, + { "ro", CS_KSC5601, "03" }, + { "ror", CS_KSC5601, "04" }, + { "ros", CS_KSC5601, "05" }, + { "rof", CS_KSC5601, "06" }, + { "roa", CS_KSC5601, "07" }, + { "roq", CS_KSC5601, "08" }, + { "rot", CS_KSC5601, "09" }, + { "roT", CS_KSC5601, "0:" }, + { "rod", CS_KSC5601, "0;" }, + { "ri", CS_KSC5601, "0<" }, + { "rir", CS_KSC5601, "0=" }, + { "ris", CS_KSC5601, "0>" }, + { "rif", CS_KSC5601, "0?" }, + { "rit", CS_KSC5601, "0@" }, + { "rid", CS_KSC5601, "0A" }, + { "rO", CS_KSC5601, "0B" }, + { "rOs", CS_KSC5601, "0C" }, + { "rOf", CS_KSC5601, "0D" }, + { "rj", CS_KSC5601, "0E" }, + { "rjr", CS_KSC5601, "0F" }, + { "rjs", CS_KSC5601, "0G" }, + { "rje", CS_KSC5601, "0H" }, + { "rjf", CS_KSC5601, "0I" }, + { "rjfa", CS_KSC5601, "0J" }, + { "rja", CS_KSC5601, "0K" }, + { "rjq", CS_KSC5601, "0L" }, + { "rjt", CS_KSC5601, "0M" }, + { "rjT", CS_KSC5601, "0N" }, + { "rjd", CS_KSC5601, "0O" }, + { "rjw", CS_KSC5601, "0P" }, + { "rjx", CS_KSC5601, "0Q" }, + { "rjv", CS_KSC5601, "0R" }, + { "rjg", CS_KSC5601, "0S" }, + { "rp", CS_KSC5601, "0T" }, + { "rps", CS_KSC5601, "0U" }, + { "rpf", CS_KSC5601, "0V" }, + { "rpa", CS_KSC5601, "0W" }, + { "rpq", CS_KSC5601, "0X" }, + { "rpt", CS_KSC5601, "0Y" }, + { "rpd", CS_KSC5601, "0[" }, + { "rpT", CS_KSC5601, "0Z" }, + { "ru", CS_KSC5601, "0\\" }, + { "rur", CS_KSC5601, "0]" }, + { "ruR", CS_KSC5601, "0^" }, + { "rus", CS_KSC5601, "0_" }, + { "rue", CS_KSC5601, "0`" }, + { "ruf", CS_KSC5601, "0a" }, + { "rua", CS_KSC5601, "0b" }, + { "ruq", CS_KSC5601, "0c" }, + { "rut", CS_KSC5601, "0d" }, + { "ruT", CS_KSC5601, "0e" }, + { "rud", CS_KSC5601, "0f" }, + { "rux", CS_KSC5601, "0g" }, + { "rP", CS_KSC5601, "0h" }, + { "rPs", CS_KSC5601, "0i" }, + { "rPf", CS_KSC5601, "0j" }, + { "rPq", CS_KSC5601, "0k" }, + { "rPt", CS_KSC5601, "0l" }, + { "rh", CS_KSC5601, "0m" }, + { "rhr", CS_KSC5601, "0n" }, + { "rhs", CS_KSC5601, "0o" }, + { "rhe", CS_KSC5601, "0p" }, + { "rhf", CS_KSC5601, "0q" }, + { "rhfa", CS_KSC5601, "0r" }, + { "rhft", CS_KSC5601, "0s" }, + { "rhfg", CS_KSC5601, "0t" }, + { "rha", CS_KSC5601, "0u" }, + { "rhq", CS_KSC5601, "0v" }, + { "rht", CS_KSC5601, "0w" }, + { "rhd", CS_KSC5601, "0x" }, + { "rhw", CS_KSC5601, "0y" }, + { "rhk", CS_KSC5601, "0z" }, + { "rhkr", CS_KSC5601, "0{" }, + { "rhks", CS_KSC5601, "0|" }, + { "rhkf", CS_KSC5601, "0}" }, + { "rhkfa", CS_KSC5601, "0~" }, + { "rhka", CS_KSC5601, "1!" }, + { "rhkq", CS_KSC5601, "1\"" }, + { "rhkt", CS_KSC5601, "1#" }, + { "rhkd", CS_KSC5601, "1$" }, + { "rho", CS_KSC5601, "1%" }, + { "rhos", CS_KSC5601, "1&" }, + { "rhof", CS_KSC5601, "1\'" }, + { "rhoq", CS_KSC5601, "1(" }, + { "rhoT", CS_KSC5601, "1)" }, + { "rhod", CS_KSC5601, "1*" }, + { "rhl", CS_KSC5601, "1+" }, + { "rhlr", CS_KSC5601, "1," }, + { "rhls", CS_KSC5601, "1-" }, + { "rhlf", CS_KSC5601, "1." }, + { "rhla", CS_KSC5601, "1/" }, + { "rhlq", CS_KSC5601, "10" }, + { "rhlt", CS_KSC5601, "11" }, + { "rhld", CS_KSC5601, "12" }, + { "ry", CS_KSC5601, "13" }, + { "rys", CS_KSC5601, "14" }, + { "ryf", CS_KSC5601, "15" }, + { "ryq", CS_KSC5601, "16" }, + { "ryt", CS_KSC5601, "17" }, + { "rn", CS_KSC5601, "18" }, + { "rnr", CS_KSC5601, "19" }, + { "rns", CS_KSC5601, "1:" }, + { "rne", CS_KSC5601, "1;" }, + { "rnf", CS_KSC5601, "1<" }, + { "rnfr", CS_KSC5601, "1=" }, + { "rnfa", CS_KSC5601, "1>" }, + { "rnfg", CS_KSC5601, "1?" }, + { "rna", CS_KSC5601, "1@" }, + { "rnq", CS_KSC5601, "1A" }, + { "rnt", CS_KSC5601, "1B" }, + { "rnd", CS_KSC5601, "1C" }, + { "rnw", CS_KSC5601, "1D" }, + { "rnj", CS_KSC5601, "1E" }, + { "rnjr", CS_KSC5601, "1F" }, + { "rnjs", CS_KSC5601, "1G" }, + { "rnjf", CS_KSC5601, "1H" }, + { "rnjT", CS_KSC5601, "1I" }, + { "rnjd", CS_KSC5601, "1J" }, + { "rnp", CS_KSC5601, "1K" }, + { "rnpt", CS_KSC5601, "1L" }, + { "rnl", CS_KSC5601, "1M" }, + { "rnlr", CS_KSC5601, "1N" }, + { "rnls", CS_KSC5601, "1O" }, + { "rnlf", CS_KSC5601, "1P" }, + { "rnla", CS_KSC5601, "1Q" }, + { "rnlq", CS_KSC5601, "1R" }, + { "rnlt", CS_KSC5601, "1S" }, + { "rb", CS_KSC5601, "1T" }, + { "rbs", CS_KSC5601, "1U" }, + { "rbf", CS_KSC5601, "1V" }, + { "rm", CS_KSC5601, "1W" }, + { "rmr", CS_KSC5601, "1X" }, + { "rms", CS_KSC5601, "1Y" }, + { "rme", CS_KSC5601, "1Z" }, + { "rmf", CS_KSC5601, "1[" }, + { "rmfr", CS_KSC5601, "1\\" }, + { "rma", CS_KSC5601, "1]" }, + { "rmq", CS_KSC5601, "1^" }, + { "rmt", CS_KSC5601, "1_" }, + { "rmd", CS_KSC5601, "1`" }, + { "rml", CS_KSC5601, "1a" }, + { "rl", CS_KSC5601, "1b" }, + { "rlr", CS_KSC5601, "1c" }, + { "rls", CS_KSC5601, "1d" }, + { "rle", CS_KSC5601, "1e" }, + { "rlf", CS_KSC5601, "1f" }, + { "rlfa", CS_KSC5601, "1g" }, + { "rla", CS_KSC5601, "1h" }, + { "rlq", CS_KSC5601, "1i" }, + { "rlt", CS_KSC5601, "1j" }, + { "rld", CS_KSC5601, "1k" }, + { "rlw", CS_KSC5601, "1l" }, + { "rlv", CS_KSC5601, "1m" }, + { "Rk", CS_KSC5601, "1n" }, + { "Rkr", CS_KSC5601, "1o" }, + { "RkR", CS_KSC5601, "1p" }, + { "Rks", CS_KSC5601, "1q" }, + { "Rkf", CS_KSC5601, "1r" }, + { "Rkfa", CS_KSC5601, "1s" }, + { "Rka", CS_KSC5601, "1t" }, + { "Rkq", CS_KSC5601, "1u" }, + { "Rkt", CS_KSC5601, "1v" }, + { "RkT", CS_KSC5601, "1w" }, + { "Rkd", CS_KSC5601, "1x" }, + { "Rkx", CS_KSC5601, "1y" }, + { "Ro", CS_KSC5601, "1z" }, + { "Ror", CS_KSC5601, "1{" }, + { "Ros", CS_KSC5601, "1|" }, + { "Rof", CS_KSC5601, "1}" }, + { "Roa", CS_KSC5601, "1~" }, + { "Roq", CS_KSC5601, "2!" }, + { "Rot", CS_KSC5601, "2\"" }, + { "RoT", CS_KSC5601, "2#" }, + { "Rod", CS_KSC5601, "2$" }, + { "Ri", CS_KSC5601, "2%" }, + { "Rir", CS_KSC5601, "2&" }, + { "Rif", CS_KSC5601, "2\'" }, + { "Rj", CS_KSC5601, "2(" }, + { "Rjr", CS_KSC5601, "2)" }, + { "RjR", CS_KSC5601, "2*" }, + { "Rjs", CS_KSC5601, "2+" }, + { "Rjf", CS_KSC5601, "2," }, + { "Rja", CS_KSC5601, "2-" }, + { "Rjq", CS_KSC5601, "2." }, + { "Rjt", CS_KSC5601, "2/" }, + { "RjT", CS_KSC5601, "20" }, + { "Rjd", CS_KSC5601, "21" }, + { "Rp", CS_KSC5601, "22" }, + { "Rpr", CS_KSC5601, "23" }, + { "Rps", CS_KSC5601, "24" }, + { "Rpa", CS_KSC5601, "25" }, + { "Rpt", CS_KSC5601, "26" }, + { "Rpd", CS_KSC5601, "27" }, + { "Ru", CS_KSC5601, "28" }, + { "Rus", CS_KSC5601, "29" }, + { "Ruf", CS_KSC5601, "2:" }, + { "Rut", CS_KSC5601, "2;" }, + { "RuT", CS_KSC5601, "2<" }, + { "Rux", CS_KSC5601, "2=" }, + { "RP", CS_KSC5601, "2>" }, + { "Rh", CS_KSC5601, "2?" }, + { "Rhr", CS_KSC5601, "2@" }, + { "Rhs", CS_KSC5601, "2A" }, + { "Rhsg", CS_KSC5601, "2B" }, + { "Rhf", CS_KSC5601, "2C" }, + { "Rha", CS_KSC5601, "2D" }, + { "Rhq", CS_KSC5601, "2E" }, + { "Rht", CS_KSC5601, "2F" }, + { "Rhd", CS_KSC5601, "2G" }, + { "Rhw", CS_KSC5601, "2H" }, + { "Rhc", CS_KSC5601, "2I" }, + { "Rhk", CS_KSC5601, "2J" }, + { "Rhkr", CS_KSC5601, "2K" }, + { "Rhkf", CS_KSC5601, "2L" }, + { "RhkT", CS_KSC5601, "2M" }, + { "Rhkd", CS_KSC5601, "2N" }, + { "Rho", CS_KSC5601, "2O" }, + { "Rhor", CS_KSC5601, "2P" }, + { "Rhod", CS_KSC5601, "2Q" }, + { "Rhl", CS_KSC5601, "2R" }, + { "Rhls", CS_KSC5601, "2S" }, + { "Rhlf", CS_KSC5601, "2T" }, + { "Rhla", CS_KSC5601, "2U" }, + { "Rhlq", CS_KSC5601, "2V" }, + { "Rhld", CS_KSC5601, "2W" }, + { "Ry", CS_KSC5601, "2X" }, + { "Rn", CS_KSC5601, "2Y" }, + { "Rnr", CS_KSC5601, "2Z" }, + { "Rns", CS_KSC5601, "2[" }, + { "Rnf", CS_KSC5601, "2\\" }, + { "Rnfg", CS_KSC5601, "2]" }, + { "Rna", CS_KSC5601, "2^" }, + { "Rnq", CS_KSC5601, "2_" }, + { "Rnt", CS_KSC5601, "2`" }, + { "Rnd", CS_KSC5601, "2a" }, + { "Rnw", CS_KSC5601, "2b" }, + { "Rnj", CS_KSC5601, "2c" }, + { "Rnjf", CS_KSC5601, "2d" }, + { "RnjT", CS_KSC5601, "2e" }, + { "Rnjd", CS_KSC5601, "2f" }, + { "Rnp", CS_KSC5601, "2g" }, + { "Rnpr", CS_KSC5601, "2h" }, + { "Rnps", CS_KSC5601, "2i" }, + { "Rnpf", CS_KSC5601, "2j" }, + { "Rnpa", CS_KSC5601, "2k" }, + { "Rnpq", CS_KSC5601, "2l" }, + { "RnpT", CS_KSC5601, "2m" }, + { "Rnl", CS_KSC5601, "2n" }, + { "Rnls", CS_KSC5601, "2o" }, + { "Rnlf", CS_KSC5601, "2p" }, + { "Rnla", CS_KSC5601, "2q" }, + { "Rnlq", CS_KSC5601, "2r" }, + { "Rb", CS_KSC5601, "2s" }, + { "Rm", CS_KSC5601, "2t" }, + { "Rmr", CS_KSC5601, "2u" }, + { "Rms", CS_KSC5601, "2v" }, + { "Rmsg", CS_KSC5601, "2w" }, + { "Rmf", CS_KSC5601, "2x" }, + { "Rmfa", CS_KSC5601, "2y" }, + { "Rmfg", CS_KSC5601, "2z" }, + { "Rma", CS_KSC5601, "2{" }, + { "Rmq", CS_KSC5601, "2|" }, + { "Rmt", CS_KSC5601, "2}" }, + { "Rmd", CS_KSC5601, "2~" }, + { "Rmx", CS_KSC5601, "3!" }, + { "Rl", CS_KSC5601, "3\"" }, + { "Rlr", CS_KSC5601, "3#" }, + { "Rls", CS_KSC5601, "3$" }, + { "Rlf", CS_KSC5601, "3%" }, + { "Rla", CS_KSC5601, "3&" }, + { "Rlq", CS_KSC5601, "3\'" }, + { "Rlt", CS_KSC5601, "3(" }, + { "Rld", CS_KSC5601, "3)" }, + { "sk", CS_KSC5601, "3*" }, + { "skr", CS_KSC5601, "3+" }, + { "skR", CS_KSC5601, "3," }, + { "sks", CS_KSC5601, "3-" }, + { "ske", CS_KSC5601, "3." }, + { "skf", CS_KSC5601, "3/" }, + { "skfr", CS_KSC5601, "30" }, + { "skfa", CS_KSC5601, "31" }, + { "ska", CS_KSC5601, "32" }, + { "skq", CS_KSC5601, "33" }, + { "skt", CS_KSC5601, "34" }, + { "skT", CS_KSC5601, "35" }, + { "skd", CS_KSC5601, "36" }, + { "skw", CS_KSC5601, "37" }, + { "skc", CS_KSC5601, "38" }, + { "skx", CS_KSC5601, "39" }, + { "skg", CS_KSC5601, "3:" }, + { "so", CS_KSC5601, "3;" }, + { "sor", CS_KSC5601, "3<" }, + { "sos", CS_KSC5601, "3=" }, + { "sof", CS_KSC5601, "3>" }, + { "soa", CS_KSC5601, "3?" }, + { "soq", CS_KSC5601, "3@" }, + { "sot", CS_KSC5601, "3A" }, + { "soT", CS_KSC5601, "3B" }, + { "sod", CS_KSC5601, "3C" }, + { "si", CS_KSC5601, "3D" }, + { "sir", CS_KSC5601, "3E" }, + { "sis", CS_KSC5601, "3F" }, + { "sif", CS_KSC5601, "3G" }, + { "sia", CS_KSC5601, "3H" }, + { "sid", CS_KSC5601, "3I" }, + { "sj", CS_KSC5601, "3J" }, + { "sjr", CS_KSC5601, "3K" }, + { "sjrt", CS_KSC5601, "3L" }, + { "sjs", CS_KSC5601, "3M" }, + { "sjf", CS_KSC5601, "3N" }, + { "sjfa", CS_KSC5601, "3O" }, + { "sjfq", CS_KSC5601, "3P" }, + { "sja", CS_KSC5601, "3Q" }, + { "sjq", CS_KSC5601, "3R" }, + { "sjt", CS_KSC5601, "3S" }, + { "sjT", CS_KSC5601, "3T" }, + { "sjd", CS_KSC5601, "3U" }, + { "sjg", CS_KSC5601, "3V" }, + { "sp", CS_KSC5601, "3W" }, + { "spr", CS_KSC5601, "3X" }, + { "sps", CS_KSC5601, "3Y" }, + { "spf", CS_KSC5601, "3Z" }, + { "spa", CS_KSC5601, "3[" }, + { "spq", CS_KSC5601, "3\\" }, + { "spt", CS_KSC5601, "3]" }, + { "spT", CS_KSC5601, "3^" }, + { "spd", CS_KSC5601, "3_" }, + { "su", CS_KSC5601, "3`" }, + { "sur", CS_KSC5601, "3a" }, + { "sus", CS_KSC5601, "3b" }, + { "suf", CS_KSC5601, "3c" }, + { "sua", CS_KSC5601, "3d" }, + { "suq", CS_KSC5601, "3e" }, + { "suT", CS_KSC5601, "3f" }, + { "sud", CS_KSC5601, "3g" }, + { "suz", CS_KSC5601, "3h" }, + { "sP", CS_KSC5601, "3i" }, + { "sPs", CS_KSC5601, "3j" }, + { "sh", CS_KSC5601, "3k" }, + { "shr", CS_KSC5601, "3l" }, + { "shs", CS_KSC5601, "3m" }, + { "shf", CS_KSC5601, "3n" }, + { "shfa", CS_KSC5601, "3o" }, + { "sha", CS_KSC5601, "3p" }, + { "shq", CS_KSC5601, "3q" }, + { "sht", CS_KSC5601, "3r" }, + { "shd", CS_KSC5601, "3s" }, + { "shv", CS_KSC5601, "3t" }, + { "shg", CS_KSC5601, "3u" }, + { "shk", CS_KSC5601, "3v" }, + { "shks", CS_KSC5601, "3w" }, + { "shkf", CS_KSC5601, "3x" }, + { "shkT", CS_KSC5601, "3y" }, + { "shl", CS_KSC5601, "3z" }, + { "shls", CS_KSC5601, "3{" }, + { "shlf", CS_KSC5601, "3|" }, + { "shla", CS_KSC5601, "3}" }, + { "shlq", CS_KSC5601, "3~" }, + { "shlt", CS_KSC5601, "4!" }, + { "sy", CS_KSC5601, "4\"" }, + { "syr", CS_KSC5601, "4#" }, + { "sys", CS_KSC5601, "4$" }, + { "syf", CS_KSC5601, "4%" }, + { "syq", CS_KSC5601, "4&" }, + { "syt", CS_KSC5601, "4\'" }, + { "syd", CS_KSC5601, "4(" }, + { "sn", CS_KSC5601, "4)" }, + { "snr", CS_KSC5601, "4*" }, + { "sns", CS_KSC5601, "4+" }, + { "sne", CS_KSC5601, "4," }, + { "snf", CS_KSC5601, "4-" }, + { "sna", CS_KSC5601, "4." }, + { "snq", CS_KSC5601, "4/" }, + { "snt", CS_KSC5601, "40" }, + { "snd", CS_KSC5601, "41" }, + { "snj", CS_KSC5601, "42" }, + { "snjT", CS_KSC5601, "43" }, + { "snp", CS_KSC5601, "44" }, + { "snl", CS_KSC5601, "45" }, + { "snls", CS_KSC5601, "46" }, + { "snlf", CS_KSC5601, "47" }, + { "snla", CS_KSC5601, "48" }, + { "snlq", CS_KSC5601, "49" }, + { "sb", CS_KSC5601, "4:" }, + { "sbr", CS_KSC5601, "4;" }, + { "sbf", CS_KSC5601, "4<" }, + { "sba", CS_KSC5601, "4=" }, + { "sbq", CS_KSC5601, "4>" }, + { "sbd", CS_KSC5601, "4?" }, + { "sm", CS_KSC5601, "4@" }, + { "smr", CS_KSC5601, "4A" }, + { "sms", CS_KSC5601, "4B" }, + { "smf", CS_KSC5601, "4C" }, + { "smfr", CS_KSC5601, "4D" }, + { "smfa", CS_KSC5601, "4E" }, + { "sma", CS_KSC5601, "4F" }, + { "smq", CS_KSC5601, "4G" }, + { "smt", CS_KSC5601, "4H" }, + { "smd", CS_KSC5601, "4I" }, + { "smw", CS_KSC5601, "4J" }, + { "smv", CS_KSC5601, "4K" }, + { "sml", CS_KSC5601, "4L" }, + { "smls", CS_KSC5601, "4M" }, + { "smlf", CS_KSC5601, "4N" }, + { "sl", CS_KSC5601, "4O" }, + { "slr", CS_KSC5601, "4P" }, + { "sls", CS_KSC5601, "4Q" }, + { "slf", CS_KSC5601, "4R" }, + { "slfa", CS_KSC5601, "4S" }, + { "sla", CS_KSC5601, "4T" }, + { "slq", CS_KSC5601, "4U" }, + { "slt", CS_KSC5601, "4V" }, + { "sld", CS_KSC5601, "4W" }, + { "slv", CS_KSC5601, "4X" }, + { "ek", CS_KSC5601, "4Y" }, + { "ekr", CS_KSC5601, "4Z" }, + { "ekR", CS_KSC5601, "4[" }, + { "eks", CS_KSC5601, "4\\" }, + { "eke", CS_KSC5601, "4]" }, + { "ekf", CS_KSC5601, "4^" }, + { "ekfr", CS_KSC5601, "4_" }, + { "ekfa", CS_KSC5601, "4`" }, + { "ekfq", CS_KSC5601, "4a" }, + { "ekfg", CS_KSC5601, "4b" }, + { "eka", CS_KSC5601, "4c" }, + { "ekq", CS_KSC5601, "4d" }, + { "ekt", CS_KSC5601, "4e" }, + { "ekT", CS_KSC5601, "4f" }, + { "ekd", CS_KSC5601, "4g" }, + { "ekw", CS_KSC5601, "4h" }, + { "ekc", CS_KSC5601, "4i" }, + { "ekg", CS_KSC5601, "4j" }, + { "eo", CS_KSC5601, "4k" }, + { "eor", CS_KSC5601, "4l" }, + { "eos", CS_KSC5601, "4m" }, + { "eof", CS_KSC5601, "4n" }, + { "eoa", CS_KSC5601, "4o" }, + { "eoq", CS_KSC5601, "4p" }, + { "eot", CS_KSC5601, "4q" }, + { "eoT", CS_KSC5601, "4r" }, + { "eod", CS_KSC5601, "4s" }, + { "ei", CS_KSC5601, "4t" }, + { "ej", CS_KSC5601, "4u" }, + { "ejr", CS_KSC5601, "4v" }, + { "ejR", CS_KSC5601, "4w" }, + { "ejs", CS_KSC5601, "4x" }, + { "eje", CS_KSC5601, "4y" }, + { "ejf", CS_KSC5601, "4z" }, + { "ejfa", CS_KSC5601, "4{" }, + { "ejfq", CS_KSC5601, "4|" }, + { "eja", CS_KSC5601, "4}" }, + { "ejq", CS_KSC5601, "4~" }, + { "ejt", CS_KSC5601, "5!" }, + { "ejd", CS_KSC5601, "5\"" }, + { "ejc", CS_KSC5601, "5#" }, + { "ejv", CS_KSC5601, "5$" }, + { "ep", CS_KSC5601, "5%" }, + { "epr", CS_KSC5601, "5&" }, + { "eps", CS_KSC5601, "5\'" }, + { "epf", CS_KSC5601, "5(" }, + { "epa", CS_KSC5601, "5)" }, + { "epq", CS_KSC5601, "5*" }, + { "ept", CS_KSC5601, "5+" }, + { "epT", CS_KSC5601, "5," }, + { "epd", CS_KSC5601, "5-" }, + { "eu", CS_KSC5601, "5." }, + { "eus", CS_KSC5601, "5/" }, + { "euf", CS_KSC5601, "50" }, + { "euT", CS_KSC5601, "51" }, + { "eud", CS_KSC5601, "52" }, + { "eP", CS_KSC5601, "53" }, + { "ePs", CS_KSC5601, "54" }, + { "eh", CS_KSC5601, "55" }, + { "ehr", CS_KSC5601, "56" }, + { "ehs", CS_KSC5601, "57" }, + { "ehe", CS_KSC5601, "58" }, + { "ehf", CS_KSC5601, "59" }, + { "ehfa", CS_KSC5601, "5:" }, + { "ehft", CS_KSC5601, "5;" }, + { "eha", CS_KSC5601, "5<" }, + { "ehq", CS_KSC5601, "5=" }, + { "eht", CS_KSC5601, "5>" }, + { "ehd", CS_KSC5601, "5?" }, + { "ehc", CS_KSC5601, "5@" }, + { "ehx", CS_KSC5601, "5A" }, + { "ehk", CS_KSC5601, "5B" }, + { "ehks", CS_KSC5601, "5C" }, + { "ehkf", CS_KSC5601, "5D" }, + { "eho", CS_KSC5601, "5E" }, + { "ehoT", CS_KSC5601, "5F" }, + { "ehl", CS_KSC5601, "5G" }, + { "ehls", CS_KSC5601, "5H" }, + { "ehlf", CS_KSC5601, "5I" }, + { "ehla", CS_KSC5601, "5J" }, + { "ehlq", CS_KSC5601, "5K" }, + { "ehlt", CS_KSC5601, "5L" }, + { "ey", CS_KSC5601, "5M" }, + { "en", CS_KSC5601, "5N" }, + { "enr", CS_KSC5601, "5O" }, + { "ens", CS_KSC5601, "5P" }, + { "enf", CS_KSC5601, "5Q" }, + { "ena", CS_KSC5601, "5R" }, + { "enq", CS_KSC5601, "5S" }, + { "ent", CS_KSC5601, "5T" }, + { "end", CS_KSC5601, "5U" }, + { "enj", CS_KSC5601, "5V" }, + { "enjT", CS_KSC5601, "5W" }, + { "enp", CS_KSC5601, "5X" }, + { "enpd", CS_KSC5601, "5Y" }, + { "enl", CS_KSC5601, "5Z" }, + { "enls", CS_KSC5601, "5[" }, + { "enlf", CS_KSC5601, "5\\" }, + { "enlq", CS_KSC5601, "5]" }, + { "enlt", CS_KSC5601, "5^" }, + { "enld", CS_KSC5601, "5_" }, + { "eb", CS_KSC5601, "5`" }, + { "ebs", CS_KSC5601, "5a" }, + { "ebf", CS_KSC5601, "5b" }, + { "eba", CS_KSC5601, "5c" }, + { "ebd", CS_KSC5601, "5d" }, + { "em", CS_KSC5601, "5e" }, + { "emr", CS_KSC5601, "5f" }, + { "ems", CS_KSC5601, "5g" }, + { "eme", CS_KSC5601, "5h" }, + { "emf", CS_KSC5601, "5i" }, + { "emfa", CS_KSC5601, "5j" }, + { "ema", CS_KSC5601, "5k" }, + { "emq", CS_KSC5601, "5l" }, + { "emt", CS_KSC5601, "5m" }, + { "emd", CS_KSC5601, "5n" }, + { "eml", CS_KSC5601, "5o" }, + { "el", CS_KSC5601, "5p" }, + { "elr", CS_KSC5601, "5q" }, + { "els", CS_KSC5601, "5r" }, + { "ele", CS_KSC5601, "5s" }, + { "elf", CS_KSC5601, "5t" }, + { "ela", CS_KSC5601, "5u" }, + { "elq", CS_KSC5601, "5v" }, + { "elt", CS_KSC5601, "5w" }, + { "elT", CS_KSC5601, "5x" }, + { "eld", CS_KSC5601, "5y" }, + { "elw", CS_KSC5601, "5z" }, + { "Ek", CS_KSC5601, "5{" }, + { "Ekr", CS_KSC5601, "5|" }, + { "Eks", CS_KSC5601, "5}" }, + { "Ekf", CS_KSC5601, "5~" }, + { "Eka", CS_KSC5601, "6!" }, + { "Ekq", CS_KSC5601, "6\"" }, + { "Ekt", CS_KSC5601, "6#" }, + { "EkT", CS_KSC5601, "6$" }, + { "Ekd", CS_KSC5601, "6%" }, + { "Ekg", CS_KSC5601, "6&" }, + { "Eo", CS_KSC5601, "6\'" }, + { "Eor", CS_KSC5601, "6(" }, + { "Eos", CS_KSC5601, "6)" }, + { "Eof", CS_KSC5601, "6*" }, + { "Eoa", CS_KSC5601, "6+" }, + { "Eoq", CS_KSC5601, "6," }, + { "Eot", CS_KSC5601, "6-" }, + { "EoT", CS_KSC5601, "6." }, + { "Eod", CS_KSC5601, "6/" }, + { "Ej", CS_KSC5601, "60" }, + { "Ejr", CS_KSC5601, "61" }, + { "Ejs", CS_KSC5601, "62" }, + { "Ejf", CS_KSC5601, "63" }, + { "Ejfa", CS_KSC5601, "64" }, + { "Ejfq", CS_KSC5601, "65" }, + { "Eja", CS_KSC5601, "66" }, + { "Ejq", CS_KSC5601, "67" }, + { "Ejt", CS_KSC5601, "68" }, + { "EjT", CS_KSC5601, "69" }, + { "Ejd", CS_KSC5601, "6:" }, + { "Ejg", CS_KSC5601, "6;" }, + { "Ep", CS_KSC5601, "6<" }, + { "Epr", CS_KSC5601, "6=" }, + { "Eps", CS_KSC5601, "6>" }, + { "Epf", CS_KSC5601, "6?" }, + { "Epa", CS_KSC5601, "6@" }, + { "Epq", CS_KSC5601, "6A" }, + { "Ept", CS_KSC5601, "6B" }, + { "EpT", CS_KSC5601, "6C" }, + { "Epd", CS_KSC5601, "6D" }, + { "Eu", CS_KSC5601, "6E" }, + { "EuT", CS_KSC5601, "6F" }, + { "Eh", CS_KSC5601, "6G" }, + { "Ehr", CS_KSC5601, "6H" }, + { "Ehs", CS_KSC5601, "6I" }, + { "Ehf", CS_KSC5601, "6J" }, + { "Ehd", CS_KSC5601, "6K" }, + { "Ehk", CS_KSC5601, "6L" }, + { "Ehkf", CS_KSC5601, "6M" }, + { "Eho", CS_KSC5601, "6N" }, + { "Ehl", CS_KSC5601, "6O" }, + { "Ehls", CS_KSC5601, "6P" }, + { "En", CS_KSC5601, "6Q" }, + { "Enr", CS_KSC5601, "6R" }, + { "Ens", CS_KSC5601, "6S" }, + { "Enf", CS_KSC5601, "6T" }, + { "Enfg", CS_KSC5601, "6U" }, + { "Ena", CS_KSC5601, "6V" }, + { "End", CS_KSC5601, "6W" }, + { "Enp", CS_KSC5601, "6X" }, + { "Enl", CS_KSC5601, "6Y" }, + { "Enls", CS_KSC5601, "6Z" }, + { "Enlf", CS_KSC5601, "6[" }, + { "Enla", CS_KSC5601, "6\\" }, + { "Enlq", CS_KSC5601, "6]" }, + { "Enld", CS_KSC5601, "6^" }, + { "Em", CS_KSC5601, "6_" }, + { "Emr", CS_KSC5601, "6`" }, + { "Ems", CS_KSC5601, "6a" }, + { "Eme", CS_KSC5601, "6b" }, + { "Emf", CS_KSC5601, "6c" }, + { "Ema", CS_KSC5601, "6d" }, + { "Emq", CS_KSC5601, "6e" }, + { "Emt", CS_KSC5601, "6f" }, + { "Eml", CS_KSC5601, "6g" }, + { "Emls", CS_KSC5601, "6h" }, + { "Emlf", CS_KSC5601, "6i" }, + { "Emla", CS_KSC5601, "6j" }, + { "Emlq", CS_KSC5601, "6k" }, + { "El", CS_KSC5601, "6l" }, + { "Els", CS_KSC5601, "6m" }, + { "Elf", CS_KSC5601, "6n" }, + { "Ela", CS_KSC5601, "6o" }, + { "Elq", CS_KSC5601, "6p" }, + { "Elt", CS_KSC5601, "6q" }, + { "Eld", CS_KSC5601, "6r" }, + { "fk", CS_KSC5601, "6s" }, + { "fkr", CS_KSC5601, "6t" }, + { "fks", CS_KSC5601, "6u" }, + { "fkf", CS_KSC5601, "6v" }, + { "fka", CS_KSC5601, "6w" }, + { "fkq", CS_KSC5601, "6x" }, + { "fkt", CS_KSC5601, "6y" }, + { "fkT", CS_KSC5601, "6z" }, + { "fkd", CS_KSC5601, "6{" }, + { "fkw", CS_KSC5601, "6|" }, + { "fkv", CS_KSC5601, "6}" }, + { "fkg", CS_KSC5601, "6~" }, + { "fo", CS_KSC5601, "7!" }, + { "for", CS_KSC5601, "7\"" }, + { "fos", CS_KSC5601, "7#" }, + { "fof", CS_KSC5601, "7$" }, + { "foa", CS_KSC5601, "7%" }, + { "foq", CS_KSC5601, "7&" }, + { "fot", CS_KSC5601, "7\'" }, + { "foT", CS_KSC5601, "7(" }, + { "fod", CS_KSC5601, "7)" }, + { "fi", CS_KSC5601, "7*" }, + { "fir", CS_KSC5601, "7+" }, + { "fis", CS_KSC5601, "7," }, + { "fit", CS_KSC5601, "7-" }, + { "fid", CS_KSC5601, "7." }, + { "fj", CS_KSC5601, "7/" }, + { "fjr", CS_KSC5601, "70" }, + { "fjs", CS_KSC5601, "71" }, + { "fjf", CS_KSC5601, "72" }, + { "fja", CS_KSC5601, "73" }, + { "fjq", CS_KSC5601, "74" }, + { "fjt", CS_KSC5601, "75" }, + { "fjT", CS_KSC5601, "76" }, + { "fjd", CS_KSC5601, "77" }, + { "fjg", CS_KSC5601, "78" }, + { "fp", CS_KSC5601, "79" }, + { "fpr", CS_KSC5601, "7:" }, + { "fps", CS_KSC5601, "7;" }, + { "fpf", CS_KSC5601, "7<" }, + { "fpa", CS_KSC5601, "7=" }, + { "fpq", CS_KSC5601, "7>" }, + { "fpt", CS_KSC5601, "7?" }, + { "fpd", CS_KSC5601, "7@" }, + { "fu", CS_KSC5601, "7A" }, + { "fur", CS_KSC5601, "7B" }, + { "fus", CS_KSC5601, "7C" }, + { "fuf", CS_KSC5601, "7D" }, + { "fua", CS_KSC5601, "7E" }, + { "fuq", CS_KSC5601, "7F" }, + { "fut", CS_KSC5601, "7G" }, + { "fuT", CS_KSC5601, "7H" }, + { "fud", CS_KSC5601, "7I" }, + { "fP", CS_KSC5601, "7J" }, + { "fPs", CS_KSC5601, "7K" }, + { "fPq", CS_KSC5601, "7L" }, + { "fPt", CS_KSC5601, "7M" }, + { "fh", CS_KSC5601, "7N" }, + { "fhr", CS_KSC5601, "7O" }, + { "fhs", CS_KSC5601, "7P" }, + { "fhf", CS_KSC5601, "7Q" }, + { "fha", CS_KSC5601, "7R" }, + { "fhq", CS_KSC5601, "7S" }, + { "fht", CS_KSC5601, "7T" }, + { "fhd", CS_KSC5601, "7U" }, + { "fhk", CS_KSC5601, "7V" }, + { "fhks", CS_KSC5601, "7W" }, + { "fhkd", CS_KSC5601, "7X" }, + { "fhoT", CS_KSC5601, "7Y" }, + { "fhl", CS_KSC5601, "7Z" }, + { "fhls", CS_KSC5601, "7[" }, + { "fhlf", CS_KSC5601, "7\\" }, + { "fhla", CS_KSC5601, "7]" }, + { "fhlq", CS_KSC5601, "7^" }, + { "fhlt", CS_KSC5601, "7_" }, + { "fhld", CS_KSC5601, "7`" }, + { "fy", CS_KSC5601, "7a" }, + { "fys", CS_KSC5601, "7b" }, + { "fyf", CS_KSC5601, "7c" }, + { "fyq", CS_KSC5601, "7d" }, + { "fyt", CS_KSC5601, "7e" }, + { "fyd", CS_KSC5601, "7f" }, + { "fn", CS_KSC5601, "7g" }, + { "fnr", CS_KSC5601, "7h" }, + { "fns", CS_KSC5601, "7i" }, + { "fnf", CS_KSC5601, "7j" }, + { "fna", CS_KSC5601, "7k" }, + { "fnq", CS_KSC5601, "7l" }, + { "fnt", CS_KSC5601, "7m" }, + { "fnd", CS_KSC5601, "7n" }, + { "fnj", CS_KSC5601, "7o" }, + { "fnjT", CS_KSC5601, "7p" }, + { "fnp", CS_KSC5601, "7q" }, + { "fnl", CS_KSC5601, "7r" }, + { "fnlr", CS_KSC5601, "7s" }, + { "fnls", CS_KSC5601, "7t" }, + { "fnlf", CS_KSC5601, "7u" }, + { "fnla", CS_KSC5601, "7v" }, + { "fnlt", CS_KSC5601, "7w" }, + { "fnld", CS_KSC5601, "7x" }, + { "fb", CS_KSC5601, "7y" }, + { "fbr", CS_KSC5601, "7z" }, + { "fbs", CS_KSC5601, "7{" }, + { "fbf", CS_KSC5601, "7|" }, + { "fba", CS_KSC5601, "7}" }, + { "fbq", CS_KSC5601, "7~" }, + { "fbt", CS_KSC5601, "8!" }, + { "fbd", CS_KSC5601, "8\"" }, + { "fm", CS_KSC5601, "8#" }, + { "fmr", CS_KSC5601, "8$" }, + { "fms", CS_KSC5601, "8%" }, + { "fmf", CS_KSC5601, "8&" }, + { "fma", CS_KSC5601, "8\'" }, + { "fmq", CS_KSC5601, "8(" }, + { "fmt", CS_KSC5601, "8)" }, + { "fmd", CS_KSC5601, "8*" }, + { "fmw", CS_KSC5601, "8+" }, + { "fmx", CS_KSC5601, "8," }, + { "fmv", CS_KSC5601, "8-" }, + { "fl", CS_KSC5601, "8." }, + { "flr", CS_KSC5601, "8/" }, + { "fls", CS_KSC5601, "80" }, + { "flf", CS_KSC5601, "81" }, + { "fla", CS_KSC5601, "82" }, + { "flq", CS_KSC5601, "83" }, + { "flt", CS_KSC5601, "84" }, + { "fld", CS_KSC5601, "85" }, + { "ak", CS_KSC5601, "86" }, + { "akr", CS_KSC5601, "87" }, + { "aks", CS_KSC5601, "88" }, + { "aksg", CS_KSC5601, "89" }, + { "ake", CS_KSC5601, "8:" }, + { "akf", CS_KSC5601, "8;" }, + { "akfr", CS_KSC5601, "8<" }, + { "akfa", CS_KSC5601, "8=" }, + { "aka", CS_KSC5601, "8>" }, + { "akq", CS_KSC5601, "8?" }, + { "akt", CS_KSC5601, "8@" }, + { "akd", CS_KSC5601, "8A" }, + { "akw", CS_KSC5601, "8B" }, + { "akx", CS_KSC5601, "8C" }, + { "akg", CS_KSC5601, "8D" }, + { "ao", CS_KSC5601, "8E" }, + { "aor", CS_KSC5601, "8F" }, + { "aos", CS_KSC5601, "8G" }, + { "aof", CS_KSC5601, "8H" }, + { "aoa", CS_KSC5601, "8I" }, + { "aoq", CS_KSC5601, "8J" }, + { "aot", CS_KSC5601, "8K" }, + { "aoT", CS_KSC5601, "8L" }, + { "aod", CS_KSC5601, "8M" }, + { "aow", CS_KSC5601, "8N" }, + { "ai", CS_KSC5601, "8O" }, + { "air", CS_KSC5601, "8P" }, + { "aif", CS_KSC5601, "8Q" }, + { "aid", CS_KSC5601, "8R" }, + { "aj", CS_KSC5601, "8S" }, + { "ajr", CS_KSC5601, "8T" }, + { "ajs", CS_KSC5601, "8U" }, + { "ajf", CS_KSC5601, "8V" }, + { "ajfa", CS_KSC5601, "8W" }, + { "aja", CS_KSC5601, "8X" }, + { "ajq", CS_KSC5601, "8Y" }, + { "ajt", CS_KSC5601, "8Z" }, + { "ajd", CS_KSC5601, "8[" }, + { "ajw", CS_KSC5601, "8\\" }, + { "ajg", CS_KSC5601, "8]" }, + { "ap", CS_KSC5601, "8^" }, + { "apr", CS_KSC5601, "8_" }, + { "aps", CS_KSC5601, "8`" }, + { "apf", CS_KSC5601, "8a" }, + { "apa", CS_KSC5601, "8b" }, + { "apq", CS_KSC5601, "8c" }, + { "apt", CS_KSC5601, "8d" }, + { "apT", CS_KSC5601, "8e" }, + { "apd", CS_KSC5601, "8f" }, + { "au", CS_KSC5601, "8g" }, + { "aur", CS_KSC5601, "8h" }, + { "aus", CS_KSC5601, "8i" }, + { "auf", CS_KSC5601, "8j" }, + { "aut", CS_KSC5601, "8k" }, + { "auT", CS_KSC5601, "8l" }, + { "aud", CS_KSC5601, "8m" }, + { "auc", CS_KSC5601, "8n" }, + { "aP", CS_KSC5601, "8o" }, + { "ah", CS_KSC5601, "8p" }, + { "ahr", CS_KSC5601, "8q" }, + { "ahrt", CS_KSC5601, "8r" }, + { "ahs", CS_KSC5601, "8s" }, + { "ahf", CS_KSC5601, "8t" }, + { "ahfa", CS_KSC5601, "8u" }, + { "aha", CS_KSC5601, "8v" }, + { "ahq", CS_KSC5601, "8w" }, + { "aht", CS_KSC5601, "8x" }, + { "ahd", CS_KSC5601, "8y" }, + { "ahk", CS_KSC5601, "8z" }, + { "ahks", CS_KSC5601, "8{" }, + { "ahkT", CS_KSC5601, "8|" }, + { "ahkd", CS_KSC5601, "8}" }, + { "ahl", CS_KSC5601, "8~" }, + + { "ahls", CS_KSC5601, "9!" }, + { "ahlf", CS_KSC5601, "9\"" }, + { "ahlq", CS_KSC5601, "9#" }, + { "ahlt", CS_KSC5601, "9$" }, + { "ahld", CS_KSC5601, "9%" }, + { "ay", CS_KSC5601, "9&" }, + { "ays", CS_KSC5601, "9\'" }, + { "ayf", CS_KSC5601, "9(" }, + { "ayq", CS_KSC5601, "9)" }, + { "ayt", CS_KSC5601, "9*" }, + { "an", CS_KSC5601, "9+" }, + { "anr", CS_KSC5601, "9," }, + { "anR", CS_KSC5601, "9-" }, + { "ans", CS_KSC5601, "9." }, + { "ane", CS_KSC5601, "9/" }, + { "anf", CS_KSC5601, "90" }, + { "anfr", CS_KSC5601, "91" }, + { "anfa", CS_KSC5601, "92" }, + { "ana", CS_KSC5601, "93" }, + { "anq", CS_KSC5601, "94" }, + { "ant", CS_KSC5601, "95" }, + { "and", CS_KSC5601, "96" }, + { "anx", CS_KSC5601, "97" }, + { "ang", CS_KSC5601, "98" }, + { "anj", CS_KSC5601, "99" }, + { "anjs", CS_KSC5601, "9:" }, + { "anjf", CS_KSC5601, "9;" }, + { "anjq", CS_KSC5601, "9<" }, + { "anjt", CS_KSC5601, "9=" }, + { "anp", CS_KSC5601, "9>" }, + { "anl", CS_KSC5601, "9?" }, + { "anls", CS_KSC5601, "9@" }, + { "anlf", CS_KSC5601, "9A" }, + { "ab", CS_KSC5601, "9B" }, + + { "abs", CS_KSC5601, "9C" }, + { "abf", CS_KSC5601, "9D" }, + { "aba", CS_KSC5601, "9E" }, + { "abt", CS_KSC5601, "9F" }, + { "am", CS_KSC5601, "9G" }, + { "ams", CS_KSC5601, "9H" }, + { "amf", CS_KSC5601, "9I" }, + { "ama", CS_KSC5601, "9J" }, + { "amt", CS_KSC5601, "9K" }, + { "al", CS_KSC5601, "9L" }, + { "alr", CS_KSC5601, "9M" }, + { "als", CS_KSC5601, "9N" }, + { "ale", CS_KSC5601, "9O" }, + { "alf", CS_KSC5601, "9P" }, + { "alfa", CS_KSC5601, "9Q" }, + { "ala", CS_KSC5601, "9R" }, + { "alq", CS_KSC5601, "9S" }, + { "alt", CS_KSC5601, "9T" }, + { "alT", CS_KSC5601, "9U" }, + { "ald", CS_KSC5601, "9V" }, + { "alc", CS_KSC5601, "9W" }, + { "alx", CS_KSC5601, "9X" }, + { "qk", CS_KSC5601, "9Y" }, + { "qkr", CS_KSC5601, "9Z" }, + { "qkR", CS_KSC5601, "9[" }, + { "qkrt", CS_KSC5601, "9\\" }, + { "qks", CS_KSC5601, "9]" }, + { "qke", CS_KSC5601, "9^" }, + { "qkf", CS_KSC5601, "9_" }, + { "qkfr", CS_KSC5601, "9`" }, + { "qkfa", CS_KSC5601, "9a" }, + { "qkfq", CS_KSC5601, "9b" }, + { "qka", CS_KSC5601, "9c" }, + { "qkq", CS_KSC5601, "9d" }, + { "qkt", CS_KSC5601, "9e" }, + { "qkd", CS_KSC5601, "9f" }, + { "qkx", CS_KSC5601, "9g" }, + { "qo", CS_KSC5601, "9h" }, + { "qor", CS_KSC5601, "9i" }, + { "qos", CS_KSC5601, "9j" }, + { "qof", CS_KSC5601, "9k" }, + { "qoa", CS_KSC5601, "9l" }, + { "qoq", CS_KSC5601, "9m" }, + { "qot", CS_KSC5601, "9n" }, + { "qoT", CS_KSC5601, "9o" }, + { "qod", CS_KSC5601, "9p" }, + { "qox", CS_KSC5601, "9q" }, + { "qi", CS_KSC5601, "9r" }, + { "qir", CS_KSC5601, "9s" }, + { "qis", CS_KSC5601, "9t" }, + { "qiq", CS_KSC5601, "9u" }, + { "qj", CS_KSC5601, "9v" }, + { "qjr", CS_KSC5601, "9w" }, + { "qjs", CS_KSC5601, "9x" }, + { "qje", CS_KSC5601, "9y" }, + { "qjf", CS_KSC5601, "9z" }, + { "qjfa", CS_KSC5601, "9{" }, + { "qja", CS_KSC5601, "9|" }, + { "qjq", CS_KSC5601, "9}" }, + { "qjt", CS_KSC5601, "9~" }, + { "qjd", CS_KSC5601, ":!" }, + { "qjw", CS_KSC5601, ":\"" }, + { "qp", CS_KSC5601, ":#" }, + { "qpr", CS_KSC5601, ":$" }, + { "qps", CS_KSC5601, ":%" }, + { "qpe", CS_KSC5601, ":&" }, + { "qpf", CS_KSC5601, ":\'" }, + { "qpa", CS_KSC5601, ":(" }, + { "qpq", CS_KSC5601, ":)" }, + { "qpt", CS_KSC5601, ":*" }, + { "qpT", CS_KSC5601, ":+" }, + { "qpd", CS_KSC5601, ":," }, + { "qu", CS_KSC5601, ":-" }, + { "qur", CS_KSC5601, ":." }, + { "qus", CS_KSC5601, ":/" }, + { "quf", CS_KSC5601, ":0" }, + { "quq", CS_KSC5601, ":1" }, + { "qut", CS_KSC5601, ":2" }, + { "quT", CS_KSC5601, ":3" }, + { "qud", CS_KSC5601, ":4" }, + { "qux", CS_KSC5601, ":5" }, + { "qP", CS_KSC5601, ":6" }, + { "qPs", CS_KSC5601, ":7" }, + { "qh", CS_KSC5601, ":8" }, + { "qhr", CS_KSC5601, ":9" }, + { "qhR", CS_KSC5601, "::" }, + { "qhs", CS_KSC5601, ":;" }, + { "qhf", CS_KSC5601, ":<" }, + { "qha", CS_KSC5601, ":=" }, + { "qhq", CS_KSC5601, ":>" }, + { "qht", CS_KSC5601, ":?" }, + { "qhd", CS_KSC5601, ":@" }, + { "qhk", CS_KSC5601, ":A" }, + { "qhks", CS_KSC5601, ":B" }, + { "qhkT", CS_KSC5601, ":C" }, + { "qho", CS_KSC5601, ":D" }, + { "qhoT", CS_KSC5601, ":E" }, + { "qhl", CS_KSC5601, ":F" }, + { "qhlr", CS_KSC5601, ":G" }, + { "qhls", CS_KSC5601, ":H" }, + { "qhlf", CS_KSC5601, ":I" }, + { "qhla", CS_KSC5601, ":J" }, + { "qhlq", CS_KSC5601, ":K" }, + { "qy", CS_KSC5601, ":L" }, + { "qys", CS_KSC5601, ":M" }, + { "qn", CS_KSC5601, ":N" }, + { "qnr", CS_KSC5601, ":O" }, + { "qns", CS_KSC5601, ":P" }, + { "qne", CS_KSC5601, ":Q" }, + { "qnf", CS_KSC5601, ":R" }, + { "qnfr", CS_KSC5601, ":S" }, + { "qnfa", CS_KSC5601, ":T" }, + { "qna", CS_KSC5601, ":U" }, + { "qnq", CS_KSC5601, ":V" }, + { "qnt", CS_KSC5601, ":W" }, + { "qnd", CS_KSC5601, ":X" }, + { "qnx", CS_KSC5601, ":Y" }, + { "qnv", CS_KSC5601, ":Z" }, + { "qnj", CS_KSC5601, ":[" }, + { "qnjf", CS_KSC5601, ":\\" }, + { "qnjT", CS_KSC5601, ":]" }, + { "qnp", CS_KSC5601, ":^" }, + { "qnl", CS_KSC5601, ":_" }, + { "qnlr", CS_KSC5601, ":`" }, + { "qnls", CS_KSC5601, ":a" }, + { "qnlf", CS_KSC5601, ":b" }, + { "qnld", CS_KSC5601, ":c" }, + { "qb", CS_KSC5601, ":d" }, + { "qbs", CS_KSC5601, ":e" }, + { "qbf", CS_KSC5601, ":f" }, + { "qba", CS_KSC5601, ":g" }, + { "qbt", CS_KSC5601, ":h" }, + { "qbd", CS_KSC5601, ":i" }, + { "qm", CS_KSC5601, ":j" }, + { "qmr", CS_KSC5601, ":k" }, + { "qms", CS_KSC5601, ":l" }, + { "qmf", CS_KSC5601, ":m" }, + { "qma", CS_KSC5601, ":n" }, + { "qmq", CS_KSC5601, ":o" }, + { "qmt", CS_KSC5601, ":p" }, + { "ql", CS_KSC5601, ":q" }, + { "qlr", CS_KSC5601, ":r" }, + { "qls", CS_KSC5601, ":s" }, + { "qlf", CS_KSC5601, ":t" }, + { "qlfa", CS_KSC5601, ":u" }, + { "qla", CS_KSC5601, ":v" }, + { "qlq", CS_KSC5601, ":w" }, + { "qlt", CS_KSC5601, ":x" }, + { "qld", CS_KSC5601, ":y" }, + { "qlw", CS_KSC5601, ":z" }, + { "qlc", CS_KSC5601, ":{" }, + { "Qk", CS_KSC5601, ":|" }, + { "Qkr", CS_KSC5601, ":}" }, + { "Qks", CS_KSC5601, ":~" }, + { "Qkf", CS_KSC5601, ";!" }, + { "Qkfa", CS_KSC5601, ";\"" }, + { "Qka", CS_KSC5601, ";#" }, + { "Qkq", CS_KSC5601, ";$" }, + { "Qkt", CS_KSC5601, ";%" }, + { "QkT", CS_KSC5601, ";&" }, + { "Qkd", CS_KSC5601, ";\'" }, + { "Qkg", CS_KSC5601, ";(" }, + { "Qo", CS_KSC5601, ";)" }, + { "Qor", CS_KSC5601, ";*" }, + { "Qos", CS_KSC5601, ";+" }, + { "Qof", CS_KSC5601, ";," }, + { "Qoa", CS_KSC5601, ";-" }, + { "Qoq", CS_KSC5601, ";." }, + { "Qot", CS_KSC5601, ";/" }, + { "QoT", CS_KSC5601, ";0" }, + { "Qod", CS_KSC5601, ";1" }, + { "Qi", CS_KSC5601, ";2" }, + { "Qir", CS_KSC5601, ";3" }, + { "Qia", CS_KSC5601, ";4" }, + { "Qj", CS_KSC5601, ";5" }, + { "Qjr", CS_KSC5601, ";6" }, + { "Qjs", CS_KSC5601, ";7" }, + { "Qje", CS_KSC5601, ";8" }, + { "Qjf", CS_KSC5601, ";9" }, + { "Qja", CS_KSC5601, ";:" }, + { "Qjt", CS_KSC5601, ";;" }, + { "QjT", CS_KSC5601, ";<" }, + { "Qjd", CS_KSC5601, ";=" }, + { "Qp", CS_KSC5601, ";>" }, + { "Qpd", CS_KSC5601, ";?" }, + { "Qu", CS_KSC5601, ";@" }, + { "Qur", CS_KSC5601, ";A" }, + { "Qua", CS_KSC5601, ";B" }, + { "Quq", CS_KSC5601, ";C" }, + { "Qut", CS_KSC5601, ";D" }, + { "QuT", CS_KSC5601, ";E" }, + { "Qud", CS_KSC5601, ";F" }, + { "Qh", CS_KSC5601, ";G" }, + { "Qhr", CS_KSC5601, ";H" }, + { "Qhs", CS_KSC5601, ";I" }, + { "Qhf", CS_KSC5601, ";J" }, + { "Qha", CS_KSC5601, ";K" }, + { "Qhq", CS_KSC5601, ";L" }, + { "Qhd", CS_KSC5601, ";M" }, + { "Qhl", CS_KSC5601, ";N" }, + { "Qy", CS_KSC5601, ";O" }, + { "Qyd", CS_KSC5601, ";P" }, + { "Qn", CS_KSC5601, ";Q" }, + { "Qnr", CS_KSC5601, ";R" }, + { "Qns", CS_KSC5601, ";S" }, + { "Qnf", CS_KSC5601, ";T" }, + { "Qna", CS_KSC5601, ";U" }, + { "Qnt", CS_KSC5601, ";V" }, + { "Qnd", CS_KSC5601, ";W" }, + { "Qb", CS_KSC5601, ";X" }, + { "Qbd", CS_KSC5601, ";Y" }, + { "Qm", CS_KSC5601, ";Z" }, + { "Qms", CS_KSC5601, ";[" }, + { "Qmf", CS_KSC5601, ";\\" }, + { "Qma", CS_KSC5601, ";]" }, + { "Qmq", CS_KSC5601, ";^" }, + { "Ql", CS_KSC5601, ";_" }, + { "Qlr", CS_KSC5601, ";`" }, + { "Qls", CS_KSC5601, ";a" }, + { "Qlf", CS_KSC5601, ";b" }, + { "Qla", CS_KSC5601, ";c" }, + { "Qlq", CS_KSC5601, ";d" }, + { "Qlt", CS_KSC5601, ";e" }, + { "Qld", CS_KSC5601, ";f" }, + { "tk", CS_KSC5601, ";g" }, + { "tkr", CS_KSC5601, ";h" }, + { "tkrt", CS_KSC5601, ";i" }, + { "tks", CS_KSC5601, ";j" }, + { "tke", CS_KSC5601, ";k" }, + { "tkf", CS_KSC5601, ";l" }, + { "tkfr", CS_KSC5601, ";m" }, + { "tkfa", CS_KSC5601, ";n" }, + { "tka", CS_KSC5601, ";o" }, + { "tkq", CS_KSC5601, ";p" }, + { "tkt", CS_KSC5601, ";q" }, + { "tkT", CS_KSC5601, ";r" }, + { "tkd", CS_KSC5601, ";s" }, + { "tkx", CS_KSC5601, ";t" }, + { "to", CS_KSC5601, ";u" }, + { "tor", CS_KSC5601, ";v" }, + { "tos", CS_KSC5601, ";w" }, + { "tof", CS_KSC5601, ";x" }, + { "toa", CS_KSC5601, ";y" }, + { "toq", CS_KSC5601, ";z" }, + { "tot", CS_KSC5601, ";{" }, + { "toT", CS_KSC5601, ";|" }, + { "tod", CS_KSC5601, ";}" }, + { "ti", CS_KSC5601, ";~" }, + { "tir", CS_KSC5601, "" }, + { "tpf", CS_KSC5601, "" }, + { "tma", CS_KSC5601, "=?" }, + { "tmq", CS_KSC5601, "=@" }, + { "tmt", CS_KSC5601, "=A" }, + { "tmd", CS_KSC5601, "=B" }, + { "tl", CS_KSC5601, "=C" }, + { "tlr", CS_KSC5601, "=D" }, + { "tls", CS_KSC5601, "=E" }, + { "tle", CS_KSC5601, "=F" }, + { "tlf", CS_KSC5601, "=G" }, + { "tlfg", CS_KSC5601, "=H" }, + { "tla", CS_KSC5601, "=I" }, + { "tlq", CS_KSC5601, "=J" }, + { "tlt", CS_KSC5601, "=K" }, + { "tld", CS_KSC5601, "=L" }, + { "tlv", CS_KSC5601, "=M" }, + { "Tk", CS_KSC5601, "=N" }, + { "Tkr", CS_KSC5601, "=O" }, + { "Tkrt", CS_KSC5601, "=P" }, + { "Tks", CS_KSC5601, "=Q" }, + { "Tkf", CS_KSC5601, "=R" }, + { "Tka", CS_KSC5601, "=S" }, + { "Tkq", CS_KSC5601, "=T" }, + { "TkT", CS_KSC5601, "=U" }, + { "Tkd", CS_KSC5601, "=V" }, + { "Tkg", CS_KSC5601, "=W" }, + { "To", CS_KSC5601, "=X" }, + { "Tor", CS_KSC5601, "=Y" }, + { "Tos", CS_KSC5601, "=Z" }, + { "Tof", CS_KSC5601, "=[" }, + { "Toa", CS_KSC5601, "=\\" }, + { "Toq", CS_KSC5601, "=]" }, + { "ToT", CS_KSC5601, "=^" }, + { "Tod", CS_KSC5601, "=_" }, + { "Tid", CS_KSC5601, "=`" }, + { "Tj", CS_KSC5601, "=a" }, + { "Tjr", CS_KSC5601, "=b" }, + { "Tjs", CS_KSC5601, "=c" }, + { "Tjf", CS_KSC5601, "=d" }, + { "Tjfa", CS_KSC5601, "=e" }, + { "Tja", CS_KSC5601, "=f" }, + { "Tjq", CS_KSC5601, "=g" }, + { "TjT", CS_KSC5601, "=h" }, + { "Tjd", CS_KSC5601, "=i" }, + { "Tp", CS_KSC5601, "=j" }, + { "Tps", CS_KSC5601, "=k" }, + { "Tpf", CS_KSC5601, "=l" }, + { "TPs", CS_KSC5601, "=m" }, + { "Th", CS_KSC5601, "=n" }, + { "Thr", CS_KSC5601, "=o" }, + { "Ths", CS_KSC5601, "=p" }, + { "The", CS_KSC5601, "=q" }, + { "Thf", CS_KSC5601, "=r" }, + { "Thfa", CS_KSC5601, "=s" }, + { "Tha", CS_KSC5601, "=t" }, + { "Thq", CS_KSC5601, "=u" }, + { "Thd", CS_KSC5601, "=v" }, + { "Thk", CS_KSC5601, "=w" }, + { "Thkr", CS_KSC5601, "=x" }, + { "Thks", CS_KSC5601, "=y" }, + { "ThkT", CS_KSC5601, "=z" }, + { "Tho", CS_KSC5601, "={" }, + { "ThoT", CS_KSC5601, "=|" }, + { "Thl", CS_KSC5601, "=}" }, + { "Thls", CS_KSC5601, "=~" }, + { "Thlf", CS_KSC5601, ">!" }, + { "Thla", CS_KSC5601, ">\"" }, + { "Thlq", CS_KSC5601, ">#" }, + { "Ty", CS_KSC5601, ">$" }, + { "Tn", CS_KSC5601, ">%" }, + { "Tnr", CS_KSC5601, ">&" }, + { "Tns", CS_KSC5601, ">\'" }, + { "Tnf", CS_KSC5601, ">(" }, + { "Tna", CS_KSC5601, ">)" }, + { "Tnq", CS_KSC5601, ">*" }, + { "Tnd", CS_KSC5601, ">+" }, + { "Tnj", CS_KSC5601, ">," }, + { "TnjT", CS_KSC5601, ">-" }, + { "Tnp", CS_KSC5601, ">." }, + { "Tnl", CS_KSC5601, ">/" }, + { "Tnls", CS_KSC5601, ">0" }, + { "Tbd", CS_KSC5601, ">1" }, + { "Tm", CS_KSC5601, ">2" }, + { "Tmr", CS_KSC5601, ">3" }, + { "Tms", CS_KSC5601, ">4" }, + { "Tmf", CS_KSC5601, ">5" }, + { "Tmfa", CS_KSC5601, ">6" }, + { "Tmfg", CS_KSC5601, ">7" }, + { "Tma", CS_KSC5601, ">8" }, + { "Tmq", CS_KSC5601, ">9" }, + { "Tml", CS_KSC5601, ">:" }, + { "Tmls", CS_KSC5601, ">;" }, + { "Tmlf", CS_KSC5601, "><" }, + { "Tmla", CS_KSC5601, ">=" }, + { "Tl", CS_KSC5601, ">>" }, + { "Tlr", CS_KSC5601, ">?" }, + { "Tls", CS_KSC5601, ">@" }, + { "Tlf", CS_KSC5601, ">A" }, + { "Tla", CS_KSC5601, ">B" }, + { "Tlq", CS_KSC5601, ">C" }, + { "Tlt", CS_KSC5601, ">D" }, + { "Tld", CS_KSC5601, ">E" }, + { "dk", CS_KSC5601, ">F" }, + { "dkr", CS_KSC5601, ">G" }, + { "dks", CS_KSC5601, ">H" }, + { "dksw", CS_KSC5601, ">I" }, + { "dksg", CS_KSC5601, ">J" }, + { "dkf", CS_KSC5601, ">K" }, + { "dkfr", CS_KSC5601, ">L" }, + { "dkfa", CS_KSC5601, ">M" }, + { "dkfg", CS_KSC5601, ">N" }, + { "dka", CS_KSC5601, ">O" }, + { "dkq", CS_KSC5601, ">P" }, + { "dkt", CS_KSC5601, ">Q" }, + { "dkT", CS_KSC5601, ">R" }, + { "dkd", CS_KSC5601, ">S" }, + { "dkx", CS_KSC5601, ">T" }, + { "dkv", CS_KSC5601, ">U" }, + { "do", CS_KSC5601, ">V" }, + { "dor", CS_KSC5601, ">W" }, + { "dos", CS_KSC5601, ">X" }, + { "dof", CS_KSC5601, ">Y" }, + { "doa", CS_KSC5601, ">Z" }, + { "doq", CS_KSC5601, ">[" }, + { "dot", CS_KSC5601, ">\\" }, + { "doT", CS_KSC5601, ">]" }, + { "dod", CS_KSC5601, ">^" }, + { "di", CS_KSC5601, ">_" }, + { "dir", CS_KSC5601, ">`" }, + { "dis", CS_KSC5601, ">a" }, + { "dif", CS_KSC5601, ">b" }, + { "difq", CS_KSC5601, ">c" }, + { "dia", CS_KSC5601, ">d" }, + { "diq", CS_KSC5601, ">e" }, + { "dit", CS_KSC5601, ">f" }, + { "did", CS_KSC5601, ">g" }, + { "dix", CS_KSC5601, ">h" }, + { "dig", CS_KSC5601, ">i" }, + { "dO", CS_KSC5601, ">j" }, + { "dOs", CS_KSC5601, ">k" }, + { "dOf", CS_KSC5601, ">l" }, + { "dOq", CS_KSC5601, ">m" }, + { "dj", CS_KSC5601, ">n" }, + { "djr", CS_KSC5601, ">o" }, + { "djs", CS_KSC5601, ">p" }, + { "djsw", CS_KSC5601, ">q" }, + { "dje", CS_KSC5601, ">r" }, + { "djf", CS_KSC5601, ">s" }, + { "djfr", CS_KSC5601, ">t" }, + { "djfa", CS_KSC5601, ">u" }, + { "dja", CS_KSC5601, ">v" }, + { "djq", CS_KSC5601, ">w" }, + { "djqt", CS_KSC5601, ">x" }, + { "djt", CS_KSC5601, ">y" }, + { "djT", CS_KSC5601, ">z" }, + { "djd", CS_KSC5601, ">{" }, + { "djw", CS_KSC5601, ">|" }, + { "djz", CS_KSC5601, ">}" }, + { "djv", CS_KSC5601, ">~" }, + { "dp", CS_KSC5601, "?!" }, + { "dpr", CS_KSC5601, "?\"" }, + { "dps", CS_KSC5601, "?#" }, + { "dpf", CS_KSC5601, "?$" }, + { "dpa", CS_KSC5601, "?%" }, + { "dpq", CS_KSC5601, "?&" }, + { "dpt", CS_KSC5601, "?\'" }, + { "dpd", CS_KSC5601, "?(" }, + { "du", CS_KSC5601, "?)" }, + { "dur", CS_KSC5601, "?*" }, + { "duR", CS_KSC5601, "?+" }, + { "dus", CS_KSC5601, "?," }, + { "duf", CS_KSC5601, "?-" }, + { "dufa", CS_KSC5601, "?." }, + { "dufq", CS_KSC5601, "?/" }, + { "dua", CS_KSC5601, "?0" }, + { "duq", CS_KSC5601, "?1" }, + { "duqt", CS_KSC5601, "?2" }, + { "dut", CS_KSC5601, "?3" }, + { "duT", CS_KSC5601, "?4" }, + { "dud", CS_KSC5601, "?5" }, + { "dux", CS_KSC5601, "?6" }, + { "duv", CS_KSC5601, "?7" }, + { "dug", CS_KSC5601, "?8" }, + { "dP", CS_KSC5601, "?9" }, + { "dPs", CS_KSC5601, "?:" }, + { "dPf", CS_KSC5601, "?;" }, + { "dPa", CS_KSC5601, "?<" }, + { "dPq", CS_KSC5601, "?=" }, + { "dPt", CS_KSC5601, "?>" }, + { "dPT", CS_KSC5601, "??" }, + { "dh", CS_KSC5601, "?@" }, + { "dhr", CS_KSC5601, "?A" }, + { "dhs", CS_KSC5601, "?B" }, + { "dhf", CS_KSC5601, "?C" }, + { "dhfr", CS_KSC5601, "?D" }, + { "dhfa", CS_KSC5601, "?E" }, + { "dhft", CS_KSC5601, "?F" }, + { "dhfg", CS_KSC5601, "?G" }, + { "dha", CS_KSC5601, "?H" }, + { "dhq", CS_KSC5601, "?I" }, + { "dht", CS_KSC5601, "?J" }, + { "dhd", CS_KSC5601, "?K" }, + { "dhc", CS_KSC5601, "?L" }, + { "dhk", CS_KSC5601, "?M" }, + { "dhkr", CS_KSC5601, "?N" }, + { "dhks", CS_KSC5601, "?O" }, + { "dhkf", CS_KSC5601, "?P" }, + { "dhka", CS_KSC5601, "?Q" }, + { "dhkq", CS_KSC5601, "?R" }, + { "dhkt", CS_KSC5601, "?S" }, + { "dhkT", CS_KSC5601, "?T" }, + { "dhkd", CS_KSC5601, "?U" }, + { "dho", CS_KSC5601, "?V" }, + { "dhor", CS_KSC5601, "?W" }, + { "dhos", CS_KSC5601, "?X" }, + { "dhoa", CS_KSC5601, "?Y" }, + { "dhot", CS_KSC5601, "?Z" }, + { "dhod", CS_KSC5601, "?[" }, + { "dhl", CS_KSC5601, "?\\" }, + { "dhlr", CS_KSC5601, "?]" }, + { "dhls", CS_KSC5601, "?^" }, + { "dhlf", CS_KSC5601, "?_" }, + { "dhla", CS_KSC5601, "?`" }, + { "dhlq", CS_KSC5601, "?a" }, + { "dhlt", CS_KSC5601, "?b" }, + { "dhld", CS_KSC5601, "?c" }, + { "dy", CS_KSC5601, "?d" }, + { "dyr", CS_KSC5601, "?e" }, + { "dys", CS_KSC5601, "?f" }, + { "dyf", CS_KSC5601, "?g" }, + { "dya", CS_KSC5601, "?h" }, + { "dyq", CS_KSC5601, "?i" }, + { "dyt", CS_KSC5601, "?j" }, + { "dyd", CS_KSC5601, "?k" }, + { "dn", CS_KSC5601, "?l" }, + { "dnr", CS_KSC5601, "?m" }, + { "dns", CS_KSC5601, "?n" }, + { "dnf", CS_KSC5601, "?o" }, + { "dnfr", CS_KSC5601, "?p" }, + { "dnfa", CS_KSC5601, "?q" }, + { "dna", CS_KSC5601, "?r" }, + { "dnq", CS_KSC5601, "?s" }, + { "dnt", CS_KSC5601, "?t" }, + { "dnd", CS_KSC5601, "?u" }, + { "dnj", CS_KSC5601, "?v" }, + { "dnjr", CS_KSC5601, "?w" }, + { "dnjs", CS_KSC5601, "?x" }, + { "dnjf", CS_KSC5601, "?y" }, + { "dnja", CS_KSC5601, "?z" }, + { "dnjq", CS_KSC5601, "?{" }, + { "dnjT", CS_KSC5601, "?|" }, + { "dnjd", CS_KSC5601, "?}" }, + { "dnp", CS_KSC5601, "?~" }, + { "dnpr", CS_KSC5601, "@!" }, + { "dnps", CS_KSC5601, "@\"" }, + { "dnpf", CS_KSC5601, "@#" }, + { "dnpa", CS_KSC5601, "@$" }, + { "dnpq", CS_KSC5601, "@%" }, + { "dnpd", CS_KSC5601, "@&" }, + { "dnl", CS_KSC5601, "@\'" }, + { "dnlr", CS_KSC5601, "@(" }, + { "dnls", CS_KSC5601, "@)" }, + { "dnlf", CS_KSC5601, "@*" }, + { "dnla", CS_KSC5601, "@+" }, + { "dnlq", CS_KSC5601, "@," }, + { "dnlt", CS_KSC5601, "@-" }, + { "dnld", CS_KSC5601, "@." }, + { "db", CS_KSC5601, "@/" }, + { "dbr", CS_KSC5601, "@0" }, + { "dbs", CS_KSC5601, "@1" }, + { "dbf", CS_KSC5601, "@2" }, + { "dba", CS_KSC5601, "@3" }, + { "dbq", CS_KSC5601, "@4" }, + { "dbt", CS_KSC5601, "@5" }, + { "dbd", CS_KSC5601, "@6" }, + { "dbc", CS_KSC5601, "@7" }, + { "dm", CS_KSC5601, "@8" }, + { "dmr", CS_KSC5601, "@9" }, + { "dms", CS_KSC5601, "@:" }, + { "dmf", CS_KSC5601, "@;" }, + { "dmfv", CS_KSC5601, "@<" }, + { "dma", CS_KSC5601, "@=" }, + { "dmq", CS_KSC5601, "@>" }, + { "dmt", CS_KSC5601, "@?" }, + { "dmd", CS_KSC5601, "@@" }, + { "dmw", CS_KSC5601, "@A" }, + { "dmc", CS_KSC5601, "@B" }, + { "dmz", CS_KSC5601, "@C" }, + { "dmx", CS_KSC5601, "@D" }, + { "dmv", CS_KSC5601, "@E" }, + { "dmg", CS_KSC5601, "@F" }, + { "dml", CS_KSC5601, "@G" }, + { "dmls", CS_KSC5601, "@H" }, + { "dmlf", CS_KSC5601, "@I" }, + { "dmla", CS_KSC5601, "@J" }, + { "dmlt", CS_KSC5601, "@K" }, + { "dl", CS_KSC5601, "@L" }, + { "dlr", CS_KSC5601, "@M" }, + { "dls", CS_KSC5601, "@N" }, + { "dlf", CS_KSC5601, "@O" }, + { "dlfr", CS_KSC5601, "@P" }, + { "dlfa", CS_KSC5601, "@Q" }, + { "dlfg", CS_KSC5601, "@R" }, + { "dla", CS_KSC5601, "@S" }, + { "dlq", CS_KSC5601, "@T" }, + { "dlt", CS_KSC5601, "@U" }, + { "dlT", CS_KSC5601, "@V" }, + { "dld", CS_KSC5601, "@W" }, + { "dlw", CS_KSC5601, "@X" }, + { "dlv", CS_KSC5601, "@Y" }, + { "wk", CS_KSC5601, "@Z" }, + { "wkr", CS_KSC5601, "@[" }, + { "wks", CS_KSC5601, "@\\" }, + { "wksg", CS_KSC5601, "@]" }, + { "wke", CS_KSC5601, "@^" }, + { "wkf", CS_KSC5601, "@_" }, + { "wkfa", CS_KSC5601, "@`" }, + { "wka", CS_KSC5601, "@a" }, + { "wkq", CS_KSC5601, "@b" }, + { "wkt", CS_KSC5601, "@c" }, + { "wkT", CS_KSC5601, "@d" }, + { "wkd", CS_KSC5601, "@e" }, + { "wkw", CS_KSC5601, "@f" }, + { "Or", CS_KSC5601, "@h" }, + { "Os", CS_KSC5601, "@i" }, + { "Of", CS_KSC5601, "@j" }, + { "Oa", CS_KSC5601, "@k" }, + { "Oq", CS_KSC5601, "@l" }, + { "Ot", CS_KSC5601, "@m" }, + { "OT", CS_KSC5601, "@n" }, + { "Od", CS_KSC5601, "@o" }, + { "wo", CS_KSC5601, "@g" }, + { "wor", CS_KSC5601, "@h" }, + { "wos", CS_KSC5601, "@i" }, + { "wof", CS_KSC5601, "@j" }, + { "woa", CS_KSC5601, "@k" }, + { "woq", CS_KSC5601, "@l" }, + { "wot", CS_KSC5601, "@m" }, + { "woT", CS_KSC5601, "@n" }, + { "wod", CS_KSC5601, "@o" }, + { "wi", CS_KSC5601, "@p" }, + { "wir", CS_KSC5601, "@q" }, + { "wis", CS_KSC5601, "@r" }, + { "wisg", CS_KSC5601, "@s" }, + { "wif", CS_KSC5601, "@t" }, + { "wia", CS_KSC5601, "@u" }, + { "wid", CS_KSC5601, "@v" }, + { "wO", CS_KSC5601, "@w" }, + { "wOs", CS_KSC5601, "@x" }, + { "wOf", CS_KSC5601, "@y" }, + { "wj", CS_KSC5601, "@z" }, + { "wjr", CS_KSC5601, "@{" }, + { "wjs", CS_KSC5601, "@|" }, + { "wjf", CS_KSC5601, "@}" }, + { "wjfa", CS_KSC5601, "@~" }, + { "wja", CS_KSC5601, "A!" }, + { "wjq", CS_KSC5601, "A\"" }, + { "wjt", CS_KSC5601, "A#" }, + { "wjd", CS_KSC5601, "A$" }, + { "wjw", CS_KSC5601, "A%" }, + { "wp", CS_KSC5601, "A&" }, + { "wpr", CS_KSC5601, "A\'" }, + { "wps", CS_KSC5601, "A(" }, + { "wpf", CS_KSC5601, "A)" }, + { "wpa", CS_KSC5601, "A*" }, + { "wpq", CS_KSC5601, "A+" }, + { "wpt", CS_KSC5601, "A," }, + { "wpd", CS_KSC5601, "A-" }, + { "wu", CS_KSC5601, "A." }, + { "wus", CS_KSC5601, "A/" }, + { "wuf", CS_KSC5601, "A0" }, + { "wua", CS_KSC5601, "A1" }, + { "wuq", CS_KSC5601, "A2" }, + { "wuT", CS_KSC5601, "A3" }, + { "wud", CS_KSC5601, "A4" }, + { "wP", CS_KSC5601, "A5" }, + { "wh", CS_KSC5601, "A6" }, + { "whr", CS_KSC5601, "A7" }, + { "whs", CS_KSC5601, "A8" }, + { "whf", CS_KSC5601, "A9" }, + { "whfa", CS_KSC5601, "A:" }, + { "wha", CS_KSC5601, "A;" }, + { "whq", CS_KSC5601, "A<" }, + { "wht", CS_KSC5601, "A=" }, + { "whd", CS_KSC5601, "A>" }, + { "whw", CS_KSC5601, "A?" }, + { "whc", CS_KSC5601, "A@" }, + { "whg", CS_KSC5601, "AA" }, + { "whk", CS_KSC5601, "AB" }, + { "whkr", CS_KSC5601, "AC" }, + { "whkf", CS_KSC5601, "AD" }, + { "whkq", CS_KSC5601, "AE" }, + { "whkt", CS_KSC5601, "AF" }, + { "whkd", CS_KSC5601, "AG" }, + { "who", CS_KSC5601, "AH" }, + { "whoT", CS_KSC5601, "AI" }, + { "whod", CS_KSC5601, "AJ" }, + { "whl", CS_KSC5601, "AK" }, + { "whls", CS_KSC5601, "AL" }, + { "whlf", CS_KSC5601, "AM" }, + { "whla", CS_KSC5601, "AN" }, + { "whlq", CS_KSC5601, "AO" }, + { "whlt", CS_KSC5601, "AP" }, + { "whld", CS_KSC5601, "AQ" }, + { "wy", CS_KSC5601, "AR" }, + { "wyr", CS_KSC5601, "AS" }, + { "wys", CS_KSC5601, "AT" }, + { "wyd", CS_KSC5601, "AU" }, + { "wn", CS_KSC5601, "AV" }, + { "wnr", CS_KSC5601, "AW" }, + { "wns", CS_KSC5601, "AX" }, + { "wnf", CS_KSC5601, "AY" }, + { "wnfr", CS_KSC5601, "AZ" }, + { "wnfa", CS_KSC5601, "A[" }, + { "wna", CS_KSC5601, "A\\" }, + { "wnq", CS_KSC5601, "A]" }, + { "wnt", CS_KSC5601, "A^" }, + { "wnd", CS_KSC5601, "A_" }, + { "wnj", CS_KSC5601, "A`" }, + { "wnjT", CS_KSC5601, "Aa" }, + { "wnp", CS_KSC5601, "Ab" }, + { "wnl", CS_KSC5601, "Ac" }, + { "wnlr", CS_KSC5601, "Ad" }, + { "wnls", CS_KSC5601, "Ae" }, + { "wnlf", CS_KSC5601, "Af" }, + { "wnla", CS_KSC5601, "Ag" }, + { "wnlq", CS_KSC5601, "Ah" }, + { "wnlt", CS_KSC5601, "Ai" }, + { "wb", CS_KSC5601, "Aj" }, + { "wbs", CS_KSC5601, "Ak" }, + { "wbf", CS_KSC5601, "Al" }, + { "wba", CS_KSC5601, "Am" }, + { "wm", CS_KSC5601, "An" }, + { "wmr", CS_KSC5601, "Ao" }, + { "wms", CS_KSC5601, "Ap" }, + { "wmf", CS_KSC5601, "Aq" }, + { "wma", CS_KSC5601, "Ar" }, + { "wmq", CS_KSC5601, "As" }, + { "wmt", CS_KSC5601, "At" }, + { "wmd", CS_KSC5601, "Au" }, + { "wl", CS_KSC5601, "Av" }, + { "wlr", CS_KSC5601, "Aw" }, + { "wls", CS_KSC5601, "Ax" }, + { "wle", CS_KSC5601, "Ay" }, + { "wlf", CS_KSC5601, "Az" }, + { "wlfa", CS_KSC5601, "A{" }, + { "wla", CS_KSC5601, "A|" }, + { "wlq", CS_KSC5601, "A}" }, + { "wlt", CS_KSC5601, "A~" }, + { "wld", CS_KSC5601, "B!" }, + { "wlw", CS_KSC5601, "B\"" }, + { "wlx", CS_KSC5601, "B#" }, + { "wlv", CS_KSC5601, "B$" }, + { "Wk", CS_KSC5601, "B%" }, + { "Wkr", CS_KSC5601, "B&" }, + { "Wks", CS_KSC5601, "B\'" }, + { "Wksg", CS_KSC5601, "B(" }, + { "Wkf", CS_KSC5601, "B)" }, + { "Wkfq", CS_KSC5601, "B*" }, + { "Wka", CS_KSC5601, "B+" }, + { "Wkq", CS_KSC5601, "B," }, + { "Wkt", CS_KSC5601, "B-" }, + { "WkT", CS_KSC5601, "B." }, + { "Wkd", CS_KSC5601, "B/" }, + { "Wo", CS_KSC5601, "B0" }, + { "Wor", CS_KSC5601, "B1" }, + { "Wos", CS_KSC5601, "B2" }, + { "Wof", CS_KSC5601, "B3" }, + { "Woa", CS_KSC5601, "B4" }, + { "Woq", CS_KSC5601, "B5" }, + { "Wot", CS_KSC5601, "B6" }, + { "WoT", CS_KSC5601, "B7" }, + { "Wod", CS_KSC5601, "B8" }, + { "Wi", CS_KSC5601, "B9" }, + { "Wis", CS_KSC5601, "B:" }, + { "Wid", CS_KSC5601, "B;" }, + { "Wj", CS_KSC5601, "B<" }, + { "Wjr", CS_KSC5601, "B=" }, + { "Wjs", CS_KSC5601, "B>" }, + { "Wjf", CS_KSC5601, "B?" }, + { "Wja", CS_KSC5601, "B@" }, + { "Wjq", CS_KSC5601, "BA" }, + { "Wjt", CS_KSC5601, "BB" }, + { "WjT", CS_KSC5601, "BC" }, + { "Wjd", CS_KSC5601, "BD" }, + { "Wp", CS_KSC5601, "BE" }, + { "Wpd", CS_KSC5601, "BF" }, + { "Wu", CS_KSC5601, "BG" }, + { "WuT", CS_KSC5601, "BH" }, + { "Wh", CS_KSC5601, "BI" }, + { "Whr", CS_KSC5601, "BJ" }, + { "Whs", CS_KSC5601, "BK" }, + { "Whf", CS_KSC5601, "BL" }, + { "Wha", CS_KSC5601, "BM" }, + { "Whq", CS_KSC5601, "BN" }, + { "Wht", CS_KSC5601, "BO" }, + { "Whd", CS_KSC5601, "BP" }, + { "Whc", CS_KSC5601, "BQ" }, + { "Whk", CS_KSC5601, "BR" }, + { "Whkr", CS_KSC5601, "BS" }, + { "Whkf", CS_KSC5601, "BT" }, + { "WhkT", CS_KSC5601, "BU" }, + { "Who", CS_KSC5601, "BV" }, + { "WhoT", CS_KSC5601, "BW" }, + { "Whl", CS_KSC5601, "BX" }, + { "Whls", CS_KSC5601, "BY" }, + { "Whlf", CS_KSC5601, "BZ" }, + { "Whla", CS_KSC5601, "B[" }, + { "Whlq", CS_KSC5601, "B\\" }, + { "Wyd", CS_KSC5601, "B]" }, + { "Wn", CS_KSC5601, "B^" }, + { "Wnr", CS_KSC5601, "B_" }, + { "Wns", CS_KSC5601, "B`" }, + { "Wnf", CS_KSC5601, "Ba" }, + { "Wna", CS_KSC5601, "Bb" }, + { "Wnq", CS_KSC5601, "Bc" }, + { "Wnd", CS_KSC5601, "Bd" }, + { "Wnj", CS_KSC5601, "Be" }, + { "WnjT", CS_KSC5601, "Bf" }, + { "Wnjd", CS_KSC5601, "Bg" }, + { "Wnl", CS_KSC5601, "Bh" }, + { "Wb", CS_KSC5601, "Bi" }, + { "Wm", CS_KSC5601, "Bj" }, + { "Wma", CS_KSC5601, "Bk" }, + { "Wmt", CS_KSC5601, "Bl" }, + { "Wmd", CS_KSC5601, "Bm" }, + { "Wl", CS_KSC5601, "Bn" }, + { "Wlr", CS_KSC5601, "Bo" }, + { "Wls", CS_KSC5601, "Bp" }, + { "Wlf", CS_KSC5601, "Bq" }, + { "Wla", CS_KSC5601, "Br" }, + { "Wlq", CS_KSC5601, "Bs" }, + { "Wld", CS_KSC5601, "Bt" }, + { "Wlw", CS_KSC5601, "Bu" }, + { "Wlg", CS_KSC5601, "Bv" }, + { "ck", CS_KSC5601, "Bw" }, + { "ckr", CS_KSC5601, "Bx" }, + { "cks", CS_KSC5601, "By" }, + { "cksg", CS_KSC5601, "Bz" }, + { "ckf", CS_KSC5601, "B{" }, + { "cka", CS_KSC5601, "B|" }, + { "ckq", CS_KSC5601, "B}" }, + { "ckt", CS_KSC5601, "B~" }, + { "ckT", CS_KSC5601, "C!" }, + { "ckd", CS_KSC5601, "C\"" }, + { "ckw", CS_KSC5601, "C#" }, + { "co", CS_KSC5601, "C$" }, + { "cor", CS_KSC5601, "C%" }, + { "cos", CS_KSC5601, "C&" }, + { "cof", CS_KSC5601, "C\'" }, + { "coa", CS_KSC5601, "C(" }, + { "coq", CS_KSC5601, "C)" }, + { "cot", CS_KSC5601, "C*" }, + { "coT", CS_KSC5601, "C+" }, + { "cod", CS_KSC5601, "C," }, + { "ci", CS_KSC5601, "C-" }, + { "cis", CS_KSC5601, "C." }, + { "cisg", CS_KSC5601, "C/" }, + { "cif", CS_KSC5601, "C0" }, + { "cia", CS_KSC5601, "C1" }, + { "cid", CS_KSC5601, "C2" }, + { "cj", CS_KSC5601, "C3" }, + { "cjr", CS_KSC5601, "C4" }, + { "cjs", CS_KSC5601, "C5" }, + { "cjf", CS_KSC5601, "C6" }, + { "cja", CS_KSC5601, "C7" }, + { "cjq", CS_KSC5601, "C8" }, + { "cjt", CS_KSC5601, "C9" }, + { "cjT", CS_KSC5601, "C:" }, + { "cjd", CS_KSC5601, "C;" }, + { "cp", CS_KSC5601, "C<" }, + { "cpr", CS_KSC5601, "C=" }, + { "cps", CS_KSC5601, "C>" }, + { "cpf", CS_KSC5601, "C?" }, + { "cpa", CS_KSC5601, "C@" }, + { "cpq", CS_KSC5601, "CA" }, + { "cpt", CS_KSC5601, "CB" }, + { "cpd", CS_KSC5601, "CC" }, + { "cu", CS_KSC5601, "CD" }, + { "cus", CS_KSC5601, "CE" }, + { "cuT", CS_KSC5601, "CF" }, + { "cP", CS_KSC5601, "CG" }, + { "cPs", CS_KSC5601, "CH" }, + { "cPd", CS_KSC5601, "CI" }, + { "ch", CS_KSC5601, "CJ" }, + { "chr", CS_KSC5601, "CK" }, + { "chs", CS_KSC5601, "CL" }, + { "chf", CS_KSC5601, "CM" }, + { "cha", CS_KSC5601, "CN" }, + { "chq", CS_KSC5601, "CO" }, + { "cht", CS_KSC5601, "CP" }, + { "chd", CS_KSC5601, "CQ" }, + { "chk", CS_KSC5601, "CR" }, + { "chks", CS_KSC5601, "CS" }, + { "chkf", CS_KSC5601, "CT" }, + { "chkd", CS_KSC5601, "CU" }, + { "chl", CS_KSC5601, "CV" }, + { "chls", CS_KSC5601, "CW" }, + { "chlf", CS_KSC5601, "CX" }, + { "chla", CS_KSC5601, "CY" }, + { "chlq", CS_KSC5601, "CZ" }, + { "chlt", CS_KSC5601, "C[" }, + { "chld", CS_KSC5601, "C\\" }, + { "cy", CS_KSC5601, "C]" }, + { "cya", CS_KSC5601, "C^" }, + { "cn", CS_KSC5601, "C_" }, + { "cnr", CS_KSC5601, "C`" }, + { "cns", CS_KSC5601, "Ca" }, + { "cnf", CS_KSC5601, "Cb" }, + { "cna", CS_KSC5601, "Cc" }, + { "cnq", CS_KSC5601, "Cd" }, + { "cnt", CS_KSC5601, "Ce" }, + { "cnd", CS_KSC5601, "Cf" }, + { "cnj", CS_KSC5601, "Cg" }, + { "cnjT", CS_KSC5601, "Ch" }, + { "cnp", CS_KSC5601, "Ci" }, + { "cnps", CS_KSC5601, "Cj" }, + { "cnl", CS_KSC5601, "Ck" }, + { "cnls", CS_KSC5601, "Cl" }, + { "cnlf", CS_KSC5601, "Cm" }, + { "cnla", CS_KSC5601, "Cn" }, + { "cnlq", CS_KSC5601, "Co" }, + { "cnlt", CS_KSC5601, "Cp" }, + { "cnld", CS_KSC5601, "Cq" }, + { "cb", CS_KSC5601, "Cr" }, + { "cbs", CS_KSC5601, "Cs" }, + { "cbf", CS_KSC5601, "Ct" }, + { "cba", CS_KSC5601, "Cu" }, + { "cbd", CS_KSC5601, "Cv" }, + { "cm", CS_KSC5601, "Cw" }, + { "cmr", CS_KSC5601, "Cx" }, + { "cms", CS_KSC5601, "Cy" }, + { "cmf", CS_KSC5601, "Cz" }, + { "cma", CS_KSC5601, "C{" }, + { "cmq", CS_KSC5601, "C|" }, + { "cmt", CS_KSC5601, "C}" }, + { "cmd", CS_KSC5601, "C~" }, + { "cl", CS_KSC5601, "D!" }, + { "clr", CS_KSC5601, "D\"" }, + { "cls", CS_KSC5601, "D#" }, + { "cle", CS_KSC5601, "D$" }, + { "clf", CS_KSC5601, "D%" }, + { "clfr", CS_KSC5601, "D&" }, + { "cla", CS_KSC5601, "D\'" }, + { "clq", CS_KSC5601, "D(" }, + { "clt", CS_KSC5601, "D)" }, + { "cld", CS_KSC5601, "D*" }, + { "zk", CS_KSC5601, "D+" }, + { "zkr", CS_KSC5601, "D," }, + { "zks", CS_KSC5601, "D-" }, + { "zkf", CS_KSC5601, "D." }, + { "zka", CS_KSC5601, "D/" }, + { "zkq", CS_KSC5601, "D0" }, + { "zkt", CS_KSC5601, "D1" }, + { "zkd", CS_KSC5601, "D2" }, + { "zo", CS_KSC5601, "D3" }, + { "zor", CS_KSC5601, "D4" }, + { "zos", CS_KSC5601, "D5" }, + { "zof", CS_KSC5601, "D6" }, + { "zoa", CS_KSC5601, "D7" }, + { "zoq", CS_KSC5601, "D8" }, + { "zot", CS_KSC5601, "D9" }, + { "zoT", CS_KSC5601, "D:" }, + { "zod", CS_KSC5601, "D;" }, + { "zi", CS_KSC5601, "D<" }, + { "zir", CS_KSC5601, "D=" }, + { "zid", CS_KSC5601, "D>" }, + { "zj", CS_KSC5601, "D?" }, + { "zjr", CS_KSC5601, "D@" }, + { "zjs", CS_KSC5601, "DA" }, + { "zje", CS_KSC5601, "DB" }, + { "zjf", CS_KSC5601, "DC" }, + { "zja", CS_KSC5601, "DD" }, + { "zjq", CS_KSC5601, "DE" }, + { "zjt", CS_KSC5601, "DF" }, + { "zjT", CS_KSC5601, "DG" }, + { "zjd", CS_KSC5601, "DH" }, + { "zp", CS_KSC5601, "DI" }, + { "zpr", CS_KSC5601, "DJ" }, + { "zps", CS_KSC5601, "DK" }, + { "zpf", CS_KSC5601, "DL" }, + { "zpa", CS_KSC5601, "DM" }, + { "zpq", CS_KSC5601, "DN" }, + { "zpt", CS_KSC5601, "DO" }, + { "zpd", CS_KSC5601, "DP" }, + { "zu", CS_KSC5601, "DQ" }, + { "zus", CS_KSC5601, "DR" }, + { "zuf", CS_KSC5601, "DS" }, + { "zua", CS_KSC5601, "DT" }, + { "zuq", CS_KSC5601, "DU" }, + { "zut", CS_KSC5601, "DV" }, + { "zuT", CS_KSC5601, "DW" }, + { "zud", CS_KSC5601, "DX" }, + { "zP", CS_KSC5601, "DY" }, + { "zh", CS_KSC5601, "DZ" }, + { "zhr", CS_KSC5601, "D[" }, + { "zhs", CS_KSC5601, "D\\" }, + { "zhf", CS_KSC5601, "D]" }, + { "zha", CS_KSC5601, "D^" }, + { "zhq", CS_KSC5601, "D_" }, + { "zht", CS_KSC5601, "D`" }, + { "zhd", CS_KSC5601, "Da" }, + { "zhk", CS_KSC5601, "Db" }, + { "zhkr", CS_KSC5601, "Dc" }, + { "zhks", CS_KSC5601, "Dd" }, + { "zhkf", CS_KSC5601, "De" }, + { "zhka", CS_KSC5601, "Df" }, + { "zhkd", CS_KSC5601, "Dg" }, + { "zho", CS_KSC5601, "Dh" }, + { "zhod", CS_KSC5601, "Di" }, + { "zhl", CS_KSC5601, "Dj" }, + { "zhlf", CS_KSC5601, "Dk" }, + { "zy", CS_KSC5601, "Dl" }, + { "zn", CS_KSC5601, "Dm" }, + { "znr", CS_KSC5601, "Dn" }, + { "zns", CS_KSC5601, "Do" }, + { "znf", CS_KSC5601, "Dp" }, + { "zna", CS_KSC5601, "Dq" }, + { "znq", CS_KSC5601, "Dr" }, + { "znt", CS_KSC5601, "Ds" }, + { "znd", CS_KSC5601, "Dt" }, + { "znj", CS_KSC5601, "Du" }, + { "znjs", CS_KSC5601, "Dv" }, + { "znjf", CS_KSC5601, "Dw" }, + { "znjd", CS_KSC5601, "Dx" }, + { "znp", CS_KSC5601, "Dy" }, + { "znpd", CS_KSC5601, "Dz" }, + { "znl", CS_KSC5601, "D{" }, + { "znlr", CS_KSC5601, "D|" }, + { "znls", CS_KSC5601, "D}" }, + { "znlf", CS_KSC5601, "D~" }, + { "znla", CS_KSC5601, "E!" }, + { "znlq", CS_KSC5601, "E\"" }, + { "znlt", CS_KSC5601, "E#" }, + { "znld", CS_KSC5601, "E$" }, + { "zb", CS_KSC5601, "E%" }, + { "zbs", CS_KSC5601, "E&" }, + { "zbf", CS_KSC5601, "E\'" }, + { "zba", CS_KSC5601, "E(" }, + { "zm", CS_KSC5601, "E)" }, + { "zmr", CS_KSC5601, "E*" }, + { "zms", CS_KSC5601, "E+" }, + { "zmf", CS_KSC5601, "E," }, + { "zma", CS_KSC5601, "E-" }, + { "zmq", CS_KSC5601, "E." }, + { "zmd", CS_KSC5601, "E/" }, + { "zl", CS_KSC5601, "E0" }, + { "zlr", CS_KSC5601, "E1" }, + { "zls", CS_KSC5601, "E2" }, + { "zlf", CS_KSC5601, "E3" }, + { "zla", CS_KSC5601, "E4" }, + { "zlq", CS_KSC5601, "E5" }, + { "zlt", CS_KSC5601, "E6" }, + { "zld", CS_KSC5601, "E7" }, + { "xk", CS_KSC5601, "E8" }, + { "xkr", CS_KSC5601, "E9" }, + { "xks", CS_KSC5601, "E:" }, + { "xkf", CS_KSC5601, "E;" }, + { "xkfr", CS_KSC5601, "E<" }, + { "xka", CS_KSC5601, "E=" }, + { "xkq", CS_KSC5601, "E>" }, + { "xkt", CS_KSC5601, "E?" }, + { "xkT", CS_KSC5601, "E@" }, + { "xkd", CS_KSC5601, "EA" }, + { "xo", CS_KSC5601, "EB" }, + { "xor", CS_KSC5601, "EC" }, + { "xos", CS_KSC5601, "ED" }, + { "xof", CS_KSC5601, "EE" }, + { "xoa", CS_KSC5601, "EF" }, + { "xoq", CS_KSC5601, "EG" }, + { "xot", CS_KSC5601, "EH" }, + { "xoT", CS_KSC5601, "EI" }, + { "xod", CS_KSC5601, "EJ" }, + { "xi", CS_KSC5601, "EK" }, + { "xid", CS_KSC5601, "EL" }, + { "xj", CS_KSC5601, "EM" }, + { "xjr", CS_KSC5601, "EN" }, + { "xjs", CS_KSC5601, "EO" }, + { "xjf", CS_KSC5601, "EP" }, + { "xjfa", CS_KSC5601, "EQ" }, + { "xja", CS_KSC5601, "ER" }, + { "xjq", CS_KSC5601, "ES" }, + { "xjt", CS_KSC5601, "ET" }, + { "xjT", CS_KSC5601, "EU" }, + { "xjd", CS_KSC5601, "EV" }, + { "xp", CS_KSC5601, "EW" }, + { "xpr", CS_KSC5601, "EX" }, + { "xps", CS_KSC5601, "EY" }, + { "xpf", CS_KSC5601, "EZ" }, + { "xpa", CS_KSC5601, "E[" }, + { "xpq", CS_KSC5601, "E\\" }, + { "xpt", CS_KSC5601, "E]" }, + { "xpd", CS_KSC5601, "E^" }, + { "xu", CS_KSC5601, "E_" }, + { "xus", CS_KSC5601, "E`" }, + { "xuT", CS_KSC5601, "Ea" }, + { "xP", CS_KSC5601, "Eb" }, + { "xPs", CS_KSC5601, "Ec" }, + { "xh", CS_KSC5601, "Ed" }, + { "xhr", CS_KSC5601, "Ee" }, + { "xhs", CS_KSC5601, "Ef" }, + { "xhf", CS_KSC5601, "Eg" }, + { "xha", CS_KSC5601, "Eh" }, + { "xhq", CS_KSC5601, "Ei" }, + { "xht", CS_KSC5601, "Ej" }, + { "xhd", CS_KSC5601, "Ek" }, + { "xhv", CS_KSC5601, "El" }, + { "xhk", CS_KSC5601, "Em" }, + { "xhks", CS_KSC5601, "En" }, + { "xho", CS_KSC5601, "Eo" }, + { "xhl", CS_KSC5601, "Ep" }, + { "xhls", CS_KSC5601, "Eq" }, + { "xhlt", CS_KSC5601, "Er" }, + { "xhld", CS_KSC5601, "Es" }, + { "xy", CS_KSC5601, "Et" }, + { "xn", CS_KSC5601, "Eu" }, + { "xnr", CS_KSC5601, "Ev" }, + { "xns", CS_KSC5601, "Ew" }, + { "xnf", CS_KSC5601, "Ex" }, + { "xna", CS_KSC5601, "Ey" }, + { "xnq", CS_KSC5601, "Ez" }, + { "xnt", CS_KSC5601, "E{" }, + { "xnd", CS_KSC5601, "E|" }, + { "xnj", CS_KSC5601, "E}" }, + { "xnjT", CS_KSC5601, "E~" }, + { "xnp", CS_KSC5601, "F!" }, + { "xnl", CS_KSC5601, "F\"" }, + { "xnlr", CS_KSC5601, "F#" }, + { "xnls", CS_KSC5601, "F$" }, + { "xnlf", CS_KSC5601, "F%" }, + { "xnla", CS_KSC5601, "F&" }, + { "xnlq", CS_KSC5601, "F\'" }, + { "xnld", CS_KSC5601, "F(" }, + { "xb", CS_KSC5601, "F)" }, + { "xbs", CS_KSC5601, "F*" }, + { "xbf", CS_KSC5601, "F+" }, + { "xba", CS_KSC5601, "F," }, + { "xbd", CS_KSC5601, "F-" }, + { "xm", CS_KSC5601, "F." }, + { "xmr", CS_KSC5601, "F/" }, + { "xms", CS_KSC5601, "F0" }, + { "xme", CS_KSC5601, "F1" }, + { "xmf", CS_KSC5601, "F2" }, + { "xmfa", CS_KSC5601, "F3" }, + { "xma", CS_KSC5601, "F4" }, + { "xmq", CS_KSC5601, "F5" }, + { "xmt", CS_KSC5601, "F6" }, + { "xml", CS_KSC5601, "F7" }, + { "xmls", CS_KSC5601, "F8" }, + { "xmlf", CS_KSC5601, "F9" }, + { "xmla", CS_KSC5601, "F:" }, + { "xmlq", CS_KSC5601, "F;" }, + { "xl", CS_KSC5601, "F<" }, + { "xlr", CS_KSC5601, "F=" }, + { "xls", CS_KSC5601, "F>" }, + { "xlf", CS_KSC5601, "F?" }, + { "xla", CS_KSC5601, "F@" }, + { "xlq", CS_KSC5601, "FA" }, + { "xlt", CS_KSC5601, "FB" }, + { "xld", CS_KSC5601, "FC" }, + { "vk", CS_KSC5601, "FD" }, + { "vkr", CS_KSC5601, "FE" }, + { "vkR", CS_KSC5601, "FF" }, + { "vks", CS_KSC5601, "FG" }, + { "vkf", CS_KSC5601, "FH" }, + { "vkfa", CS_KSC5601, "FI" }, + { "vka", CS_KSC5601, "FJ" }, + { "vkq", CS_KSC5601, "FK" }, + { "vkt", CS_KSC5601, "FL" }, + { "vkT", CS_KSC5601, "FM" }, + { "vkd", CS_KSC5601, "FN" }, + { "vkx", CS_KSC5601, "FO" }, + { "vo", CS_KSC5601, "FP" }, + { "vor", CS_KSC5601, "FQ" }, + { "vos", CS_KSC5601, "FR" }, + { "vof", CS_KSC5601, "FS" }, + { "voa", CS_KSC5601, "FT" }, + { "voq", CS_KSC5601, "FU" }, + { "vot", CS_KSC5601, "FV" }, + { "voT", CS_KSC5601, "FW" }, + { "vod", CS_KSC5601, "FX" }, + { "vi", CS_KSC5601, "FY" }, + { "vir", CS_KSC5601, "FZ" }, + { "vj", CS_KSC5601, "F[" }, + { "vjr", CS_KSC5601, "F\\" }, + { "vjs", CS_KSC5601, "F]" }, + { "vjf", CS_KSC5601, "F^" }, + { "vja", CS_KSC5601, "F_" }, + { "vjq", CS_KSC5601, "F`" }, + { "vjt", CS_KSC5601, "Fa" }, + { "vjT", CS_KSC5601, "Fb" }, + { "vjd", CS_KSC5601, "Fc" }, + { "vp", CS_KSC5601, "Fd" }, + { "vpr", CS_KSC5601, "Fe" }, + { "vps", CS_KSC5601, "Ff" }, + { "vpf", CS_KSC5601, "Fg" }, + { "vpa", CS_KSC5601, "Fh" }, + { "vpq", CS_KSC5601, "Fi" }, + { "vpt", CS_KSC5601, "Fj" }, + { "vpd", CS_KSC5601, "Fk" }, + { "vu", CS_KSC5601, "Fl" }, + { "vus", CS_KSC5601, "Fm" }, + { "vuf", CS_KSC5601, "Fn" }, + { "vua", CS_KSC5601, "Fo" }, + { "vuq", CS_KSC5601, "Fp" }, + { "vuT", CS_KSC5601, "Fq" }, + { "vud", CS_KSC5601, "Fr" }, + { "vP", CS_KSC5601, "Fs" }, + { "vPf", CS_KSC5601, "Ft" }, + { "vPq", CS_KSC5601, "Fu" }, + { "vPt", CS_KSC5601, "Fv" }, + { "vh", CS_KSC5601, "Fw" }, + { "vhr", CS_KSC5601, "Fx" }, + { "vhs", CS_KSC5601, "Fy" }, + { "vhf", CS_KSC5601, "Fz" }, + { "vha", CS_KSC5601, "F{" }, + { "vhq", CS_KSC5601, "F|" }, + { "vht", CS_KSC5601, "F}" }, + { "vhd", CS_KSC5601, "F~" }, + { "vhk", CS_KSC5601, "G!" }, + { "vhkd", CS_KSC5601, "G\"" }, + { "vhl", CS_KSC5601, "G#" }, + { "vhls", CS_KSC5601, "G$" }, + { "vy", CS_KSC5601, "G%" }, + { "vys", CS_KSC5601, "G&" }, + { "vyf", CS_KSC5601, "G\'" }, + { "vyq", CS_KSC5601, "G(" }, + { "vyt", CS_KSC5601, "G)" }, + { "vn", CS_KSC5601, "G*" }, + { "vnr", CS_KSC5601, "G+" }, + { "vns", CS_KSC5601, "G," }, + { "vne", CS_KSC5601, "G-" }, + { "vnf", CS_KSC5601, "G." }, + { "vnfa", CS_KSC5601, "G/" }, + { "vna", CS_KSC5601, "G0" }, + { "vnq", CS_KSC5601, "G1" }, + { "vnt", CS_KSC5601, "G2" }, + { "vnd", CS_KSC5601, "G3" }, + { "vnj", CS_KSC5601, "G4" }, + { "vnjd", CS_KSC5601, "G5" }, + { "vnl", CS_KSC5601, "G6" }, + { "vnls", CS_KSC5601, "G7" }, + { "vnlf", CS_KSC5601, "G8" }, + { "vnla", CS_KSC5601, "G9" }, + { "vnlt", CS_KSC5601, "G:" }, + { "vb", CS_KSC5601, "G;" }, + { "vbs", CS_KSC5601, "G<" }, + { "vbf", CS_KSC5601, "G=" }, + { "vba", CS_KSC5601, "G>" }, + { "vbt", CS_KSC5601, "G?" }, + { "vbd", CS_KSC5601, "G@" }, + { "vm", CS_KSC5601, "GA" }, + { "vms", CS_KSC5601, "GB" }, + { "vmf", CS_KSC5601, "GC" }, + { "vma", CS_KSC5601, "GD" }, + { "vmq", CS_KSC5601, "GE" }, + { "vmt", CS_KSC5601, "GF" }, + { "vl", CS_KSC5601, "GG" }, + { "vlr", CS_KSC5601, "GH" }, + { "vls", CS_KSC5601, "GI" }, + { "vlf", CS_KSC5601, "GJ" }, + { "vla", CS_KSC5601, "GK" }, + { "vlq", CS_KSC5601, "GL" }, + { "vlt", CS_KSC5601, "GM" }, + { "vld", CS_KSC5601, "GN" }, + { "gk", CS_KSC5601, "GO" }, + { "gkr", CS_KSC5601, "GP" }, + { "gks", CS_KSC5601, "GQ" }, + { "gkf", CS_KSC5601, "GR" }, + { "gkfx", CS_KSC5601, "GS" }, + { "gka", CS_KSC5601, "GT" }, + { "gkq", CS_KSC5601, "GU" }, + { "gkt", CS_KSC5601, "GV" }, + { "gkd", CS_KSC5601, "GW" }, + { "go", CS_KSC5601, "GX" }, + { "gor", CS_KSC5601, "GY" }, + { "gos", CS_KSC5601, "GZ" }, + { "gof", CS_KSC5601, "G[" }, + { "goa", CS_KSC5601, "G\\" }, + { "goq", CS_KSC5601, "G]" }, + { "got", CS_KSC5601, "G^" }, + { "goT", CS_KSC5601, "G_" }, + { "god", CS_KSC5601, "G`" }, + { "gi", CS_KSC5601, "Ga" }, + { "gid", CS_KSC5601, "Gb" }, + { "gj", CS_KSC5601, "Gc" }, + { "gjr", CS_KSC5601, "Gd" }, + { "gjs", CS_KSC5601, "Ge" }, + { "gjf", CS_KSC5601, "Gf" }, + { "gjfa", CS_KSC5601, "Gg" }, + { "gja", CS_KSC5601, "Gh" }, + { "gjq", CS_KSC5601, "Gi" }, + { "gjt", CS_KSC5601, "Gj" }, + { "gjd", CS_KSC5601, "Gk" }, + { "gp", CS_KSC5601, "Gl" }, + { "gpr", CS_KSC5601, "Gm" }, + { "gps", CS_KSC5601, "Gn" }, + { "gpf", CS_KSC5601, "Go" }, + { "gpa", CS_KSC5601, "Gp" }, + { "gpq", CS_KSC5601, "Gq" }, + { "gpt", CS_KSC5601, "Gr" }, + { "gpd", CS_KSC5601, "Gs" }, + { "gu", CS_KSC5601, "Gt" }, + { "gur", CS_KSC5601, "Gu" }, + { "gus", CS_KSC5601, "Gv" }, + { "guf", CS_KSC5601, "Gw" }, + { "gua", CS_KSC5601, "Gx" }, + { "guq", CS_KSC5601, "Gy" }, + { "gut", CS_KSC5601, "Gz" }, + { "guT", CS_KSC5601, "G{" }, + { "gud", CS_KSC5601, "G|" }, + { "gP", CS_KSC5601, "G}" }, + { "gPs", CS_KSC5601, "G~" }, + { "gPf", CS_KSC5601, "H!" }, + { "gPq", CS_KSC5601, "H\"" }, + { "gh", CS_KSC5601, "H#" }, + { "ghr", CS_KSC5601, "H$" }, + { "ghs", CS_KSC5601, "H%" }, + { "ghf", CS_KSC5601, "H&" }, + { "ghfx", CS_KSC5601, "H\'" }, + { "gha", CS_KSC5601, "H(" }, + { "ghq", CS_KSC5601, "H)" }, + { "ght", CS_KSC5601, "H*" }, + { "ghd", CS_KSC5601, "H+" }, + { "ghx", CS_KSC5601, "H," }, + { "ghk", CS_KSC5601, "H-" }, + { "ghkr", CS_KSC5601, "H." }, + { "ghks", CS_KSC5601, "H/" }, + { "ghkf", CS_KSC5601, "H0" }, + { "ghkt", CS_KSC5601, "H1" }, + { "ghkd", CS_KSC5601, "H2" }, + { "gho", CS_KSC5601, "H3" }, + { "ghor", CS_KSC5601, "H4" }, + { "ghos", CS_KSC5601, "H5" }, + { "ghot", CS_KSC5601, "H6" }, + { "ghod", CS_KSC5601, "H7" }, + { "ghl", CS_KSC5601, "H8" }, + { "ghlr", CS_KSC5601, "H9" }, + { "ghls", CS_KSC5601, "H:" }, + { "ghlf", CS_KSC5601, "H;" }, + { "ghlq", CS_KSC5601, "H<" }, + { "ghlt", CS_KSC5601, "H=" }, + { "ghld", CS_KSC5601, "H>" }, + { "gy", CS_KSC5601, "H?" }, + { "gys", CS_KSC5601, "H@" }, + { "gyf", CS_KSC5601, "HA" }, + { "gyq", CS_KSC5601, "HB" }, + { "gyt", CS_KSC5601, "HC" }, + { "gn", CS_KSC5601, "HD" }, + { "gnr", CS_KSC5601, "HE" }, + { "gns", CS_KSC5601, "HF" }, + { "gnf", CS_KSC5601, "HG" }, + { "gnfx", CS_KSC5601, "HH" }, + { "gna", CS_KSC5601, "HI" }, + { "gnt", CS_KSC5601, "HJ" }, + { "gnd", CS_KSC5601, "HK" }, + { "gnj", CS_KSC5601, "HL" }, + { "gnjs", CS_KSC5601, "HM" }, + { "gnjf", CS_KSC5601, "HN" }, + { "gnja", CS_KSC5601, "HO" }, + { "gnjd", CS_KSC5601, "HP" }, + { "gnp", CS_KSC5601, "HQ" }, + { "gnpr", CS_KSC5601, "HR" }, + { "gnps", CS_KSC5601, "HS" }, + { "gnpf", CS_KSC5601, "HT" }, + { "gnpd", CS_KSC5601, "HU" }, + { "gnl", CS_KSC5601, "HV" }, + { "gnlr", CS_KSC5601, "HW" }, + { "gnls", CS_KSC5601, "HX" }, + { "gnlf", CS_KSC5601, "HY" }, + { "gnla", CS_KSC5601, "HZ" }, + { "gnlq", CS_KSC5601, "H[" }, + { "gnlt", CS_KSC5601, "H\\" }, + { "gnld", CS_KSC5601, "H]" }, + { "gb", CS_KSC5601, "H^" }, + { "gbr", CS_KSC5601, "H_" }, + { "gbs", CS_KSC5601, "H`" }, + { "gbf", CS_KSC5601, "Ha" }, + { "gba", CS_KSC5601, "Hb" }, + { "gbt", CS_KSC5601, "Hc" }, + { "gbd", CS_KSC5601, "Hd" }, + { "gm", CS_KSC5601, "He" }, + { "gmr", CS_KSC5601, "Hf" }, + { "gms", CS_KSC5601, "Hg" }, + { "gmsg", CS_KSC5601, "Hh" }, + { "gme", CS_KSC5601, "Hi" }, + { "gmf", CS_KSC5601, "Hj" }, + { "gmfr", CS_KSC5601, "Hk" }, + { "gma", CS_KSC5601, "Hl" }, + { "gmq", CS_KSC5601, "Hm" }, + { "gmt", CS_KSC5601, "Hn" }, + { "gmd", CS_KSC5601, "Ho" }, + { "gmx", CS_KSC5601, "Hp" }, + { "gml", CS_KSC5601, "Hq" }, + { "gmls", CS_KSC5601, "Hr" }, + { "gmlf", CS_KSC5601, "Hs" }, + { "gmla", CS_KSC5601, "Ht" }, + { "gmlq", CS_KSC5601, "Hu" }, + { "gmld", CS_KSC5601, "Hv" }, + { "gl", CS_KSC5601, "Hw" }, + { "glr", CS_KSC5601, "Hx" }, + { "gls", CS_KSC5601, "Hy" }, + { "glf", CS_KSC5601, "Hz" }, + { "gla", CS_KSC5601, "H{" }, + { "glq", CS_KSC5601, "H|" }, + { "glt", CS_KSC5601, "H}" }, + { "gld", CS_KSC5601, "H~" }, + + { "Z!", CS_KSC5601, "#!" }, + { "Z\"", CS_KSC5601, "#\"" }, + { "Z#", CS_KSC5601, "##" }, + { "Z$", CS_KSC5601, "#$" }, + { "Z%", CS_KSC5601, "#%" }, + { "Z&", CS_KSC5601, "#&" }, + { "Z\'", CS_KSC5601, "#\'" }, + { "Z(", CS_KSC5601, "#(" }, + { "Z)", CS_KSC5601, "#)" }, + { "Z*", CS_KSC5601, "#*" }, + { "Z+", CS_KSC5601, "#+" }, + { "Z,", CS_KSC5601, "#," }, + { "Z-", CS_KSC5601, "#-" }, + { "Z.", CS_KSC5601, "#." }, + { "Z/", CS_KSC5601, "#/" }, + { "Z0", CS_KSC5601, "#0" }, + { "Z1", CS_KSC5601, "#1" }, + { "Z2", CS_KSC5601, "#2" }, + { "Z3", CS_KSC5601, "#3" }, + { "Z4", CS_KSC5601, "#4" }, + { "Z5", CS_KSC5601, "#5" }, + { "Z6", CS_KSC5601, "#6" }, + { "Z7", CS_KSC5601, "#7" }, + { "Z8", CS_KSC5601, "#8" }, + { "Z9", CS_KSC5601, "#9" }, + { "Z:", CS_KSC5601, "#:" }, + { "Z;", CS_KSC5601, "#;" }, + { "Z<", CS_KSC5601, "#<" }, + { "Z=", CS_KSC5601, "#=" }, + { "Z>", CS_KSC5601, "#>" }, + { "Z?", CS_KSC5601, "#?" }, + { "Z@", CS_KSC5601, "#@" }, + { "ZA", CS_KSC5601, "#A" }, + { "ZB", CS_KSC5601, "#B" }, + { "ZC", CS_KSC5601, "#C" }, + { "ZD", CS_KSC5601, "#D" }, + { "ZE", CS_KSC5601, "#E" }, + { "ZF", CS_KSC5601, "#F" }, + { "ZG", CS_KSC5601, "#G" }, + { "ZH", CS_KSC5601, "#H" }, + { "ZI", CS_KSC5601, "#I" }, + { "ZJ", CS_KSC5601, "#J" }, + { "ZK", CS_KSC5601, "#K" }, + { "ZL", CS_KSC5601, "#L" }, + { "ZM", CS_KSC5601, "#M" }, + { "ZN", CS_KSC5601, "#N" }, + { "ZO", CS_KSC5601, "#O" }, + { "ZP", CS_KSC5601, "#P" }, + { "ZQ", CS_KSC5601, "#Q" }, + { "ZR", CS_KSC5601, "#R" }, + { "ZS", CS_KSC5601, "#S" }, + { "ZT", CS_KSC5601, "#T" }, + { "ZU", CS_KSC5601, "#U" }, + { "ZV", CS_KSC5601, "#V" }, + { "ZW", CS_KSC5601, "#W" }, + { "ZX", CS_KSC5601, "#X" }, + { "ZY", CS_KSC5601, "#Y" }, + { "ZZ", CS_KSC5601, "#Z" }, + { "Z[", CS_KSC5601, "#[" }, + { "SW", CS_KSC5601, "#\\" }, + { "Z]", CS_KSC5601, "#]" }, + { "Z^", CS_KSC5601, "#^" }, + { "Z_", CS_KSC5601, "#_" }, + { "Z`", CS_KSC5601, "#`" }, + { "Za", CS_KSC5601, "#a" }, + { "Zb", CS_KSC5601, "#b" }, + { "Zc", CS_KSC5601, "#c" }, + { "Zd", CS_KSC5601, "#d" }, + { "Ze", CS_KSC5601, "#e" }, + { "Zf", CS_KSC5601, "#f" }, + { "Zg", CS_KSC5601, "#g" }, + { "Zh", CS_KSC5601, "#h" }, + { "Zi", CS_KSC5601, "#i" }, + { "Zj", CS_KSC5601, "#j" }, + { "Zk", CS_KSC5601, "#k" }, + { "Zl", CS_KSC5601, "#l" }, + { "Zm", CS_KSC5601, "#m" }, + { "Zn", CS_KSC5601, "#n" }, + { "Zo", CS_KSC5601, "#o" }, + { "Zp", CS_KSC5601, "#p" }, + { "Zq", CS_KSC5601, "#q" }, + { "Zr", CS_KSC5601, "#r" }, + { "Zs", CS_KSC5601, "#s" }, + { "Zt", CS_KSC5601, "#t" }, + { "Zu", CS_KSC5601, "#u" }, + { "Zv", CS_KSC5601, "#v" }, + { "Zw", CS_KSC5601, "#w" }, + { "Zx", CS_KSC5601, "#x" }, + { "Zy", CS_KSC5601, "#y" }, + { "Zz", CS_KSC5601, "#z" }, + { "Z{", CS_KSC5601, "#{" }, + { "Z|", CS_KSC5601, "#|" }, + { "Z}", CS_KSC5601, "#}" }, + { "Z^-", CS_KSC5601, "#~" }, + + { "HS", CS_KSC5601, "$U" }, + { "Hse", CS_KSC5601, "$V" }, + { "Hst", CS_KSC5601, "$W" }, + { "HsT", CS_KSC5601, "$X" }, + { "Hfrt", CS_KSC5601, "$Y" }, + { "Hfqt", CS_KSC5601, "$[" }, + { "Hfe", CS_KSC5601, "$Z" }, + { "HfT", CS_KSC5601, "$\\" }, + { "HfG", CS_KSC5601, "$]" }, + { "Haq", CS_KSC5601, "$^" }, + { "Hat", CS_KSC5601, "$_" }, + { "HaT", CS_KSC5601, "$`" }, + { "Had", CS_KSC5601, "$a" }, + { "Hqr", CS_KSC5601, "$b" }, + { "Hqe", CS_KSC5601, "$c" }, + { "Hqtr", CS_KSC5601, "$d" }, + { "Hqte", CS_KSC5601, "$e" }, + { "Hqw", CS_KSC5601, "$f" }, + { "Hqx", CS_KSC5601, "$g" }, + { "Hqd", CS_KSC5601, "$h" }, + { "HQd", CS_KSC5601, "$i" }, + { "Htr", CS_KSC5601, "$j" }, + { "Hts", CS_KSC5601, "$k" }, + { "Hte", CS_KSC5601, "$l" }, + { "Htq", CS_KSC5601, "$m" }, + { "Htw", CS_KSC5601, "$n" }, + { "HT", CS_KSC5601, "$o" }, + { "HD", CS_KSC5601, "$p" }, + { "Hd", CS_KSC5601, "$q" }, + { "Hdw", CS_KSC5601, "$r" }, + { "HdT", CS_KSC5601, "$s" }, + { "Hvd", CS_KSC5601, "$t" }, + { "HG", CS_KSC5601, "$u" }, + { "Hg", CS_KSC5601, "$v" }, + { "Hyi", CS_KSC5601, "$w" }, + { "HyO", CS_KSC5601, "$x" }, + { "Hyl", CS_KSC5601, "$y" }, + { "Hbu", CS_KSC5601, "$z" }, + { "HbP", CS_KSC5601, "${" }, + { "Hbl", CS_KSC5601, "$|" }, + { "H.", CS_KSC5601, "$}" }, + { "H.l", CS_KSC5601, "$~" }, + + { "SY", CS_KSC5601, "!M" }, + { "SP", CS_KSC5601, "!L" }, + { "S%", CS_KSC5601, "\"6" }, + { "Swn", CS_KSC5601, "\"_" }, + { "Sks", CS_KSC5601, "\"^" }, + { "SNo", CS_KSC5601, "\"`" }, + { "SCo", CS_KSC5601, "\"a" }, + { "STM", CS_KSC5601, "\"b" }, + { "Sam", CS_KSC5601, "\"c" }, + { "Spm", CS_KSC5601, "\"d" }, + { "STel", CS_KSC5601, "\"e" }, + { "SC", CS_KSC5601, "!I" }, + { "SA", CS_KSC5601, "!J" }, + { "SC/", CS_KSC5601, "!K" }, + { "SF", CS_KSC5601, "\"5" }, + #endif + + #if 1 + #endif + { NULL }, + }; + + static DICT * + quail_finddict(name, len, partial) + CHAR_T *name; + size_t len; + size_t *partial; + { + DICT *p; + DICT *q; + size_t plen; + size_t nmatches; + size_t npartial; + + q = NULL; + nmatches = 0; + npartial = 0; + for (p = quaildict; p->name; p++) { + plen = strlen(p->name); + if (plen == len && memcmp(name, p->name, plen) == 0) { + q = p; + nmatches++; + } else if (plen > len && memcmp(name, p->name, len) == 0) { + npartial++; + } + } + + if (partial) + *partial = npartial; + + switch (nmatches) { + case 0: + if (npartial) + return NULL; + else + return p; + case 1: + return q; + default: + abort(); + } + } + + void + quail_keyinput(sp, e, kbuf, kbuflen, intbuf, pintbuflen, pstate, pconsumed) + SCR *sp; + ENCODING *e; + CHAR_T *kbuf; + size_t kbuflen; + CHAR_T *intbuf; + size_t *pintbuflen; + int *pstate; + size_t *pconsumed; + { + size_t i; + size_t j; + size_t consumed; + int quailmode; + int state; + + + quailmode = *pstate & (1<<20); + state = *pstate & ~((~0) << 19); + i = j = consumed = 0; + + if (quailmode) { + DICT *odictent; + DICT *dictent; + CHAR_T *t; + size_t partial; + + again: + if (kbuflen == consumed) + goto finish; + + if (kbuflen - consumed - 1) { + odictent = quail_finddict(kbuf + consumed, + kbuflen - consumed - 1, NULL); + } else + odictent = NULL; + dictent = quail_finddict(kbuf + consumed, + kbuflen - consumed, &partial); + + if (!dictent) { + /* partial matches only */ + goto finish; + } + + if (dictent->name == NULL) { + /* no possible match*/ + if (odictent) { + consumed += strlen(odictent->name); + goto again; + } else { + i = consumed; + goto notquail; + } + } + + /* + * Tricky part... + * Say the input buffer is "abcd". + * 1. If there is an entry for "abc", we already + * emitted some item. erase that by ctrl-H. + * 2. Emit the content of dict entry. + * 3a. If it is complete match and there's no + * ambiguity, mark the input buffer "consumed". + * 3b. if the input buffer is not empty, do it again. + */ + if (odictent) + intbuf[j++] = '\010'; /*ctrl-H*/ + if (dictent->charset != CS_NONE) + intbuf[j++] = dictent->charset; + for (t = dictent->str; *t; t++) + intbuf[j++] = *t; + + if (partial == 0) { + consumed += strlen(dictent->name); + goto again; + } + + goto finish; + } + + notquail: + while (i < kbuflen) { + if (kbuf[i] == ('O' & 0x1f)) { + /* enter/leave quail mode */ + quailmode = quailmode ? 0 : 1; + i++; + consumed++; + continue; + } + + if (kbuf[i] & 0x80) { + intbuf[j++] = CS_RAW0 + v_key_len(sp, kbuf[i]); + intbuf[j++] = kbuf[i] & 0x7f; + i++; + consumed++; + } else { + intbuf[j++] = kbuf[i++]; + consumed++; + } + } + + finish: + *pintbuflen = j; + *pconsumed = consumed; + *pstate = (quailmode ? (1<<20) : 0) | state; + } + #endif /*MULTIBYTE*/ Index: common/util.c Prereq: 10.11 *** nvi-1.79/common/util.c Mon Sep 16 04:57:58 1996 --- nvi-1.79-m17n/common/util.c Thu Feb 20 00:41:49 1997 *************** *** 78,84 **** --- 78,88 ---- recno_t lno; size_t *cnop; { + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif size_t cnt, len, off; int isempty; Index: curses/README.m17n *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/curses/README.m17n Sun Feb 16 00:00:54 1997 *************** *** 0 **** --- 1,55 ---- + notes on curses multilingual patch + Jun-ichiro itojun Itoh + $Id: README.m17n,v 1.3 1997/02/15 15:00:54 itojun Exp $ + + The patched curses contained in this directory can easily be used + separately from nvi-m17n. (I've never tried, but I believe so) + So, I would like to add a brief description on the patch. + + Programming interface + If called with addnstr() or waddnstr() with proper designation, + the package recognizes the following escape sequences: + ESC $ A GB2312 mapped to G0 + ESC $ B JIS X0208-1983 mapped to G0 + ESC $ @ JIS X0208-1976 mapped to G0 + ESC ( x any 94 charsets mapped to G0 + ESC , x any 96 charsets mapped to G0 + ESC $ ( x any 94-94 charsets mapped to G0 + ESC $ , x any 96-96 charsets mapped to G0 + (There's no usage example so it may not work) + curses package will properly designate those charsets on redraw. + + If some char passed by addnstr() or waddnstr() comes with 8th bit set + (0x80 - 0xff), it will be recognized as either: + two-byte 8bit sequence, or + single-byte 8bit sequence if there's no more char + They will just go through curses. It will be useful to implement + euc-jp/cn/kr, sjis, or big5 display. + + The package does NOT hold designation status. If you have no + designation in your argument to addnstr() or waddnstr(), it will be + considered as ASCII string. You must re-designate each time you do + addnstr() or waddnstr(). + For example, + addnstr(win, "\033$B", 3); + addnstr(win, "xx", 2); + will display "xx" in ASCII, not in JIS X0208-1983. + + Example: + addnstr(win, "\033$Bxx", 5); JIS X0208-1983 char + addnstr(win, "\033,Ax", 4); latin-1 some char + addnstr(win, "\241\241", 2); two-byte 8bit, go through + addnstr(win, "\241\041", 2); two-byte 8bit, go through + addnstr(win, "\241", 1); single-byte 8bit, go through + + Requirement to terminal + A terminal software must properly handle G0 designation, if + you specified designation in parameter to addnstr() or waddnstr(). + + A terminal software must properly handle "ESC ( B" (ASCII charset to + G0), which will be frequently emitted by this curses package. + + A terminal must be configured so that it can handle 8bit chars + emitted by programmers. Since there's no way to find out what kind of + 8bit encoding method is currently used, it is up to users to control + terminal encoding and the program's encoding. Index: curses/addbytes.c Prereq: 8.4 *** nvi-1.79/curses/addbytes.c Thu Mar 7 06:54:43 1996 --- nvi-1.79-m17n/curses/addbytes.c Thu Feb 20 12:49:10 1997 *************** *** 52,57 **** --- 52,58 ---- register const char *bytes; register int count; int so; + #ifndef MULTIBYTE { static char blanks[] = " "; register int c, newx, x, y; *************** *** 157,159 **** --- 158,432 ---- SYNCH_OUT; return (OK); } + #else /*MULTIBYTE*/ + { + static char blanks[] = " "; + register int c, newx, x, y; + __LINE *lp; + __LDATA newch; + __LDATA newch0; + enum {ASCII, MB7, MB8} kstate; + char designation; + int is96; + int ismb; + + /* initilize */ + kstate = ASCII; + designation = '\0'; + is96 = 0; + ismb = 0; + + SYNCH_IN; + + #ifdef CURSES_DEBUG + __CTRACE("ADDBYTES('%c') at (%d, %d)\n", c, y, x); + #endif + while (count--) { + c = *bytes++; + switch (c) { + case '\t': + SYNCH_OUT; + if (waddbytes(win, blanks, 8 - (x % 8)) == ERR) + return (ERR); + SYNCH_IN; + break; + case '\033': + if (2 <= count && bytes[0] == '(' && bytes[1] == 'B') { + designation = '\0'; + count -= 2; + bytes += 2; + break; + } else if (2 <= count && strchr("(,", bytes[0]) + && 0x30 <= bytes[1] && bytes[1] <= 0x7f) { + designation = bytes[1]; + is96 = (bytes[0] == ','); + ismb = 0; + count -= 2; + bytes += 2; + break; + } else if (2 <= count && bytes[0] == '$' + && strchr("@AB", bytes[1])) { + designation = bytes[1]; + is96 = 0; + ismb = 1; + count -= 2; + bytes += 2; + break; + } else if (3 <= count && bytes[0] == '$' + && strchr("(,", bytes[1]) + && 0x30 <= bytes[2] && bytes[2] <= 0x7f) { + designation = bytes[2]; + is96 = (bytes[1] == ','); + ismb = 1; + count -= 3; + bytes += 3; + break; + } + /* fall through */ + + default: + #ifdef CURSES_DEBUG + __CTRACE("ADDBYTES(%0.2o, %d, %d)\n", win, y, x); + #endif + + lp = win->lines[y]; + if (lp->flags & __ISPASTEOL) { + lp->flags &= ~__ISPASTEOL; + newline: if (y == win->maxy - 1) { + if (win->flags & __SCROLLOK) { + SYNCH_OUT; + scroll(win); + SYNCH_IN; + lp = win->lines[y]; + x = 0; + } else + return (ERR); + } else { + y++; + lp = win->lines[y]; + x = 0; + } + if (c == '\n') + break; + } + + #ifdef CURSES_DEBUG + __CTRACE("ADDBYTES: 1: y = %d, x = %d, firstch = %d, lastch = %d\n", + y, x, *win->lines[y]->firstchp, *win->lines[y]->lastchp); + #endif + + memcpy(&newch, &lp->line[x], __LDATASIZE); + + /* + * Create buffer for new character. + */ + newch.ch = c; + if (win->flags & __WSTANDOUT || so) + newch.attr |= __STANDOUT; + else + newch.attr &= ~__STANDOUT; + newch.attr &= ~(__MBFIRST | __MBSECOND | __MBDESIG | __MB96); + newch.desig = '\0'; + switch (kstate) { + case ASCII: + if (designation) { + newch.attr |= __MBDESIG; + newch.attr |= (is96 ? __MB96 : 0); + newch.desig = designation; + if (1 <= count && ismb) { + newch.attr |= __MBFIRST; + kstate = MB7; + } + } else if (c & 0x80) { + if (1 <= count) { + newch.attr |= __MBFIRST; + kstate = MB8; + } + } + break; + case MB7: + newch.attr |= __MBDESIG; + newch.attr |= (is96 ? __MB96 : 0); + newch.desig = designation; + /* fall through */ + case MB8: + newch.attr |= __MBSECOND; + kstate = ASCII; + break; + } + + /* + * Displaying multibyte char across start-of-line + * or end-of-line is illegal. Protect ourself against + * that situation. + */ + if (x == 0 && (newch.attr & __MBSECOND)) { + newch.ch = ' '; + newch.attr &= ~__MBALL; + newch.desig = '\0'; + } else if (x == win->maxx - 1 + && (newch.attr & __MBFIRST)) { + newch.ch = ' '; + newch.attr &= ~__MBALL; + newch.desig = '\0'; + } + + #define UPDATE(x) \ + { \ + newx = (x) + win->ch_off; \ + if (!(lp->flags & __ISDIRTY)) { \ + lp->flags |= __ISDIRTY; \ + *lp->firstchp = *lp->lastchp = newx; \ + } else if (newx < *lp->firstchp) \ + *lp->firstchp = newx; \ + else if (newx > *lp->lastchp) \ + *lp->lastchp = newx; \ + } + + /* + * Perform update, only if it is needed. + * + * 1. If we got first part of multibyte char, + * update will be delayed till the next round. + * 2. If we got second part of multibyte char, + * and there is a change, update both part. + * 3. If we got singlebyte char, and there is a change, + * update. + * + * While doing update, we might overwrite first/second + * part of multibyte char only. Since it is illegal + * to do so, we'll erase the countarpart by space. + */ + if (newch.attr & __MBFIRST) { + /* update it later. */ + memcpy(&newch0, &newch, __LDATASIZE); + } else if ((newch.attr & __MBSECOND) + && (memcmp(&newch0, &lp->line[x - 1], __LDATASIZE) + || memcmp(&newch, &lp->line[x], __LDATASIZE))) { + UPDATE(x - 1); + UPDATE(x); + + if (0 <= x - 2 + && (lp->line[x-1].attr & __MBSECOND)) { + lp->line[x - 2].ch = ' '; + lp->line[x - 2].attr = 0; + lp->line[x - 2].desig = 0; + + UPDATE(x - 2); + } + if (x + 1 < win->maxx + && (lp->line[x].attr & __MBFIRST)) { + lp->line[x + 1].ch = ' '; + lp->line[x + 1].attr = 0; + lp->line[x + 1].desig = 0; + + UPDATE(x + 1); + } + + #ifdef CURSES_DEBUG + __CTRACE("ADDBYTES: change gives f/l: %d/%d [%d/%d]\n", + *lp->firstchp, *lp->lastchp, + *lp->firstchp - win->ch_off, + *lp->lastchp - win->ch_off); + #endif + + memcpy(&lp->line[x - 1], &newch0, __LDATASIZE); + memcpy(&lp->line[x], &newch, __LDATASIZE); + } else if (memcmp(&newch, &lp->line[x], __LDATASIZE)) { + UPDATE(x); + + if (0 <= x - 1 + && (lp->line[x].attr & __MBSECOND)) { + lp->line[x - 1].ch = ' '; + lp->line[x - 1].attr = 0; + lp->line[x - 1].desig = 0; + + UPDATE(x - 1); + } + if (x + 1 < win->maxx + && (lp->line[x].attr & __MBFIRST)) { + lp->line[x + 1].ch = ' '; + lp->line[x + 1].attr = 0; + lp->line[x + 1].desig = 0; + + UPDATE(x + 1); + } + + #ifdef CURSES_DEBUG + __CTRACE("ADDBYTES: change gives f/l: %d/%d [%d/%d]\n", + *lp->firstchp, *lp->lastchp, + *lp->firstchp - win->ch_off, + *lp->lastchp - win->ch_off); + #endif + + memcpy(&lp->line[x], &newch, __LDATASIZE); + } + if (x == win->maxx - 1) + lp->flags |= __ISPASTEOL; + else + x++; + #ifdef CURSES_DEBUG + __CTRACE("ADDBYTES: 2: y = %d, x = %d, firstch = %d, lastch = %d\n", + y, x, *win->lines[y]->firstchp, *win->lines[y]->lastchp); + #endif + break; + case '\n': + SYNCH_OUT; + wclrtoeol(win); + SYNCH_IN; + if (!NONL) + x = 0; + goto newline; + case '\r': + x = 0; + break; + case '\b': + if (--x < 0) + x = 0; + break; + } + } + SYNCH_OUT; + return (OK); + } + #endif /*MULTIBYTE*/ Index: curses/addch.c Prereq: 8.2 *** nvi-1.79/curses/addch.c Wed May 4 22:25:24 1994 --- nvi-1.79-m17n/curses/addch.c Sun Feb 2 18:21:18 1997 *************** *** 51,56 **** --- 51,59 ---- buf.ch = ch; buf.attr = 0; + #ifdef MULTIBYTE + buf.desig = 0; + #endif return (__waddch(win, &buf)); } Index: curses/box.c Prereq: 8.2 *** nvi-1.79/curses/box.c Wed May 4 22:25:24 1994 --- nvi-1.79-m17n/curses/box.c Tue Feb 4 01:41:11 1997 *************** *** 56,77 **** --- 56,114 ---- lp = win->lines[endy]->line; for (i = 0; i < endx; i++) { fp[i].ch = lp[i].ch = hor; + #ifndef MULTIBYTE fp[i].attr &= ~__STANDOUT; lp[i].attr &= ~__STANDOUT; + #else + fp[i].attr &= ~(__STANDOUT | __MBALL); + fp[i].desig = 0; + lp[i].attr &= ~(__STANDOUT | __MBALL); + lp[i].desig = 0; + #endif /*MULTIBYTE*/ } endx--; for (i = 0; i <= endy; i++) { + #ifndef MULTIBYTE win->lines[i]->line[0].ch = vert; win->lines[i]->line[endx].ch = vert; win->lines[i]->line[0].attr &= ~__STANDOUT; win->lines[i]->line[endx].attr &= ~__STANDOUT; + #else + if (win->lines[i]->line[1].attr & __MBSECOND) { + win->lines[i]->line[1].ch = ' '; + win->lines[i]->line[1].attr &= ~(__STANDOUT | __MBALL); + win->lines[i]->line[1].desig = 0; + } + win->lines[i]->line[0].ch = vert; + win->lines[i]->line[0].attr &= ~(__STANDOUT | __MBALL); + win->lines[i]->line[0].desig = 0; + if (win->lines[i]->line[endx - 1].attr & __MBFIRST) { + win->lines[i]->line[endx - 1].ch = ' '; + win->lines[i]->line[endx - 1].attr &= ~(__STANDOUT | __MBALL); + win->lines[i]->line[endx - 1].desig = 0; + } + win->lines[i]->line[endx].ch = vert; + win->lines[i]->line[endx].attr &= ~(__STANDOUT | __MBALL); + win->lines[i]->line[endx].desig = 0; + #endif /*MULTIBYTE*/ } if (!(win->flags & __SCROLLOK) && (win->flags & __SCROLLWIN)) { fp[0].ch = fp[endx].ch = lp[0].ch = lp[endx].ch = ' '; + #ifndef MULTIBYTE fp[0].attr &= ~__STANDOUT; fp[endx].attr &= ~__STANDOUT; lp[0].attr &= ~__STANDOUT; lp[endx].attr &= ~__STANDOUT; + #else + fp[0].attr &= ~(__STANDOUT | __MBALL); + fp[0].desig = 0; + fp[endx].attr &= ~(__STANDOUT | __MBALL); + fp[endx].desig = 0; + lp[0].attr &= ~(__STANDOUT | __MBALL); + lp[0].desig = 0; + lp[endx].attr &= ~(__STANDOUT | __MBALL); + lp[endx].desig = 0; + #endif /*MULTIBYTE*/ } __touchwin(win); return (OK); Index: curses/clrtobot.c Prereq: 8.2 *** nvi-1.79/curses/clrtobot.c Wed May 4 22:25:25 1994 --- nvi-1.79-m17n/curses/clrtobot.c Sun Feb 2 18:21:54 1997 *************** *** 65,70 **** --- 65,73 ---- minx = sp - win->lines[y]->line; sp->ch = ' '; sp->attr = 0; + #ifdef MULTIBYTE + sp->desig = 0; + #endif } if (minx != -1) __touchline(win, y, minx, maxx - win->lines[y]->line, Index: curses/clrtoeol.c Prereq: 8.2 *** nvi-1.79/curses/clrtoeol.c Mon Feb 26 01:32:38 1996 --- nvi-1.79-m17n/curses/clrtoeol.c Sun Feb 2 18:22:19 1997 *************** *** 67,72 **** --- 67,75 ---- minx = sp - win->lines[y]->line; sp->ch = ' '; sp->attr = 0; + #ifdef MULTIBYTE + sp->desig = 0; + #endif } #ifdef CURSES_DEBUG __CTRACE("CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", Index: curses/cr_put.c Prereq: 8.3 *** nvi-1.79/curses/cr_put.c Mon Feb 26 01:32:41 1996 --- nvi-1.79-m17n/curses/cr_put.c Sun Feb 2 18:21:42 1997 *************** *** 379,388 **** --- 379,395 ---- } } while (outcol < destcol) { + #ifndef MULTIBYTE /* * Move one char to the right. We don't use ND space because * it's better to just print the char we are moving over. */ + #else + /* + * We use ND space since it is not possible to reprint + * part of kanji chars. + */ + #endif /*MULTIBYTE*/ if (in_refresh) if (plodflg) /* Avoid a complex calculation. */ plodcnt--; *************** *** 390,398 **** i = curscr->lines[outline]->line[outcol].ch; if ((curscr->lines[outline]->line[outcol].attr & __STANDOUT) == ! (curscr->flags & __WSTANDOUT)) putchar(i); ! else goto nondes; } else --- 397,412 ---- i = curscr->lines[outline]->line[outcol].ch; if ((curscr->lines[outline]->line[outcol].attr & __STANDOUT) == ! (curscr->flags & __WSTANDOUT)) { ! #ifndef MULTIBYTE putchar(i); ! #else ! if (ND) ! tputs(ND, 0, plodput); ! else ! putchar(i); ! #endif /*MULTIBYTE*/ ! } else goto nondes; } else Index: curses/curses.h Prereq: 8.5 *** nvi-1.79/curses/curses.h Fri Jun 14 22:11:11 1996 --- nvi-1.79-m17n/curses/curses.h Tue Feb 4 02:00:57 1997 *************** *** 120,126 **** --- 120,134 ---- char ch; /* the actual character */ #define __STANDOUT 0x01 /* Added characters are standout. */ + #define __MBFIRST 0x02 /* 94x94/96x96 first char */ + #define __MBSECOND 0x04 /* 94x94/96x96 second char */ + #define __MBDESIG 0x08 /* Need designation */ + #define __MB96 0x10 /* 96/96x96 charset */ + #define __MBALL 0x1e char attr; /* attributes of character */ + #ifdef MULTIBYTE + char desig; + #endif } __LDATA; #define __LDATASIZE (sizeof(__LDATA)) *************** *** 235,242 **** --- 243,255 ---- ((bf) ? ((w)->flags |= __LEAVEOK) : ((w)->flags &= ~__LEAVEOK)) #define scrollok(w, bf) \ ((bf) ? ((w)->flags |= __SCROLLOK) : ((w)->flags &= ~__SCROLLOK)) + #ifndef MULTIBYTE #define winch(w) \ ((w)->lines[(w)->cury]->line[(w)->curx].ch & 0177) + #else + #define winch(w) \ + ((w)->lines[(w)->cury]->line[(w)->curx].ch) + #endif /*MULTIBYTE*/ /* Public function prototypes. */ int box(); Index: curses/delch.c Prereq: 8.2 *** nvi-1.79/curses/delch.c Wed May 4 22:25:26 1994 --- nvi-1.79-m17n/curses/delch.c Sun Feb 2 18:22:35 1997 *************** *** 58,63 **** --- 58,66 ---- } temp1->ch = ' '; temp1->attr = 0; + #ifdef MULTIBYTE + temp1->desig = 0; + #endif __touchline(win, win->cury, win->curx, win->maxx - 1, 0); return (OK); } Index: curses/deleteln.c Prereq: 8.2 *** nvi-1.79/curses/deleteln.c Mon Feb 26 01:32:47 1996 --- nvi-1.79-m17n/curses/deleteln.c Sun Feb 2 18:22:50 1997 *************** *** 74,79 **** --- 74,82 ---- for(i = 0; i < win->maxx; i++) { temp->line[i].ch = ' '; temp->line[i].attr = 0; + #ifdef MULTIBYTE + temp->line[i].desig = 0; + #endif } __touchline(win, y, 0, win->maxx - 1, 0); if (win->orig == NULL) Index: curses/erase.c Prereq: 8.2 *** nvi-1.79/curses/erase.c Mon Feb 26 01:32:50 1996 --- nvi-1.79-m17n/curses/erase.c Sun Feb 2 18:23:15 1997 *************** *** 63,68 **** --- 63,71 ---- minx = sp - start; sp->ch = ' '; sp->attr = 0; + #ifdef MULTIBYTE + sp->desig = 0; + #endif } if (minx != -1) __touchline(win, y, minx, maxx - win->lines[y]->line, Index: curses/insch.c Prereq: 8.2 *** nvi-1.79/curses/insch.c Wed May 4 22:25:27 1994 --- nvi-1.79-m17n/curses/insch.c Tue Feb 4 01:44:15 1997 *************** *** 54,65 **** --- 54,90 ---- end = &win->lines[win->cury]->line[win->curx]; temp1 = &win->lines[win->cury]->line[win->maxx - 1]; temp2 = temp1 - 1; + #ifdef MULTIBYTE + if (end->attr & __MBSECOND) { + if (1 < win->curx) { + (end - 1)->ch = ' '; + (end - 1)->attr &= ~__MBALL; + (end - 1)->desig = 0; + } + end->ch = ' '; + end->attr &= ~__MBALL; + end->desig = 0; + } + if (temp2->attr & __MBFIRST) { + temp2->ch = ' '; + temp2->attr &= ~__MBALL; + temp2->desig = 0; + temp1->ch = ' '; + temp1->attr &= ~__MBALL; + temp1->desig = 0; + } + #endif /*MULTIBYTE*/ while (temp1 > end) { (void)memcpy(temp1, temp2, sizeof(__LDATA)); temp1--, temp2--; } temp1->ch = ch; + #ifndef MULTIBYTE temp1->attr &= ~__STANDOUT; + #else + temp1->attr &= ~(__STANDOUT | __MBALL); + temp1->desig = 0; + #endif __touchline(win, win->cury, win->curx, win->maxx - 1, 0); if (win->cury == LINES - 1 && (win->lines[LINES - 1]->line[COLS - 1].ch != ' ' || Index: curses/insertln.c Prereq: 8.2 *** nvi-1.79/curses/insertln.c Mon Feb 26 01:32:59 1996 --- nvi-1.79-m17n/curses/insertln.c Sun Feb 2 18:23:33 1997 *************** *** 74,79 **** --- 74,82 ---- for(i = 0; i < win->maxx; i++) { temp->line[i].ch = ' '; temp->line[i].attr = 0; + #ifdef MULTIBYTE + temp->line[i].desig = 0; + #endif } __touchline(win, y, 0, win->maxx - 1, 0); if (win->orig == NULL) Index: curses/newwin.c Prereq: 8.3 *** nvi-1.79/curses/newwin.c Mon Feb 26 01:33:09 1996 --- nvi-1.79-m17n/curses/newwin.c Sun Feb 2 18:21:48 1997 *************** *** 80,85 **** --- 80,88 ---- for (sp = lp->line, j = 0; j < nc; j++, sp++) { sp->ch = ' '; sp->attr = 0; + #ifdef MULTIBYTE + sp->desig = 0; + #endif } lp->hash = __hash((char *) lp->line, nc * __LDATASIZE); } Index: curses/overlay.c Prereq: 8.2 *** nvi-1.79/curses/overlay.c Mon Feb 26 01:33:13 1996 --- nvi-1.79-m17n/curses/overlay.c Thu Feb 20 12:41:12 1997 *************** *** 71,77 **** x = startx - win2->begx; for (sp = &win1->lines[y1]->line[startx - win1->begx]; sp < end; sp++) { ! if (!isspace(sp->ch)) { wmove(win2, y2, x); __waddch(win2, sp); } --- 71,82 ---- x = startx - win2->begx; for (sp = &win1->lines[y1]->line[startx - win1->begx]; sp < end; sp++) { ! #ifndef MULTIBYTE ! if (!isspace(sp->ch)) ! #else ! if (!isspace(sp->ch & 0xff)) ! #endif ! { wmove(win2, y2, x); __waddch(win2, sp); } Index: curses/refresh.c Prereq: 8.7 *** nvi-1.79/curses/refresh.c Sat Mar 16 00:49:32 1996 --- nvi-1.79-m17n/curses/refresh.c Thu Feb 20 12:49:51 1997 *************** *** 47,52 **** --- 47,96 ---- static void quickch(); static void scrolln(); + #ifdef MULTIBYTE + static void + putdesig(csp) + __LDATA *csp; + { + static enum { NO, ASCII, CACHED } prevstate = NO; + static __LDATA prev; + + if (csp == NULL) + goto ascii; + + if ((csp->attr & __MBDESIG) && csp->desig) { + if (prevstate == CACHED) { + if (csp && prev.attr == csp->attr + && prev.desig == csp->desig) + return; + } + + putchar('\033'); + if (csp->attr & __MBFIRST) { + putchar('$'); + if (!strchr("@AB", csp->desig)) + putchar((csp->attr & __MB96) ? ',' : '('); + putchar(csp->desig); + } else { + putchar((csp->attr & __MB96) ? ',' : '('); + putchar(csp->desig); + } + + prev = *csp; + prevstate = CACHED; + } else { + ascii: + if (prevstate == ASCII) + return; + + putchar('\033'); + putchar('('); + putchar('B'); + prevstate = ASCII; + } + } + #endif /*MULTIBYTE*/ + /* * wrefresh -- * Make the current screen look like "win" over the area coverd by *************** *** 272,290 **** } while (wx <= lch) { ! if (!force && memcmp(nsp, csp, sizeof(__LDATA)) == 0) { if (wx <= lch) { while (wx <= lch && ! memcmp(nsp, csp, sizeof(__LDATA)) == 0) { nsp++; if (!curwin) ++csp; ++wx; } continue; } break; } domvcur(ly, lx, y, wx + win->begx); #ifdef CURSES_DEBUG --- 316,364 ---- } while (wx <= lch) { ! #ifndef MULTIBYTE ! if (!force && memcmp(nsp, csp, sizeof(__LDATA)) == 0) ! #else ! if (!force && memcmp(nsp, csp, ! ((nsp->attr & __MBFIRST) ? 2 : 1) * sizeof(__LDATA)) == 0) ! #endif /*MULTIBYTE*/ ! { if (wx <= lch) { + #ifndef MULTIBYTE while (wx <= lch && ! memcmp(nsp, csp, sizeof(__LDATA)) == 0) ! #else ! while (wx <= lch && ! memcmp(nsp, csp, ! ((nsp->attr & __MBFIRST) ? 2 : 1) * sizeof(__LDATA)) == 0) ! #endif /*MULTIBYTE*/ ! { ! #ifndef MULTIBYTE nsp++; if (!curwin) ++csp; ++wx; + #else + if (nsp->attr & __MBFIRST) { + nsp += 2; + if (!curwin) + csp += 2; + wx += 2; + } else { + nsp++; + if (!curwin) + ++csp; + ++wx; + } + #endif /*MULTIBYTE*/ } continue; } break; } + #ifdef MULTIBYTE + putdesig(NULL); + #endif domvcur(ly, lx, y, wx + win->begx); #ifdef CURSES_DEBUG *************** *** 293,300 **** #endif ly = y; lx = wx + win->begx; while (wx <= lch && ! (force || memcmp(nsp, csp, sizeof(__LDATA)) != 0)) { if (ce != NULL && win->maxx + win->begx == curscr->maxx && --- 367,381 ---- #endif ly = y; lx = wx + win->begx; + #ifndef MULTIBYTE while (wx <= lch && ! (force || memcmp(nsp, csp, sizeof(__LDATA)) != 0)) ! #else ! while (wx <= lch && ! (force || memcmp(nsp, csp, ! ((nsp->attr & __MBFIRST) ? 2 : 1) * sizeof(__LDATA)) != 0)) ! #endif /*MULTIBYTE*/ ! { if (ce != NULL && win->maxx + win->begx == curscr->maxx && *************** *** 312,317 **** --- 393,401 ---- if ((clsp - nlsp >= strlen(CE) && clsp < win->maxx * __LDATASIZE) || wy == win->maxy - 1) { + #ifdef MULTIBYTE + putdesig(NULL); + #endif if (curscr->flags & __WSTANDOUT) { tputs(SE, 0, __cputchar); curscr->flags &= ~__WSTANDOUT; *************** *** 321,326 **** --- 405,413 ---- while (wx++ <= clsp) { csp->ch = ' '; csp->attr = 0; + #ifdef MULTIBYTE + csp->desig = 0; + #endif csp++; } return (OK); *************** *** 336,352 **** --- 423,452 ---- if (nsp->attr & __STANDOUT) { if (!(curscr->flags & __WSTANDOUT) && SO != NULL && SE != NULL) { + #ifdef MULTIBYTE + putdesig(NULL); + #endif tputs(SO, 0, __cputchar); curscr->flags |= __WSTANDOUT; } } else if (curscr->flags & __WSTANDOUT && SE != NULL) { + #ifdef MULTIBYTE + putdesig(NULL); + #endif tputs(SE, 0, __cputchar); curscr->flags &= ~__WSTANDOUT; } + #ifndef MULTIBYTE wx++; + #else + if (nsp->attr & __MBFIRST) + wx += 2; + else + wx++; + #endif /*MULTIBYTE*/ if (wx >= win->maxx && wy == win->maxy - 1 && !curwin) if (win->flags & __SCROLLOK) { if (curscr->flags & __WSTANDOUT *************** *** 359,395 **** --- 459,567 ---- } if (!(win->flags & __SCROLLWIN)) { if (!curwin) { + #ifndef MULTIBYTE csp->attr = nsp->attr; putchar(csp->ch = nsp->ch); + #else + putdesig(nsp); + if (nsp->attr & __MBFIRST) { + csp->attr = nsp->attr; + csp->desig = nsp->desig; + putchar(csp->ch = nsp->ch); + (csp+1)->attr = (nsp+1)->attr; + (csp+1)->desig = (nsp+1)->desig; + putchar((csp+1)->ch = (nsp+1)->ch); + } else { + csp->attr = nsp->attr; + csp->desig = nsp->desig; + putchar(csp->ch = nsp->ch); + } + #endif /*MULTIBYTE*/ } else + #ifndef MULTIBYTE putchar(nsp->ch); + #else + { + putdesig(nsp); + if (nsp->attr & __MBFIRST) { + putchar(nsp->ch); + putchar((nsp+1)->ch); + } else + putchar(nsp->ch); + } + #endif /*MULTIBYTE*/ } if (wx + win->begx < curscr->maxx) { + #ifdef MULTIBYTE + putdesig(NULL); + #endif domvcur(ly, wx + win->begx, win->begy + win->maxy - 1, win->begx + win->maxx - 1); } ly = win->begy + win->maxy - 1; lx = win->begx + win->maxx - 1; + #ifdef MULTIBYTE + putdesig(NULL); + #endif return (OK); } if (wx < win->maxx || wy < win->maxy - 1 || !(win->flags & __SCROLLWIN)) { if (!curwin) { + #ifndef MULTIBYTE csp->attr = nsp->attr; putchar(csp->ch = nsp->ch); csp++; + #else + putdesig(nsp); + if (nsp->attr & __MBFIRST) { + csp->attr = nsp->attr; + csp->desig = nsp->desig; + putchar(csp->ch = nsp->ch); + (csp+1)->attr = (nsp+1)->attr; + (csp+1)->desig = (nsp+1)->desig; + putchar((csp+1)->ch = (nsp+1)->ch); + csp += 2; + } else { + csp->attr = nsp->attr; + csp->desig = nsp->desig; + putchar(csp->ch = nsp->ch); + csp++; + } + #endif /*MULTIBYTE*/ } else + #ifndef MULTIBYTE putchar(nsp->ch); + #else + { + putdesig(nsp); + if (nsp->attr & __MBFIRST) { + putchar(nsp->ch); + putchar((nsp+1)->ch); + } else + putchar(nsp->ch); + } + #endif /*MULTIBYTE*/ } #ifdef CURSES_DEBUG __CTRACE("makech: putchar(%c)\n", nsp->ch & 0177); #endif if (UC && (nsp->attr & __STANDOUT)) { + #ifdef MULTIBYTE + putdesig(NULL); + #endif putchar('\b'); tputs(UC, 0, __cputchar); } + #ifndef MULTIBYTE nsp++; + #else + if (nsp->attr & __MBFIRST) + nsp += 2; + else + nsp++; + #endif /*MULTIBYTE*/ #ifdef CURSES_DEBUG __CTRACE("makech: 2: wx = %d, lx = %d\n", wx, lx); #endif *************** *** 400,405 **** --- 572,580 ---- if (lx >= COLS && AM) lx = COLS - 1; else if (wx >= win->maxx) { + #ifdef MULTIBYTE + putdesig(NULL); + #endif domvcur(ly, lx, ly, win->maxx + win->begx - 1); lx = win->maxx + win->begx - 1; } *************** *** 410,415 **** --- 585,593 ---- } /* Don't leave the screen in standout mode. */ + #ifdef MULTIBYTE + putdesig(NULL); + #endif if (curscr->flags & __WSTANDOUT) { tputs(SE, 0, __cputchar); curscr->flags &= ~__WSTANDOUT; *************** *** 568,573 **** --- 746,754 ---- for (i = 0; i < win->maxx; i++) { buf[i].ch = ' '; buf[i].attr = 0; + #ifdef MULTIBYTE + buf[i].desig = 0; + #endif } blank_hash = __hash((char *) buf, win->maxx * __LDATASIZE); Index: docs.m17n/CHANGELOG *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/docs.m17n/CHANGELOG Wed Aug 20 15:53:23 1997 *************** *** 0 **** --- 1,922 ---- + The following part is progress log, written in japanese. + --- + $BFC$K5-=R$N$J$$5!G=$O!V$^$@J,$N encoding$BL>$K%*%W%7%g%s$,=q$1$k$h$&$K$9$k(B? + fileencoding=sjis:nantara:kantara + $BJ#;($G$o$+$j$K$/$$!#C/$,(Bparse$B$9$k$N(B? + $BL$2r7h(B: leftright$B$N$H$-!"9T:8C<$N0LCV$,$*$+$7$$!#(B(2/21) + $BFC$K!"$$$A$P$s:8$N7e$+$i(Bmultibyte$BJ8;z$,;O$^$k$H$-!#(B + $BL$2r7h(B: isblank()$B4X78$N%H%i%V%k%7%e!<%F%#%s%0!#(B(2/19) + $B0lIt$N(BOS$B$KIUB0$N$O%^%$%J%9$NCM$rEO$9$HH/68$9$k!#(B + -> char *$B$O$[$\A4It(BCHAR_T$B$K!#(B + printf$B4X78LLE]!#(B -> CHAR_T$B$r(Bu_int$B$K$7$h$&7W2h$X(B + $BL$2r7h(B: ex$B$N(Bechoback$B$r$I$&$7$h$&(B? (2/14) + $BL$2r7h(B: esc$B$N%?%$%`%"%&%H$,G\D9$$!#$^$"$$$$$+$"(B?(2/7) + $BL$2r7h(B: :r$B$G%U%!%$%k$rFI$s$@$"$H(Bundo$B$9$k$H!"FbItI=8=$K(B + $BJQ49$r$d$C$?9T?t$,%P%l$F$7$^$&!#(B(2/4) + $B$3$lF($2$k$NAjEvFq$7$$$G$9!#(Bundo log management$B$N$H$3$m$r(B + $B13$D$+$J$$$H$$$1$J$$$s$@$b$s$M!#(B + $BL$2r7h(B: wrapmargin/wraplen$B$N40A42=!#9T$r@Z$k>r7o$ND4@0!#(B(2/15) + $BESCf(B: JIS X0201-left$B$NJ8;z$H(BASCII$B$NJ8;z$H$+!"8!:w$H$+$N$H$-$K(B + $BF10l;k$7$?$$J8;z$O$I$&$9$l$P$$$$$+(B?(2/4) + 1. $B@55,2=%D!<%k$r$D$1$F(Bfilter$B$7$F$b$i$&(B(2/11 ok) + 2. $BF10l;k$9$k%*%W%7%g%s$r$D$1$k(B --- $BLLE](B + $BL$2r7h(B: cl_deleteln()$B$O8=:_0\?"@-$,$J$$$N$GD>$9(B(2/3) + inch()$B$N(Bmultibyte$B2=$C$F$I$&$d$l$P$$$$$s$@!#(B + $BL$2r7h(B: Wnn$B$H$N%j%s%/$O2DG=$+(B?(2/2) + $B$-$C$H$a$s$I$/$5$$$H$*$b$&!#(B + cserver$B$H$+;H$($k$H$-$C$H$$$$$s$@$1$I$J!#(B + $BL$2r7h(B: $B1Q8l(Bnvi/vi$B$H$N(B.exrc$B$N%3%s%U%j%/%H$r$I$&$7$h$&!#(B(2/2) + 1. $B%3%a%s%H$K$7$F$*$/(B + 2. $B%U%!%$%kL>$rJQ$($k(B + 3. wrapper$B$GF($2$k(B + 4. $B5$$K$7$J$$(B + $BL$2r7h(B: $B@55,I=8=$r$,$s$P$m$&(B(12/30) + $B;D$k$OC18l6-3&G'<1!#(B + $BMWD4::(B: $B3Fe$ODL$jH4$1$k$@$1(B) (11/30) + $BESCf(B: %$B%3%^%s%I(B(multibyte$BJ8;z$N>e$ODL$jH4$1$k$@$1(B) (11/30) + $BESCf(B: ~$B%3%^%s%I(B(multibyte$BJ8;z$N>e$ODL$jH4$1$k$@$1(B) (11/30) + + 8/20 + $B:n6H(B: typo fix: s/JIS X0208-1976/JIS X0208-1978/ + common/multibyte.c + common/multi_iso2022.c + $B:n6H(B: character set$BL>$N@0M}!#(B + common/multibyte.c + $B:n6H(B: multibyte$BJ8;z$N>e$G(B"r\r"$B$9$k$H2=$1$F$$$?$N$r=$@5!#(B + vi/v_replace.c + $B:n6H(B: JIS X0208-1990$B%5%]!<%H!#(BESC & x$B$N%5%]!<%H4^$`!#(B + common/multibyte.c + common/multibyte.h + common/multi_iso2022.h + 6/17 + $B:n6H(B: memory leak$B4X78$N=$@5!#(B + 6/2 + $B:n6H(B: sjis$B$N<+F0H=Dj$,4V0c$C$F$$$?(B(0x8e$B$H(B0x8f$B$,8=$l$?$H$-$N=hM}(B)$B$N$G(B + $B=$@5!#(Bserow$B$5$s$N%l%]!<%H$N$*$+$2$G$9!#(B + common/multibyte.c + 5/24 + $B:n6H(B: sizeof(size_t) != sizeof(int)$B$J%^%7%s$N$?$a$N=$@5!#(B + cl/cl_read.c + 4/11 + $B:n6H(B: $B%]%+%_%9=$@5!#(Bthanks to dsp@aries.bekkoame.or.jp + common/multibyte.h + 4/10 + $B:n6H(B: $B%]%+%_%9=$@5!#(B + regex/regcomp.c + 4/8 23:00 + $B:n6H(B: canna fence$B$,$$$-$J$j2hLL2<$K$G$J$$$H$$$1$J$$$H$-$K(B + $BB8:_$7$J$$9T$N(Brepaint$B$K9T$C$F$$$?$N$r=$@5!#(B + canna$B4X78!"$b$&$A$g$C$H@0M}$7$J$$$H$J$"(B... + common/multi_canna.c + $B:n6H(B: $B%I%-%e%a%s%HD>$7!#(B + 4/6 + $B:n6H(B: multi_predict_iso2022()$B$N(Bbugfix$B!#(BSS2$B$,Mh$k$HMn$A$F$$$?!#(B + common/multibyte.c + common/multibyte.h + $B:n6H(B: autodetect=tw + common/multibyte.c + common/multibyte.h + 4/4 + $B:n6H(B: :r$B$7$F$+$i(Bundo$B$7$?$H$-$N(B"n lines changed"$B$NI=<($,$G$J$$$h$&$K(B + $B$G$-$J$$$+$J!"$H;W$C$?$,!"L5M}$@$C$?!#(B + $B:n6H(B: iso2022$B7O$N$H$-$N!"9TKv$N%j%;%C%HJ}K!$rJQ99!#(B + common/multi_iso2022.c + $B:n6H(B: MB_JOIN$B$N=hM}!#$-$?$J$$$>!#(B + common/multibyte.c + common/exf.c + ex/ex_read.c + ex/ex_script.c + $B2r7h(B: hz encoding$B;~$N9TO"7k$N(Bescape($B9TKv$N(B~)$B!#(B(12/26) + $B2r7h(B: iso-2022-kr$B$NFCJL07$$!#(B(4/1) + 1. designation$B$O9TF,$G$d$i$M$P$J$i$J$$(B(4/2 ok) + 2. designation$B$N$_$N9T$,$"$C$?$iFI$_Ht$P$5$M$P$J$i$J$$(B + (RFC1557$B$K$O=q$$$F$J$$$1$I!"=,47>e(B) + 4/3 10:00 + $B:n6H(B: hz$B$N9TKv%(%9%1!<%W$H(Biso-2022-kr$B$N$?$a$K$A$g$C$H$7$?=`Hw!#(B + MB_JOIN$B$NDj5A!#$^$@=hM}$9$k$H$3$m$O=q$$$F$J$$!#(B + common/multi_iso2022.c + common/multi_hz.c + common/multibyte.h + $B:n6H(B: selcharset()$B$r(Bselcharset()$B$H(Bcallcharset()$B$KJ,3d!#(B + $B$A$g$C$H$7$?@0F\!#(B + common/multi_iso2022.c + 4/2 + $B:n6H(B: iso-8859-[1234789]$B$rMQ0U!#(Biso-8859-10 additions(ESC , X)$B$rDI2C!#(B + common/multibyte.c + common/multibyte.h + 4/2 14:00 + $B:n6H(B: iso-2022-kr$B$K$D$$$F0lIt2r7h!#(Bdesignation$B$r9TF,$KEG$/!#(B + Thanks to Jungshik Shin + common/multibyte.c + common/multibyte.h + 3/30 + $B:n6H(B: euc-tw$B%5%]!<%H!#(Bcurses$BB?9q8l2=$N@)Ls$+$i(BCNS11643-1$B0J30$O2hLL$K(B + $B=P$;$J$$$1$I!"$^$"$H$j$"$($:!#(B + common/multibyte.c + common/multibyte.h + common/multi_euctw.c + 3/28 + $B:n6H(B: iso-2022-cn/-ext$B$,$$$^$$$A$@$C$?$N$r=$@5!#(B + encoding$BL>$H$7$F!"(Biso-2022-jp-2$B$H(Biso-2022-cn-ext$B$rMQ0U!#(B + $BFbMFE*$K$O$*$J$8!#(B + common/multi_iso2022.c + common/multibyte.c + $B:n6H(B: regular/qregular$B$N6/2=!#(BISO646 character set$B$G!"Cf4VJ8;z$N(B + $B$J$$$b$N$O$@$$$?$$%U%)%m!e$NJ8;z$r$D$C$3$`$H$-$N(B + $B=hM}$r=$@5!#(B + vi/v_txt.c + 3/17 + $B:n6H(B: $B%-!uBV$r(Bcontrol-C$B$G%j%;%C%H$9$k$h$&$K(B + $B$7$?!#(B + iso-2022-*$B7O$N(Bencoding$B$r%-!C5n=hM}$rD{@5!#(B + $B$H$F$b(Bquickhack$B$G$o$+$j$K$/$$$N$GMW@0M}!#(B + common/multi_canna.c + vi/vs_refresh.c + 2/28 + $B:n6H(B: regexp$B$N(B[^$B$"(B]$B$H$+$&$^$/$$$+$J$+$C$?$N$r=$@5!#(B + $B$d$C$Q$j(Bregexp$B$^$o$j$O%_%9$,$"$k$J!#(B + regex/engine.c + $B:n6H(B: regexp replacement$B$N(B\1$B$H$+$,$&$^$/$$$+$J$+$C$?$N$r=$@5!#(B + regex/engine.c + $B:n6H(B: ex$B$N(B:print$B$H$+$N9TKv=hM}$,4E$+$C$?$N$r=$@5!#(B + vi/vs_msg.c + 2/24 + $B:n6H(B: regular$B$,$"$s$^$jCY$$$N$G(Bqregular$B$rMQ0U!#(B + build/configure.in + build/qregular.in + 2/22 24:00 + $B:n6H(B: CHAR_T$B4XO"@0M}$r CHAR_T$B!#(BKEY_BLEN()$B$H$+$N0z?t!#(B + KEY_BLEN()$B$H$+$NDj5A$b$A$g$C$HD>$7!#$3$l$GB-$j$k$H$$$$$J(B... + */*.c + common/gs.h + 2/20 + $B:n6H(B: mailing list$B2~L>!#(Bnvi-jp@dit.co.jp -> nvi-m17n@dit.co.jp + docs.m17n/README.* + 2/20 16:00 + $B:n6H(B: bcopy()/index()$B$rGS=|!#(B + */*.c + $B:n6H(B: $B9TKv$G%P%$%H?t$,A}$($k$h$&$J(Boverwrite$B$r$9$k$HIe$k$N$r(Bfix. + ($BNc(B: $B9TKv$N(B"a"$B$r(B"$B$"(B"$B$G(Boverwrite) + vi/v_txt.c + 2/19 + $BESCf(B: char -> CHAR_T$B!#$H$j$"$($:(Bisxxxxx()$B$N0z?t$H;W$o$l$k$b$N$@$1!#(B + */*.c + 2/17 + $B:n6H(B: recovery$B$N$H$-M>7W$K30It%3!<%I(B->$BFbIt%3!<%I$NJQ49$,M>7W$K(B + $B5/$-$k$N$r=$@5!#$?$@$7!"$R$8$g!<$K1x$$(Bpatch$B$G$9!#(B + (thanks for trouble report: tate@nerv.org) + common/exf.c + common/gs.h + 2/16 + $B:n6H(B: autodetect=nantara+$B$N$H$-!"(Bctrl-G$B$G(Bfileencoding$B$,I=<($5$l$k(B + $B$h$&$K$7$?!#(B + common/msg.c + $B:n6H(B: $B%3%a%s%H@0M}!#(B + common/multibyte.c + $B:n6H(B: :set autodetect=jp+$B$H$+$9$k$H!"(Bfileencoding$B$r(Boverwrite$B$9$k!#(B + common/multibyte.c + $B2r7h(B: elvis$B$G8@$&$H$3$m$N(B:set kfilecode=euc-jp+$B!#(B(12/24) + ($B<+F0H=JL$N7k2L$G(Boption$B$r>e=q$-$9$k(B) + $B:n6H(B: autodetect$B$^$o$j$N8+D>$7!#$@$$$V$h$/$J$C$?$H;W$$$^$9$,!"(B + iso-2022-kr/cn$B$K$D$$$F$O$A$g$C$HIT0B$@(B... + common/multibyte.c + 2/15 + $B:n6H(B: canna fence$B$N(Bechoback$B$r@0M}!#(B + common/multi_canna.c + $B:n6H(B: JIS X0208-1983/1976$B$NC18lG'<1$,$$$^$R$H$D$@$C$?$N$G=$@5!#(B + common/multi_chclass.c + 2/14 + $B:n6H(B: wrapmargin$B$N=hM}$r$^$H$b$K$7$?!#$3$l$G$?$V$sMn$A$J$$!#(B + $B$?$@!"$$$$F0:n$+$I$&$+$K$OITK~$,;D$k!#(B + vi/v_txt.c + $B2r7h(B: $BF|K\8l$N(Bwrapmargin$B$K$h$k9T(Bwrap(12/21) + $B$G$-$?$iC18l6h@Z$j$G6J$2$k(B? $B$=$3$^$G$;$s$G$($((B? + 2/13 + $B:n6H(B: ex$B$N2hLL=PNO$N$"$H(Bdesignation$B$N%j%;%C%H$,$J$+$C$?!#(B + $B$H$C$F$b(Bquickhack$B!"$+$DKhEYKhEY(BASCII$B$r(Bdesignate$B$9$k$N$G(B + $B$+$C$3$o$k$$!#(B + vi/vs_msg.c + 2/11 + $B:n6H(B: regular$B$H$$$&%D!<%k$r$D$1$?!#$3$l$G(BJIS X0201 roman$B$N(B"a"$B$H$+$r(B + $BA4It(BASCII$B$N(B"a"$B$KD>$;$^$9!#(B + build/regular.in + $B$A$g$C$H$@$12r7h(B: JIS X0201-left$B$NJ8;z$H(BASCII$B$NJ8;z$H$+!"(B + $B8!:w$H$+$N$H$-$KF10l;k$7$?$$J8;z$O$I$&$9$l$P$$$$$+(B? + $B:n6H(B: ctext$B$GJ8;z%;%C%H$r8F$S=P$9@h$r7h$a$k%"%k%4%j%:%`$,(B + $B4V0c$C$F$?$N$G=$@5!#(B + $B9TKv$N(Bdesignation$B$N=hM}(B(eolreset)$B$r=$@5!#(B + ctext$B$N>l9g$N$h$&$K!"(BESC $ ( B$B$G(BJIS X0208-1983$B$r8F$S=P$9(B + $B$b$N$KBP1~$7$?=hM}$rDI2C(B(nooldstyle$B$r(Bgrep$B$9$k$H$o$+$k(B)$B!#(B + common/multi_iso2022.c + common/multibyte.c + common/multibyte.h + 2/7 + $B:n6H(B: W$B$H(BB$B$NF0:n(B($BFC$K(Bcount$B$rM?$($?$H$-!"(BASCII$B$H$=$l0J30$,:.$6$C$F$k(B + $B$H$-(B)$B$,%X%s$@$C$?$N$rD>$7$?!#(B + vi/v_word.c + 2/5 + $B:n6H(B: canna_echoback()$B$N%_%9=$@5!#2hLL0lHV2<9T$rM>7W$K(Bredraw$B$7$F$$$?!#(B + common/multi_canna.c + $B:n6H(B: tab$B$N>e$N1&0\F0$,%X%s$@$C$?$N$r2~A1!#(B + vi/vs_refresh.c + $B:n6H(B: showmatch$B$N$H$-$N(Bcanna fence$B$N:FI=<($r2~A1!#(B + canna_echoback()$B$,D6J#;($K$J$C$F$-$^$7$?!#:$$C$?$>!#(B + cl/cl_read.c + common/multi_canna.c + $B2r7h(B: set showmatch$B$7$F$k>l9g!"3g8L$NBP1~I=<(Cf$K(B + $B%-!e$KI=<($5$l$k!#(B(2/4) + 2/5 11:00 + $B:n6H(B: v_replace()$B$NCf$NJQ?tL>%P%C%F%#%s%0$r2r7h!#(B(mblen) + vi/v_replace.c + $B:n6H(B: canna_on/off$B4X78$r$b$&$A$g$C$HD4@0!#(Bfepkey$B$K;XDj$5$l$F$$$J$$(B + $B%3%^%s%I$N=hM}$r$J$a$i$+$K!#(B + vi/vi.c + $B:n6H(B: range$B;XDj$K(B"/"$B$H$+$r;H$&$H2hLL$,Jx$l$F$$$?$N$rD>$7$?!#(B + vi/v_search.c + $B:n6H(B: $B2hLL$$$A$P$s2<$N9T$GD9$9$.$k(Bfence$B$r=P$7$?$H$-$K2hLL$,(B + $BIe$C$F$$$?$N$G=$@5!#(B + common/multi_canna.c + $B2r7h(B: canna$B4XO"(B: fence$B$,D9$9$.$k$H$-$NBP=h(B(2/3) + $B:n6H(B: :r$B$7$?$H$-$K@9Bg$KJ8;z2=$1$9$k$N$r=$@5!#$?$@$7!"$A$g$C$H(B + $B!VF($2!W$G$9!#(B + ex/ex_read.c + 2/4 15:00 + $B:n6H(B: $B4A;z$rH>J,$@$1=q$-DY$9$H$-$N=hM}$rDI2C!#(B + $B$6$C$/$j=q$-49$($F$7$^$$$^$7$?!#(B + curses/addbytes.c + $B:n6H(B: configure$B$N(Bcanna$B4XO"$rD>$7!#(B + build/configure.in + 2/3 26:00 + $B:n6H(B: $BH?E>$7$?9T$N%9%/%m!<%k$N$H$-$K!"(Bmultibyte$B4XO"$N>pJs$,(B + $B$4$C$=$j>C$($F$$$?$N$r=$@5!#$?$@$7!"0\?"@-$N$3$H$r9M$($J$$(B + $B5-=R$K$J$C$F$$$k$N$G$"$H$GD>$9$Y$7!#(Bcl_deleteln()$B$M!#(B + cl/cl_funcs.c + $B:n6H(B: $B4A;z$rH>J,$@$1=q$-DY$9$H$-$N=hM}$rDI2C!#%(%s%P%0$3$$$F$?$N$G(B + $B$A$g$$=$@5!#(B + curses/addbytes.c + $B:n6H(B: fence$B$,2hLL:8C<$r1[$($?$H$-$N=hM}!#(Bcolon mode$B$G$b$A$c$s$H(B + fence$B$,2hLL2<$KF($2$k!#D9$9$.$k(Bfence$B$O$^$@$@$a$M!#(B + common/multi_canna.c + 2/3 21:00 + $B:n6H(B: fence$B$,2hLL:8C<$r1[$($?$H$-$N=hM}!#2hLL:G2<9T$K0\$k!#(B + $B$b$H$b$H:G2<9T$K$$$k$H$-$O$I$&$7$h$&$+$J$"!#(B + common/multi_canna.c + vi/vs_refresh.c + $B:n6H(B: $B4A;z$rH>J,$@$1=q$-DY$9$H$-$N=hM}$rDI2C!#7k9=BgNL$K(B + $B=q$-49$($F$7$^$$$^$7$?$,!"F1$80UL#$N$3$H$r=q$-D>$7$F(B + $B$$$k$@$1$J$N$GLdBj$O$J$$$O$:$G$9!#(B + curses/addbytes.c + $B:n6H(B: canna$B4X78!#(Bfence$B$,(Bon$B$N:GCf!"(Bcontrol-O$B$,(Bcanna$BB&$KEO$C$F(B + $B$$$J$+$C$?(B($BJ8@a$,?-$P$;$J$$(B)$B!#(B + common/multibyte.c + $B:n6H(B: canna$B4X78!#(BjrKanjiString()$B$NJV$jCM$K$D$$$FLdBjE@$,$"$C$?$N$G(B + $BD>$7!#(Bks.length == -1$B$N$H$-$N=hM}$rK:$l$F$?!#(B + $BB>$N$3$H$O$@$$$?$$(Bclient$BB&$O(Bstateless$B$G$$$$$N$K!"$3$3$@$1(B + $B$A$g$C$H(Bstateful$B$J$N$M!"(Bfence$B$NJ8;zNs3P$($H$+$J$$$H(B + $B$$$1$J$$$+$i!#(Bechoback$B$5$\$k=hM}$O(Bclient$BB&$G$b$d$l$k$+$i!"(B + stateless$B$G$"$C$FM_$7$+$C$?!#(B + common/multi_canna.c + $B:n6H(B: canna$B$N(Bcontrol-C$BBP:v$N%_%9$r=$@5!#(B + cl/cl_read.c + $B:n6H(B: fepkey$B$NK:$l$F$?$H$3$m=$@5!#(Brange$BF~NO$N:]$N(Bcanna_on/off$B!#(B + vi/vi.c + 2/2 26:00 + $B:n6H(B: configure.in$B$N8+D>$7!#(BFreeBSD$B$H$+!"%G%#%l%/%H%jL>$N(Bprefix$B$,(B + $B0c$&$d$DBP:v$H$+$=$N$[$+!#(B + build/configure.in + 2/2 22:00 + $B:n6H(B: cannakey$B$NJQ99!#0JA0$O!V(Bcontrol-O$B$K$9$k$J$i(B"O"$B!W$@$C$?$,!"(B + $B4JC1$N$?$a(Bcontrol-O$B$H$+$r$=$N$^$^;XDj$7$F$b$i$&$3$H$K$7$?!#(B + ($B$H$$$&$+!"(B:set filec$B$H$+$b$=$N$^$^;XDj$J$N$G(B) + common/options.c + common/multibyte.c + $B:n6H(B: fepkey$B4X78$ND4@0!#7k9=$+$o$$$/F0$/$>!#(B + :set fepkey="?/aioAIOcCrRtfTF" + $B$H$+$$$&L5Cc$7$F$bJ?5$!#(B + common/options.c + vi/v_txt.c + vi/vi.c + $B:n6H(B: canna$BMxMQCf$K(Bcontrol-C$B$,2!$5$l$?$H$-$NF0:n$rJQ99!#(B + control-C$B$,Mh$k$H(Bcanna_force_off()$B$7$^$9!#(B + cl/cl_read.c + common/multi_canna.c + $B:n6H(B: canna$B4XO"$N:FIA2h$r%A%'%C%/!#$3$l$G$+$J$j40`z$G$7$g$&!#(B + common/multi_canna.c + $B:n6H(B: curses$B$N(Bmultibyte$B2=$NBg%]%+$r=$@5!#A4A3=i4|2=$,B-$j$J$+$C$?(B... + $B$^$"L5BL$KIA2h$9$k$@$1$Gu$@$H(BG1(GR)$B$O(B96 charset$B$K$7$+;H$o$l$J$$$1$I$3$l$G$$$$$N$+$J(B? + common/multi_iso2022.h + common/multibyte.c + common/multibyte.h + 1/10 + $B:n6H(B: :set leftright$B$N2~A1!#$"$H$b$&$9$3$7$+$J!#(B + vi/vs_refresh.c + vi/vs_relative.c + $B:n6H(B: iso-2022 7bit encoding$B$N$H$-!"(BCS_RAW$B$N%G!<%?$r=q$-=P$=$&$H$9$k$H(B + $BMn$A$F$?$N$r=$@5!#(B + common/multi_iso2022.c + 1/9 + $B:n6H(B: $B7?$K6KNO(Bconst$B=$>~;R$r$D$1$?!#(B + common/multi* + $B2r7h(B: multibyte.c$B$NCf$N%]%$%s%?$r$?$@$7$/(Bconst char *$B$H$+$K(B + $BD>$9(B(1/6) + 1/4 27:00 + $B:n6H(B: :set autodetect=cn$B$N$H$-$K!"(Bhz$B$NG'<1$rDI2C!#(B + :set autodetect=cn $BCf9q8lMQ(B(euc-cn/big5/others) + common/multibyte.c + 1/4 26:00 + $B:n6H(B: autodetect$B$N;EMMJQ99!#9qJL$N@_Dj(B($BJ8;zNs$G(B)$B$K$7$?!#(B + $B$d$C$Q$j(Beuc-cn$B$H(Bbig5$B$O6hJL$9$s$N$[$\L5M}$@!#(B + :set autodetect=jp $BF|K\8lMQ(B(euc-jp/sjis/others) + :set autodetect=cn $BCf9q8lMQ(B(euc-cn/big5/others) + :set autodetect=kr $B4Z9q8lMQ(B(euc-kr/others) + :set autodetect=$B$=$l0J30(B autodetect$B$7$J$$(B + common/exf.c + common/multibyte.c + common/options.c + ex/ex_read.c + ex/ex_script.c + 1/4 16:00 + $B:n6H(B: $B2hLL$N(Brefresh$B$^$o$j$r@0M}!&:F%A%'%C%/!#$@$$$V$s$^$H$b$K$J$C$?$H(B + $B;W$$$^$9!#(B:set leftright$B$O$^$@$h!#(B + vi/vs_line.c + vi/vs_refresh.c + $B:n6H(B: quail$B$b$I$-uBV$G$O(Bcompile in$B$5$l$^$;$s!#(B + $Be$N(Bmapping$B$O?I$$$>!#(B + common/test/multi_quail.c + 1/3 + $B:n6H(B: :set inputencoding$B$"$?$j$N%(%i!<%A%'%C%/6/2=!#(B + common/options_f.c + common/multibyte.c + $B:n6H(B: canna$BAH$_9~$_$N(B + #define$B4X78$r<+F0@8@.2=!#$A$g$C$H%=!<%9J,$1$9$.$?(B? + multi_chclass.c$B$@$1J,$1J}$,(Bencoding$B$8$c$J$$$N$,5$$K$J$k$1$I(B + $B$^$"$$$$$+!#(B + build/distrib + common/multi_big5.c + common/multi_chclass.c + common/multi_euc.c + common/multi_eucjp.c + common/multi_hz.c + common/multi_iso2022.c + common/multi_none.c + common/multi_sjis.c + common/multibyte.awk + common/multibyte.c + common/multibyte.h + include/multibyte_def.h + $B:n6H(B: korean(KSC5601)$B$NC18l0\F0!#;n$7$F$J$$$>!#(B + common/multibyte.c + 12/31 30:00 + $B$"$1$^$7$F$*$a$G$H$&$4$6$$$^$9!#?7G/(B(1:00AM)$B$N;MC+1X$N%[!<%`$G(Bhack + $B$9$k2x$7$$$R$H$G$9!#(B + + $B:n6H(B: big5$B%5%]!<%H!#B?J,F0$/$H;W$&$1$I!";n$7$h$&$,$J$$!#(B + iso-2022-*$B$N$H$-$N(Bencoding$B$HFbItI=8=$O(Bmule$B$H9g$o$;$F$"$j$^$9!#(B + ("ESC $ ( 0"$B$H(B"ESC $ ( 1") + big5$B$b<+F0H=JLBP>]$K$7$F%m%8%C%/$O=q$$$F$"$j$^$9$,!"B?J,H=JL(B + $B$9$s$N$OFq$7$$$G$7$g$&!#FC$KC;$$J8=q$N$H$-!#(B + $B2r7h(B: big5$B$OI,MW!#(B(12/27) + common/multibyte.c + 12/30 25:30 + $B:n6H(B: $B$?$$$7$?$3$H$8$c$J$$$1$I!"(B:ver$B$G%P!<%8%g%s$,$G$k$h$&$K$7$?!#(B + ex/ex_version.c + ex/mversion.h + $B:n6H(B: :script$B$N(Bmultibyte$BBP1~!#(B:script$B$C$F=i$a$FCN$C$?$s$@$1$I!"(B + $B$9$2$(2wD4!#$3$j$c$($($o!#$d$a$i$l$^$X$s!#(B + $B$3$N$?$a$K(Bmulti_ext2int_region()$B$N%$%s%?%U%'!<%9$re$r(Brange$B;XDj$GF'$s$G$bH/68$7$^$;$s!#(B + word$B6-3&G'<1$r$7$h$&$H$9$k$HH/68$9$k$O$:$G$9!#(B + patch$B$O$H$C$F$b1x$$$>!#(B + regex/regcomp.c + regex/engine.c + regex/regex2.c + $B:n6H(B: multibyte$BJ8;z$N8!:w(B/$BCV49(B(vi$B$G8@$&(B"/"$B$H(B"?")$B!#@55,I=8=$O$^$@%J%7$M!#(B + $B$D$$$G$K!"(Brange$B;XDj$K(Bmultibyte$BJ8;z;H$C$F$bJ?5$!#(B + common/search.c + ex/ex.c + ex/ex_subst.c + regex/regcomp.c + $B:n6H(B: $B%U%!%$%k$N(Bencoding$B<+F0H=JL$r$A$g$C$H2~A1!#(B + common/multibyte.c + 12/29 + $B:n6H(B: $BHFMQ(Biso-2022-*$B%-!<%\!<%IF~NO!#%-!<%\!<%IF~NO%3!<%I$NJQ49$O(B + event manager$BIt$KFM$C9~$^$l$^$7$?!#(B + iso-2022-jp$B0J30$G;n$7$F$$$^$;$s!#$$$B$a$F$_$F$/$@$5$$!#(B + $B$"!"$=$&$=$&!"(Bcontrol-N/O$B$O>o$K?)$o$l$A$c$&(B(SO$B$H(BSI$B$@$b$s$M(B)$B$N$G!"(B + vi command$B%b!<%I$G(Bcontrol-N$B$H$+$rBG$C$F$b!"(Bvi$B$N%3%^%s%I$H$O(B + $BG'<1$5$l$^$;$s!#(BSO/SI$B2r$9$k(B?(ESC$B$N%O%s%I%j%s%0(B) + cl/cl.h + cl/cl_read.c + cl/cl_main.c + common/key.c + common/multibyte.c + common/options_f.c + vi/v_key.c + vi/ex_key.c + 12/28 26:30 + $B:n6H(B: $B%I%-%e%a%s%H$N99?7!#(B + 12/28 15:30 + $B:n6H(B: curses$B$NE0Dl(Bmultibyte$BBP1~!#(Bsjis$B$G(Bx0201 kana$B$b;H$($k$>!#(B + $B>\:Y$O(Bcurses/README.jnvi$B;2>H!#(B + $B2r7h(B: curses$BB&$N9TKv=hM}$,$^$@$J$N$G$H$-$I$-2=$1$k!#(B(12/27) + $B2r7h(B: curses$B$N(Bmultibyte$B=hM}(B(12/1) + curses$B$KEO$9J8;zNs$O$I$&%(%s%3!<%I$9$k$Y$-$+(B? + $B$"$k$$$O(Bstandout()$B$_$?$$$KJL4X?t(B? + curses/README.jnvi + curses/addbytes.c + curses/box.c + curses/cr_put.c + curses/curses.h + curses/insch.c + curses/refresh.c + $B:n6H(B: multi_name()$B$r$A$g$C$H=q$-D>$7!#(Beuc/sjis$B$N%5%]!<%H$re:No$K!#(B + :set skipdisplay$B$G(B"?"$B$G$NI=<($N@ZBX$(!#(B + $B2r7h(B: multi_name()$B$NCf$GF|K\8l$@$1$:$k$7$F$$$k!#(B(12/27) + x0208.1973$B$H(Bx0208.1983$B$rN>J}I=<($G$-$k$h$&$K$J$C$F$$$k!#(B + common/multibyte.c + common/options.c + 12/27 + kinput2$B$r(Binstall$B$7$J$*$7$?$N$G!"$H$&$H$&$3$N%3%a%s%HJ8<+BN$b(B + jnvi$B$G=q$$$F$^$9!#(B + + $B:n6H(B: curses$B$N(Biso-2022-*$BBP1~(B($B2>(B)$B!#$J$s$G$b(BG0$B$K(Bdesignate$B$7$F$7$^$$$^$9!#(B + $B$"$o$;$F2hLL=PNO$N(Biso-2022-*$B2=!#(B + curses$B$G(Biso-2022-*$B$r;H$&$H$-$O!"%(%9%1!<%W%7!<%1%s%9$HJ8;z$r(B + $B0l5$$K(Baddnstr()$B$7$J$$$H$&$^$/F0$-$^$;$s!#Cm0U!#(B + curses/addbytes.c + curses/refresh.c + curses/cr_put.c + common/multibyte.c + $B:n6H(B: curses$B$N(Beuc 2byte$BBP1~ITB-$ND>$7!#F|K\8l$N>l9g%P%$%H$a$+$r(B + $B5-O?$7$F$*$+$J$$$H$"$H$GLLE]!#(B + curses/addbytes.c + curses/refresh.c + $B:n6H(B: vs_msg()$B$N(Bmultibyte$BBP1~!#(B + multi_name()$B$N%?%$%_%s%0$r$:$i$7$?!#(Bprintf()$B$^$?$O(Baddnstr$B$9$k(B + $B$H$-$^$G2f!9$N(Bencoding$BJ}<0$G;}$C$F$$$/(B + $B2r7h(B: vi$B$+$i(B:p$B$7$?$H$-$N=hM}!#(B(12/27) + vs_msg()$B$H0l=o$G!"(B2$BEY(BKEY_NAME()$B$9$k$3$H$K$J$k!#(B + $B%?%A0-$$!#(B + $B2r7h(B: vs_msg()$B$N(Bmultibyte$BBP1~(B (12/1) + ex_print()$B$H(Bvs_msg()$B$H(B2$B2s(BKEY_NAME()$B$rDL$k$N$G(B + $B%?%A$,0-$$(B + cl/cl_funcs.c + common/multibyte.c + ex/ex_print.c + vi/vs_line.c + vi/vs_msg.c + $BESCf(B: vs_msg()$B$N(Bmultibyte$BBP1~(B(12/1) + $B:n6H(B: indentation$B$ND4@0$r$9$k$HMn$A$k%P%0$r=$@5!#(B + $B$$$^$9!#(B + ex/ex_txt.c + $B:n6H(B: iso-2022-jp2$B$G$O(Blatin1$B$J$I$N(B96 charsets$B$O(BG2$B$K(Bdesignate + $B$9$k$h!<$K!"$H=q$$$F$"$j$^$7$?!#8+Mn$H$7$F$?!#(B + $B$3$l$K=>$&$h$&!"(Biso2022jp$B4XO"$N=hM}$rJQ99!#(B + 12/27 13:00$BHG$N(BREADME.jnvi$B$K$O13$,$"$j$^$7$?!#(B + common/multibyte.c + $B:n6H(B: 0x8e/0x8f(single shift G2/G3)$B$N$"$H$O(B8bit$B$a$r$_$J$$!"$C$F$3$H$O(B + GL/GR$B$NN>J}$K(BG2($B$^$?$O(BG3)$B$,E=$i$l$k$s$G$9$M!#$U!<$`!#(B + common/multibyte.c + 12/27 13:00 + $B:n6H(B: $B%G%U%)%k%H$N(Bencoding$B$r(Bconfigure$B$N%Q%i%a%?$KDI$$=P$7!#(B + $BA4$F$N(Bencoding(input/display/file)$B$N%G%U%)%k%HCM$,1F6A$5$l$^$9!#(B + $BJL$K(Beuc-*$B0J308@$C$F$b$$$$$1$I!"I=<($G$-$J$$$+$i$M!#(B + % ./configure --enable-multibyte (euc-jp$B$K$J$k(B) + % ./configure --enable-multibyte=euc-kr + % ./configure --enable-multibyte=euc-jp + % ./configure --enable-multibyte=euc-cn + build/configure.in + build/config.h.in + common/multibyte.h + $B:n6H(B: euc-jp/cn/kr$B$NI=<($r%5%]!<%H!#(B + common/multibyte.c + 12/26 24:00 + $B:n6H(B: euc-jp/cn/kr$B$N%-!<%\!<%IF~NO$r6&DL2=!#(B + :set inputencoding=euc-jp $B%-!$7!#(B + - $B9TKv$r1[$($F>uBV$N;D$k(Bencoding$B$KBP1~(B(iso-2022-kr) + - G0/G1/G2/G3$BA4It;H$&$h$&$J(Bencoding$B$KBP1~(B(iso-2022-cn) + - $B=q$1$J$$(Bcharset$B$NJ8;z$,$G$FMh$?;~$K%U%i%0$r$?$F$k(B + (:w$B$7$?$H$-!"=q$1$J$$(Bcharset$B$,$G$G$?$i7Y9p$7$h$&$+(B?) + - SS2/SS3 (ESC N$B$H(BESC O)$B$rFI$a$k(B + - $B$=$N$[$+$?$/$5$s(B + $B7k2L$H$7$F!"0J2<$,;H$($^$9!#(Blatin*$B$H$+$O$^$@$^$@A}$d$;$k$>!#(B + iso-2022-7-2$B$H$+$O0UL#$,$I$l$@$1$"$k$+$h$/$o$+$i$J$$!#(B + $B8=:_$O%m%8%C%/$,0-$$$N$G!"2DG=$J$b$N$OA4It(BG0$B$K(Bdesignate + $B$5$l$A$c$$$^$9!#$I$&$9$j$c$$$$$s$@$+!#(B + :set fileencoding=none + :set fileencoding=euc-jp + :set fileencoding=euc-cn + :set fileencoding=euc-kr + :set fileencoding=latin1 + :set fileencoding=latin2 + :set fileencoding=iso-2022-7-1 7bit$B!"(BG0$B$N$_(B + :set fileencoding=iso-2022-7-2 7bit$B!"(BG0/G1 + :set fileencoding=iso-2022-8-2 8bit$B!"(BG0/G1 + :set fileencoding=iso-2022-cn 7bit$B!"(BG0-3 + :set fileencoding=iso-2022-jp 7bit$B!"(BG0$B$N$_(B + :set fileencoding=iso-2022-kr 7bit$B!"(BG0/G1 + :set fileencoding=sjis + :set fileencoding=hz + + $B2r7h(B: ISO-2022-*$B7O$N=PNO$O@5$7$$$1$I@)Ls$,4K$9$.(B(12/24) + $B$b$C$H$$$m$$$m@)Ls$+$1$i$l$F$b$$$$$N$G$O(B? + - ISO-2022-JP/2$B$ruBV$r30$K=P$9!#(B(12/23) + $B9T$r$^$?$$$G(Bdesignation$B$N>uBV$,;D$k%3!<%I7O$N(B + $B%5%]!<%H$KI,MW!#(B + common/multibyte.c + $B:n6H(B: :set autodetect$B$rJ,N%!#$h$C$F!"(B:set fileencoding=euc-jp*$B$N(B + $B$+$o$j$K!"(B:set fileencoding=euc-jp$B$7$F!"(B:set autodetect + $B$7$F$/$@$5$$!#(B + common/multibyte.c + common/options.c + common/options_f.c + 12/25 + $B:n6H(B: hz$B%Q!<%5$r:n@.!#(B + common/multibyte.c + $B:n6H(B: euc$B%Q!<%54XO"$r@0M}!#(Beuc-jp/euc-kr/euc-cn$B$r$D$1$k!#(B + (euc-tw$B$O$A$g$C$HBT$C$F(B) + common/multibyte.c + $B:n6H(B: :set noleftright$B$N$H$-$N9TKv$r1[$($k9T$N9TKv=hM}(B + $B$A$g$$$HCn$H$j!#(B + vi/vs_line.c + vi/vs_refresh.c + vi/vs_relative.c + $B:n6H(B: $BHs(Bascii/contro$BJ8;z$N%+!<%=%k@)8f$rJQ99!#%+!<%=%k$O:8C<$K>h$k!#(B + $B2r7h(B: $BHs(Bascii$B$GHs(Bcontrol$BJ8;z$N>l9g(B($B4A;z$H$+%O%s%0%k$H$+(B)$B!"(B + $B%+!<%=%k$rJ8;z$N:8C<$K(B(12/25) + vi/vs_line.c + vi/vs_refresh.c + vi/vs_relative.c + 12/24 24:00$B0J9_(B + $B:n6H(B: R$B%3%^%s%I$N(Bmultibyte$BBP1~!#(B + $B2r7h(B: R$B%3%^%s%I$N(Bmultibyte$BBP1~!#(B(12/23) + v_txt.c$B$N(Bv_Rresolve()$B$NCf$r(Bmultibyte$BBP1~$9$k$N$,(B + $B$H$F$b$a$s$I$/$5$$!#(B + vi/v_txt.c + $B:n6H(B: $B%U%!%$%kF~=PNO%3!<%I$N<+F0H=JL(B + recovery/logging$B4X78$N:Y$+$$%_%9$r=$@5!#@0M}!#(B + $B5$$E$$$?$3$H(B: file_init()$B$NCf$G$O(Bdb_get()$B$H$+$r;H$C$A$c$$$1$J$$!#(B + common/exf.c + common/multibyte.c + ex/ex_read.c + 12/24(Merry Christmas!) + $B:n6H(B: $B%U%!%$%kF~=PNO%3!<%I$N<+F0H=JL!#(B + $BH=JL$7$F$b!"(Bfileencoding$B$NCM$OJQ2=$7$J$$!#(B + $B$A$J$_$K!"(B!$B$H$+$N=hM}%3!<%I$b(B:set fileencoding$B$G@_Dj$5$l$F$k(B + $B$d$D$H0l=o$G$9!#(B + :set fileencoding=euc-jp euc-jp + :set fileencoding=iso-2022-jp iso-2022-jp + :set fileencoding=sjis sjis + :set fileencoding=euc-jp* $B<+F0H=JL(B/$BITL@$J$i(Beuc-jp + :set fileencoding=iso-2022-jp* $B<+F0H=JL(B/$BITL@$J$i(Biso-2022-jp + :set fileencoding=sjis* $B<+F0H=JL(B/$BITL@$J$i(Bsjis + $B2r7h(B: $B%U%!%$%kF~NO$N:]$N(Bencoding$B<+F0H=JL(B(12/10) + common/exf.c + common/multibyte.c + ex/ex_read.c + $B:n6H(B: $B%U%!%$%kFI$_=P$7;~$N%3!<%IJQ49$N>l=j$rJQ99!#(B + db$B$KA4ItFI$_9~$_=*$C$F$+$iA4It$J$a$k!#(B + $B2r7h(B: $B%U%!%$%k(Bopen$B;~$N%3!<%IJQ49(Bhook$B$N0LCV!#(B(12/23) + db$B%i%$%V%i%j$K8e!#(B + $B$I$s$JJ8=q$G$b!"(B3$B9TL\:o=|$7$F$$$k$H$-(B($B$J$s$G(B3$B9TL\$J$o$1(B?) + text_init()$B$+$i8F$P$l$?(Bcalloc()$B$N:GCf!#(B + $B$I$C$+%a%b%j2u$7$F$k(B?? + common/exf.c + common/multibyte.c + db/recno/rec_get.c + ex/ex_read.c + 12/23 + $B:n6H(B: sjis$B$N(BJIS X0201$B:8B&(B(1$B%P%$%H%+%?%+%J(B)$B%5%]!<%H!#;n$7$F$J$$$>!#(B + $B2r7h(B: sjis$B$N$H$-$N(BJIS X0201$B%+%?%+%JBP1~(B(12/22) + common/multibyte.c + $B:n6H(B: euc-jp$B$N(BJIS X0212-1990($BJd=u4A;z(B)/JIS X0201$B:8B&(B(1$B%P%$%H%+%?%+%J(B) + $B%5%]!<%H!#;n$7$F$J$$$>!#(B + common/multibyte.c + $B:n6H(B: JIS X0212-1990($BJd=u4A;z(B)$B%5%]!<%H!#;n$7$F$J$$$>!#(B + common/multibyte.c + $B:n6H(B: $BI=<($b$G$-$J$$$N$K(Bcharset$BA}$d$7$^$/$j!#$"$H;D$k$O(Bbig5? + $B2r7h(B: charset$B$r$b$C$HA}$d$=$&(B(12/10) + common/multibyte.c + $B:n6H(B: ISO-2022-*$B7O$N$=$3$=$3$P$C$A$j$J%Q!<%5!#(B + $B$?$@$7!"3F9T$4$H$K(Bdesignation$B$N>uBV$,$b$H$KLa$k$d$D$K8B$k!#(B + common/multibyte.c + 12/22 + $B:n6H(B: ftp.foretune.co.jp$B$K(Bftp directory$B$rMQ0U!#(B + $B:n6H(B: :set noleftright$B$N$H$-$N9TKv$r1[$($k9T$N9TKv=hM}(B + vi/vs_line.c + vi/vs_refresh.c + vi/vs_relative.c + $B2r7h(B: $B9TKv$r1[$($k9T$N=hM}(B(12/1) + $B:n6H(B: v_ex_done()$B$N(Bmultibyte$BBP1~(B + vi/v_ex.c + $B:n6H(B: multibyte$BJ8;z$NESCf$rF'$s$G$?$H$3$m$,$"$C$?$N$G=$@5(B + (#ifdef MULTIBYTE$B$N(Btypo!) + vi/v_txt.c + 12/21 + $B:n6H(B: prototype$B@k8@$NIU2C!#(BCHAR_T -> ARG_CHAR_T$B!"(Bchclass$B$r(Bu_int$B$K(B + common/multibyte.c + vi/v_word.c + $B2r7h(B: include$B$N2<$N%U%!%$%k$N<+F0@8@.2=(B(12/10) + $B:n6H(B: wrapmargin$B$NA`:n$,F|K\8lF'$s$G$bH/68$7$J$$(B + vi/v_txt.c + $B:n6H(B: $B%-!J,$@$1$H$+(B)$B!"(Btimeout$B4XO"$O$^$@IT0B!#(B + $BFM$C9~$`$H$3$m$rJQ$($?J}$,$$$$(B? + :set inputencoding=euc-jp euc-jp + :set inputencoding=sjis sjis + common/multibyte.c + vi/v_txt.c + 12/10 26:30$B0J9_(B + $B:n6H(B: E/e/B/b$B%3%^%s%I$K$D$$$F$b(Bmultibyte$BBP1~!#(B + W/w$B%3%^%s%I$N=hM}FbMF$rJQ$($A$c$C$?%(%s%P%0$rD>$9!#(B + vi/v_word.c + 12/10 17:30$B0J9_(B + $B:n6H(B: $B$H$j$"$($:(BW$B$H(Bw$B%3%^%s%I$@$1(Bmultibyte$BBP1~!#F0:n$O(Bjelvis$B$H0l=o!#(B + $BB>$K$D$$$F$bK=Av$O$7$J$$!#(B + $B2r7h(B: word movement$B$N(Bmultibyte$BBP1~(B(12/10) + vi/v_word.c + common/multibyte.c + $B:n6H(B: $B:FIA2hIt$K!V(B1$B%P%$%H$K$D$-(B1$B7e0J>eI=<($5$l$k!W$C$F$N$rA0Ds$K(B + $B$9$k%3!<%I$,;D$C$F$$$?$N$G=|5n!#(B + vi/vs_line.c + $B:n6H(B: word movement$B$G$H$j$"$($:K=Av$7$J$$$h$&$K$9$k!#(B + vi/v_word.c + $B:n6H(B: $BFbIt%3!<%I4XO"$N%(%s%P%0$7$?$H$3$m$N=$@5!#(Bmulti_back()$B$H$+!#(B + common/multibyte.c + $B:n6H(B: 0x80$B$+$i(B0xff$B$N%P%$%J%j$,Mh$?$H$-$NBP=h!#I=<(7O$b!#(B + $BfIW$@$H$*$b$&!#(B + $B2r7h(B: KEY_LEN(sp, x)$B$G!"(Bx=0x80$B$N$H$-$N=hM}(B(12/10) + CS_RAW + 12/10 17:30$B$^$G(B + $B:n6H(B: $B%U%!%$%kF~=PNOMQ(Bencoding$B$N@ZBX$(!#<+F0H=JL$O$J$7!#(B + $B2hLLI=<($O(Beuc-jp$B$N$_(B(curses$B2~B$$,B-$j$J$$(B) + $B%-!<%\!<%I$+$i$OF|K\8l$,BG$F$J$$!#(B + :set fileencoding=euc-jp euc-jp + :set fileencoding=iso-2022-jp iso-2022-jp + :set fileencoding=sjis sjis + common/multibyte.c + db/recno/rec_get.c + ex/ex_write.c + ex/ex_read.c + common/options.c + common/options_f.c + include/options_def.h + include/com_extern.h + $B:n6H(B: $BFbIt%3!<%I$O(Beuc-jp$B$r$d$a$F(Bmule$B$C$]$/!#J#?t(Bcharset$B$N%5%]!<%H!#(B + common/multibyte.c + 12/8 + $B:n6H(B: :j$B%3%^%s%I$N(Bmultibyte$BBP1~(B($BF0:n$O(Bjelvis$B$HF1MM(B) + $B$[$s$H$OJ8;z$K(B) $BFbMF$O(Btoku$BHG$HF1MM(B + $B2r7h(B: $B4A;z$N(B2$B%P%$%H$a$rF'$`$h$&$J%+!<%=%k0\F0$r$9$k$H!"(B + $B%+!<%=%k$,$:$l$A$c$&(B(12/1) + curses/cr_put.c + curses/refresh.c + $B:n6H(B: vs_line()$B$N8+D>$7(B + vi/vs_line.c + vi/vs_refresh.c + $B2r7h(B: $B4A;z$N>e$r1[$($F(B~$B$9$k$H%+!<%=%k$,$:$l$k(B(11/29) + $B2r7h(B: $B>e2<0\F0$,$A$g$C$H%X%s!#$H$-$I$-(Babort()$B$9$k(B(12/1) + $B2r7h(B: d$B8e$N(Bredraw(11/25) + $B2r7h(B: p$B8e$N(Bredraw$B$G%+!<%=%k$,$:$l$k(B(11/26) + $B2r7h(B: $B$R$H$b$8:o=|8e$N(Bredraw(11/25) + 11/30 + $B:n6H(B: cs_next()/cs_prev()$B$N(Bmultibyte$BHG$rMQ0U(B + vi/getc.c vi/vi.h + $B:n6H(B: ($B%3%^%s%I$H(B)$B%3%^%s%I(B(multibyte$BJ8;z$N>e$ODL$jH4$1$k$@$1(B) + vi/v_sentence.c + $B:n6H(B: %$B%3%^%s%I(B(multibyte$BJ8;z$N>e$ODL$jH4$1$k$@$1(B) + vi/v_match.c + $B:n6H(B: vs_colpos()$B$N=q$-D>$7(B + vi/vs_relative.c + 11/29 + $B:n6H(B: ~$B%3%^%s%I(B(multibyte$BJ8;z$N>e$ODL$jH4$1$k$@$1(B) + vi/v_ulcase.c + 11/26 + $BESCf(B: %$B%3%^%s%I(B($B:n6HESCf$G(Bvi/getc.c$B$NBgI}JQ99$NI,MW$K5$$E$-CGG0(B) + vi/v_match.c + $B:n6H(B: p/P$B%3%^%s%I(B + common/put.c + 11/25 + $B:n6H(B: d$B%3%^%s%I(B + vi/v_delete.c + $B:n6H(B: f$B$H$+(Bt$B$H$+(B(multibyte$BJ8;z$O8!:w$G$-$J$$(B) + vi/v_ch.c + $B:n6H(B: vi$B$N$R$H$b$8:o=|(B + vi/v_xchar.c + common/cut.c + common/delete.c + $B:n6H(B: vi$B$N(Bredraw + vi/vs_refresh.c + 11/24 + $B:n6H(B: vi$B$N(Bredraw + vi/vs_refresh.c + $B:n6H(B: vi$B$NAjBP0\F0(B + vi/vs_relative.c + $B:n6H(B: vi$B$N:81&0\F0(B + vi/v_right.c + vi/v_left.c + 11/23 + $B:n6H3+;O(B + + $B:n6H(B: $B%^%k%A%P%$%HH=JL(B + common/multibyte.c + common/key.c + common/gs.h + $B:n6H(B: Makefile$B$H(Bconfigure + build/Makefile + build/configure.in + $B:n6H(B: ex$B$N9TI=<((B + ex/ex_print.c + $B:n6H(B: vi$B$N:81&0\F0(B + vi/v_right.c + vi/v_left.c + $B:n6H(B: vi$B$N(Bredraw + vi/vs_refresh.c Index: docs.m17n/README.english *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/docs.m17n/README.english Wed Aug 20 16:08:51 1997 *************** *** 0 **** --- 1,786 ---- + multilingual patch for Keith Bostic's nvi + Jun-ichiro itojun Itoh + $Id: README.english,v 1.100 1997/08/20 07:08:50 itojun Exp $ + + + vi users of the world, unite! + + + OVERVIEW + + This patchkit contains multilingual patch for nvi 1.79. + We call it "nvi-m17n" for short. "m17n" stands for + multilingualization, since "multilingualization" is made up by + m, 17 letters, and n. + + You can obtain the latest release of nvi from the following place: + ftp://ftp.cs.berkeley.edu/ucb/4bsd/ + This package and more up-to-date versions can be found from the + following place: + ftp://ftp.foretune.co.jp/pub/tools/nvi-m17n/ + + Historical note: + We once called it "jnvi" since it started as Japanization of nvi. + You may see the name "jnvi" left somewhere. That means "nvi-m17n". + + REDISTRIBUTION + + Freely redistributable, under condition written in LICENSE file. + + WARRANITY AND COPYRIGHT + + Absolutely no warranty. Pray and backup before try. + + The patch is based on the Japanization work on nvi 1.03 by: + Yoshitaka Tokugawa + and Japanization patch to elvis(vi clone by Steve Kirkendall) by: + Jun-ichiro itojun Itoh + + Some part of multibyte support has been derived from other people's + work. See comment in multibyte.c. + + Multilingual portion copyright(c) 1996, 1997 by Jun-ichiro Itoh. + All rights reserved. + + DOCUMENTATION NOTE + + We denote "multilingualized nvi" as "nvi" where it is obvious. + If it is not obvious, we denote that as "nvi-m17n". + + QUICK START GUIDE (for impatients) + + First of all, please note that the patch DOES NOT multilingual-ize + all the functionality of original nvi. + Therefore, there are some functionalities that shall NOT be invoked. + The list of functionalities that are multilingualized, and that are + not multilingualized, will be provided later in the document. + For details refer to "IT ENABLES..." and "IT DOES NOT ENABLE..." + sections. + + 0. patch the original nvi package. + % cd nvi-1.79 + % patch -p1 < nvi-m17n.diff + 1. configure nvi with multilingual patch enabled. + % cd build + % ./configure --enable-multibyte + If you need canna support (Japanese keyboard input engine), + configure as following. + /usr/local/canna should be the path to canna library/header. + % ./configure --enable-multibyte --enable-canna=/usr/local/canna + + 2. build and install it. + % make + % su + password: xxxx + # make install + + 3. If you're using X, I recommend you to install kterm 6.2.0 for + multilingual display. kterm 6.2.0 can be found at X11R6 contrib + mirror site near you. Also you might need to install some + additional fonts. + + 4. edit the configuration file. (~/.exrc) + 4-a. iso-2022-* display capability + If you have fully iso-2022-* capable terminal software, add the + following line: + set noskipdisplay + If you don't have one, add the following line: + set skipdisplay + 4-b. display encoding + Choose encoding scheme of your terminal output from the list + below. Add a line like this: + set displayencoding=iso-2022-jp + set displayencoding=sjis + set displayencoding=euc-jp + set displayencoding=big5 + Please note that, the display encoding support has very big twist. + See "IT ENABLES..." section for details. + 4-c. keyboard encoding + Choose encoding scheme of your keyboard input from the list below. + Add a line like this: + set inputencoding=euc-jp + Note that not all the encodings are available as keyboard input + encoding. + 4-d. file encoding + Choose encoding scheme of your file i/o from the list below. + Add a line like this: + set fileencoding=iso-2022-jp + Also, if you would like an automatic encoding scheme selection + on file read operation, add the following line: + set autodetect=jp (for detecting euc-jp/sjis/iso-2022-jp) + set autodetect=cn (for detecting euc-cn/big5/hz/iso-2022-cn) + set autodetect=tw (for detecting euc-tw/big5/hz/iso-2022-cn) + set autodetect=kr (for detecting euc-kr/iso-2022-kr) + You can also set autodetection procedure to overwrite + fileencoding option, on file open time. (:e/:n) + In this case, you should append "+" to autodetect option. + In this case, you can preserve encoding method of the file + you are editing: + set autodetect=jp+ + set autodetect=cn+ + + It should be noted that, if you are using chinese encodings + (:set autodetect=cn), it is adviced that you have "euc-cn" or + "big5" set to fileencoding. Making a correct guess between + euc-cn and big5 is almost impossible, so the autodetection + usually fails. If autodetection fails, the value set to + fileencoding will be used. + Therefore, if you prefer big5, use the following setting: + set autodetect=cn fileencoding=big5 + If you prefer euc-cn, use the following setting: + set autodetect=cn fileencoding=euc-cn + No other settings are recommended for chinese code detection. + + If you use autodetection of tiwanese encodings + (:set autodetect=tw) the above description will apply. + Please set fileencoding option to "euc-tw" or "big5". + + 4-e. canna support + If you are willing to use canna support, add the following line: + set canna + If you would like to have automatic canna fence control, add the + following too. (also, set fepkey as you like): + set cannactrl + If you need to specify canna server, do it as following: + set cannaserver="somehost.your.domain" + If you would like to change canna starter key, specify that as + following. This will set the canna starter key to control-O. + be VERY careful making choice!: + set cannakey=^O + + 5. Please note that, after applying this patch, some part of nvi's + original document are no longer valid. + For example, locale-related items (as found as the first question + in nvi-1.79/FAQ) are not applicable to nvi-m17n. + + 6. You're all set. Enjoy! + + Here are some exaples for .exrc file: + + Example 1: using iso-2022-* capable terminal, uses euc-jp terminal + and filesystem, autodetection enabled for Japanese encodings + set noskipdisplay + set displayencoding=euc-jp + set inputencoding=euc-jp + set fileencoding=euc-jp + set autodetect=jp + + Example 2: using iso-2022-* capable terminal, uses iso-2022-jp terminal + and filesystem, autodetection enabled for Japanese encodings, + need canna support, and automatic fence control. + set noskipdisplay + set displayencoding=iso-2022-jp + set inputencoding=iso-2022-jp + set fileencoding=iso-2022-jp + set autodetect=jp + set canna cannactrl + + Example 3: using iso-2022-* capable terminal, uses big5 terminal + and filesystem, autodetection enabled for Chinese encodings + set noskipdisplay + set displayencoding=big5 + set inputencoding=big5 + set fileencoding=big5 + set autodetect=cn + + ENCODING SCHEMES + + "*" sign at the leftmost column of the line indicates that the + encoding is available as keyboard input encoding too. + (:set inputencoding=xxx) + + "!" sign at the leftmost column indicates that the encoding scheme + does not conform to the specification. Please look into the note for + detail. + + Note that multilingual encoding uses iso-2022-* designations for + character sets that are not specified in the encoding specification. + (For example, latin-1 character set in iso-2022-kr, cyrillic in + iso-2022-cn, and so forth) + Monolingual encoding skips characters of unsupported character set. + + For details of encoding scheme treatment, refer to the "IT ENABLES..." + section. + + fully multilingual encodings: + name note initially designated charsets + --- --- --- + * euc-jp-1978 G0=ascii, G1=JIS X0208-1978, + G2=JIS X0201 kana, + G3=JIS X0212-1990. + SS1 and SS2 used + * euc-jp G0=ascii, G1=JIS X0208-1983, + G2=JIS X0201 kana, + G3=JIS X0212-1990. + SS1 and SS2 used + * euc-jp-1983 same as euc-jp + * euc-jp-1990 G0=ascii, G1=JIS X0208-1990, + G2=JIS X0201 kana, + G3=JIS X0212-1990. + SS1 and SS2 used + * euc-cn G0=ascii/G1=GB2312 + * euc-kr G0=ascii/G1=KSC5601 + + * iso-8859-1 8bit G0=ascii/G1=iso-8859-1 + * iso-8859-2 8bit G0=ascii/G1=iso-8859-2 + * iso-8859-3 8bit G0=ascii/G1=iso-8859-3 + * iso-8859-4 8bit G0=ascii/G1=iso-8859-4 + * iso-8859-7 8bit G0=ascii/G1=iso-8859-7 + * iso-8859-8 8bit G0=ascii/G1=iso-8859-8 + * iso-8859-9 8bit G0=ascii/G1=iso-8859-9 + * latin1 8bit alias of iso-8859-1 + * latin2 8bit alias of iso-8859-2 + * iso-2022-cn-ext G0=ascii + rfc1922 SI, SO, SS2 and SS3 used + * iso-2022-cn rfc1922 alias of iso-2022-cn-ext + (they are compatible) + * iso-2022-jp-2 rfc1554 G0=ascii + SS2 used + * iso-2022-jp rfc1468 alias of iso-2022-jp-2 + (they are compatible) + *! iso-2022-kr rfc1557 G0=ascii + SI and SO used + * ctext X11 compound text G0=ascii/G1=iso-8859-1 + 8bit no locking shift used + + * iso-2022-7-1 generic 7bit for test, use G0 only + * iso-2022-7-2 generic 7bit for test, use G0/1 + * iso-2022-8-2 generic 8bit for test, use G0/1 + + monolingual encodings: + name note character sets(fixed) + --- --- --- + * none imitates original nvi G0=ascii, G1=ascii(binary) + * sjis MS-Kanji/Shift JIS + * big5 + * euc-tw G0=ascii, G1=CNS11643-1, + G2=CNS11643-[2-7] + hz rfc1842 + + + iso-2022-kr feature: + Though not documented in rfc1557, actual practice shows that it is + necessery to remove EOL of the line with KSC5601 designation only. + nvi-m17n implements this behavior. + + CHARACTER SETS + + nvi will not recognize the designation sequence for the character + sets that are not listed here. If you need some character sets + to be recognized, please drop the author a note. + + 94 character sets: + name designation to G0 note + --- --- --- + IRV 1983 ESC ( @ + UK ESC ( A + ASCII (IRV 1991) ESC ( B hardcoded as default + Swedish ESC ( C + Norwegian ESC ( E + JIS X0201 right ESC ( I katakana + JIS X0201 left ESC ( J + German ESC ( K + French ESC ( R + Italian ESC ( Y + Spanish ESC ( Z + + 96 character sets: + name designation to G0 note + --- --- --- + Latin1 ESC , A iso-8859-1 + Latin2 ESC , B iso-8859-2 + Latin3 ESC , C iso-8859-3 + Latin4 ESC , D iso-8859-4 + Greek ESC , F iso-8859-7 + Arabic ESC , G iso-8859-6 + Hebrew ESC , H iso-8859-8 + Cyrillic ESC , L iso-8859-5 + Latin5 ESC , M iso-8859-9 + Thai ESC , T TIS620.2529 + Latin6 ESC , V iso-8859-10 + Latin6 additions ESC , X iso-8859-10 additions + + 94x94 character sets: + name designation to G0 note + --- --- --- + JIS X0208 1978 ESC $ ( @ or ESC $ @ + GB2312-80 ESC $ ( A or ESC $ A + JIS X0208 1983 ESC $ ( B or ESC $ B + JIS X0208 1990 ESC & @ ESC $ ( B or ESC & @ ESC $ B + KSC5601 1987 ESC $ ( C + JIS X0212.1990 ESC $ ( D + ISO IR-165 ESC $ ( E + CNS11643-1992-1 ESC $ ( G + CNS11643-1992-2 ESC $ ( H + CNS11643-1992-3 ESC $ ( I + CNS11643-1992-4 ESC $ ( J + CNS11643-1992-5 ESC $ ( K + CNS11643-1992-6 ESC $ ( L + CNS11643-1992-7 ESC $ ( M + Big5-1 ESC $ ( 0 unofficial, Mule-like + Big5-2 ESC $ ( 1 unofficial, Mule-like + + OPTIONS ADDED + + name type range description + --- --- --- --- + autodetect(ad) str - detect encoding at file input + displayencoding(de) str global display encoding + fepkey str - lists cmds with auto fence ctrl + fileencoding(fe) str - file input/output encoding + inputencoding(ie) str - keyboard input encoding + skipdisplay(sd) bool - skip unsupported chars on disp + + OPTIONS ADDED FOR CANNA SUPPORT + + name type range description + --- --- --- --- + canna bool global use canna or not + cannactrl bool - controls fence automatically + cannakey str - canna starter key + cannaserver str global hostname of canna server + + CONFIGURATION + + MULTIBYTE + + On configuration time, you need to add "--enable-multibyte" to enable + multibyte support. Typical installation procedure might be as follows: + % cd build + % ./configure --enable-multibyte + % make + You might want to give a default parameter for multibyte encoding, + such as: + % ./configure --enable-multibyte=euc-kr + % ./configure --enable-multibyte=iso-2022-jp + % ./configure --enable-multibyte=euc-cn + If you didn't specify encoding method, it will become "none". + + CANNA + + If you would like to use canna support, you should add "--enable-canna" + to the argument to configure. It must come with --enable-multibyte. + % cd build + % ./configure --enable-multibyte --enable-canna + + You may need to specify directory where the compiler can find + canna headers and libraries. + If you specify directory SOMEWHERE as argument to --enable-canna, + like: + % ./configure --enable-multibyte --enable-canna=SOMEWHERE + it means that you have the following headers and libraries: + SOMEWHERE/include/canna/jrkanji.h + SOMEWHERE/lib/libcanna.a + + If you have non-standard installation, and the directory prefix + is not the same for headers/libraries, you should specify those + directories manually. If you have headers/libraries in the following + location: + SOMEWHERE/canna/jrkanji.h + ELSEWHERE/libcanna.a + you should do the following: + % env CFLAGS=-ISOMEWHERE LDFLAGS=-LELSEWHERE \ + ./configure --enable-multibyte --enable-canna + + In most cases, you will need to use the following setting: + % ./configure --enable-multibyte --enable-canna=/usr/local/canna + + IT ENABLES... + + Multibyte-safe movement/input. + + Multibyte word movement. (currently japanese/korean only, sorry) + + Console output for iso-2022-* capable terminal, and primitive + euc-jp/euc-cn/euc-kr/euc-tw/sjis/big5 support. + Encoding must be set by + :set displayencoding=foobaa + + The available encodings are listed in "ENCODING SCHEMES" section. + However, it is not very straightforward; read the following + description with care. + + Multibyte chars will be displayed in the following manner: + + 1. If special function was defined for the encoding, use that. + special function is defined for each some 8bit encodings. + name note + --- --- + euc-jp G0/G1 only + G0=ASCII, G1=JIS X0208-1990/1983/1978 + euc-cn + euc-kr + euc-tw G0/G1 only (G0=ASCII, G1=CNS11643-1) + sjis supports JIS X0208-1990/1983/1978 and JIS X0201 kana + big5 + + 2. if ":set skipdisplay" was done, skip it by displaying "?" or "??". + + 3. Otherwise, try displaying it with G0 designation of iso-2022-* + escape sequence, such as "ESC $ B" for JIS X0208-1983, + "ESC , A" for latin-1. We use G0 designation only for simplicity. + It is same as "iso-2022-7-1" encoding, which uses G0 designations + only. + + For multilingual use, (case 3 in the above steps) best suited for + use with fully iso-2022-* capable terminals. For example, you may + want to try kterm-6.2.0, which can be found on ftp servers that has + X11R6 contrib. + + If you would like to know about detail of the patch to curses, + see curses/README.m17n. + + :set displayencoding=xxx is global option, so it will affect + all the sub-screens. On the other hand, :set skipdisplay is + not an global option, so that a user can have a control over it + per sub-screen manner. + + File i/o encoding is switchable. + The available encodings are listed in "ENCODING SCHEMES" section. + + Most of multilingual encodings are made possible by using generic + iso-2022-* parser/generator. + Please note that, some multilingual encoding specification does not + specify some of the character set. For example, iso-2022-jp2 + (RFC1554) specifies how to designate arbitrary character set, + but iso-2022-kr(RFC1557) does not. + If the encoding scheme you are using does not specify how to encode + some character set, nvi will recognize/generate iso-2022-* + escape sequences. + Example: + If you use JIS X0208-1983 while you are using + ":set fileencoding=latin1" setting, nvi will emit + "ESC $ B whatever ESC ( B", which is valid iso-2022-* sequence + for JIS X0208-1983. + + Monolingual encodings (namely sjis and hz) are hardcoded, and + they will just skip any charsets that are not supported. + + :set fileencoding=xxx affects the filter command (! in vi), + file open/read/write (:r, :w, :e and :n), and scripting input/output + to shell (:script). + + Automatic encoding detection at file open/read time. + Capable of autodetecting several encoding schemes on the fly. + :set autodetect=jp (for detecting euc-jp/sjis/iso-2022-jp) + :set autodetect=cn (for detecting euc-cn/big5/hz/iso-2022-cn) + :set autodetect=tw (for detecting euc-tw/big5/hz/iso-2022-cn) + :set autodetect=kr (for detecting euc-kr/iso-2022-kr) + If other value is set to autodetect option, autodetect will not + be performed. + + On file edit-start time (such as :n or :e) or file read time (:r) + the content of the file will be read into the backing database, + then the autodetection procedure starts. Autodetection procedure + tries to figure out the encoding, and converts the backing database + into proper internal expression based on the result. + If the autodetection was unsuccessful, the value set to fileencoding + option (:set fileencoding) will be used as default value. + + You can also set autodetection procedure to overwrite fileencoding + option, at edit-start time. (:e/:n) By doing so, you can preserve + encoding method of an file across edit sessions. + In this case, you should append "+" to autodetect option, like: + set autodetect=jp+ + set autodetect=cn+ + If you use this option, control-G vi command will display the encoding + method you're using. + + Please note that autodetection may take some time over a huge file, + since autodetection procedure may scan whole lines which are + just read into the backing database. + (Maximum lines to be scanned can be changed by changing + PREDICT_MAXLINES in common/multibyte.c.) + Also, autodetection is not always possible; especially for short + files. + I don't think the autodetection procedure will be happy with binary + files, so please be warned. + + :set autodetect=xxx only affects file open/read operations. + (:r, :e and :n) + + It should be noted that, if you are using chinese encodings + (:set autodetect=cn), it is adviced that you have "euc-cn" or + "big5" set to fileencoding. Making a correct guess between + euc-cn and big5 is almost impossible, so the autodetection + usually fails. If autodetection fails, the value set to + fileencoding will be used. + Therefore, if you prefer big5, use the following setting: + :set autodetect=cn fileencoding=big5 + If you prefer euc-cn, use the following setting: + :set autodetect=cn fileencoding=euc-cn + No other settings are recommended for chinese code detection. + + If you use autodetection of tiwanese encodings (:set autodetect=tw) + the above description will apply. Please set fileencoding option + to "euc-tw" or "big5". + + - Multibyte keyboard input. + selection of keyboard input code should be done like: + :set inputencoding=euc-jp + :set inputencoding=iso-2022-jp + euc-jp/kr/cn and iso-2022-* encodings use generic iso-2022-* + parser. Therefore, their input stream handling is truely + multilingual. (as far as we've tested) + Note that if you are going to use iso-2022-* encodings for keyboard + input, there'll be problem with ESC. ESC denotes the start of + character set designation, as well as finish of vi entry mode... + We currently identify them by timeout mechanism. There may some + trouble arise when you are using nvi over very slow serial line. + + - Regular expression search over multibyte chars. + For list of restrictions/notes, refer to regex/README.m17n. + + - Direct canna support for Japanese text entry. + "canna" is an client-server protocol for Japanese text conversion. + added options are listed in separate section. + Canna support is for vi mode only; in ex mode execution, canna + support is not available. + + If you would like to use canna, do the following: + :set canna + It will connect nvi to canna server. You can disconnect from + canna server by doing: + :set nocanna + + To switch to canna mode (activate fence), tap control-O. + The keystroke is determined by cannakey option. You can change + it by setting cannakey option, as follows. This example sets + canna starter key to control-X: + :set cannakey=^X (to enter it on colon mode, use ^V^X) + Please be VERY careful about your choice. The selected keystroke + will overrider everything, and that keystroke will NEVER be passed + to nvi itself, while canna option is set. + + Sometimes it might be annoying to see canna fence activated while + you're in the vi command mode. nvi can automatically control + deactivation of canna. You can enable this feature by setting + the following option: + :set cannactrl + If you set this option, the following events will happen: + - on leaving from text entry (for selected commands), + canna fence will be deactivated automatically. + - on entering to text entry (for selected commands), + canna fence will be activated automatically, + if was recently automatically deactivated. + - on entering to vi command mode (for all commands), + canna fence will be automatically turned off. + You can select commands to be controlled as above, by setting + fepkey option. By default, it is set to "/?aioAIO". + You may want to add "ftFT", for example. + Full-featured example would be as follows: + :set fepkey="?/aioAIOcCrRtfTF" + Believe me, it works. + + To change canna server, do the following + :set cannaserver="hostname.your.domain". + + There are several twists to canna support. See "KNOWN TWISTS" + secton. + + SETTING UP OPTIONS SPECIFIC TO NVI + + As you see, There are several options added to original nvi. + However, under some circumstances, option settings written in .exrc + may trouble you: + 1. If you use both nvi-m17n and original nvi/other vi clone, other + implementations may not understand extended options of nvi-m17n. + In that case, they will bark on startup, or they do not start up. + 2. If you are willing to use multiple settings, it would be nice if + you can switch one setting to another. + + In case of 1., there are three sideways: + - You can use .nexrc rather than .exrc to resolve conflict between + nvi and other vi clones. + Since .nexrc is introduced in original nvi, it is unable to pass + different options to nvi-m17n and original nvi, by using .nexrc. + - You can use environment variable NEXINIT too. + It works just like EXINIT, but it is for nvi/nvi-m17n only. + - You can use wrapper script (described below) + In case of 2., you can use wrapper script. + + Wrapper script + You can use wrapper script to pass some options specific to nvi-m17n. + For example, see below: + + --->8 example for japanese editing (save as, say "jnvi") + #! /bin/sh + + EXINIT0="set canna cannactrl autodetect=jp fileencoding=iso-2022-jp displayencoding=iso-2022-jp inputencoding=iso-2022-jp noskipdisplay" + if [ -f ~/.exrc ]; then + EXINIT="$EXINIT0 `sed -e '/^set /!d' -e 's/^set //' < ~/.exrc | tr '\012' ' '`" + else + EXINIT=$EXINIT0 + fi + export EXINIT + exec /usr/local/bin/nvi $* + --->8 + + ADDITIONAL TOOL + + The package adds a perl script called "regular" to original nvi package. + + regular [-options] + + Some text files contain ASCII text with unnecessery designations. + For example, "a" in UK charset, "a" in JIS X0201 roman charset, + and so forth. They are correct use, however, they sometimes + annoy the users of nvi-m17n since it is not always easy to input those + chars in those charset, not ASCII "a". + Regular converts these chars into ASCII "a". + + Regular has several options. + -7 + Output encoding will be iso-2022-7-1. + All charset will be designated to G0. + No locking shift/single shift will be used. + Regular acts like this by default. + -8 + Output encoding will be iso-2022-8-2. + All 94/94x94 charset will be designated to G0, + and all 96/96x96 charset will be designated to G1. + No locking shift/single shift will be used. + -kr + Assume that input is iso-2022-kr. + It means that, charsets designated to G0/G1/whatever + will be valid across the line-break. In other + cases, designation will be reset to + G0=ASCII, G1=G2=G3=nothing + at every line break. + It eats text from standard input, and generate output to standard + output. Use like + % regular < source.txt > dst.txt + or, from nvi-m17n, use filter (! in vi mode) command. + + Known twists: + - Though nvi-m17n can handle it, output encoding is very uncommon. + It must not be regarded as generic tool. It is just for supporting + nvi-m17n. + - It is not possible to handle euc-*/sjis/big5/whatever document. + If you use vi filter command, fileencoding options in nvi-m17n must + be set to iso-2022-* kind of encoding. + - Regular is DEADLY slow. Be warned. + If you feel it unusable, please use "qregular" instead. + It recognize direct G0/G1 designation only. + + IT DOES NOT ENABLE... + + The patch DOES NOT multilingual-ize all the functionality of nvi. + Therefore, there are some functionalities that shall NOT be invoked. + I list SOME of them here. Check source code for unsupported features: + - sideway scrolling screen mode (:set leftright) sometimes generate + core-dump, or infinite loop. + - display interfaces other than curses will not work. + - can be compiled with embedded perl interpreter. however, it is + almost unusable since perl script will need to handle nvi's + internal code. + - not confirmed with tcl linked. I think it won't work. + - in ex mode, the echoback of the keystroke you typed will be + performed by the terminal software you're using, not by nvi itself. + (this is the behavior of original nvi) + therefore, there might be garbled echoback if your terminal software + does not properly handle it. + - there is no canna support in ex mode, due to screen control + method used by origial nvi. (colon mode in vi has canna support) + + KNOWN TWISTS(of original nvi 1.79) + + There's a problem with tcsh 6.05.00. + In tcsh 6.05.00, + % echo -n 'hoge' | tcsh -c cat + will hang. Also, + % ( echo 'hoge'; echo -n 'hoge') | tcsh -c cat + will produce only the first line, which is a different result from + that of csh. + Because of this, if your login shell is tcsh 6.05.00, and you invoke + "filter 1 line" command (say, "!!cat" or "!!fmt") in nvi, nvi hangs + with tcsh. + The easiest way around it is not to use tcsh from nvi. For that, + you may want to add a line in your .exrc: + set shell=/bin/csh + + If you do + :set + then + :set all + the screen will scroll too much (1 lines more than expected). + You will not be able to read the first line generated by :set all. + + The original nvi assumes that macros defined in ctype.h (isprint(), + isblank() and alike) will properly handle minus values. + (NOTE: this is NOT in the ANSI C specification!) + If it is not satisfied, nvi will hang if chars that are 8th bit set + (0x80-0xff) appears. It is very critical situation to + multilingualization, since it uses values that are 8th bit set heavily. + I've fixed most of the occurences, however, I might missed somewhere. + If nvi hangs in your configuration, please tell me how can you + repeat that. + + KNOWN TWISTS(of nvi-m17n) + + If you use iso-2022-* encoding as keyboard input, + (:set inputencoding=xxx) control-O and control-N will always + be treated as SI/SO which switches character set. Therefore, you + can't use control-N as "next line" vi command. + (If you use canna support, the behavior might be overriden by + canna starter key. See below) + To type in those kind of control key strokes, you should temporarily + change the keyboard encoding, like: + :set inputencoding=none + + Multilingual parser/generator for keyboard, terminal output, file i/o + are implemented separately. They have slightly different + characteristics. This is because: + - Keyboard parser must understand halfway-entered text stream + - Terminal output generator must designate everything into G0 + (although monolingual encoding such as sjis can use 8bit) + - File i/o is the easiest one of the three guys + + Autodetection of chinese encoding method is almost impossible. + + Canna starter key (as defined by :set cannakey) overrides everything. + Therefore, for example, if you set canna starter key to control-O, + you will not be able to use control-O as SI. If you set canna starter + key to control-M, you will not be able to enter CR! + Be very careful choosing starter key. + + Some vi commands are implemented by using other vi commands. + For example, S command is implemented as c_ command. + C, D, S, and Y commands are implemented in this way. + fepkey option looks into translated version of the command. + Therefore, if you enable automatic canna control for c command, + automatic control for S command will be automatically enabled. + see v_alias() in vi/vi.c for details. + + When you set wrapmargin/wraplen option, it will wrap lines at + word boundary which is recognized by W/B vi command. Sometimes + it may look annoying when you do it over multibyte lines. + Now I'm trying to find a good way to wrap multibyte lines. + If you have some comments, please let me know. + + I haven't checked autodetection of korean/chinese encoding very much. + If you have any suggestions, please let me know. + + If you are using iso-2022-* variants to keyboard encoding, + keyboard timeout is too long (twice as long as non-multibyte + implementation). + + Please note that, after applying this patch, some part of nvi's + original document are no longer valid. + For example, locale-related items (as found as the first question + in nvi-1.79/FAQ) are not applicable to nvi-m17n. + + COMMENTS AND SUGGESTIONS + + Bugs and comments should be sent by the following methods: + via http://www.itojun.org/cgi-bin/gnats-send-pr + e-mailed to nvi-m17n@dit.co.jp + Please specify the version number of the patch you've tried. + + CONTACTING THE AUTHOR + + Jun-ichiro itojun Itoh + itojun@mt.cs.keio.ac.jp + itojun@itojun.org + Contribution to the author, in any form (example: just say "thanks"), + is always appreciated. Index: docs.m17n/README.japanese *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/docs.m17n/README.japanese Mon Jun 30 17:41:05 1997 *************** *** 0 **** --- 1,777 ---- + multilingual patch for Keith Bostic's nvi + Jun-ichiro itojun Itoh + $Id: README.japanese,v 1.13 1997/06/30 08:41:04 itojun Exp $ + Based on: Id: README.english,v 1.98 1997/06/30 08:39:46 itojun Exp + + + vi users of the world, unite! + + + $B$3$NJ8=q$O!"1Q8lHG$NK]Lu$G$9!#1Q8lHG$NJ}$,99?7$5$l$F$$$^$9$N$G(B + $BH$7$F$/$@$5$$!#(B + + $B$3$l$J$"$K(B? + + $B$3$N(Bpatchkit$B$O!"(Bnvi 1.79$B$KBP$9$kB?9q8l2=%Q%C%A$G$9!#(B + $B$3$N%Q%C%A$N$3$H$r(B"nvi-m17n"$B$HFI$s$G$$$^$9!#(B"m17n"$B$H$O!"(B + multilingualization$B$N$3$H(B(m + 17$BJ8;z(B + n)$B$G$9!#(B + + nvi$B$N:G?7HG$O!"0J2<$+$iF@$k$3$H$,$G$-$^$9(B: + ftp://ftp.cs.berkeley.edu/ucb/4bsd/ + $B$3$N%Q%C%1!<%8$N:G?7HG$O!"0J2<$+$iF@$k$3$H$,$G$-$^$9(B: + ftp://ftp.foretune.co.jp/pub/tools/nvi-m17n/ + + $BF|K\8l2=%Q%C%A$+$i%9%?!<%H$7$?$N$G!"0JA0$O(B"jnvi"$B$H8F$s$G$^$7$?!#(B + $B$3$N$?$a!"(B"jnvi"$B$H$$$&5-=R$,;D$C$F$k$+$b$7$l$^$;$s!#(B + "nvi-m17n"$B$HFI$_BX$($F$/$@$5$$!#(B + + REDISTRIBUTION + + Freely redistributable, under condition written in LICENSE file. + + WARRANITY AND COPYRIGHT + + Absolutely no warranty. Pray and backup before try. + + The patch is based on the Japanization work on nvi 1.03 by: + Yoshitaka Tokugawa + and Japanization patch to elvis(vi clone by Steve Kirkendall) by: + Jun-ichiro itojun Itoh + + Some part of multibyte support has been derived from other people's + work. See comment in multibyte.c. + + Multilingual portion copyright(c) 1996, 1997 by Jun-ichiro Itoh. + All rights reserved. + + $BI=5-$K$D$$$F(B + + $BL@Gr$J>l9g!"(B"$BB?9q8l2=(Bnvi"$B$N$3$H$r(B"nvi"$B$HI=5-$7$^$9!#(B + $B6hJL$7$?$$>l9g$K$O(B"nvi-m17n"$B$H8F$s$G$$$^$9!#(B + + $B$H$j$"$($:;H$$$?$$(B($B$$$i$A$J$R$H$K(B) + + $B$^$:!"$3$N(Bpatch$B$O$b$H$N(Bnvi$B$NA4$F$N5!G=$rB?9q8l2=$7$F$k$HJ]>Z$5$l$F$k(B + $B$o$1$G$O$J$$!"$H$$$&$3$H$KCm0U$7$F$/$@$5$$!#(B + $B$$$/$D$+$N5!G=$O$^$@;H$C$F$O$$$1$J$$>l9g$,$"$j$^$9!#(B + "$BB?9q8l2=:Q$_(B"$B$H(B"$BB?9q8lL$BP1~(B"$B$N@a$r8+$k$H$I$N5!G=$,(Bok$B$G$I$N5!G=$,(B + $B$^$@$+$o$+$j$^$9!#(B + + 0. nvi$B$N%Q%C%1!<%8$K(Bpatch$B$r$"$F$^$9!#(B + % cd nvi-1.79 + % patch -p1 < nvi-m17n.diff + 1. $BB?9q8l%Q%C%A$r3h$+$7$F(Bconfigure$B$7$^$9!#(B + % cd build + % ./configure --enable-multibyte + nvi$B$+$iD>@\(Bcanna$B$r;H$$$?$$>l9g!"0J2<$N$h$&$K(Bconfigure$B$r8F$S=P$7$F(B + $B$/$@$5$$!#0J2<$NNc$@$H!"(B/usr/local/canna$B$K(Bcanna$B$N%i%$%V%i%j$d(B + $B%X%C%@%U%!%$%k$,%$%s%9%H!<%k$5$l$F$$$kI,MW$,$"$j$^$9!#(B + % ./configure --enable-multibyte --enable-canna=/usr/local/canna + + 2. make$B$7$F%$%s%9%H!<%k$7$^$7$g$&!#(B + % make + % su + password: xxxx + # make install + + 3. X$B$r;H$C$F$$$k>l9g!"B?9q8lI=<($N$?$a$K(Bkterm 6.2.0$B$r%$%s%9%H!<%k(B + $B$9$k$3$H$r$*$9$9$a$7$^$9!#(Bkterm 6.2.0$B$O(BX11R6 contrib$B$N%_%i!<$r(B + $B$7$F$$$k(Bftp$B%5!<%P$+$i;}$C$F$3$l$^$9!#%U%)%s%H$bDI2C%$%s%9%H!<%k(B + $B$7$^$7$g$&!#(B + $BC1$KF|K\8l$,;H$$$?$$$@$1$J$i8E$$(Bkterm$B$G$bJ?5$$G$9!#(B + + 4. $B@_Dj%U%!%$%k$rJT=8$7$^$7$g$&!#(B(~/.exrc) + 4-a. iso-2022-*$B$NI=<((B + iso-2022-*$BBP1~$NCl9g!"0J2<$N9T$r(B + $BB-$7$^$7$g$&(B(kterm$B$N>l9g$3$C$A$G$9(B): + set noskipdisplay + $B$=$&$G$J$1$l$P!"0J2<$N9T$rB-$7$^$7$g$&(B: + set skipdisplay + 4-b. $BI=<($N(Bencoding + $BJL$N@a$K$"$k%j%9%H$+$i!"Cl9g!"F0:n$K%/%;$,$"$j$^$9!#(B + "$BB?9q8lBP1~:Q$_(B"$B$N@a$r;2>H$7$F$/$@$5$$!#(B + 4-c. $B%-!e=q$-$9$k$3$H$b$G$-$^$9!#(B + $B$3$N>l9g!"0J2<$N$h$&$K@_Dj$7$^$9!#$3$&$9$k$3$H$G!"(B + $B%U%!%$%k$N(Bencoding$B$,%U%!%$%kJT=8A0$HJT=88e$G(B + $BJQ$o$i$J$$$h$&$K$9$k$3$H$,$G$-$^$9!#$?$H$($P(B: + set autodetect=jp+ + set autodetect=cn+ + + $BCf9q8l$N<+F0H=JL$r$7$?$$>l9g(B(:set autodetect=cn)$B!"(B + fileencoding$B$r(B"euc-cn"$B$^$?$O(B"big5"$B$K@_Dj$9$k$3$H$r$*4+$a$7$^$9!#(B + euc-cn$B$H(Bbig5$B$r<+F0H=JL$9$k$N$O$[$H$s$IIT2DG=$J$N$G!"(B + $B<+F0H=JL$O$?$$$F$$<:GT$7$^$9!#<+F0H=JL$,<:GT$7$?>l9g!"(B + fileencoding$B$K@_Dj$5$l$?(Bencoding$B$,;H$o$l$^$9!#(B + $B$N$G!"(Bbig5$B$r$h$/;H$&>l9g!"0J2<$N$h$&$K$7$^$7$g$&(B: + set autodetect=cn fileencoding=big5 + euc-cn$B$r$h$/;H$&>l9g!"0J2<$N$h$&$K$7$^$7$g$&(B: + set autodetect=cn fileencoding=euc-cn + $BCf9q8l$N<+F0H=JL$r$9$k>l9g!"$3$l0J30$N@_Dj$O$*4+$a$7$^$;$s!#(B + + $BBfOQ8l(B(?)$B$N<+F0H=JL$r$7$?$$>l9g(B(:set autodetect=tw)$B$b!"(B + $B>e5-$N5-=R$O$"$F$O$^$j$^$9!#(Bfileencoding$B$O(B"euc-tw"$B$+(B"big5"$B$N(B + $B$I$A$i$+$K@_Dj$7$F$/$@$5$$!#(B + + 4-e. canna$B%5%]!<%H(B + canna$B$K$h$kF|K\8lF~NO$r;H$$$?$$>l9g!"0J2<$N9T$rDI2C$7$^$9(B: + set canna + canna$B$NF~NO%b!<%I(B($B%U%'%s%9(B)$B$N(Bon/off$B$N<+F0@)8f$r;H$$$?$$>l9g!"(B + $B0J2<$b@_Dj$7$F$/$@$5$$(B($B$"$H!"(Bfepkey$B$r9%$_$K$"$o$;$F$/$@$5$$(B): + set cannactrl + canna$B%5!<%P$r;XDj$9$k>l9g!"0J2<$N$h$&$K$7$^$9(B: + set cannaserver="somehost.your.domain" + canna$BF~NO%b!<%I$KF~$k%-!<$rJQ$($?$$>l9g!"0J2<$N$h$&$K$7$^$9!#(B + $B$3$N@_Dj$r$9$k$HF~NO%b!<%I$KF~$k%-!<$,(Bcontrol-O$B$K$J$j$^$9!#(B + $B%-!<$O(B*$B?5=E$K(B*$BA*$s$G2<$5$$(B!: + set cannakey=^O + + 5. $B$3$N%Q%C%A$r$"$F$?>l9g!"86:n(Bnvi$B$N%I%-%e%a%s%H$K=R$Y$i$l$F$$$k(B + $B@bL@J8$N0lIt$OE,MQ$5$l$J$/$J$k$3$H$KCm0U$7$F$/$@$5$$!#(B + $BNc$($P!"(Blocale$B4XO"$N$b$N(B(nvi-1.79/FAQ$B$N$$$A$P$s:G=i$Nl9g!"(Biso-2022-*$BE*$J;X<($,(B + $B;H$o$l$^$9!#(B + ($BNc$($P!"(Biso-2022-kr$BCf$N(Blatin-1$B$H$+!"(Biso-2022-cn$BCf$N(Bcyrillic$B$H$+(B) + $BC10l8@8l(Bencoding$B$N>l9g!"CN$i$J$$J8;z%;%C%H$OC1$KHt$P$5$l$^$9!#(B + + encoding$B$N07$o$lJ}$N>\:Y$O(B"$BB?9q8l2=:Q$_(B"$B$N@a$r;2>H$7$F$/$@$5$$!#(B + + $BB?9q8l(Bencoding: + name note initially designated charsets + --- --- --- + * euc-jp-old G0=ascii, G1=JIS X0208-1976, + G2=JIS X0201 kana, + G3=JIS X0212-1990. + SS1 and SS2 used + * euc-jp G0=ascii, G1=JIS X0208-1983, + G2=JIS X0201 kana, + G3=JIS X0212-1990. + SS1 and SS2 used + * euc-cn G0=ascii/G1=GB2312 + * euc-kr G0=ascii/G1=KSC5601 + + * iso-8859-1 8bit G0=ascii/G1=iso-8859-1 + * iso-8859-2 8bit G0=ascii/G1=iso-8859-2 + * iso-8859-3 8bit G0=ascii/G1=iso-8859-3 + * iso-8859-4 8bit G0=ascii/G1=iso-8859-4 + * iso-8859-7 8bit G0=ascii/G1=iso-8859-7 + * iso-8859-8 8bit G0=ascii/G1=iso-8859-8 + * iso-8859-9 8bit G0=ascii/G1=iso-8859-9 + * latin1 8bit iso-8859-1$B$NJLL>(B + * latin2 8bit iso-8859-2$B$NJLL>(B + * iso-2022-cn-ext G0=ascii + rfc1922 SI, SO, SS2 and SS3 used + * iso-2022-cn rfc1922 iso-2022-cn-ext$B$NJLL>(B + ($B;EMM$,8_49(B) + * iso-2022-jp-2 rfc1554 G0=ascii + SS2 used + * iso-2022-jp rfc1468 iso-2022-jp-2$B$NJLL>(B + ($B;EMM$,8_49(B) + *! iso-2022-kr rfc1557 G0=ascii + SI and SO used + * ctext X11 compound text G0=ascii/G1=iso-8859-1 + 8bit no locking shift used + + * iso-2022-7-1 $B%F%9%HMQ$NHFMQ(B7bit$B!"(BG0$B$N$_;HMQ(B + * iso-2022-7-2 $B%F%9%HMQ$NHFMQ(B7bit$B!"(BG0/1$B$N$_;HMQ(B + * iso-2022-8-2 $B%F%9%HMQ$NHFMQ(B8bit$B!"(BG0/1$B$N$_;HMQ(B + + $BC10l8@8l(Bencoding: + name note charsets + --- --- --- + * none $B%Q%C%AA0$N(Bnvi$B$NF0:n(B G0=ascii, G1=ascii(binary) + * sjis MS-Kanji/Shift JIS + * big5 + * euc-tw G0=ascii, G1=CNS11643-1, + G2=CNS11643-[2-7] + hz rfc1842 + + + iso-2022-kr$B$N2rl9g!":n(B + fileencoding(fe) str - $B%U%!%$%kF~=PNO(Bencoding + inputencoding(ie) str - $B%-!o$N%$%s%9%H!<%kl9g!"(B"--enable-canna"$B$r(Bconfigure$B$N(B + $B0z?t$K$D$1$kI,MW$,$"$j$^$9!#(B"--enable-multibyte"$B$,I,MW$G$9!#(B + % cd build + % ./configure --enable-multibyte --enable-canna + + $B%X%C%@$d%i%$%V%i%j$N$"$k%G%#%l%/%H%j$r;XDj$9$kI,MW$,$"$k$+$b(B + $B$7$l$^$;$s!#(B + --enable-canna$B$N8e$K%G%#%l%/%H%j(BSOMEWHERE$B$r;XDj$7$?>l9g(B: + % ./configure --enable-multibyte --enable-canna=SOMEWHERE + $B0J2<$K%X%C%@%U%!%$%k$H%i%$%V%i%j%U%!%$%k$,$"$k$3$H$r0UL#$7$^$9(B: + SOMEWHERE/include/canna/jrkanji.h + SOMEWHERE/lib/libcanna.a + + $BHs0lHLE*$J@_Dj$r$7$F$$$F!"%X%C%@$H%i%$%V%i%j$N%Q%9L>$N(Bprefix$B$,(B + $B0c$&>l9g!"%G%#%l%/%H%j$r8DJL$K;XDj$9$kI,MW$,$"$j$^$9!#(B + $BNc$($P0J2<$N$H$3$m$K%U%!%$%k$,$"$k>l9g(B: + SOMEWHERE/canna/jrkanji.h + ELSEWHERE/libcanna.a + $B0J2<$N$h$&$K(Bconfigure$B$r5/F0$7$^$9(B: + % env CFLAGS=-ISOMEWHERE LDFLAGS=-LELSEWHERE \ + ./configure --enable-multibyte --enable-canna + + $B$?$$$F$$$N>l9g!"0J2<$N@_Dj$G$&$^$/$$$-$^$9(B: + % ./configure --enable-multibyte --enable-canna=/usr/local/canna + + $BB?9q8l2=:Q$_(B + + $BB?9q8lJ8;z$N>e$N0\F0(B/$BB?9q8lJ8;z$NF~NO!#(B + + $BB?9q8l$NC18l0\F0(B($BF|K\8l(B/$B4Z9q8l$N$_(B) + + iso-2022-*$B$r%5%]!<%H$9$kC4QE*$G$O$J$$$N$G!"0J2<$rCm0U?<$/(B + $BFI$s$G2<$5$$!#(B + + $BB?9q8lJ8;z$O0J2<$NJ}K!$GI=<($5$l$^$9(B: + + 1. $B$=$N(Bencoding$BMQ$KFCJL$NJ}K!$,Dj5A$5$l$F$$$?$i!"$=$l$r;H$$$^$9!#(B + $B$3$l$O!"(B8bit$B7O$N(Bencoding$B$N>l9g$KDj5A$5$l$F$$$^$9!#(B + name note + --- --- + euc-jp G0/G1$B$N$_(B + G0=ASCII, G1=JIS X0208-1983/1976 + euc-cn + euc-kr + euc-tw G0/G1$B$N$_(B (G0=ASCII, G1=CNS11643-1) + sjis X0208-1983/1976$B$H(BJIS X0201$B%+%?%+%J(B + big5 + + 2. ":set skipdisplay"$B$N@_Dj$N>l9g!"B?9q8lJ8;z$O(B"?"$B$+(B"??"$B$H$7$F(B + $BI=<($5$l$^$9!#(B + + 3. $B$=$&$G$J$1$l$P!"I=<(BP>]$NJ8;z%;%C%H$r(Biso-2022-*$B$N%(%9%1!<%W(B + $B%7!<%1%s%9$r;H$C$F(BG0$B$K;X<($7$FI=<($7$^$9!#(B + $BNc$($P!"(BJIS X0208-1983$B$N>l9g(B"ESC $ B"$B!"(Blatin-1$B$N>l9g(B"ESC , A" + G0$B$@$1$r;H$&$N$OC1=c2=$N$?$a$G$9!#$3$l$O(Bnvi$B$N(Bencoding$B$N(B + "iso-2022-7-1"$B$K;w$F$$$^$9!#(B + + $BB?9q8lI=<($N$?$a$K$O(B($B>e5-$N(B3.$B$N>l9g(B)iso-2022-*$B40A4BP1~$NC\:Y$,CN$j$?$1$l$P!"(Bcurses/README.m17n$B$r(B + $B8+$F2<$5$$(B + + :set displayencoding=xxx$B$H$$$&@_Dj$O(Bnvi$BA4BN$K$D$$$F$N@_Dj$J$N$G!"(B + $BA4$F$N%5%V2hLL$KBP$7$F8z$-$^$9!#(B:set skipdisplay$B$O%5%V2hLL$4$H$K(B + $B@_Dj$G$-$^$9!#(B + + $B%U%!%$%kF~=PNO(Bencoding$B$O@ZBX$(2DG=$G$9!#(B + $B;H$($k(Bencoding$B$O(B"encoding"$B$N@a$KNs5s$7$F$"$j$^$9!#(B + + $B$[$H$s$I$NB?9q8l(Bencoding$B$OHFMQ(Biso-2022-*$B2r@O4o(B/$B@8@.4o$G(B + $Bl9g$K$O!"(Bnvi$B$O(Biso-2022-*$B$N%(%9%1!<%W%7!<%1%s%9$r(B + $B2rl9g!"(Bnvi$B$O(B"ESC $ B $B$[$2$[$2(B ESC ( B"$B$r=PNO$7$^$9!#(B + $B$3$l$O(BJIS X0208-1983$B$r;XDj$9$kJ}K!$H$7$F@5Ev$G$9!#(B + + $BC10l8@8l(Bencoding($BFC$K(Bsjis$B$H(Bhz)$B$O%W%m%0%i%`%3!<%I$H$7$FF0:n$,(B + $B7h$aBG$A$5$l$F$$$F!"CN$i$J$$J8;z%;%C%H$OA4$FHt$P$9$h$&$K(B + $B$J$C$F$$$^$9!#(B + + :set fileencoding=xxx$B$O%U%#%k%?7O$N%3%^%s%I(B(vi$B$N(B!$B%3%^%s%I(B)$B!"(B + $B%U%!%$%k$N%*!<%W%s(B/$BF~NO(B/$B=PNO(B(:r$B!"(B:w$B!"(B:e$B$d(B:n)$B!"$*$h$S(Bshell$B$H$N(B + $BF~=PNO(B(:script)$B$K1F6A$7$^$9!#(B + + $B%U%!%$%k%*!<%W%s(B/$BF~NO;~$N(Bencoding$B<+F0H=JL!#(B + $B0lIt$N(Bencoding$B$rI,MW$J$H$-$K<+F0H=JL$G$-$^$9!#(B + set autodetect=jp (euc-jp/sjis/iso-2022-jp) + set autodetect=cn (euc-cn/big5/hz/iso-2022-cn) + set autodetect=tw (euc-tw/big5/hz/iso-2022-cn) + set autodetect=kr (euc-kr/iso-2022-kr) + $BB>$NCM$r@_Dj$9$k$H!"<+F0H=JL$OF/$-$^$;$s!#(B + + $B%U%!%$%kJT=83+;O;~(B(:n$B$H$+(B:e$B$H$+(B)$B$^$?$O%U%!%$%kFI$_9~$_;~(B(:r)$B$K!"(B + $B%U%!%$%k$NFbMF$O%G!<%?%Y!<%9$KFI$_9~$^$l!"$=$N$"$H<+F0H=JL$N(B + $B$?$a$N%W%m%0%i%`%3!<%I$,8F$P$l$^$9!#<+F0H=JL$N$?$a$N%3!<%I$O(B + encoding$B$rH=JL$7!"$=$l$K=>$$%G!<%?%Y!<%9$NFbMF$rE,@Z$JJ}K!$G(B + $BFbItI=8=$KJQ49$7$^$9!#(B + $B<+F0H=JL$,@.8y$7$J$+$C$?>l9g!"(Bfileencoding$B$K;XDj$5$l$F$$$kCM$,(B + $B%G%U%)%k%HCM$H$7$F;H$o$l$^$9!#(B + + $B$^$?!"%U%!%$%k$N%*!<%W%s;~$K(B(:e/:n$B%3%^%s%I$G(B)$B<+F0H=Dj7k2L$G(B + fileencoding$B$NCM$r>e=q$-$9$k$3$H$b$G$-$^$9!#(B + $B$3$&$9$k$3$H$G!"%U%!%$%k$N(Bencoding$B$,%U%!%$%kJT=8A0$HJT=88e$G(B + $BJQ$o$i$J$$$h$&$K$9$k$3$H$,$G$-$^$9!#(B + $B$3$N>l9g!"0J2<$N$h$&$KKvHx$K(B"+"$B$r2C$($F@_Dj$7$^$9(B: + set autodetect=jp+ + set autodetect=cn+ + $B$3$N@_Dj$r;H$&$H!"(Bvi$B%3%^%s%I$N(Bcontrol-G$B$G(Bfileencoding$B$NCM$,(B + $BI=<($5$l$k$h$&$K$J$j$^$9!#(B + + $BBg$-$J%U%!%$%k$r07$&$H!"<+F0H=JL$K;~4V$,$+$+$k$3$H$,$"$j$^$9!#(B + $B<+F0H=JL%3!<%I$O%G!<%?%Y!<%9$KFI$_9~$^$l$?%U%!%$%k$r!"<+F0H=JL$,(B + $B=*$k$^$GD4$Y$K$$$/$+$i$G$9(B($B$D$^$j!"A49TD4$Y$A$c$&>l9g$,$"$k(B)$B!#(B + ($B:GBg9T?t$O(Bcommon/multibyte.c$B$NCf$N(BPREDICT_MAXLINES$B$N@_Dj$rJQ$($k$H(B + $BJQ99$G$-$^$9(B) + $B<+F0H=JL$,IT2DG=$J>l9g$H$$$&$N$b$"$j$^$9!#FC$K%U%!%$%k$,C;$$(B + $B>l9g$OL5M}$J>l9g$,$"$j$^$9!#(B + $B%P%$%J%j%U%!%$%k$rFI$_9~$s$G$7$^$C$?>l9g!"<+F0H=JL$O(B + $B$-$C$H$&$^$/$$$-$^$;$s!#Cm0U$7$F2<$5$$!#(B + + :set autodetect=xxx$B$O%U%!%$%k$N%*!<%W%s(B/$BF~NO$K$@$11F6A$7$^$9(B + (:r$B!"(B:e$B$H(B:n)$B!#(B + + $BCf9q8l$N<+F0H=JL$r$7$?$$>l9g(B(:set autodetect=cn)$B!"(B + fileencoding$B$r(B"euc-cn"$B$^$?$O(B"big5"$B$K@_Dj$9$k$3$H$r$*4+$a$7$^$9!#(B + euc-cn$B$H(Bbig5$B$r<+F0H=JL$9$k$N$O$[$H$s$IIT2DG=$J$N$G!"(B + $B<+F0H=JL$O$?$$$F$$<:GT$7$^$9!#<+F0H=JL$,<:GT$7$?>l9g!"(B + fileencoding$B$K@_Dj$5$l$?(Bencoding$B$,;H$o$l$^$9!#(B + $B$N$G!"(Bbig5$B$r$h$/;H$&>l9g!"0J2<$N$h$&$K$7$^$7$g$&(B: + set autodetect=cn fileencoding=big5 + euc-cn$B$r$h$/;H$&>l9g!"0J2<$N$h$&$K$7$^$7$g$&(B: + set autodetect=cn fileencoding=euc-cn + $BCf9q8l$N<+F0H=JL$r$9$k>l9g!"$3$l0J30$N@_Dj$O$*4+$a$7$^$;$s!#(B + + $BBfOQ8l(B(?)$B$N<+F0H=JL$r$7$?$$>l9g(B(:set autodetect=tw)$B$b!"(B + $B>e5-$N5-=R$O$"$F$O$^$j$^$9!#(Bfileencoding$B$O(B"euc-tw"$B$+(B"big5"$B$N(B + $B$I$A$i$+$K@_Dj$7$F$/$@$5$$!#(B + + $BB?9q8l%-!l9g!"HFMQ(Biso-2022-*$B2r@O4o$,(B + $B;H$o$l$^$9!#$3$N$?$a!"$3$l$i$N>l9g40A4B?9q8l%-!l9g!"J8;z%3!<%I;XDj$N(B + $B%(%9%1!<%W%7!<%1%s%9$H(BESC$B%-!<$H$N6hJL$,Fq$7$/$J$j$^$9!#(B + $B$3$l$i$O%?%$%`%"%&%H$r;H$C$FH=JL$5$l$^$9!#Hs>o$KCY$$2s@~1[$7$K(B + nvi$B$r;H$&>l9g!"LdBj$,@8$8$k>l9g$,$"$jF@$^$9!#(B + + $BB?9q8l$N@55,I=8=8!:w$,2DG=$G$9!#(B + $B@)Ls;v9`$K$D$$$F$O(Bregex/README.m17n$B;2>H!#(B + + canna$B$K$h$kF|K\8lF~NO$r%5%]!<%H$7$F$$$^$9!#(B + "canna"$B$O%/%i%$%"%s%H%5!<%P7A<0$NF|K\8lJQ49%7%9%F%`$G$9!#(B + canna$B$r;H$&>l9g$KDI2C$5$l$k%*%W%7%g%s$N%j%9%H$OJL$N@a$K(B + $B5s$2$F$"$j$^$9!#(B + canna$B$N%5%]!<%H$O(Bvi$B%b!<%I$N>l9g$N$_$G$9!#(Bex$B%b!<%I$G$O!"(B + canna$B$K$h$kF|K\8lF~NO$O$G$-$^$;$s!#(B + + canna$B$rMxMQ$9$k>l9g!"0J2<$r9T$$$^$9(B: + :set canna + $B$3$&$9$k$H(Bnvi$B$O(Bcanna$B%5!<%P$H@\B3$7$^$9!#(Bcanna$B%5!<%P$H$N@\B3$r(B + $B@Z$k$K$O$3$&$7$^$9(B: + :set nocanna + + canna$BF~NO%b!<%I$KF~$C$?$jH4$1$?$j$9$k$K$O!"(Bcontrol-O$B$rBG$A$^$9!#(B + $B$3$N%-!<%9%H%m!<%/(B(control-O)$B$O(Bcannakey$B%*%W%7%g%s$G7h$a$i$l$F(B + $B$$$^$9!#(B + cannakey$B%*%W%7%g%s$rJQ$($k$H%-!<%9%H%m!<%/$rJQ$($i$l$^$9!#(B + $BNc$($P!"(Bcontrol-X$B$G(Bcanna$BF~NO%b!<%I$N@ZBX$($r$9$k>l9g$O$3$s$J(B + $B$+$s$8(B: + :set cannakey=^X (colon$B%b!<%I$GF~NO$9$k$K$O(B^V^X) + cannakey$B$N@_Dj$K$O(B*$B:Y?4$NCm0U$rJ'$C$F2<$5$$(B*$B!#$3$3$GA*Br$5$l$?(B + $B%-!<%9%H%m!<%/$OA4$F$KM%@h$7!"$3$N%-!<%9%H%m!<%/$O(Bcanna + $B%*%W%7%g%s$,@_Dj$5$l$F$$$k4V!"FsEY$H(Bnvi$B<+BN$KEO$i$J$/$J$j$^$9!#(B + + vi$B%3%^%s%I%b!<%I$G(Bcanna$B$N(Bfence$B$,$G$F$$$k$N$,l9g!"0J2<$N$h$&$K$J$j$^$9(B: + - ($BFCDj$N%3%^%s%I$K$D$$$F(B)$B%F%-%9%HF~NO$r=*$k$H!"(Bcanna$B$N(Bfence$B$,(B + $B<+F0E*$K(Boff$B$K$J$j$^$9!#(B + - ($BFCDj$N%3%^%s%I$K$D$$$F(B)$B%F%-%9%HF~NO$N>lLL$K$J$k$H!"(Bcanna$B$N(B + fence$B$,<+F0E*$K(Bon$B$K$J$j$^$9!#(B + - ($BA4$F$N%3%^%s%I$K$D$$$F(B)vi$B%3%^%s%I%b!<%I$KLa$k$H!"(Bcanna$B$N(B + fence$B$,<+F0E*$K(Boff$B$K$J$j$^$9!#(B + $B!VFCDj$N%3%^%s%I!W$O!"(Bfepkey$B%*%W%7%g%s$r@_Dj$9$k$3$H$G(B + $B;XDj$G$-$^$9!#%G%U%)%k%H$G$O(B"/?aioAIO"$B$,@_Dj$5$l$F$$$^$9!#(B + $B$J$s$G$b;XDj$7$?$$>l9g!"$3$s$J$3$H$b$G$-$^$9(B: + :set fepkey="?/aioAIOcCrRtfTF" + $B$3$N@_Dj$O$A$c$s$HF0$-$^$9!#13$8$c$J$$$h!#(B + + canna$B%5!<%P$r@ZBX$($k>l9g!"0J2<$r4QE*$G$J$$$H$3$m$,$"$j$^$9!#(B + "$B$R$M$/$l$F$$$k$H$3$m(B"$B$N@a$r$_$F$/$@$5$$!#(B + + nvi-m17n$BFCM-$N$G%*%W%7%g%s$r@_Dj$9$k(B + + $B0J>e$G=R$Y$?$h$&$K!"(Bnvi-m17n$B$G$O(Bnvi$B$KBP$7$$$/$D$+%*%W%7%g%s$r(B + $BDI2C$7$F$$$^$9!#$7$+$7!"$$$/$D$+$N>l9g!"(B.exrc$B$K=q$$$?%*%W%7%g%s(B + $B@_Dj$G:$$k$3$H$,$"$j$^$9(B: + 1. nvi-m17n$B$H(Bnvi($B$^$?$OB>$N%/%m!<%s(Bvi)$B$rN>J};H$C$F$$$k>l9g!"(Bnvi$B$dB>$N(B + vi$B%/%m!<%s$O(Bnvi-m17n$B$,3HD%$7$?%*%W%7%g%s$r2rl9g$,(B + $B$"$j$^$9!#$3$N>l9g!"5/F0;~$K%(%i!<%a%C%;!<%8$,$G$?$j!"(B + $BB>$N(Bvi$B$,5/F0$7$J$+$C$?$j$7$^$9!#(B + 2. $BJ#?t$N@_Dj$rIQHK$K@ZBX$($F;H$&>l9g!"4JC1$K@ZBX$($i$l$k$HAGE($G$9!#(B + + 1.$B$N>l9g!"(B3$B$D$NF($2J}$,$"$j$^$9(B: + - $BB>$N(Bvi($B%/%m!<%s(B)$B$H(Bnvi$B$N4V$N%*%W%7%g%s@_Dj$r;H$$J,$1$k$?$a$K!"(B + .exrc$B$N$+$o$j$K(B.nexrc$B$r;H$&$3$H$,$G$-$^$9!#(B + .nexrc$B$O%*%j%8%J%k$N(Bnvi$B$GF3F~$5$l$?$b$N$J$N$G!"%*%j%8%J%k$N(Bnvi$B$H(B + nvi-m17n$B$N4V$G%*%W%7%g%s@_Dj$r6hJL$9$k$?$a$K$O;H$($^$;$s!#(B + - $BF1MM$K!"4D6-JQ?t(BNEXINIT$B$b;H$($^$9!#$3$l$O(BEXINIT$B$HF1MM$K(B + $BF/$-$^$9$,!"%*%j%8%J%k$N(Bnvi$B$H(Bnvi-m17n$B$G$7$+;H$o$l$^$;$s!#(B + - wrapper$B%9%/%j%W%H$r;H$$$^$9!#0J2<;2>H!#(B + 2.$B$N>l9g!"(Bwrapper$B%9%/%j%W%H$,JXMx$G$7$g$&!#(B + + wrapper$B%9%/%j%W%H(B + $B0J2<$N$h$&$J(Bwrapper$B%9%/%j%W%H$r;H$&$H!"(Bnvi-m17n$B$KFCDj$N%*%W%7%g%s$r(B + $BEO$9$3$H$,$G$-$^$9!#$3$l$r;H$&$H!"(B.exrc$B$KHs0lHLE*$J%*%W%7%g%s$r(B + $B4^$a$:$K:Q$_$^$9(B: + + --->8 $BF|K\8l$rJT=8$9$k>l9g$NNc(B($B$?$H$($P(B"jnvi"$B$H$7$F;H$&(B) + #! /bin/sh + + EXINIT0="set canna cannactrl autodetect=jp fileencoding=iso-2022-jp displayencoding=iso-2022-jp inputencoding=iso-2022-jp noskipdisplay" + if [ -f ~/.exrc ]; then + EXINIT="$EXINIT0 `sed -e '/^set /!d' -e 's/^set //' < ~/.exrc | tr '\012' ' '`" + else + EXINIT=$EXINIT0 + fi + export EXINIT + exec /usr/local/bin/nvi $* + --->8 + + $BDI2C%D!<%k(B + + nvi-m17n$B$G$O(B"regular"$B$H$$$&%9%/%j%W%H$,DI2C$5$l$F$$$^$9!#(B + + regular [-options] + + $B0lIt$NJ8=q$K$O!"(BASCII$B$GI=8=$G$-$kJ8;z$KBP$7$FM>J,$JJ8;z%;%C%H$N(B + $B;X<($,$D$1$i$l$F$$$k$3$H$,$"$j$^$9!#$?$H$($P!"(BUK$BJ8;z%;%C%H$N(B"a"$B$H$+(B + JIS X0201$B:8B&(B(JIS roman)$BJ8;z%;%C%H$N(B"a"$B$H$+$,$=$&$G$9!#(B + $B$3$N$h$&$J;X<($O4V0c$C$F$O$$$J$$$N$G$9$,!"$?$^$K(Bnvi-m17n$B$N(B + $B%f!<%6$r$$$i$D$+$;$k860x$K$J$j$^$9!#$J$<$J$i!"(BASCII$B$N(B"a"$B0J30$r(B + $B%-!<%\!<%I$+$iF~NO$9$k$N$O7k9=Fq$7$+$C$?$jIT2DG=$@$C$?$j$9$k$+$i$G$9!#(B + Regular$B$O!"$3$N$h$&$JJ8;z$rA4It(BASCII$B$N(B"a"$B$KJQ49$7$^$9!#(B + + Regular$B$K$O$$$/$D$+$N%*%W%7%g%s$,$"$j$^$9!#(B + -7 + $B=PNO$r!"(Bnvi$B$N(Bencoding$B$G$$$&$H(Biso-2022-7-1$B$K$7$^$9!#(B + $BA4$F$NJ8;z%;%C%H$O(BG0$B$K8F$S=P$5$l$^$9!#(B + 1ocking shift$B$d(Bsingle shift$B$O;H$o$l$^$;$s!#(B + $B%*%W%7%g%s$r$J$K$b;XDj$7$J$+$C$?>l9g!"$3$NF0:n$r(B + $B$7$^$9!#(B + -8 + $B=PNO$r!"(Bnvi$B$N(Bencoding$B$G$$$&$H(Biso-2022-8-2$B$K$7$^$9!#(B + 94/94x94$BJ8;z%;%C%H$O(BG0$B$K!"(B96/96x96$BJ8;z%;%C%H$O(BG1$B$K(B + $B8F$S=P$5$l$^$9!#(Blocking shift$B$d(Bsingle shift$B$O(B + $B;H$o$l$^$;$s!#(B + -kr + $BF~NO$,(Biso-2022-kr$B$H2>Dj$7$^$9!#(B + $B$9$J$o$A!"(BG0/G1/$B$=$NB>$K8F$S=P$5$l$?J8;z%;%C%H$O(B + $B9T$r1[$($FJ]B8$5$l$^$9!#(B + -kr$B$r;XDj$7$F$$$J$$>l9g$K$O!"2~9T$4$H$K(B + G0=ASCII/G1=G2=G3=$B$J$7(B + $B$H$$$&$h$&$K%j%;%C%H$5$l$^$9!#(B + Regular$B$OI8=`F~NO$+$i%F%-%9%H$rFI$_!"I8=`=PNO$K7k2L$r=PNO$7$^$9!#(B + % regular < source.txt > dst.txt + $B$N$h$&$K;H$&$+!"$"$k$$$O%U%#%k%?%3%^%s%I(B(vi$B%b!<%I$N(B!$B%3%^%s%I(B)$B$G(B + $B8F$S=P$9$+$7$F$/$@$5$$!#(B + + $B$R$M$/$l$F$$$k$H$3$m(B: + - nvi-m17n$B$O(Bregular$B$N=PNO(Bencoding$B$r=hM}$G$-$^$9$,!"(Bregular$B$N=PNO(B + encoding$B$O0lHLE*$G$O$"$j$^$;$s!#(B + regular$B$OHFMQ%D!<%k$G$O$"$j$^$;$s!#(Bnvi-m17n$B$N%5%]!<%H@lMQ$H(B + $B;W$C$F2<$5$$!#(B + - euc-*/sjis/big5$BEy$N(Bencoding$B$G=q$+$l$?%U%!%$%k$r0BA4$Kl9g!"(Bnvi-m17n$B$N(Bfileencoding + $B%*%W%7%g%s$r(Biso-2022-*$B7O$N(Bencoding$B$K$7$F$*$/I,MW$,$"$j$^$9!#(B + - regular$B$NF0:n$OHs>o$KDcB.$G$9!#(B + $B$b$7CY$9$.$F:$$C$?$i!"(B"qregular"$B$r$+$o$j$K;H$C$F$/$@$5$$!#(B + $B$?$@$7!"(Bqregular$B$O(BG0/G1$B$X$ND>@\$N;X<($7$+9MN8$7$^$;$s(B + (SI$B$H$+(BSO$B$H$+$O2rl9g$O(B + $B%=!<%9%3!<%I$r3NG'$7$F$/$@$5$$!#(B + - $B2#%9%/%m!<%k2hLL%b!<%I(B(:set leftright)$B$O$H$-$I$-(Bcore$B$rEG$$$?$j(B + $BL58B%k!<%W$KMn$A$?$j$7$^$9!#(B + - curses$B0J30$N2hLL=PNO%$%s%?%U%'!<%9$OF0$-$^$;$s!#(B + - perl$B$r(Blink$B$9$k$3$H$O$G$-$k$h$&$G$9!#$,!"B?J,Lr$K$?$A$^$;$s!#(B + $B$J$<$J$i!"(Bperl$B%9%/%j%W%HFb$G$O(Bnvi$B$NFbIt%3!<%I$r07$o$J$$$H(B + $B$$$1$J$$$+$i$G$9!#(B + - tcl$B$r(Blink$B$7$?>l9g!"$-$C$HF0$-$^$;$s!#(B + - ex$B%b!<%I$G$O!"%-!l9g!"J8;z$,2=$1$F(B + $B%(%3!<%P%C%/$5$l$k$3$H$,$"$j$^$9!#(B + - canna$B%5%]!<%H$O(Bex$B%b!<%I$G$OF0$-$^$;$s!#(Btty$B@)8f$N$7$+$?$,(B + vi$B%b!<%I$H0c$C$F(Bcooked$B%b!<%I$@$+$i$G$9(B(vi$B$N%3%m%s%b!<%I$G$O(B + canna$B$,;H$($^$9(B) + + $B$R$M$/$l$F$$$k$H$3$m(B/$B$P$0(B(nvi 1.79$B$K$D$$$F(B) + + tcsh 6.05.00$B$N%P%0$N$;$$$G!"(Btcsh 6.05.00$B$H(Bnvi$B$r0l=o$K;H$&$H(B + $B%H%i%V%k$,H/@8$9$k$3$H$,$"$j$^$9!#(B + tcsh 6.05.00$B$G$O(B + % echo -n 'hoge' | tcsh -c cat + $B$r$9$k$H%O%s%0$7$^$9!#$^$?!"(B + % ( echo 'hoge'; echo -n 'hoge') | tcsh -c cat + $B$H$9$k$H!":G=i$N(B1$B9T$@$1$,=PNO$5$l$^$9!#$3$l$OI8=`$N(Bcsh$B$NF0:n$H$O(B + $B0[$J$j$^$9!#(B + $B$3$N$?$a!"(Blogin shell$B$,(Btcsh 6.05.00$B$N$H$-$K!"(Bnvi$B$+$i(B"1$B9T$@$1(Bfilter" + $B$9$k%3%^%s%I(B("!!cat"$B$H$+(B"!!fmt"$B$H$+(B)$B$r8e$K(B + :set all + $B$9$k$H!"2hLL$,I,MW$JNL$h$j(B1$B9TB?$/%9%/%m!<%k$7$^$9!#(B + $B$3$N$?$a!"(B:set all$B$N=PNO$N0lHV>e$N9T$,8+$($^$;$s!#(B + + $B86:n(Bnvi$B$N%3!<%I$K$O!"(Bctype.h$B$GDj5A$5$l$F$$$k%^%/%m(B(isprint()$B$H$+(B + isblank()$B$H$+(B)$B$KIi$N?t$r$D$C$3$s$@$H$-$K$b$A$c$s$HF0$/$3$H$r(B + $B2>Dj$7$F=q$+$l$?ItJ,$,$"$j$^$9!#(B + ($BCp(B: $B$3$l$O(BANSI C$B$N;EMM$K$O$"$j$^$;$s(B!) + $B$b$7$3$l$,K~$?$5$l$F$$$J$$>l9g!"(B8$B%S%C%H$a$,N)$C$F$$$kCM(B(0x80-0xff)$B$,(B + $BJ8=qCf$K8=$l$k$H(Bnvi$B$O%O%s%0%"%C%W$9$k$3$H$,$"$j$^$9!#(B + $BB?9q8l2=$N:]$K!"(B8$B%S%C%H$a$,N)$C$?CM$r$+$J$j$NIQEY$G;H$C$F$$$k$?$a!"(B + $B$3$l$O$+$J$jBg$-$JLdBj$K$J$j$^$9!#(B + $B$[$H$s$I$NItJ,$OLdBj$J$$$h$&$K=$@5$7$F$"$j$^$9$,!"$d$j$N$3$7$,(B + $B$"$k$+$b$7$l$^$;$s!#(Bnvi$B$,%O%s%0%"%C%W$7$?$i!">u67$r:F8=$9$k$?$a$N(B + $BA`:nl9g(B(:set inputencoding=xxx)$B!"(B + control-O$B$H(Bcontrol-N$B$O>o$K(BSI/SO$B$H$7$Fl9g!"(Bcanna$BF~NO%b!<%I$X$N0\9T%-!<$O$3$3$G$N(B + $B@bL@$h$jM%@h$7$F(Bcanna$B$N$?$a$K;H$o$l$^$9(B) + $B$3$l$i$N$h$&$J%-!<$rF~NO$7$?$$>l9g!"0J2<$N$h$&$K0l;~E*$K%-!$lJL!9$K$l0[$J$j$^$9!#(B + $B$3$l$O0J2<$NM}M3$K$h$j$^$9(B: + - $B%-!C<$J>uBV$NF~NO$r=hM}$7$J$$$H$$$1$^$;$s!#(B + - $BCl9g(B8bit$B$b;H$($^$9$,(B)$B!#(B + - $B%U%!%$%kF~=PNO$OCf$G$O0lHV4JC1$J$N$G!"7k9=40A4$K$G$-$^$9!#(B + + $BCf9q8l$N(Bencoding$B$N<+F0H=JL$O86M}E*$K$[$H$s$IIT2DG=$G$9!#(B + + canna$BF~NO%b!<%I$X$N0\9T%-!<(B(:set cannakey$B$G@_Dj(B)$B$OA4$F$KM%@h$7$^$9!#(B + $B$3$N$?$a!"Nc$($P$3$l$r(Bcontrol-O$B$K@_Dj$9$k$H!"%-!l9g$=$l$r(BSI$B$H2r$N(Bvi$B%3%^%s%I$NAH$_$"$o$;$G$rBP>]$K(Bfence$B@)8f$r9T$$$^$9!#(B + $B$3$N$?$a!"(Bc$B%3%^%s%I$K$D$$$F(Bfence$B@)8f$r(Bon$B$K$9$k$H!"(BS$B%3%^%s%I$K$D$$$F$b(B + $B<+F0E*$K(Bfence$B@)8f$,(Bon$B$K$J$j$^$9!#(B + $B>\:Y$O(Bvi/vi.c$B$N(Bv_alias()$B$r;2>H!#(B + + wrapmargin/wraplen$B%*%W%7%g%s$,@_Dj$5$l$F$$$k>l9g!"(Bvi$B$N(BW/B$B%3%^%s%I$G(B + $BG'<1$5$l$kC18l6-3&$G9T$,6h@Z$i$l$^$9!#$3$N$?$a!"1Q8l0J30$N9T$G$O(B + $B$H$-$I$-9TKv$ND9$5$,B7$o$J$+$C$?$j$7$^$9!#(B + $BB?9q8l$N9T$N6h@Z$jJ}$K$D$$$F$h$$J}K!$O$J$$$+LO:w$7$F$$$k$H$3$m$G$9!#(B + $B$J$K$+0U8+$,$"$C$?$i$*CN$i$;$/$@$5$$!#(B + + $BCf9q8l(B/$B4Z9q8l$N<+F0H=JL$K$D$$$F$O%A%'%C%/$,4E$$$G$9!#(B + $B$*5$7Z$K8f0U8+$r$*4s$;$/$@$5$$!#(B + + iso-2022-*$B7O$N%(%s%3!<%G%#%s%0$r%-!<%\!<%IF~NO$KMxMQ$7$F$$$k>l9g!"(B + ESC$B$N$"$H$N%?%$%`%"%&%H$,D9$/$J$C$F$7$^$C$F$$$^$9(B(2$BG\$K1d$S$F(B + $B$7$^$$$^$9(B)$B!#(B + + $B$3$N%Q%C%A$r$"$F$?>l9g!"86:n(Bnvi$B$N%I%-%e%a%s%H$K=R$Y$i$l$F$$$k(B + $B@bL@J8$N0lIt$OE,MQ$5$l$J$/$J$k$3$H$KCm0U$7$F$/$@$5$$!#(B + $BNc$($P!"(Blocale$B4XO"$N$b$N(B(nvi-1.79/FAQ$B$N$$$A$P$s:G=i$Ngp; exp = EXP(sp); *************** *** 755,760 **** --- 764,778 ---- --ecp->clen; } else if (ecp->cp[0] == delim) --cnt; + #ifdef MULTIBYTE + else if (1 < KEY_BLEN(sp, ecp->cp[0])) { + size_t advance; + + advance = KEY_BLEN(sp, ecp->cp[0]); + ecp->clen -= (advance - 1); + ecp->cp += (advance - 1); + } + #endif /*MULTIBYTE*/ } } *************** *** 792,797 **** --- 810,828 ---- --ecp->clen; break; } + #ifdef MULTIBYTE + else if (1 <= KEY_BLEN(sp, ch)) { + size_t advance; + + advance = KEY_BLEN(sp, ch); + ecp->clen -= (advance - 1); + advance--; + while (advance--) + *p++ = *ecp->cp++; + *p++ = ecp->cp[0]; + continue; + } + #endif /*MULTIBYTE*/ *p++ = ch; } *************** *** 1823,1829 **** --- 1854,1864 ---- long total, val; int isneg; int (*sf) __P((SCR *, MARK *, MARK *, char *, size_t, char **, u_int)); + #ifndef MULTIBYTE char *endp; + #else + CHAR_T *endp; + #endif gp = sp->gp; exp = EXP(sp); Index: ex/ex.h Prereq: 10.24 *** nvi-1.79/ex/ex.h Tue Aug 13 09:24:00 1996 --- nvi-1.79-m17n/ex/ex.h Thu Feb 20 00:36:58 1997 *************** *** 80,89 **** --- 80,97 ---- memset(&((cmdp)->cp), 0, ((char *)&(cmdp)->flags - \ (char *)&((cmdp)->cp)) + sizeof((cmdp)->flags)) + #ifndef MULTIBYTE char *cp; /* Current command text. */ + #else + CHAR_T *cp; /* Current command text. */ + #endif size_t clen; /* Current command length. */ + #ifndef MULTIBYTE char *save_cmd; /* Remaining command. */ + #else + CHAR_T *save_cmd; /* Remaining command. */ + #endif size_t save_cmdlen; /* Remaining command length. */ EXCMDLIST const *cmd; /* Command: entry in command table. */ *************** *** 91,97 **** --- 99,109 ---- CIRCLEQ_HEAD(_rh, _range) rq; /* @/global range: linked list. */ recno_t range_lno; /* @/global range: set line number. */ + #ifndef MULTIBYTE char *o_cp; /* Original @/global command. */ + #else + CHAR_T *o_cp; /* Original @/global command. */ + #endif size_t o_clen; /* Original @/global command length. */ #define AGV_AT 0x01 /* @ buffer execution. */ #define AGV_AT_NORANGE 0x02 /* @ buffer execution without range. */ Index: ex/ex_argv.c Prereq: 10.26 *** nvi-1.79/ex/ex_argv.c Sat Sep 21 09:33:02 1996 --- nvi-1.79-m17n/ex/ex_argv.c Thu Feb 20 00:29:24 1997 *************** *** 100,106 **** --- 100,111 ---- { EX_PRIVATE *exp; size_t blen, len; + #ifndef MULTIBYTE char *bp, *p, *t; + #else + char *bp, *t; + CHAR_T *p; + #endif /*MULTIBYTE*/ GET_SPACE_RET(sp, bp, blen, 512); *************** *** 143,149 **** --- 148,159 ---- { size_t blen, len, n; int rval; + #ifndef MULTIBYTE char *bp, *mp, *p; + #else + char *bp, *mp; + CHAR_T *p; + #endif /*MULTIBYTE*/ GET_SPACE_RET(sp, bp, blen, 512); *************** *** 256,262 **** --- 266,277 ---- EX_PRIVATE *exp; size_t len; int ch, off; + #ifndef MULTIBYTE char *ap, *p; + #else + char *ap; + CHAR_T *p; + #endif /*MULTIBYTE*/ for (exp = EXP(sp); cmdlen > 0; ++exp->argsoff) { /* Skip any leading whitespace. */ *************** *** 621,627 **** --- 636,647 ---- pid_t pid; size_t blen, len; int ch, std_output[2]; + #ifndef MULTIBYTE char *bp, *p, *sh, *sh_path; + #else + char *bp, *sh, *sh_path; + CHAR_T *p; + #endif /*MULTIBYTE*/ /* Secure means no shell access. */ if (O_ISSET(sp, O_SECURE)) { Index: ex/ex_global.c Prereq: 10.22 *** nvi-1.79/ex/ex_global.c Fri Oct 11 07:41:45 1996 --- nvi-1.79-m17n/ex/ex_global.c Mon Dec 30 23:10:44 1996 *************** *** 128,133 **** --- 128,143 ---- ++p; else if (p[1] == '\\') *t++ = *p++; + #ifdef MULTIBYTE + if (1 < KEY_BLEN(sp, p[0])) { + size_t advance; + + advance = KEY_BLEN(sp, p[0]); + advance--; + while (advance--) + *t++ = *p++; + } + #endif /*MULTIBYTE*/ *t++ = *p++; } Index: ex/ex_join.c Prereq: 10.10 *** nvi-1.79/ex/ex_join.c Mon Sep 16 04:59:12 1996 --- nvi-1.79-m17n/ex/ex_join.c Thu Feb 20 00:31:26 1997 *************** *** 38,45 **** --- 38,52 ---- { recno_t from, to; size_t blen, clen, len, tlen; + #ifndef MULTIBYTE int echar, extra, first; char *bp, *p, *tbp; + #else + int extra, first; + char *bp, *tbp; + CHAR_T echar; + CHAR_T *p; + #endif /*MULTIBYTE*/ NEEDFILE(sp, cmdp); *************** *** 111,116 **** --- 118,146 ---- */ extra = 0; if (!first && !FL_ISSET(cmdp->iflags, E_C_FORCE)) { + #ifdef MULTIBYTE + /* + * Here we implement behavior just as same as jelvis. + * last char first char behavior + * --- --- --- + * multibyte multibyte nothing ins'ed + * multibyte singlebyte 1 spc ins'ed + * singlebyte multibyte 1 spc ins'ed + * singlebyte singlebyte original + */ + if (1 < KEY_BLEN(sp, echar)) { + if (1 < KEY_BLEN(sp, p[0])) + ; /*nothing*/ + else { + *tbp++ = ' '; + ++clen; + for (; len && isblank(*p); --len, ++p); + } + } else if (1 < KEY_BLEN(sp, p[0])) { + *tbp++ = ' '; + ++clen; + } else + #endif /*MULTIBYTE*/ if (isblank(echar)) for (; len && isblank(*p); --len, ++p); else if (p[0] != ')') { *************** *** 129,135 **** --- 159,169 ---- memcpy(tbp, p, len); tbp += len; clen += len; + #ifndef MULTIBYTE echar = p[len - 1]; + #else + echar = p[len - multi_back(sp, p, &p[len])]; + #endif } else echar = ' '; *************** *** 153,162 **** * line. */ if (first) { sp->cno = (tbp - bp) - (1 + extra); first = 0; ! } else sp->cno = (tbp - bp) - len - (1 + extra); } sp->lno = cmdp->addr1.lno; --- 187,211 ---- * line. */ if (first) { + #ifndef MULTIBYTE sp->cno = (tbp - bp) - (1 + extra); + #else + sp->cno = (tbp - bp); + sp->cno -= multi_back(sp, bp, &p[sp->cno]); + if (extra) + sp->cno -= multi_back(sp, bp, &bp[sp->cno]); + #endif /*MULTIBYTE*/ first = 0; ! } else { ! #ifndef MULTIBYTE sp->cno = (tbp - bp) - len - (1 + extra); + #else + sp->cno = (tbp - bp) - len; + sp->cno -= multi_back(sp, bp, &bp[sp->cno]); + if (extra) + sp->cno -= multi_back(sp, bp, &bp[sp->cno]); + #endif /*MULTIBYTE*/ + } } sp->lno = cmdp->addr1.lno; Index: ex/ex_print.c Prereq: 10.18 *** nvi-1.79/ex/ex_print.c Mon May 13 07:07:43 1996 --- nvi-1.79-m17n/ex/ex_print.c Fri Feb 28 14:40:42 1997 *************** *** 30,36 **** #include "../common/common.h" ! static int ex_prchars __P((SCR *, const char *, size_t *, size_t, u_int, int)); /* * ex_list -- :[line [,line]] l[ist] [count] [flags] --- 30,36 ---- #include "../common/common.h" ! static int ex_prchars __P((SCR *, const CHAR_T *, size_t *, size_t, u_int, int)); /* * ex_list -- :[line [,line]] l[ist] [count] [flags] *************** *** 220,226 **** --- 220,230 ---- static int ex_prchars(sp, p, colp, len, flags, repeatc) SCR *sp; + #ifndef MULTIBYTE const char *p; + #else + const CHAR_T *p; + #endif size_t *colp, len; u_int flags; int repeatc; *************** *** 228,240 **** CHAR_T ch, *kp; GS *gp; size_t col, tlen, ts; if (O_ISSET(sp, O_LIST)) LF_SET(E_C_LIST); gp = sp->gp; ts = O_VAL(sp, O_TABSTOP); ! for (col = *colp; len--;) ! if ((ch = *p++) == '\t' && !LF_ISSET(E_C_LIST)) for (tlen = ts - col % ts; col < sp->cols && tlen--; ++col) { (void)ex_printf(sp, --- 232,247 ---- CHAR_T ch, *kp; GS *gp; size_t col, tlen, ts; + #ifdef MULTIBYTE + size_t madv; + #endif if (O_ISSET(sp, O_LIST)) LF_SET(E_C_LIST); gp = sp->gp; ts = O_VAL(sp, O_TABSTOP); ! for (col = *colp; len--;) { ! if ((ch = *p) == '\t' && !LF_ISSET(E_C_LIST)) for (tlen = ts - col % ts; col < sp->cols && tlen--; ++col) { (void)ex_printf(sp, *************** *** 242,247 **** --- 249,277 ---- if (INTERRUPTED(sp)) goto intr; } + #ifdef MULTIBYTE + else if (1 < (madv = KEY_BLEN(sp, *p))) { + /* + * Leave multibyte char as is. Be careful. + */ + kp = multi_rawname(sp, p); + tlen = KEY_LEN(sp, *p); + if (col + tlen <= sp->cols) { + (void)ex_puts(sp, kp); + col += tlen; + } else { + while (col + tlen < sp->cols) { + (void)ex_puts(sp, " "); + col++; + } + (void)ex_puts(sp, kp); + col = tlen; + } + + p += (madv - 1); /*add one at end of loop*/ + len -= (madv - 1); /*subtract one at top of loop*/ + } + #endif else { kp = KEY_NAME(sp, ch); tlen = KEY_LEN(sp, ch); *************** *** 260,265 **** --- 290,297 ---- goto intr; } } + p++; + } intr: *colp = col; return (0); } Index: ex/ex_read.c Prereq: 10.38 *** nvi-1.79/ex/ex_read.c Tue Aug 13 09:37:00 1996 --- nvi-1.79-m17n/ex/ex_read.c Fri Apr 4 12:17:55 1997 *************** *** 317,336 **** --- 317,370 ---- ccnt = 0; lcnt = 0; p = "147|Reading..."; + #ifdef MULTIBYTE + if (!silent) + gp->scr_busy(sp, p, BUSY_ON); + #endif /*MULTIBYTE*/ for (lno = fm->lno; !ex_getline(sp, fp, &len); ++lno, ++lcnt) { if ((lcnt + 1) % INTERRUPT_CHECK == 0) { if (INTERRUPTED(sp)) break; + #ifndef MULTIBYTE if (!silent) { gp->scr_busy(sp, p, p == NULL ? BUSY_UPDATE : BUSY_ON); p = NULL; } + #else + /* + * We can't do BUSY_UPDATE here, since the buffer + * contains bytestream read from the file, + * not internal expression. + */ + #endif /*MULTIBYTE*/ } if (db_append(sp, 1, lno, exp->ibp, len)) goto err; ccnt += len; } + + #ifdef MULTIBYTE + { + MARK start, end; + int tmp; + + tmp = F_ISSET(sp->ep, F_MODIFIED); + + start.lno = fm->lno + 1; + end.lno = start.lno + lcnt - 1; + start.cno = end.cno = 0; + multi_ext2int_region(sp, &start, &end, O_FILEENCODING, + O_STR(sp, O_AUTODETECT), 1, 0); + if (end.lno != start.lno + lcnt - 1) + lcnt = end.lno - start.lno + 1; + + if (tmp) + F_SET(sp->ep, F_MODIFIED); + else + F_CLR(sp->ep, F_MODIFIED); + } + #endif /*MULTIBYTE*/ if (ferror(fp) || fclose(fp)) goto err; Index: ex/ex_script.c Prereq: 10.30 *** nvi-1.79/ex/ex_script.c Wed Sep 25 09:51:12 1996 --- nvi-1.79-m17n/ex/ex_script.c Fri Apr 4 12:18:10 1997 *************** *** 344,351 **** --- 344,388 ---- /* Push the line to the shell. */ sc = sp->script; + #ifndef MULTIBYTE if ((nw = write(sc->sh_master, p, len)) != len) goto err2; + #else + { + void *cnvstate; + size_t ilen; + int mbflg; + + cnvstate = multi_cnvstart(sp, O_STR(sp, O_FILEENCODING)); + + ilen = multi_int2extlen(sp, p, len, &mbflg, cnvstate); + if (!mbflg) { + if ((nw = write(sc->sh_master, p, len)) != len) { + multi_cnvfinish(sp, cnvstate); + goto err2; + } + } else { + CHAR_T *tp; + size_t tlen; + + GET_SPACE_RET(sp, tp, tlen, ilen); + memcpy(tp, p, len); + if (multi_int2ext(sp, tp, len, ilen, cnvstate)) { + FREE_SPACE(sp, tp, tlen); + multi_cnvfinish(sp, cnvstate); + goto err2; + } + if ((nw = write(sc->sh_master, tp, ilen)) != ilen) { + FREE_SPACE(sp, tp, tlen); + multi_cnvfinish(sp, cnvstate); + goto err2; + } + + FREE_SPACE(sp, tp, tlen); + } + multi_cnvfinish(sp, cnvstate); + } + #endif /*MULTIBYTE*/ rval = 0; if (write(sc->sh_master, "\n", 1) != 1) { err2: if (nw == 0) *************** *** 431,440 **** --- 468,483 ---- u_int value; int nr, rval; char *bp; + #ifdef MULTIBYTE + recno_t lno0; + #endif /* Find out where the end of the file is. */ if (db_last(sp, &lno)) return (1); + #ifdef MULTIBYTE + lno0 = lno; + #endif #define MINREAD 1024 GET_SPACE_RET(sp, bp, blen, MINREAD); *************** *** 493,501 **** --- 536,566 ---- goto ret; } + #ifdef MULTIBYTE + { + /* convert chars into internal encoding. */ + MARK start, end; + start.lno = (lno == 0 ? 0 : lno0 + 1); + end.lno = lno; + start.cno = end.cno = 0; + multi_ext2int_region(sp, &start, &end, O_FILEENCODING, NULL, 1, 0); + lno = end.lno; + } + #endif /*MULTIBYTE*/ + /* The cursor moves to EOF. */ sp->lno = lno; + #ifndef MULTIBYTE sp->cno = len ? len - 1 : 0; + #else + if (!len) + sp->cno = 0; + else { + if (db_get(sp, lno, DBG_FATAL, &p, &len)) + return (1); + sp->cno = len - multi_back(sp, p, &p[len]); + } + #endif rval = vs_refresh(sp, 1); ret: FREE_SPACE(sp, bp, blen); Index: ex/ex_subst.c Prereq: 10.37 *** nvi-1.79/ex/ex_subst.c Mon Sep 16 04:59:58 1996 --- nvi-1.79-m17n/ex/ex_subst.c Fri Feb 21 23:01:38 1997 *************** *** 32,42 **** --- 32,51 ---- #define SUB_FIRST 0x01 /* The 'r' flag isn't reasonable. */ #define SUB_MUSTSETR 0x02 /* The 'r' flag is required. */ + #ifndef MULTIBYTE static int re_conv __P((SCR *, char **, size_t *, int *)); static int re_cscope_conv __P((SCR *, char **, size_t *, int *)); + #else + static int re_conv __P((SCR *, CHAR_T **, size_t *, int *)); + static int re_cscope_conv __P((SCR *, CHAR_T **, size_t *, int *)); + #endif /*MULTIBYTE*/ static int re_sub __P((SCR *, char *, char **, size_t *, size_t *, regmatch_t [10])); + #ifndef MULTIBYTE static int re_tag_conv __P((SCR *, char **, size_t *, int *)); + #else + static int re_tag_conv __P((SCR *, CHAR_T **, size_t *, int *)); + #endif static int s __P((SCR *, EXCMD *, char *, regex_t *, u_int)); /* *************** *** 55,62 **** --- 64,77 ---- regex_t *re; size_t blen, len; u_int flags; + #ifndef MULTIBYTE int delim; char *bp, *ptrn, *rep, *p, *t; + #else + CHAR_T delim; + char *bp, *ptrn, *rep, *t; + CHAR_T *p; + #endif /*MULTIBYTE*/ /* * Skip leading white space. *************** *** 126,131 **** --- 141,156 ---- ++p; else if (p[1] == '\\') *t++ = *p++; + #ifdef MULTIBYTE + if (1 < KEY_BLEN(sp, p[0])) { + size_t advance; + + advance = KEY_BLEN(sp, p[0]); + advance--; + while (advance--) + *t++ = *p++; + } + #endif /*MULTIBYTE*/ *t++ = *p++; } *************** *** 198,205 **** --- 223,236 ---- } else if (p[0] == '%' && (p[1] == '\0' || p[1] == delim)) p += p[1] == delim ? 2 : 1; else { + #ifndef MULTIBYTE for (rep = p, len = 0; p[0] != '\0' && p[0] != delim; ++p, ++len) + #else + for (rep = p, len = 0; + p[0] != '\0' && p[0] != delim; + len += KEY_BLEN(sp, *p), p += KEY_BLEN(sp, *p)) + #endif /*MULTIBYTE*/ if (p[0] == '~') len += sp->repl_len; GET_SPACE_RET(sp, bp, blen, len); *************** *** 227,232 **** --- 258,274 ---- len += sp->repl_len; continue; } + #ifdef MULTIBYTE + else if (1 <= KEY_BLEN(sp, p[0])) { + size_t advance; + + advance = KEY_BLEN(sp, p[0]); + len += advance; + while (advance--) + *t++ = *p++; + continue; + } + #endif /*MULTIBYTE*/ *t++ = *p++; ++len; } *************** *** 628,637 **** --- 670,690 ---- * It would be nice to change the vi code so * that we could display a cursor past EOL. */ + #ifndef MULTIBYTE if (to.cno >= llen) to.cno = llen - 1; if (from.cno >= llen) from.cno = llen - 1; + #else + if (to.cno >= llen) { + to.cno = llen - multi_back(sp, s, + &s[llen]); + } + if (from.cno >= llen) { + from.cno = llen - multi_back(sp, s, + &s[llen]); + } + #endif /*MULTIBYTE*/ sp->lno = from.lno; sp->cno = from.cno; *************** *** 1025,1037 **** --- 1078,1098 ---- static int re_conv(sp, ptrnp, plenp, replacedp) SCR *sp; + #ifndef MULTIBYTE char **ptrnp; + #else + CHAR_T **ptrnp; + #endif size_t *plenp; int *replacedp; { size_t blen, len, needlen; int magic; + #ifndef MULTIBYTE char *bp, *p, *t; + #else + CHAR_T *bp, *p, *t; + #endif /* * First pass through, we figure out how much space we'll need. *************** *** 1089,1094 **** --- 1150,1165 ---- } break; default: + #ifdef MULTIBYTE + { + size_t advance; + if (1 <= (advance = KEY_BLEN(sp, *p))) { + needlen += advance; + p += advance; + break; + } + } + #endif /*MULTIBYTE*/ needlen += 1; break; } *************** *** 1156,1161 **** --- 1227,1246 ---- *t++ = *p; break; default: + #ifdef MULTIBYTE + { + size_t advance; + + if (1 < (advance = KEY_BLEN(sp, *p))) { + len -= (advance - 1); + advance--; + while (advance--) + *t++ = *p++; + *t++ = *p; + break; + } + } + #endif /*MUTLIBYTE*/ *t++ = *p; break; } *************** *** 1173,1185 **** --- 1258,1278 ---- static int re_tag_conv(sp, ptrnp, plenp, replacedp) SCR *sp; + #ifndef MULTIBYTE char **ptrnp; + #else + CHAR_T **ptrnp; + #endif size_t *plenp; int *replacedp; { size_t blen, len; int lastdollar; + #ifndef MULTIBYTE char *bp, *p, *t; + #else + CHAR_T *bp, *p, *t; + #endif len = *plenp; *************** *** 1190,1195 **** --- 1283,1296 ---- p = *ptrnp; t = bp; + #ifdef MULTIBYTE + /* if the last char is multibyte, we don't check that. */ + if (len > 0 && 1 < multi_back(sp, p, &p[len])) { + lastdollar = 0; + goto skiplastch; + } + #endif /*MULTIBYTE*/ + /* If the last character is a '/' or '?', we just strip it. */ if (len > 0 && (p[len - 1] == '/' || p[len - 1] == '?')) --len; *************** *** 1201,1206 **** --- 1302,1310 ---- } else lastdollar = 0; + #ifdef MULTIBYTE + skiplastch: + #endif /* If the first character is a '/' or '?', we just strip it. */ if (len > 0 && (p[0] == '/' || p[0] == '?')) { ++p; *************** *** 1222,1227 **** --- 1326,1341 ---- if (p[0] == '\\' && (p[1] == '/' || p[1] == '?')) { ++p; --len; + #ifdef MULTIBYTE + } else if (1 < KEY_BLEN(sp, p[0])) { + size_t advance; + + advance = KEY_BLEN(sp, p[0]); + len -= (advance - 1); + advance--; + while (advance--) + *t++ = *p++; + #endif /*MULTIBYTE*/ } else if (strchr("^.[]$*", p[0])) *t++ = '\\'; *t++ = *p++; *************** *** 1242,1253 **** --- 1356,1375 ---- static int re_cscope_conv(sp, ptrnp, plenp, replacedp) SCR *sp; + #ifndef MULTIBYTE char **ptrnp; + #else + CHAR_T **ptrnp; + #endif size_t *plenp; int *replacedp; { size_t blen, len, nspaces; + #ifndef MULTIBYTE char *bp, *p, *t; + #else + CHAR_T *bp, *p, *t; + #endif /* * Each space in the source line printed by cscope represents an *************** *** 1279,1284 **** --- 1401,1417 ---- if (*p == ' ') { memcpy(t, CSCOPE_RE_SPACE, sizeof(CSCOPE_RE_SPACE) - 1); t += sizeof(CSCOPE_RE_SPACE) - 1; + #ifdef MULTIBYTE + } else if (1 < KEY_BLEN(sp, *p)) { + size_t advance; + + advance = KEY_BLEN(sp, *p); + len -= (advance - 1); /*plus one at for loop*/ + advance--; + while (advance--) + *t++ = *p++; + *t++ = *p; /*plus one at for loop*/ + #endif /*MULTIBYTE*/ } else { if (strchr("\\^.[]$*+?()|{}", *p)) *t++ = '\\'; *************** *** 1335,1344 **** --- 1468,1487 ---- size_t lbclen, lblen; /* Local copies. */ size_t mlen; /* Match length. */ size_t rpl; /* Remaining replacement length. */ + #ifndef MULTIBYTE char *rp; /* Replacement pointer. */ int ch; + #else + CHAR_T *rp; /* Replacement pointer. */ + CHAR_T ch; + #endif int no; /* Match replacement offset. */ + #ifndef MULTIBYTE char *p, *t; /* Buffer pointers. */ + #else + CHAR_T *p; + char *t; /* Buffer pointers. */ + #endif char *lb; /* Local copies. */ lb = *lbp; /* Get local copies. */ *************** *** 1448,1453 **** --- 1591,1622 ---- ++rp; break; } + #ifdef MULTIBYTE + default: + { + size_t advance; + + if (1 == (advance = KEY_BLEN(sp, ch))) + break; + + /* + * Multibyte chars must go through. + * + * XXX + * It would be better if we can do \u or \l + * to multibyte chars. + */ + NEEDSP(sp, advance, p); + lbclen += advance; + rpl -= (advance - 1); + + *p++ = ch; + advance--; + while (advance--) + *p++ = *rp++; + continue; + } + #endif /*MULTIBYTE*/ } OUTCH(ch, 1); } Index: ex/ex_txt.c Prereq: 10.17 *** nvi-1.79/ex/ex_txt.c Fri Oct 11 07:44:58 1996 --- nvi-1.79-m17n/ex/ex_txt.c Sun Dec 29 21:43:56 1996 *************** *** 168,175 **** --- 168,180 ---- * don't discard the backslash because we need it * to get the through the ex parser. */ + #ifndef MULTIBYTE if (LF_ISSET(TXT_BACKSLASH) && tp->len != 0 && tp->lb[tp->len - 1] == '\\') + #else + if (LF_ISSET(TXT_BACKSLASH) && tp->len != 0 && + tp->lb[tp->len - multi_back(sp, tp->lb, &tp->lb[tp->len])] == '\\') + #endif /*MULTIBYTE*/ goto ins_ch; /* *************** *** 187,194 **** * '.' may terminate text input mode; free the current * TEXT. */ if (LF_ISSET(TXT_DOTTERM) && tp->len == tp->ai + 1 && ! tp->lb[tp->len - 1] == '.') { notlast: CIRCLEQ_REMOVE(tiqh, tp, q); text_free(tp); goto done; --- 192,205 ---- * '.' may terminate text input mode; free the current * TEXT. */ + #ifndef MULTIBYTE if (LF_ISSET(TXT_DOTTERM) && tp->len == tp->ai + 1 && ! tp->lb[tp->len - 1] == '.') ! #else ! if (LF_ISSET(TXT_DOTTERM) && tp->len == tp->ai + 1 && ! tp->lb[tp->len - multi_back(sp, tp->lb, &tp->lb[tp->len])] == '.') ! #endif /*MULTIBYTE*/ ! { notlast: CIRCLEQ_REMOVE(tiqh, tp, q); text_free(tp); goto done; *************** *** 338,344 **** --- 349,362 ---- } /* NOTREACHED */ + #if 1 done: return (rval); + #else + done: + if (multi_ext2int_text(sp, tiqh, O_INPUTENCODING)) + goto err; + return rval; + #endif /*MULTIBYTE*/ err: alloc_err: Index: ex/ex_usage.c Prereq: 10.13 *** nvi-1.79/ex/ex_usage.c Wed Jun 26 23:28:29 1996 --- nvi-1.79-m17n/ex/ex_usage.c Fri Feb 21 22:51:03 1997 *************** *** 146,152 **** --- 146,156 ---- { GS *gp; VIKEYS const *kp; + #ifndef MULTIBYTE int key; + #else + CHAR_T key; + #endif gp = sp->gp; switch (cmdp->argc) { Index: ex/ex_version.c Prereq: 10.31 *** nvi-1.79/ex/ex_version.c Fri Aug 23 00:57:11 1996 --- nvi-1.79-m17n/ex/ex_version.c Tue Dec 31 00:08:51 1996 *************** *** 22,27 **** --- 22,30 ---- #include "../common/common.h" #include "version.h" + #ifdef MULTIBYTE + #include "mversion.h" + #endif /* * ex_version -- :version *************** *** 35,39 **** --- 38,45 ---- EXCMD *cmdp; { msgq(sp, M_INFO, VI_VERSION); + #ifdef MULTIBYTE + msgq(sp, M_INFO, MULTIBYTE_VERSION); + #endif return (0); } Index: ex/ex_write.c Prereq: 10.30 *** nvi-1.79/ex/ex_write.c Sat Jul 13 09:55:27 1996 --- nvi-1.79-m17n/ex/ex_write.c Mon Jun 16 11:18:35 1997 *************** *** 138,144 **** --- 138,149 ---- { MARK rm; int flags; + #ifndef MULTIBYTE char *name, *p; + #else + char *name; + CHAR_T *p; + #endif NEEDFILE(sp, cmdp); *************** *** 319,325 **** ccnt = 0; lcnt = 0; msg = "253|Writing..."; ! if (tline != 0) for (; fline <= tline; ++fline, ++lcnt) { /* Caller has to provide any interrupt message. */ if ((lcnt + 1) % INTERRUPT_CHECK == 0) { --- 324,338 ---- ccnt = 0; lcnt = 0; msg = "253|Writing..."; ! if (tline != 0) { ! #ifdef MULTIBYTE ! void *cnvstate; ! CHAR_T *cnvtmp; ! size_t cnvtmplen; ! ! GET_SPACE_RET(sp, cnvtmp, cnvtmplen, 256); ! cnvstate = multi_cnvstart(sp, O_STR(sp, O_FILEENCODING)); ! #endif /*MULTIBYTE*/ for (; fline <= tline; ++fline, ++lcnt) { /* Caller has to provide any interrupt message. */ if ((lcnt + 1) % INTERRUPT_CHECK == 0) { *************** *** 331,345 **** --- 344,403 ---- msg = NULL; } } + #ifndef MULTIBYTE if (db_get(sp, fline, DBG_FATAL, &p, &len)) goto err; if (fwrite(p, 1, len, fp) != len) goto err; ccnt += len; + #else + if (db_get(sp, fline, DBG_FATAL, &p, &len)) { + FREE_SPACE(sp, cnvtmp, cnvtmplen); + goto err; + } + + { + size_t ilen; + int mbflg; + + ilen = multi_int2extlen(sp, p, len, &mbflg, cnvstate); + if (!mbflg) { + if (fwrite(p, 1, len, fp) != len) { + FREE_SPACE(sp, cnvtmp, cnvtmplen); + multi_cnvfinish(sp, cnvstate); + goto err; + } + ccnt += len; + goto mbskip; + } + if (cnvtmplen < ilen) + ADD_SPACE_RET(sp, cnvtmp, cnvtmplen, ilen); + + /* we use memcpy() twice, it should be avoided. */ + memcpy(cnvtmp, p, len); + if (multi_int2ext(sp, cnvtmp, len, ilen, cnvstate)) { + FREE_SPACE(sp, cnvtmp, cnvtmplen); + multi_cnvfinish(sp, cnvstate); + goto err; + } + if (fwrite(cnvtmp, 1, ilen, fp) != ilen) { + FREE_SPACE(sp, cnvtmp, cnvtmplen); + multi_cnvfinish(sp, cnvstate); + goto err; + } + ccnt += ilen; + mbskip:; + } + #endif /*MULTIBYTE*/ if (putc('\n', fp) != '\n') break; ++ccnt; } + #ifdef MULTIBYTE + FREE_SPACE(sp, cnvtmp, cnvtmplen); + multi_cnvfinish(sp, cnvstate); + #endif + } if (fflush(fp)) goto err; *************** *** 357,362 **** --- 415,423 ---- rval = 0; if (0) { + #ifdef MULTIBYTE + alloc_err:; + #endif err: if (!F_ISSET(sp->ep, F_MULTILOCK)) msgq_str(sp, M_SYSERR, name, "%s"); (void)fclose(fp); Index: ex/mversion.h *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/ex/mversion.h Tue Jun 17 23:23:42 1997 *************** *** 0 **** --- 1,2 ---- + #define MULTIBYTE_VERSION \ + "multilingualization patch version 06/17/97 23:30 by Jun-ichiro itojun Itoh." Index: include/cl_extern.h *** nvi-1.79/include/cl_extern.h Wed Oct 23 22:53:08 1996 --- nvi-1.79-m17n/include/cl_extern.h Wed Aug 20 14:47:18 1997 *************** *** 27,33 **** --- 27,37 ---- #ifndef HAVE_CURSES_TIGETSTR int tigetnum __P((char *)); #endif + #ifndef MULTIBYTE int cl_addstr __P((SCR *, const char *, size_t)); + #else + int cl_addstr __P((SCR *, const CHAR_T *, size_t)); + #endif int cl_attr __P((SCR *, scr_attr_t, int)); int cl_baud __P((SCR *, u_long *)); int cl_bell __P((SCR *)); Index: include/com_extern.h *** nvi-1.79/include/com_extern.h Wed Oct 23 22:53:09 1996 --- nvi-1.79-m17n/include/com_extern.h Wed Aug 20 14:47:19 1997 *************** *** 101,107 **** --- 101,110 ---- int v_key_init __P((SCR *)); void v_key_ilookup __P((SCR *)); size_t v_key_len __P((SCR *, ARG_CHAR_T)); + size_t v_key_len1 __P((SCR *, ARG_CHAR_T)); CHAR_T *v_key_name __P((SCR *, ARG_CHAR_T)); + CHAR_T *v_key_name1 __P((SCR *, ARG_CHAR_T)); + size_t v_key_blen __P((SCR *, ARG_CHAR_T)); int v_key_val __P((SCR *, ARG_CHAR_T)); int v_event_push __P((SCR *, EVENT *, CHAR_T *, size_t, u_int)); int v_event_get __P((SCR *, EVENT *, int, u_int32_t)); *************** *** 140,145 **** --- 143,259 ---- const char *msg_cmsg __P((SCR *, cmsg_t, size_t *)); const char *msg_cat __P((SCR *, const char *, size_t *)); char *msg_print __P((SCR *, const char *, int *)); + #ifdef CANNA + int canna_enabled __P((SCR *)); + #endif + #ifdef CANNA + int canna_fenceactive __P((SCR *)); + #endif + #ifdef CANNA + void canna_on __P((SCR *)); + #endif + #ifdef CANNA + void canna_off __P((SCR *)); + #endif + #ifdef CANNA + void canna_force_on __P((SCR *)); + #endif + #ifdef CANNA + void canna_force_off __P((SCR *)); + #endif + #ifdef CANNA + int canna_init __P((SCR *)); + #endif + #ifdef CANNA + int canna_end __P((SCR *)); + #endif + #ifdef CANNA + void canna_setserver __P((SCR *, char *)); + #endif + #ifdef CANNA + int canna_modelinesw __P((SCR *, int)); + #endif + #ifdef CANNA + int canna_modeline __P((SCR *)); + #endif + #ifdef MULTIBYTE + u_int multi_chclass __P((CHAR_T *, u_int)); + #endif + #ifdef MULTIBYTE + int multi_byte_c __P((SCR *, ARG_CHAR_T)); + #endif + #ifdef MULTIBYTE + int multi_byte __P((SCR *, const CHAR_T *)); + #endif + #ifdef MULTIBYTE + int multi_fix __P((SCR *, const CHAR_T *, const CHAR_T *)); + #endif + #ifdef MULTIBYTE + int multi_back __P((SCR *, const CHAR_T *, const CHAR_T *)); + #endif + #ifdef MULTIBYTE + int multi_len_c __P((SCR *, ARG_CHAR_T)); + #endif + #ifdef MULTIBYTE + int multi_len __P((SCR *, const CHAR_T *)); + #endif + #ifdef MULTIBYTE + CHAR_T *multi_name __P((SCR *, const CHAR_T *)); + #endif + #ifdef MULTIBYTE + CHAR_T *multi_rawname __P((SCR *, const CHAR_T *)); + #endif + #ifdef MULTIBYTE + int multi_isnone __P((SCR *, ARG_CHAR_T)); + #endif + #ifdef MULTIBYTE + int multi_iswestern __P((SCR *, ARG_CHAR_T)); + #endif + #ifdef MULTIBYTE + int multi_Wordbound __P((u_int, u_int, int)); + #endif + #ifdef MULTIBYTE + int multi_wordbound __P((u_int, u_int, int)); + #endif + #ifdef MULTIBYTE + char *multi_predict_region __P((SCR *, MARK *, MARK *, char *, char *, int)); + #endif + #ifdef MULTIBYTE + int multi_ext2int_text __P((SCR *, TEXTH *, int)); + #endif + #ifdef MULTIBYTE + int multi_ext2int_region __P((SCR *, MARK *, MARK *, int, char *, int, int)); + #endif + #ifdef MULTIBYTE + void *multi_cnvstart __P((SCR *, char *)); + #endif + #ifdef MULTIBYTE + void multi_cnvfinish __P((SCR *, void *)); + #endif + #ifdef MULTIBYTE + int multi_int2extlen __P((SCR *, CHAR_T *, size_t, int *, void *)); + #endif + #ifdef MULTIBYTE + int multi_int2ext __P((SCR *, CHAR_T *, size_t, size_t, void *)); + #endif + #ifdef MULTIBYTE + void multi_keyinput_stateinit __P((SCR *)); + #endif + #ifdef MULTIBYTE + void multi_keyinput __P((SCR *, CHAR_T *, size_t *, CHAR_T *, size_t *, int *)); + #endif + #ifdef MULTIBYTE + int multi_isencoding __P((const char *, int)); + #endif + #ifdef MULTIBYTE + void v_fep_on __P((SCR *)); + #endif + #ifdef MULTIBYTE + void v_fep_off __P((SCR *)); + #endif + #ifdef MULTIBYTE + void v_fep_force_off __P((SCR *)); + #endif int opts_init __P((SCR *, int *)); int opts_set __P((SCR *, ARGS *[], char *)); int o_set __P((SCR *, int, u_int, char *, u_long)); *************** *** 166,171 **** --- 280,300 ---- int f_w1200 __P((SCR *, OPTION *, char *, u_long *)); int f_w9600 __P((SCR *, OPTION *, char *, u_long *)); int f_window __P((SCR *, OPTION *, char *, u_long *)); + #ifdef MULTIBYTE + int f_fileencoding __P((SCR *, OPTION *, char *, u_long *)); + #endif + #ifdef MULTIBYTE + int f_displayencoding __P((SCR *, OPTION *, char *, u_long *)); + #endif + #ifdef MULTIBYTE + int f_inputencoding __P((SCR *, OPTION *, char *, u_long *)); + #endif + #ifdef CANNA + int f_canna __P((SCR *, OPTION *, char *, u_long *)); + #endif + #ifdef CANNA + int f_cannaserver __P((SCR *, OPTION *, char *, u_long *)); + #endif int put __P((SCR *, CB *, CHAR_T *, MARK *, MARK *, int)); int rcv_tmp __P((SCR *, EXF *, char *)); int rcv_init __P((SCR *)); Index: include/multibyte_def.h *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/include/multibyte_def.h Wed Aug 20 16:00:28 1997 *************** *** 0 **** --- 1,47 ---- + #define CS_RAW0 0x80 + #define CS_RAW1 0x81 + #define CS_RAW2 0x82 + #define CS_RAW3 0x83 + #define CS_RAW4 0x84 + #define CS_RAW5 0x85 + #define CS_RAW6 0x86 + #define CS_RAW7 0x87 + #define CS_JISX0208_1978 0x88 + #define CS_GB2312 0x89 + #define CS_JISX0208_1983 0x8a + #define CS_JISX0208_1990 0x8b + #define CS_KSC5601 0x8c + #define CS_JISX0212_1990 0x8d + #define CS_ISO_IR165 0x8e + #define CS_CNS11643_1 0x8f + #define CS_CNS11643_2 0x90 + #define CS_CNS11643_3 0x91 + #define CS_CNS11643_4 0x92 + #define CS_CNS11643_5 0x93 + #define CS_CNS11643_6 0x94 + #define CS_CNS11643_7 0x95 + #define CS_BIG5_1 0x96 + #define CS_BIG5_2 0x97 + #define CS_IRV 0x98 + #define CS_UK 0x99 + #define CS_SWEDISH 0x9a + #define CS_NORWEGIAN 0x9b + #define CS_JISX0201_RIGHT 0x9c + #define CS_JISX0201_LEFT 0x9d + #define CS_GERMAN 0x9e + #define CS_FRENCH 0x9f + #define CS_ITALIAN 0xa0 + #define CS_SPANISH 0xa1 + #define CS_LATIN1 0xa2 + #define CS_LATIN2 0xa3 + #define CS_LATIN3 0xa4 + #define CS_LATIN4 0xa5 + #define CS_GREEK 0xa6 + #define CS_ARABIC 0xa7 + #define CS_HEBREW 0xa8 + #define CS_CYRILLIC 0xa9 + #define CS_LATIN5R 0xaa + #define CS_THAI 0xab + #define CS_LATIN6 0xac + #define CS_LATIN6ADD 0xad + #define CS_MAX 0xae Index: include/options_def.h *** nvi-1.79/include/options_def.h Wed Oct 23 22:53:10 1996 --- nvi-1.79-m17n/include/options_def.h Wed Aug 20 14:47:20 1997 *************** *** 1,79 **** #define O_ALTWERASE 0 ! #define O_AUTOINDENT 1 ! #define O_AUTOPRINT 2 ! #define O_AUTOWRITE 3 ! #define O_BACKUP 4 ! #define O_BEAUTIFY 5 ! #define O_CDPATH 6 ! #define O_CEDIT 7 ! #define O_COLUMNS 8 ! #define O_COMMENT 9 ! #define O_DIRECTORY 10 ! #define O_EDCOMPATIBLE 11 ! #define O_ESCAPETIME 12 ! #define O_ERRORBELLS 13 ! #define O_EXRC 14 ! #define O_EXTENDED 15 ! #define O_FILEC 16 ! #define O_FLASH 17 ! #define O_HARDTABS 18 ! #define O_ICLOWER 19 ! #define O_IGNORECASE 20 ! #define O_KEYTIME 21 ! #define O_LEFTRIGHT 22 ! #define O_LINES 23 ! #define O_LISP 24 ! #define O_LIST 25 ! #define O_LOCKFILES 26 ! #define O_MAGIC 27 ! #define O_MATCHTIME 28 ! #define O_MESG 29 ! #define O_MODELINE 30 ! #define O_MSGCAT 31 ! #define O_NOPRINT 32 ! #define O_NUMBER 33 ! #define O_OCTAL 34 ! #define O_OPEN 35 ! #define O_OPTIMIZE 36 ! #define O_PARAGRAPHS 37 ! #define O_PATH 38 ! #define O_PRINT 39 ! #define O_PROMPT 40 ! #define O_READONLY 41 ! #define O_RECDIR 42 ! #define O_REDRAW 43 ! #define O_REMAP 44 ! #define O_REPORT 45 ! #define O_RULER 46 ! #define O_SCROLL 47 ! #define O_SEARCHINCR 48 ! #define O_SECTIONS 49 ! #define O_SECURE 50 ! #define O_SHELL 51 ! #define O_SHELLMETA 52 ! #define O_SHIFTWIDTH 53 ! #define O_SHOWMATCH 54 ! #define O_SHOWMODE 55 ! #define O_SIDESCROLL 56 ! #define O_SLOWOPEN 57 ! #define O_SOURCEANY 58 ! #define O_TABSTOP 59 ! #define O_TAGLENGTH 60 ! #define O_TAGS 61 ! #define O_TERM 62 ! #define O_TERSE 63 ! #define O_TILDEOP 64 ! #define O_TIMEOUT 65 ! #define O_TTYWERASE 66 ! #define O_VERBOSE 67 ! #define O_W1200 68 ! #define O_W300 69 ! #define O_W9600 70 ! #define O_WARN 71 ! #define O_WINDOW 72 ! #define O_WINDOWNAME 73 ! #define O_WRAPLEN 74 ! #define O_WRAPMARGIN 75 ! #define O_WRAPSCAN 76 ! #define O_WRITEANY 77 ! #define O_OPTIONCOUNT 78 --- 1,89 ---- #define O_ALTWERASE 0 ! #define O_AUTODETECT 1 ! #define O_AUTOINDENT 2 ! #define O_AUTOPRINT 3 ! #define O_AUTOWRITE 4 ! #define O_BACKUP 5 ! #define O_BEAUTIFY 6 ! #define O_CANNA 7 ! #define O_CANNACTRL 8 ! #define O_CANNAKEY 9 ! #define O_CANNASERVER 10 ! #define O_CDPATH 11 ! #define O_CEDIT 12 ! #define O_COLUMNS 13 ! #define O_COMMENT 14 ! #define O_DIRECTORY 15 ! #define O_DISPLAYENCODING 16 ! #define O_EDCOMPATIBLE 17 ! #define O_ESCAPETIME 18 ! #define O_ERRORBELLS 19 ! #define O_EXRC 20 ! #define O_EXTENDED 21 ! #define O_FEPKEY 22 ! #define O_FILEC 23 ! #define O_FILEENCODING 24 ! #define O_FLASH 25 ! #define O_HARDTABS 26 ! #define O_ICLOWER 27 ! #define O_IGNORECASE 28 ! #define O_INPUTENCODING 29 ! #define O_KEYTIME 30 ! #define O_LEFTRIGHT 31 ! #define O_LINES 32 ! #define O_LISP 33 ! #define O_LIST 34 ! #define O_LOCKFILES 35 ! #define O_MAGIC 36 ! #define O_MATCHTIME 37 ! #define O_MESG 38 ! #define O_MODELINE 39 ! #define O_MSGCAT 40 ! #define O_NOPRINT 41 ! #define O_NUMBER 42 ! #define O_OCTAL 43 ! #define O_OPEN 44 ! #define O_OPTIMIZE 45 ! #define O_PARAGRAPHS 46 ! #define O_PATH 47 ! #define O_PRINT 48 ! #define O_PROMPT 49 ! #define O_READONLY 50 ! #define O_RECDIR 51 ! #define O_REDRAW 52 ! #define O_REMAP 53 ! #define O_REPORT 54 ! #define O_RULER 55 ! #define O_SCROLL 56 ! #define O_SEARCHINCR 57 ! #define O_SECTIONS 58 ! #define O_SECURE 59 ! #define O_SHELL 60 ! #define O_SHELLMETA 61 ! #define O_SHIFTWIDTH 62 ! #define O_SHOWMATCH 63 ! #define O_SHOWMODE 64 ! #define O_SIDESCROLL 65 ! #define O_SKIPDISPLAY 66 ! #define O_SLOWOPEN 67 ! #define O_SOURCEANY 68 ! #define O_TABSTOP 69 ! #define O_TAGLENGTH 70 ! #define O_TAGS 71 ! #define O_TERM 72 ! #define O_TERSE 73 ! #define O_TILDEOP 74 ! #define O_TIMEOUT 75 ! #define O_TTYWERASE 76 ! #define O_VERBOSE 77 ! #define O_W1200 78 ! #define O_W300 79 ! #define O_W9600 80 ! #define O_WARN 81 ! #define O_WINDOW 82 ! #define O_WINDOWNAME 83 ! #define O_WRAPLEN 84 ! #define O_WRAPMARGIN 85 ! #define O_WRAPSCAN 86 ! #define O_WRITEANY 87 ! #define O_OPTIONCOUNT 88 Index: include/vi_extern.h *** nvi-1.79/include/vi_extern.h Wed Oct 23 22:53:12 1996 --- nvi-1.79-m17n/include/vi_extern.h Wed Aug 20 14:47:21 1997 *************** *** 1,8 **** --- 1,14 ---- int cs_init __P((SCR *, VCS *)); int cs_next __P((SCR *, VCS *)); + #ifdef MULTIBYTE + int cs_multi_next __P((SCR *, VCS *)); + #endif int cs_fspace __P((SCR *, VCS *)); int cs_fblank __P((SCR *, VCS *)); int cs_prev __P((SCR *, VCS *)); + #ifdef MULTIBYTE + int cs_multi_prev __P((SCR *, VCS *)); + #endif int cs_bblank __P((SCR *, VCS *)); int v_at __P((SCR *, VICMD *)); int v_chrepeat __P((SCR *, VICMD *)); *************** *** 94,100 **** --- 100,110 ---- void v_nomove __P((SCR *)); void v_sof __P((SCR *, MARK *)); void v_sol __P((SCR *)); + #ifndef MULTIBYTE int v_isempty __P((char *, size_t)); + #else + int v_isempty __P((CHAR_T *, size_t)); + #endif void v_emsg __P((SCR *, char *, vim_t)); int v_wordW __P((SCR *, VICMD *)); int v_wordw __P((SCR *, VICMD *)); *************** *** 114,124 **** --- 124,141 ---- void vs_busy __P((SCR *, const char *, busy_t)); void vs_home __P((SCR *)); void vs_update __P((SCR *, const char *, const char *)); + #ifndef MULTIBYTE void vs_msg __P((SCR *, mtype_t, char *, size_t)); + #else + void vs_msg __P((SCR *, mtype_t, CHAR_T *, size_t)); + #endif int vs_ex_resolve __P((SCR *, int *)); int vs_resolve __P((SCR *, SCR *, int)); int vs_repaint __P((SCR *, EVENT *)); int vs_refresh __P((SCR *, int)); + #ifdef CANNA + void vs_modeline __P((SCR *)); + #endif int vs_column __P((SCR *, size_t *)); size_t vs_screens __P((SCR *, recno_t, size_t *)); size_t vs_columns __P((SCR *, char *, recno_t, size_t *, size_t *)); Index: regex/README.m17n *** /dev/null Wed Aug 20 14:47:14 1997 --- nvi-1.79-m17n/regex/README.m17n Sun Feb 16 00:00:33 1997 *************** *** 0 **** --- 1,21 ---- + notes on regex multilingual patch + Jun-ichiro itojun Itoh + $Id: README.m17n,v 1.3 1997/02/15 15:00:32 itojun Exp $ + + The patched regex routine contained in this directory understands + multilingual encoding method used by nvi-m17n. + + operations known to work for multibyte chars: + - almost everything + Please note that, you can't mix characters in different character + set in single range specification. + For example, suppose A and Z are in JIS X0208-1983, and a and z are + in ASCII: + [AZaz] ok + [A-Za-z] ok + [A-z] bad + [a-Z] bad + + operations known to be safe over multibyte chars, but has no effect + to multibyte chars: + - word boundary([[:<:]] and [[:>:]]) Index: regex/engine.c Prereq: 8.4 *** nvi-1.79/regex/engine.c Sun Mar 20 01:21:27 1994 --- nvi-1.79-m17n/regex/engine.c Fri Feb 28 16:00:28 1997 *************** *** 51,56 **** --- 51,60 ---- #define dissect sdissect #define backref sbackref #define step sstep + #ifdef MULTIBYTE + #define mstep smstep + #define mbchin smbchin + #endif #define print sprint #define at sat #define match smat *************** *** 62,67 **** --- 66,75 ---- #define dissect ldissect #define backref lbackref #define step lstep + #ifdef MULTIBYTE + #define mstep lmstep + #define mbchin lmbchin + #endif #define print lprint #define at lat #define match lmat *************** *** 84,89 **** --- 92,102 ---- states empty; /* empty set of states */ }; + #ifdef MULTIBYTE + extern int multi_byte_c __P((void *, u_int)); + extern int multi_back __P((void *, u_char *, u_char *)); + #endif + /* ========= begin header generated by ./mkh ========= */ #ifdef __cplusplus extern "C" { *************** *** 96,101 **** --- 109,118 ---- static char *fast __P((struct match *m, char *start, char *stop, sopno startst, sopno stopst)); static char *slow __P((struct match *m, char *start, char *stop, sopno startst, sopno stopst)); static states step __P((struct re_guts *g, sopno start, sopno stop, states bef, int ch, states aft)); + #ifdef MULTIBYTE + static states mstep __P((struct re_guts *g, sopno start, sopno stop, states bef, int ch, char *p, states aft, size_t *padv)); + static int mbchin __P((cset *, u_char *)); + #endif #define BOL (OUT+1) #define EOL (BOL+1) #define BOLEOL (BOL+2) *************** *** 249,255 **** --- 266,278 ---- if (dp != NULL || endp <= m->coldp) break; /* defeat */ NOTE("backoff"); + #ifndef MULTIBYTE endp = slow(m, m->coldp, endp-1, gf, gl); + #else + endp = slow(m, m->coldp, + endp - multi_back(NULL, m->coldp, endp), + gf, gl); + #endif /*MULTIBYTE*/ if (endp == NULL) break; /* defeat */ /* try it on a shorter possibility */ *************** *** 348,359 **** --- 371,396 ---- case OCHAR: sp++; break; + #ifdef MULTIBYTE + case OCHAR2: + sp += 2; + break; + case OCHAR3: + sp += 3; + break; + #endif /*MULTIBYTE*/ case OBOL: case OEOL: case OBOW: case OEOW: break; case OANY: + #ifndef MULTIBYTE + /* fall through */ + #else + sp += multi_byte_c(NULL, *sp & 0xff); + break; + #endif /*MULTIBYTE*/ case OANYOF: sp++; break; *************** *** 522,538 **** --- 559,613 ---- if (sp == stop || *sp++ != (char)OPND(s)) return(NULL); break; + #ifdef MULTIBYTE + case OCHAR2: + if (sp + 1 < stop) { + if (((u_int)*sp++ & 0xff) == (((u_int)OPND(s) >> 8) & 0xff) + && ((u_int)*sp++ & 0xff) == ((u_int)OPND(s) & 0xff)) + break; + } + return NULL; + case OCHAR3: + if (sp + 2 < stop) { + if (((u_int)*sp++ & 0xff) == (((u_int)OPND(s) >> 16) & 0xff) + && ((u_int)*sp++ & 0xff) == (((u_int)OPND(s) >> 8) & 0xff) + && ((u_int)*sp++ & 0xff) == ((u_int)OPND(s) & 0xff)) + break; + } + return NULL; + #endif /*MULTIBYTE*/ case OANY: + #ifndef MULTIBYTE if (sp == stop) return(NULL); sp++; + #else + if (sp + multi_byte_c(NULL, *sp & 0xff) < stop) + sp += multi_byte_c(NULL, *sp & 0xff); + else + return NULL; + #endif /*MULTIBYTE*/ break; case OANYOF: cs = &m->g->sets[OPND(s)]; + #ifdef MULTIBYTE + if (1 < multi_byte_c(NULL, *sp & 0xff)) { + int ret; + ret = mbchin(cs, sp); + sp += multi_byte_c(NULL, *sp & 0xff); + if (!ret) + return NULL; + } + #endif /*MULTIBYTE*/ if (sp == stop || !CHIN(cs, *sp++)) return(NULL); break; case OBOL: + #ifdef MULTIBYTE + if ((sp != m->beginp || m->eflags & REG_NOTBOL) + && 1 < multi_back(NULL, m->beginp, sp)) + return NULL; + #endif /*MULTIBYTE*/ if ( (sp == m->beginp && !(m->eflags®_NOTBOL)) || (sp < m->endp && *(sp-1) == '\n' && (m->g->cflags®_NEWLINE)) ) *************** *** 549,554 **** --- 624,636 ---- return(NULL); break; case OBOW: + #ifdef MULTIBYTE + /* XXX just for safety. */ + if (sp != m->beginp + && (1 < multi_back(NULL, m->beginp, sp) + || 1 < multi_byte_c(NULL, *sp & 0xff))) + return NULL; + #endif /*MULTIBYTE*/ if (( (sp == m->beginp && !(m->eflags®_NOTBOL)) || (sp < m->endp && *(sp-1) == '\n' && (m->g->cflags®_NEWLINE)) || *************** *** 560,565 **** --- 642,654 ---- return(NULL); break; case OEOW: + #ifdef MULTIBYTE + /* XXX just for safety. */ + if ((sp != m->endp || m->eflags & REG_NOTEOL) + && (1 < multi_back(NULL, m->beginp, sp) + || 1 < multi_byte_c(NULL, *sp & 0xff))) + return NULL; + #endif /*MULTIBYTE*/ if (( (sp == m->endp && !(m->eflags®_NOTEOL)) || (sp < m->endp && *sp == '\n' && (m->g->cflags®_NEWLINE)) || *************** *** 705,711 **** --- 794,806 ---- register states fresh = m->fresh; register states tmp = m->tmp; register char *p = start; + #ifndef MULTIBYTE register int c = (start == m->beginp) ? OUT : *(start-1); + #else + register int c = (start == m->beginp) + ? OUT + : *(start - multi_back(NULL, m->beginp, start)); + #endif /*MULTIBYTE*/ register int lastc; /* previous c */ register int flagch; register int i; *************** *** 744,749 **** --- 839,849 ---- } /* how about a word boundary? */ + #ifdef MULTIBYTE + if ((lastc != OUT && 1 < multi_byte_c(NULL, lastc & 0xff)) + || (c != OUT && 1 < multi_byte_c(NULL, c & 0xff))) + goto skipword; + #endif /*MULTIBYTE*/ if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && (c != OUT && ISWORD(c)) ) { flagch = BOW; *************** *** 756,761 **** --- 856,864 ---- st = step(m->g, startst, stopst, st, flagch, st); SP("boweow", st, c); } + #ifdef MULTIBYTE + skipword: + #endif /* are we done? */ if (ISSET(st, stopst) || p == stop) *************** *** 765,774 **** --- 868,888 ---- ASSIGN(tmp, st); ASSIGN(st, fresh); assert(c != OUT); + #ifndef MULTIBYTE st = step(m->g, startst, stopst, tmp, c, st); SP("aft", st, c); assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); p++; + #else + { + size_t advance; + + st = mstep(m->g, startst, stopst, tmp, c, p, st, &advance); + SP("aft", st, c); + assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); + p += advance; + } + #endif } assert(coldp != NULL); *************** *** 796,802 **** --- 910,922 ---- register states empty = m->empty; register states tmp = m->tmp; register char *p = start; + #ifndef MULTIBYTE register int c = (start == m->beginp) ? OUT : *(start-1); + #else + register int c = (start == m->beginp) + ? OUT + : *(start - multi_back(NULL, m->beginp, start)); + #endif /*MULTIBYTE*/ register int lastc; /* previous c */ register int flagch; register int i; *************** *** 832,837 **** --- 952,962 ---- SP("sboleol", st, c); } + #if 0 + if ((lastc != OUT && 1 < multi_byte_c(NULL, lastc & 0xff)) + || (c != OUT && 1 < multi_byte_c(NULL, c & 0xff))) + goto skipword; + #endif /*MULTIBYTE*/ /* how about a word boundary? */ if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && (c != OUT && ISWORD(c)) ) { *************** *** 845,850 **** --- 970,978 ---- st = step(m->g, startst, stopst, st, flagch, st); SP("sboweow", st, c); } + #ifdef MULTIBYTE + skipword: + #endif /* are we done? */ if (ISSET(st, stopst)) *************** *** 856,865 **** --- 984,1003 ---- ASSIGN(tmp, st); ASSIGN(st, empty); assert(c != OUT); + #ifndef MULTIBYTE st = step(m->g, startst, stopst, tmp, c, st); SP("saft", st, c); assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); p++; + #else + { + size_t advance; + st = mstep(m->g, startst, stopst, tmp, c, p, st, &advance); + SP("saft", st, c); + assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); + p += advance; + } + #endif } return(matchp); *************** *** 908,913 **** --- 1046,1056 ---- if (ch == (char)OPND(s)) FWD(aft, bef, 1); break; + #ifdef MULTIBYTE + case OCHAR2: + case OCHAR3: + break; + #endif /*MULTIBYTE*/ case OBOL: if (ch == BOL || ch == BOLEOL) FWD(aft, bef, 1); *************** *** 994,999 **** --- 1137,1323 ---- return(aft); } + #ifdef MULTIBYTE + /* + - mstep - map set of states reachable before char to set reachable after + == static states step(register struct re_guts *g, sopno start, sopno stop, \ + == register states bef, int ch, register states aft); + */ + static states + mstep(g, start, stop, bef, ch, p, aft, padv) + register struct re_guts *g; + sopno start; /* start state within strip */ + sopno stop; /* state after stop state within strip */ + register states bef; /* states reachable before */ + int ch; /* character or NONCHAR code */ + char *p; /* character */ + register states aft; /* states already known reachable after */ + size_t *padv; /* ate how many bytes? */ + { + register cset *cs; + register sop s; + register sopno pc; + register onestate here; /* note, macros know this name */ + register sopno look; + register int i; + + *padv = multi_byte_c(NULL, *p & 0xff); + for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) { + s = g->strip[pc]; + switch (OP(s)) { + case OEND: + assert(pc == stop-1); + break; + case OCHAR: + /* only characters can match */ + assert(!NONCHAR(ch) || ch != (char)OPND(s)); + if (ch == (char)OPND(s)) + FWD(aft, bef, 1); + break; + case OCHAR2: + if ((u_char)p[0] == (((u_int)OPND(s) >> 8) & 0xff) + && (u_char)p[1] == ((u_int)OPND(s) & 0xff)) + FWD(aft, bef, 1); + break; + case OCHAR3: + if ((u_char)p[0] == (((u_int)OPND(s) >> 16) & 0xff) + && (u_char)p[1] == (((u_int)OPND(s) >> 8) & 0xff) + && (u_char)p[2] == ((u_int)OPND(s) & 0xff)) + FWD(aft, bef, 1); + break; + case OBOL: + if (ch == BOL || ch == BOLEOL) + FWD(aft, bef, 1); + break; + case OEOL: + if (ch == EOL || ch == BOLEOL) + FWD(aft, bef, 1); + break; + case OBOW: + if (ch == BOW) + FWD(aft, bef, 1); + break; + case OEOW: + if (ch == EOW) + FWD(aft, bef, 1); + break; + case OANY: + if (!NONCHAR(ch)) + FWD(aft, bef, 1); + break; + case OANYOF: + cs = &g->sets[OPND(s)]; + if (1 < multi_byte_c(NULL, *p & 0xff)) { + if (!NONCHAR(ch) && mbchin(cs, p)) + FWD(aft, bef, 1); + } else { + if (!NONCHAR(ch) && CHIN(cs, ch)) + FWD(aft, bef, 1); + } + break; + case OBACK_: /* ignored here */ + case O_BACK: + FWD(aft, aft, 1); + break; + case OPLUS_: /* forward, this is just an empty */ + FWD(aft, aft, 1); + break; + case O_PLUS: /* both forward and back */ + FWD(aft, aft, 1); + i = ISSETBACK(aft, OPND(s)); + BACK(aft, aft, OPND(s)); + if (!i && ISSETBACK(aft, OPND(s))) { + /* oho, must reconsider loop body */ + pc -= OPND(s) + 1; + INIT(here, pc); + } + break; + case OQUEST_: /* two branches, both forward */ + FWD(aft, aft, 1); + FWD(aft, aft, OPND(s)); + break; + case O_QUEST: /* just an empty */ + FWD(aft, aft, 1); + break; + case OLPAREN: /* not significant here */ + case ORPAREN: + FWD(aft, aft, 1); + break; + case OCH_: /* mark the first two branches */ + FWD(aft, aft, 1); + assert(OP(g->strip[pc+OPND(s)]) == OOR2); + FWD(aft, aft, OPND(s)); + break; + case OOR1: /* done a branch, find the O_CH */ + if (ISSTATEIN(aft, here)) { + for (look = 1; + OP(s = g->strip[pc+look]) != O_CH; + look += OPND(s)) + assert(OP(s) == OOR2); + FWD(aft, aft, look); + } + break; + case OOR2: /* propagate OCH_'s marking */ + FWD(aft, aft, 1); + if (OP(g->strip[pc+OPND(s)]) != O_CH) { + assert(OP(g->strip[pc+OPND(s)]) == OOR2); + FWD(aft, aft, OPND(s)); + } + break; + case O_CH: /* just empty */ + FWD(aft, aft, 1); + break; + default: /* ooooops... */ + assert(nope); + break; + } + } + + return(aft); + } + + static int + mbchin(cs, q) + cset *cs; + register u_char *q; + { + register u_char *pstart; + register u_char *pfinish; + register u_char *p; + register u_int start; + register u_int finish; + register u_int target; + register size_t siz; + register size_t i; + int ret; + + for (p = cs->multis; + (char *)p - cs->multis < cs->smultis; + p += multi_byte_c(NULL, *p) * 2 + 1) { + siz = multi_byte_c(NULL, *p); + pstart = p; + pfinish = p + siz; + assert(pstart[0] == pfinish[0]); + + if (q[0] != pstart[0]) + continue; + + start = finish = target = 0; + for (i = 1; i < siz; i++) { + start *= 256; + finish *= 256; + target *= 256; + start += pstart[i]; + finish += pfinish[i]; + target += q[i]; + } + if (start <= target && target <= finish) + return (!cs->multiinvert) ? 1 : 0; + } + return (!cs->multiinvert) ? 0 : 1; + } + #endif /*MULTIBYTE*/ + #ifdef REDEBUG /* - print - print a set of states *************** *** 1086,1091 **** --- 1410,1419 ---- #undef dissect #undef backref #undef step + #ifdef MULTIBYTE + #undef mstep + #undef mbchin + #endif #undef print #undef at #undef match Index: regex/regcomp.c Prereq: 8.4 *** nvi-1.79/regex/regcomp.c Sun Mar 20 01:21:28 1994 --- nvi-1.79-m17n/regex/regcomp.c Thu Apr 10 12:29:49 1997 *************** *** 94,99 **** --- 94,102 ---- static char othercase __P((int ch)); static void bothcases __P((struct parse *p, int ch)); static void ordinary __P((struct parse *p, int ch)); + #ifdef MULTIBYTE + static void mordinary __P((struct parse *p, int ch)); + #endif static void nonnewline __P((struct parse *p)); static void repeat __P((struct parse *p, sopno start, int from, int to)); static int seterr __P((struct parse *p, int e)); *************** *** 400,412 **** --- 403,423 ---- case '\\': REQUIRE(MORE(), REG_EESCAPE); c = GETNEXT(); + #ifndef MULTIBYTE ordinary(p, c); + #else + mordinary(p, c); + #endif break; case '{': /* okay as ordinary except if digit follows */ REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT); /* FALLTHROUGH */ default: + #ifndef MULTIBYTE ordinary(p, c); + #else + mordinary(p, c); + #endif break; } *************** *** 479,486 **** register struct parse *p; { REQUIRE(MORE(), REG_EMPTY); ! while (MORE()) ordinary(p, GETNEXT()); } /* --- 490,502 ---- register struct parse *p; { REQUIRE(MORE(), REG_EMPTY); ! while (MORE()) { ! #ifndef MULTIBYTE ordinary(p, GETNEXT()); + #else + mordinary(p, GETNEXT()); + #endif + } } /* *************** *** 609,615 **** --- 625,635 ---- REQUIRE(starordinary, REG_BADRPT); /* FALLTHROUGH */ default: + #ifndef MULTIBYTE ordinary(p, c &~ BACKSL); + #else + mordinary(p, c &~ BACKSL); + #endif break; } *************** *** 731,737 **** --- 751,759 ---- mcinvert(p, cs); } + #ifndef MULTIBYTE assert(cs->multis == NULL); /* xxx */ + #endif if (nch(p, cs) == 1) { /* optimize singleton sets */ ordinary(p, firstch(p, cs)); *************** *** 787,794 **** --- 809,880 ---- REQUIRE(EATTWO('=', ']'), REG_ECOLLATE); break; default: /* symbol, ordinary character, or range */ + #ifndef MULTIBYTE /* xxx revision needed for multichar stuff */ + #else + /* + * multibyte case. + */ + if (1 < multi_byte_c(NULL, PEEK())) { + u_char charset; + size_t siz; + size_t i; + char *pstart; + char *pfinish; + char *ptmp; + + charset = PEEK() & 0xff; + siz = multi_byte_c(NULL, charset); + pstart = (char *)malloc(siz + 1); + pfinish = (char *)malloc(siz + 1); + ptmp = (char *)malloc(siz * 2 + 1); + + memcpy(pstart, p->next, siz); + pstart[siz] = '\0'; + NEXTn(siz); + if (SEE('-') && (p->next + siz < p->end)) { + NEXT(); + if ((PEEK() & 0xff) == charset) { + memcpy(pfinish, p->next, siz); + pfinish[siz] = '\0'; + NEXTn(siz); + } else + SETERROR(REG_ERANGE); + } else { + memcpy(pfinish, pstart, siz + 1); + pfinish[siz] = '\0'; + } + + for (i = 1; i < siz; i++) { + if ((u_char)pstart[i] < (u_char)pfinish[i]) + break; + else if ((u_char)pstart[i] > (u_char)pfinish[i]) + SETERROR(REG_ERANGE); + } + + strcpy(ptmp, pstart); + strcat(ptmp, pfinish); + MCadd(p, cs, ptmp); + + free(pstart); + free(pfinish); + free(ptmp); + + break; + } + + /* + * singlebyte case. + */ + /* just to make sure */ + if (1 < multi_byte_c(NULL, PEEK())) + SETERROR(REG_ERANGE); + #endif /*MULTIBYTE*/ start = p_b_symbol(p); + #ifdef MULTIBYTE + if (1 < multi_byte_c(NULL, PEEK2())) + SETERROR(REG_ERANGE); + #endif /*MULTIBYTE*/ if (SEE('-') && MORE2() && PEEK2() != ']') { /* range */ NEXT(); *************** *** 971,976 **** --- 1057,1105 ---- } } + #ifdef MULTIBYTE + /* + - ordinary - emit an ordinary character + == static void mordinary(register struct parse *p, register int ch); + */ + static void + mordinary(p, ch) + register struct parse *p; + register int ch; + { + register cat_t *cap = p->g->categories; + size_t advance; + extern int multi_byte_c __P((void *, u_int)); /*XXX*/ + + advance = multi_byte_c(NULL, ch); /*XXX*/ + if (advance == 1) { + ordinary(p, ch); + return; + } + + /* multibyte case. */ + p->next--; + REQUIRE(p->next + advance - 1 < p->end, REG_INVARG); /*XXX*/ + switch (advance) { + case 2: + ch = ((u_int)p->next[0] & 0xff) << 8; + ch |= ((u_int)p->next[1] & 0xff); + EMIT(OCHAR2, ch); + NEXTn(2); + break; + case 3: + ch = ((u_int)p->next[0] & 0xff) << 16; + ch |= ((u_int)p->next[1] & 0xff) << 8; + ch |= p->next[2] & 0xff; + EMIT(OCHAR3, ch); + NEXTn(3); + break; + default: + abort(); + } + } + #endif + /* - nonnewline - emit REG_NEWLINE version of OANY == static void nonnewline(register struct parse *p); *************** *** 1136,1141 **** --- 1265,1273 ---- cs->hash = 0; cs->smultis = 0; cs->multis = NULL; + #ifdef MULTIBYTE + cs->multiinvert = 0; + #endif return(cs); } *************** *** 1260,1266 **** return; } ! (void) strcpy(cs->multis + oldend - 1, cp); cs->multis[cs->smultis - 1] = '\0'; } --- 1392,1398 ---- return; } ! (void) strcpy(cs->multis + oldend, cp); cs->multis[cs->smultis - 1] = '\0'; } *************** *** 1334,1340 **** --- 1466,1476 ---- register struct parse *p; register cset *cs; { + #ifndef MULTIBYTE assert(cs->multis == NULL); /* xxx */ + #else + cs->multiinvert = cs->multiinvert ? 0 : 1; + #endif } /* *************** *** 1349,1355 **** --- 1485,1493 ---- register struct parse *p; register cset *cs; { + #ifndef MULTIBYTE assert(cs->multis == NULL); /* xxx */ + #endif } /* Index: regex/regex2.h Prereq: 8.3 *** nvi-1.79/regex/regex2.h Wed Jul 10 08:05:31 1996 --- nvi-1.79-m17n/regex/regex2.h Thu Jan 2 09:54:39 1997 *************** *** 105,110 **** --- 105,112 ---- #define O_CH (18< char[smulti] ab\0cd\0ef\0\0 */ + char multiinvert; } cset; /* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */ #define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c)) Index: vi/getc.c Prereq: 10.10 *** nvi-1.79/vi/getc.c Sun Apr 28 00:20:32 1996 --- nvi-1.79-m17n/vi/getc.c Fri Feb 21 22:40:32 1997 *************** *** 77,82 **** --- 77,87 ---- { char *p; + #ifndef MULTIBYTE + /* it is illegal to use this function */ + abort(); + #endif /*MULTIBYTE*/ + switch (csp->cs_flags) { case CS_EMP: /* EMP; get next line. */ case CS_EOL: /* EOL; get next line. */ *************** *** 110,115 **** --- 115,177 ---- return (0); } + #ifdef MULTIBYTE + /* + * cs_multi_next -- + * Retrieve the next character, with consideration to multibyte chars. + * It returns the first byte of multibyte char only. You will need to + * retrieve rest of it by using cs_next(). + * It is assumed that csp->cs_cno designates the first byte of + * multibyte char. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int cs_multi_next __P((SCR *, VCS *)); + * PUBLIC: #endif + */ + int + cs_multi_next(sp, csp) + SCR *sp; + VCS *csp; + { + char *p; + + switch (csp->cs_flags) { + case CS_EMP: /* EMP; get next line. */ + case CS_EOL: /* EOL; get next line. */ + if (db_get(sp, ++csp->cs_lno, 0, &p, &csp->cs_len)) { + --csp->cs_lno; + csp->cs_flags = CS_EOF; + } else { + csp->cs_bp = p; + if (csp->cs_len == 0 || + v_isempty(csp->cs_bp, csp->cs_len)) { + csp->cs_cno = 0; + csp->cs_flags = CS_EMP; + } else { + csp->cs_flags = 0; + csp->cs_ch = csp->cs_bp[csp->cs_cno = 0]; + } + } + break; + case 0: + if (csp->cs_len <= + csp->cs_cno + KEY_BLEN(sp, csp->cs_bp[csp->cs_cno])) + csp->cs_flags = CS_EOL; + else { + csp->cs_cno += KEY_BLEN(sp, csp->cs_bp[csp->cs_cno]); + csp->cs_ch = csp->cs_bp[csp->cs_cno]; + } + break; + case CS_EOF: /* EOF. */ + break; + default: + abort(); + /* NOTREACHED */ + } + return (0); + } + #endif /*MULTIBYTE*/ + /* * cs_fspace -- * If on a space, eat forward until something other than a *************** *** 130,136 **** --- 192,202 ---- if (csp->cs_flags != 0 || !isblank(csp->cs_ch)) return (0); for (;;) { + #ifndef MULTIBYTE if (cs_next(sp, csp)) + #else + if (cs_multi_next(sp, csp)) + #endif return (1); if (csp->cs_flags != 0 || !isblank(csp->cs_ch)) break; *************** *** 150,156 **** --- 216,226 ---- VCS *csp; { for (;;) { + #ifndef MULTIBYTE if (cs_next(sp, csp)) + #else + if (cs_multi_next(sp, csp)) + #endif return (1); if (csp->cs_flags == CS_EOL || csp->cs_flags == CS_EMP || csp->cs_flags == 0 && isblank(csp->cs_ch)) *************** *** 171,176 **** --- 241,251 ---- SCR *sp; VCS *csp; { + #ifndef MULTIBYTE + /* it is illegal to use this function. */ + abort(); + #endif /*MULTIBYTE*/ + switch (csp->cs_flags) { case CS_EMP: /* EMP; get previous line. */ case CS_EOL: /* EOL; get previous line. */ *************** *** 211,216 **** --- 286,353 ---- return (0); } + #ifdef MULTIBYTE + /* + * cs_multi_prev -- + * Retrieve the previous character, with consideration to multibyte chars. + * It returns the first byte of multibyte char only. You will need to + * retrieve rest of it by using cs_next(). + * It is assumed that csp->cs_cno designates the first byte of + * multibyte char. + * + * PUBLIC: #ifdef MULTIBYTE + * PUBLIC: int cs_multi_prev __P((SCR *, VCS *)); + * PUBLIC: #endif + */ + int + cs_multi_prev(sp, csp) + SCR *sp; + VCS *csp; + { + switch (csp->cs_flags) { + case CS_EMP: /* EMP; get previous line. */ + case CS_EOL: /* EOL; get previous line. */ + if (csp->cs_lno == 1) { /* SOF. */ + csp->cs_flags = CS_SOF; + break; + } + if (db_get(sp, /* The line should exist. */ + --csp->cs_lno, DBG_FATAL, &csp->cs_bp, &csp->cs_len)) { + ++csp->cs_lno; + return (1); + } + if (csp->cs_len == 0 || v_isempty(csp->cs_bp, csp->cs_len)) { + csp->cs_cno = 0; + csp->cs_flags = CS_EMP; + } else { + csp->cs_flags = 0; + csp->cs_cno = csp->cs_len; + csp->cs_cno -= multi_back(sp, csp->cs_bp, &csp->cs_bp[csp->cs_len]); + csp->cs_ch = csp->cs_bp[csp->cs_cno]; + } + break; + case CS_EOF: /* EOF: get previous char. */ + case 0: + if (csp->cs_cno == 0) + if (csp->cs_lno == 1) + csp->cs_flags = CS_SOF; + else + csp->cs_flags = CS_EOL; + else { + csp->cs_cno -= multi_back(sp, csp->cs_bp, &csp->cs_bp[csp->cs_cno]); + csp->cs_ch = csp->cs_bp[csp->cs_cno]; + } + break; + case CS_SOF: /* SOF. */ + break; + default: + abort(); + /* NOTREACHED */ + } + return (0); + } + #endif /*MULTIBYTE*/ + /* * cs_bblank -- * Eat backward to the next non-whitespace character. *************** *** 223,229 **** --- 360,370 ---- VCS *csp; { for (;;) { + #ifndef MULTIBYTE if (cs_prev(sp, csp)) + #else + if (cs_multi_prev(sp, csp)) + #endif return (1); if (csp->cs_flags == CS_EOL || csp->cs_flags == CS_EMP || csp->cs_flags == 0 && isblank(csp->cs_ch)) Index: vi/v_ch.c Prereq: 10.8 *** nvi-1.79/vi/v_ch.c Sun Apr 28 00:20:32 1996 --- nvi-1.79-m17n/vi/v_ch.c Sun Feb 2 15:48:33 1997 *************** *** 25,31 **** --- 25,35 ---- #include "../common/common.h" #include "vi.h" + #ifndef MULTIBYTE static void notfound __P((SCR *, ARG_CHAR_T)); + #else + static void notfound __P((SCR *, CHAR_T *)); + #endif static void noprev __P((SCR *)); /* *************** *** 39,45 **** --- 43,53 ---- SCR *sp; VICMD *vp; { + #ifndef MULTIBYTE vp->character = VIP(sp)->lastckey; + #else + memcpy(vp->characters, VIP(sp)->lastckeys, sizeof(vp->characters)); + #endif switch (VIP(sp)->csearchdir) { case CNOTSET: *************** *** 73,79 **** --- 81,91 ---- cdir_t savedir; int rval; + #ifndef MULTIBYTE vp->character = VIP(sp)->lastckey; + #else + memcpy(vp->characters, VIP(sp)->lastckeys, sizeof(vp->characters)); + #endif savedir = VIP(sp)->csearchdir; switch (VIP(sp)->csearchdir) { *************** *** 111,125 **** --- 123,151 ---- SCR *sp; VICMD *vp; { + #ifdef MULTIBYTE + CHAR_T *p; + #endif + if (v_chf(sp, vp)) return (1); + #ifdef MULTIBYTE + /* we need content of the line. */ + if (db_eget(sp, vp->m_start.lno, &p, NULL, NULL)) + return (1); + #endif + /* * v_chf places the cursor on the character, where the 't' * command wants it to its left. We know this is safe since * we had to move right for v_chf() to have succeeded. */ + #ifndef MULTIBYTE --vp->m_stop.cno; + #else + vp->m_stop.cno -= multi_back(sp, p, &p[vp->m_stop.cno]); + #endif /* * Make any necessary correction to the motion decision made *************** *** 146,162 **** --- 172,202 ---- { size_t len; u_long cnt; + #ifndef MULTIBYTE int isempty, key; char *endp, *p, *startp; + #else + int isempty; + CHAR_T *key; + size_t blen; + CHAR_T *endp, *p, *startp; + #endif /*MULTIBYTE*/ /* * !!! * If it's a dot command, it doesn't reset the key for which we're * searching, e.g. in "df1|f2|.|;", the ';' searches for a '2'. */ + #ifndef MULTIBYTE key = vp->character; if (!F_ISSET(vp, VC_ISDOT)) VIP(sp)->lastckey = key; + #else + key = vp->characters; + blen = KEY_BLEN(sp, key[0]); + if (!F_ISSET(vp, VC_ISDOT)) + memcpy(VIP(sp)->lastckeys, key, sizeof(VIP(sp)->lastckeys)); + #endif /*MULTIBYTE*/ VIP(sp)->csearchdir = fSEARCH; if (db_eget(sp, vp->m_start.lno, &p, &len, &isempty)) { *************** *** 173,179 **** --- 213,225 ---- endp = (startp = p) + len; p += vp->m_start.cno; for (cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { + #ifndef MULTIBYTE while (++p < endp && *p != key); + #else + do { + p += KEY_BLEN(sp, p[0]); + } while (p < endp && (*p != key[0] || memcmp(p, key, blen))); + #endif /*MULTIBYTE*/ if (p == endp) { notfound(sp, key); return (1); *************** *** 202,216 **** --- 248,276 ---- SCR *sp; VICMD *vp; { + #ifdef MULTIBYTE + CHAR_T *p; + #endif + if (v_chF(sp, vp)) return (1); + #ifdef MULTIBYTE + /* we need content of the line. */ + if (db_eget(sp, vp->m_start.lno, &p, NULL, NULL)) + return (1); + #endif + /* * v_chF places the cursor on the character, where the 'T' * command wants it to its right. We know this is safe since * we had to move left for v_chF() to have succeeded. */ + #ifndef MULTIBYTE ++vp->m_stop.cno; + #else + vp->m_stop.cno += KEY_BLEN(sp, p[vp->m_stop.cno]); + #endif vp->m_final = vp->m_stop; VIP(sp)->csearchdir = TSEARCH; *************** *** 231,238 **** --- 291,305 ---- { size_t len; u_long cnt; + #ifndef MULTIBYTE int isempty, key; char *endp, *p; + #else + int isempty; + CHAR_T *key; + size_t blen; + CHAR_T *endp, *p; + #endif /* * !!! *************** *** 240,248 **** --- 307,322 ---- * we're searching, e.g. in "df1|f2|.|;", the ';' searches * for a '2'. */ + #ifndef MULTIBYTE key = vp->character; if (!F_ISSET(vp, VC_ISDOT)) VIP(sp)->lastckey = key; + #else + key = vp->characters; + blen = KEY_BLEN(sp, key[0]); + if (!F_ISSET(vp, VC_ISDOT)) + memcpy(VIP(sp)->lastckeys, key, sizeof(VIP(sp)->lastckeys)); + #endif /*MULTIBYTE*/ VIP(sp)->csearchdir = FSEARCH; if (db_eget(sp, vp->m_start.lno, &p, &len, &isempty)) { *************** *** 259,265 **** --- 333,345 ---- endp = p - 1; p += vp->m_start.cno; for (cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) { + #ifndef MULTIBYTE while (--p > endp && *p != key); + #else + do { + p -= multi_back(sp, endp + 1, p); + } while (p > endp && (*p != key[0] || memcmp(p, key, blen))); + #endif if (p == endp) { notfound(sp, key); return (1); *************** *** 274,281 **** * one. */ vp->m_final = vp->m_stop; ! if (ISMOTION(vp)) --vp->m_start.cno; return (0); } --- 354,366 ---- * one. */ vp->m_final = vp->m_stop; ! if (ISMOTION(vp)) { ! #ifndef MULTIBYTE --vp->m_start.cno; + #else + vp->m_start.cno -= multi_back(sp, p, &p[vp->m_start.cno]); + #endif + } return (0); } *************** *** 286,291 **** --- 371,377 ---- msgq(sp, M_BERR, "178|No previous F, f, T or t search"); } + #ifndef MULTIBYTE static void notfound(sp, ch) SCR *sp; *************** *** 293,295 **** --- 379,400 ---- { msgq(sp, M_BERR, "179|%s not found", KEY_NAME(sp, ch)); } + #else + static void + notfound(sp, p) + SCR *sp; + CHAR_T *p; + { + #if 0 + msgq(sp, M_BERR, "179|%s not found", multi_name(sp, p)); + #else + /* + * currently msg routines do not support multibyte chars. + */ + if (1 < KEY_BLEN(sp, p[0])) + msgq(sp, M_BERR, "179|%s not found", "character"); + else + msgq(sp, M_BERR, "179|%s not found", KEY_NAME(sp, p)); + #endif + } + #endif /*MULTIBYTE*/ Index: vi/v_delete.c Prereq: 10.9 *** nvi-1.79/vi/v_delete.c Wed Oct 23 22:31:41 1996 --- nvi-1.79-m17n/vi/v_delete.c Mon Nov 25 00:51:19 1996 *************** *** 90,97 **** F_SET(vp, VM_RCM_SET); /* Make sure the set cursor position exists. */ ! if (vp->m_final.cno >= len) vp->m_final.cno = len ? len - 1 : 0; } /* --- 90,111 ---- F_SET(vp, VM_RCM_SET); /* Make sure the set cursor position exists. */ ! if (vp->m_final.cno >= len) { ! #ifndef MULTIBYTE vp->m_final.cno = len ? len - 1 : 0; + #else + CHAR_T *p; + + /* we need content of the line. */ + if (db_get(sp, vp->m_final.lno, 0, &p, NULL)) + return 1; + + if (len) + vp->m_final.cno = len - multi_back(sp, p, &p[len]); + else + vp->m_final.cno = 0; + #endif /*MULTIBYTE*/ + } } /* Index: vi/v_ex.c Prereq: 10.42 *** nvi-1.79/vi/v_ex.c Mon Sep 16 05:03:02 1996 --- nvi-1.79-m17n/vi/v_ex.c Fri Mar 28 00:30:29 1997 *************** *** 506,511 **** --- 506,514 ---- VICMD *vp; { size_t len; + #ifdef MULTIBYTE + CHAR_T *p; + #endif /* * The only cursor modifications are real, however, the underlying *************** *** 521,531 **** * Ex will soon have to start handling the column correctly; see * the POSIX 1003.2 standard. */ ! if (db_eget(sp, sp->lno, NULL, &len, NULL)) { sp->lno = 1; sp->cno = 0; ! } else if (sp->cno >= len) sp->cno = len ? len - 1 : 0; vp->m_final.lno = sp->lno; vp->m_final.cno = sp->cno; --- 524,544 ---- * Ex will soon have to start handling the column correctly; see * the POSIX 1003.2 standard. */ ! #ifndef MULTIBYTE ! if (db_eget(sp, sp->lno, NULL, &len, NULL)) ! #else ! if (db_eget(sp, sp->lno, &p, &len, NULL)) ! #endif ! { sp->lno = 1; sp->cno = 0; ! } else if (sp->cno >= len) { ! #ifndef MULTIBYTE sp->cno = len ? len - 1 : 0; + #else + sp->cno = len ? len - multi_back(sp, p, &p[len]) : 0; + #endif + } vp->m_final.lno = sp->lno; vp->m_final.cno = sp->cno; Index: vi/v_increment.c Prereq: 10.12 *** nvi-1.79/vi/v_increment.c Sun Apr 28 00:20:33 1996 --- nvi-1.79-m17n/vi/v_increment.c Thu Feb 20 00:03:46 1997 *************** *** 59,65 **** --- 59,70 ---- long change, ltmp, lval; size_t beg, blen, end, len, nlen, wlen; int base, isempty, rval; + #ifndef MULTIBYTE char *bp, *ntype, *p, *t, nbuf[100]; + #else + char *bp, *ntype, *t, nbuf[100]; + CHAR_T *p; + #endif /*MULTIBYTE*/ /* Validate the operator. */ if (vp->character == '#') Index: vi/v_init.c Prereq: 10.8 *** nvi-1.79/vi/v_init.c Fri May 17 09:09:04 1996 --- nvi-1.79-m17n/vi/v_init.c Thu Feb 20 12:40:31 1997 *************** *** 63,69 **** --- 63,74 ---- v_strdup(sp, ovip->ps, strlen(ovip->ps))) == NULL) return (1); + #ifndef MULTIBYTE nvip->lastckey = ovip->lastckey; + #else + memcpy(nvip->lastckeys, ovip->lastckeys, + sizeof(nvip->lastckeys)); + #endif nvip->csearchdir = ovip->csearchdir; nvip->srows = ovip->srows; Index: vi/v_itxt.c Prereq: 10.16 *** nvi-1.79/vi/v_itxt.c Wed Oct 23 22:31:47 1996 --- nvi-1.79-m17n/vi/v_itxt.c Fri Feb 21 22:13:41 1997 *************** *** 71,79 **** --- 71,87 ---- VICMD *vp; { size_t len; + #ifdef MULTIBYTE + CHAR_T *p; + #endif + #ifndef MULTIBYTE if (!db_get(sp, vp->m_start.lno, 0, NULL, &len)) sp->cno = len == 0 ? 0 : len - 1; + #else + if (!db_get(sp, vp->m_start.lno, 0, &p, &len)) + sp->cno = len == 0 ? 0 : len - multi_back(sp, p, &p[len]); + #endif /*MULTIBYTE*/ LOG_CORRECT; *************** *** 95,101 **** --- 103,113 ---- size_t len; u_int32_t flags; int isempty; + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif flags = set_txt_std(sp, vp, 0); sp->showmode = SM_APPEND; *************** *** 108,118 **** len = 0; LF_SET(TXT_APPENDEOL); } else if (len) { ! if (len == sp->cno + 1) { sp->cno = len; LF_SET(TXT_APPENDEOL); ! } else ++sp->cno; } else LF_SET(TXT_APPENDEOL); --- 120,140 ---- len = 0; LF_SET(TXT_APPENDEOL); } else if (len) { ! #ifndef MULTIBYTE ! if (len == sp->cno + 1) ! #else ! if (len == sp->cno + KEY_BLEN(sp, p[sp->cno])) ! #endif ! { sp->cno = len; LF_SET(TXT_APPENDEOL); ! } else { ! #ifndef MULTIBYTE ++sp->cno; + #else + sp->cno += KEY_BLEN(sp, p[sp->cno]); + #endif + } } else LF_SET(TXT_APPENDEOL); *************** *** 422,428 **** --- 444,454 ---- LF_SET(TXT_OVERWRITE | TXT_REPLACE); } vp->m_stop.lno = vp->m_start.lno; + #ifndef MULTIBYTE vp->m_stop.cno = len ? len - 1 : 0; + #else + vp->m_stop.cno = len ? len - multi_back(sp, p, &p[len]) : 0; + #endif return (v_txt(sp, vp, &vp->m_stop, p, len, 0, OOBLNO, F_ISSET(vp, VC_C1SET) ? vp->count : 1, flags)); *************** *** 442,448 **** --- 468,478 ---- size_t len; u_int32_t flags; int isempty; + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif flags = set_txt_std(sp, vp, 0); sp->showmode = SM_CHANGE; *************** *** 459,468 **** --- 489,514 ---- } vp->m_stop.lno = vp->m_start.lno; + #ifndef MULTIBYTE vp->m_stop.cno = vp->m_start.cno + (F_ISSET(vp, VC_C1SET) ? vp->count - 1 : 0); if (vp->m_stop.cno > len - 1) vp->m_stop.cno = len - 1; + #else + { + size_t i; + vp->m_stop.cno = vp->m_start.cno; + if (F_ISSET(vp, VC_C1SET)) { + i = 0; + while (vp->m_stop.cno < len && i < vp->count - 1) { + vp->m_stop.cno += KEY_BLEN(sp, p[vp->m_stop.cno]); + i++; + } + } + } + if (vp->m_stop.cno > len - multi_back(sp, p, &p[len])) + vp->m_stop.cno = len - multi_back(sp, p, &p[len]); + #endif /*MULTIBYTE*/ if (p != NULL && cut(sp, F_ISSET(vp, VC_BUFFER) ? &vp->buffer : NULL, Index: vi/v_left.c Prereq: 10.7 *** nvi-1.79/vi/v_left.c Sun Apr 28 00:20:33 1996 --- nvi-1.79-m17n/vi/v_left.c Sun Nov 24 13:37:17 1996 *************** *** 36,41 **** --- 36,44 ---- VICMD *vp; { recno_t cnt; + #ifdef MULTIBYTE + CHAR_T *p; + #endif /* * !!! *************** *** 46,56 **** return (1); } /* Find the end of the range. */ cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; ! if (vp->m_start.cno > cnt) vp->m_stop.cno = vp->m_start.cno - cnt; ! else vp->m_stop.cno = 0; /* --- 49,71 ---- return (1); } + #ifdef MULTIBYTE + /* we need the content of the line. */ + if (db_eget(sp, vp->m_start.lno, &p, NULL, NULL)) + return (1); + #endif /*MULTIBYTE*/ + /* Find the end of the range. */ cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; ! if (vp->m_start.cno > cnt) { ! #ifndef MULTIBYTE vp->m_stop.cno = vp->m_start.cno - cnt; ! #else ! vp->m_stop.cno = vp->m_start.cno; ! while (cnt--) ! vp->m_stop.cno -= multi_back(sp, p, &p[vp->m_stop.cno]); ! #endif /*MULTIBYTE*/ ! } else vp->m_stop.cno = 0; /* *************** *** 58,65 **** * adjust the starting point to the character before the current * one. */ ! if (ISMOTION(vp)) --vp->m_start.cno; vp->m_final = vp->m_stop; return (0); } --- 73,85 ---- * adjust the starting point to the character before the current * one. */ ! if (ISMOTION(vp)) { ! #ifndef MULTIBYTE --vp->m_start.cno; + #else + vp->m_start.cno -= multi_back(sp, p, &p[vp->m_start.cno]); + #endif + } vp->m_final = vp->m_stop; return (0); } *************** *** 144,149 **** --- 164,173 ---- SCR *sp; VICMD *vp; { + #ifdef MULTIBYTE + CHAR_T *p; + #endif + /* * !!! * Yielding to none in our quest for compatibility with every *************** *** 172,177 **** --- 196,209 ---- return (1); } + #ifdef MULTIBYTE + if (ISMOTION(vp)) { + /* we need the content of this line. */ + if (db_eget(sp, vp->m_start.lno, &p, NULL, NULL)) + return (1); + } + #endif /*MULTIBYTE*/ + /* * If moving right, non-motion commands move to the end of the range. * Delete and yank stay at the start. Motion commands adjust the *************** *** 183,195 **** */ if (vp->m_start.cno < vp->m_stop.cno) if (ISMOTION(vp)) { --vp->m_stop.cno; vp->m_final = vp->m_start; } else vp->m_final = vp->m_stop; else { ! if (ISMOTION(vp)) --vp->m_start.cno; vp->m_final = vp->m_stop; } return (0); --- 215,236 ---- */ if (vp->m_start.cno < vp->m_stop.cno) if (ISMOTION(vp)) { + #ifndef MULTIBYTE --vp->m_stop.cno; + #else + vp->m_stop.cno -= multi_back(sp, p, &p[vp->m_stop.cno]); + #endif vp->m_final = vp->m_start; } else vp->m_final = vp->m_stop; else { ! if (ISMOTION(vp)) { ! #ifndef MULTIBYTE --vp->m_start.cno; + #else + vp->m_start.cno -= multi_back(sp, p, &p[vp->m_start.cno]); + #endif + } vp->m_final = vp->m_stop; } return (0); *************** *** 208,213 **** --- 249,258 ---- SCR *sp; VICMD *vp; { + #ifdef MULTIBYTE + CHAR_T *p; + #endif + if (F_ISSET(vp, VC_C1SET) && vp->count > 1) { --vp->count; vp->m_stop.cno = *************** *** 236,241 **** --- 281,294 ---- vp->m_stop.cno = 0; } + #ifdef MULTIBYTE + if (ISMOTION(vp)) { + /* we need the content of this line. */ + if (db_eget(sp, vp->m_start.lno, &p, NULL, NULL)) + return (1); + } + #endif /*MULTIBYTE*/ + /* * If moving right, non-motion commands move to the end of the range. * Delete and yank stay at the start. Motion commands adjust the *************** *** 247,259 **** */ if (vp->m_start.cno < vp->m_stop.cno) if (ISMOTION(vp)) { --vp->m_stop.cno; vp->m_final = vp->m_start; } else vp->m_final = vp->m_stop; else { ! if (ISMOTION(vp)) --vp->m_start.cno; vp->m_final = vp->m_stop; } return (0); --- 300,321 ---- */ if (vp->m_start.cno < vp->m_stop.cno) if (ISMOTION(vp)) { + #ifndef MULTIBYTE --vp->m_stop.cno; + #else + vp->m_stop.cno -= multi_back(sp, p, &p[vp->m_stop.cno]); + #endif vp->m_final = vp->m_start; } else vp->m_final = vp->m_stop; else { ! if (ISMOTION(vp)) { ! #ifndef MULTIBYTE --vp->m_start.cno; + #else + vp->m_start.cno -= multi_back(sp, p, &p[vp->m_start.cno]); + #endif + } vp->m_final = vp->m_stop; } return (0); *************** *** 270,275 **** --- 332,341 ---- SCR *sp; VICMD *vp; { + #ifdef MULTIBYTE + CHAR_T *p; + #endif + /* * !!! * The 0 command succeeded if used as a command in the first column *************** *** 286,293 **** * one. */ vp->m_stop.cno = 0; ! if (ISMOTION(vp)) --vp->m_start.cno; vp->m_final = vp->m_stop; return (0); } --- 352,369 ---- * one. */ vp->m_stop.cno = 0; ! if (ISMOTION(vp)) { ! #ifndef MULTIBYTE --vp->m_start.cno; + #else + /* we need the content of this line. */ + if (db_eget(sp, vp->m_start.lno, &p, NULL, NULL)) + return (1); + + vp->m_start.cno -= multi_back(sp, p, &p[vp->m_start.cno]); + #endif /*MULTIBYTE*/ + + } vp->m_final = vp->m_stop; return (0); } Index: vi/v_match.c Prereq: 10.8 *** nvi-1.79/vi/v_match.c Sun Apr 28 00:21:26 1996 --- nvi-1.79-m17n/vi/v_match.c Thu Feb 20 00:04:02 1997 *************** *** 31,36 **** --- 31,42 ---- * * PUBLIC: int v_match __P((SCR *, VICMD *)); */ + #ifdef MULTIBYTE + /* + * XXX + * There should be a way to handle multibyte parentheses/brackets matching. + */ + #endif int v_match(sp, vp) SCR *sp; *************** *** 40,46 **** --- 46,56 ---- MARK *mp; size_t cno, len, off; int cnt, isempty, matchc, startc, (*gc)__P((SCR *, VCS *)); + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif /* * !!! *************** *** 55,61 **** goto nomatch; return (1); } ! for (off = vp->m_start.cno;; ++off) { if (off >= len) { nomatch: msgq(sp, M_BERR, "184|No match character on this line"); return (1); --- 65,76 ---- goto nomatch; return (1); } ! #ifndef MULTIBYTE ! for (off = vp->m_start.cno;; ++off) ! #else ! for (off = vp->m_start.cno;; off += KEY_BLEN(sp, p[off])) ! #endif ! { if (off >= len) { nomatch: msgq(sp, M_BERR, "184|No match character on this line"); return (1); *************** *** 99,104 **** --- 114,126 ---- break; } + #ifdef MULTIBYTE + if (gc == cs_next) + gc = cs_multi_next; + else if (gc == cs_prev) + gc = cs_multi_prev; + #endif /*MULTIBYTE*/ + cs.cs_lno = vp->m_start.lno; cs.cs_cno = off; if (cs_init(sp, &cs)) *************** *** 162,170 **** --- 184,205 ---- mp = vp->m_start.lno < vp->m_stop.lno ? &vp->m_stop : &vp->m_start; if (db_get(sp, mp->lno, DBG_FATAL, &p, &len)) return (1); + #ifndef MULTIBYTE for (p += mp->cno + 1, len -= mp->cno; --len; ++p) if (!isblank(*p)) return (0); + #else + { + size_t i; + i = mp->cno + 1; + while (i < len) { + /* XXX need check for multibyte chars? */ + if (!isblank(p[i])) + return (0); + i += KEY_BLEN(sp, p[i]); + } + } + #endif /*MULTIBYTE*/ F_SET(vp, VM_LMODE); return (0); } Index: vi/v_paragraph.c Prereq: 10.7 *** nvi-1.79/vi/v_paragraph.c Sun Apr 28 00:21:26 1996 --- nvi-1.79-m17n/vi/v_paragraph.c Tue Nov 26 00:32:37 1996 *************** *** 145,151 **** --- 145,155 ---- */ found: if (ISMOTION(vp)) { vp->m_stop.lno = lastlno; + #ifndef MULTIBYTE vp->m_stop.cno = lastlen ? lastlen - 1 : 0; + #else + vp->m_stop.cno = lastlen ? lastlen - multi_back(sp, p, &p[lastlen]) : 0; + #endif /*MULTIBYTE*/ vp->m_final = vp->m_start; } else { vp->m_stop.lno = lno; *************** *** 173,179 **** vp->m_start.cno = 0; return (0); } ! if (vp->m_start.cno == (len ? len - 1 : 0)) { v_eof(sp, NULL); return (1); } --- 177,188 ---- vp->m_start.cno = 0; return (0); } ! #ifndef MULTIBYTE ! if (vp->m_start.cno == (len ? len - 1 : 0)) ! #else ! if (vp->m_start.cno == (len ? len - multi_back(sp, p, &p[len]) : 0)) ! #endif ! { v_eof(sp, NULL); return (1); } *************** *** 191,197 **** --- 200,210 ---- F_SET(vp, VM_RCM_SETFNB); } vp->m_stop.lno = lno - 1; + #ifndef MULTIBYTE vp->m_stop.cno = len ? len - 1 : 0; + #else + vp->m_stop.cno = len ? len - multi_back(sp, p, &p[len]) : 0; + #endif /*MULTIBYTE*/ vp->m_final = ISMOTION(vp) ? vp->m_start : vp->m_stop; return (0); } *************** *** 240,247 **** } else --vp->m_start.lno; F_SET(vp, VM_LMODE); ! } else --vp->m_start.cno; if (vp->m_start.lno <= 1) goto sof; --- 253,270 ---- } else --vp->m_start.lno; F_SET(vp, VM_LMODE); ! } else { ! #ifndef MULTIBYTE --vp->m_start.cno; + #else + CHAR_T *p; + + if (db_eget(sp, vp->m_start.lno, &p, NULL, NULL)) { + return 1; /* is this correct? */ + } + vp->m_start.cno -= multi_back(sp, p, &p[vp->m_start.cno]); + #endif /*MULTIBYTE*/ + } if (vp->m_start.lno <= 1) goto sof; Index: vi/v_replace.c Prereq: 10.17 *** nvi-1.79/vi/v_replace.c Mon Jul 1 06:50:24 1996 --- nvi-1.79-m17n/vi/v_replace.c Wed Aug 20 15:37:29 1997 *************** *** 53,59 **** --- 53,66 ---- size_t blen, len; u_long cnt; int quote, rval; + #ifndef MULTIBYTE char *bp, *p; + #else + CHAR_T *bp, *p; + #endif + #ifdef MULTIBYTE + size_t chlen; + #endif vip = VIP(sp); *************** *** 87,94 **** */ cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; vp->m_stop.lno = vp->m_start.lno; vp->m_stop.cno = vp->m_start.cno + cnt - 1; ! if (vp->m_stop.cno > len - 1) { v_eol(sp, &vp->m_start); return (1); } --- 94,115 ---- */ cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; vp->m_stop.lno = vp->m_start.lno; + #ifndef MULTIBYTE vp->m_stop.cno = vp->m_start.cno + cnt - 1; ! #else ! { ! u_long i; /* i should be u_long, since cnt is u_long*/ ! vp->m_stop.cno = vp->m_start.cno; ! for (i = 0; i < cnt - 1; i++) ! vp->m_stop.cno += KEY_BLEN(sp, p[vp->m_stop.cno]); ! } ! #endif /*MULTIBYTE*/ ! #ifndef MULTIBYTE ! if (vp->m_stop.cno > len - 1) ! #else ! if (vp->m_stop.cno > len - multi_back(sp, p, &p[len])) ! #endif ! { v_eol(sp, &vp->m_start); return (1); } *************** *** 121,126 **** --- 142,159 ---- } vip->rlast = ev.e_c; vip->rvalue = ev.e_value; + #ifdef MULTIBYTE + if (1 < (chlen = KEY_BLEN(sp, vip->rlasts[0]))) { + size_t i; + for (i = 1; i < chlen; i++) { + if (v_event_get(sp, &ev, 0, 0)) + return 1; + if (ev.e_event != E_CHARACTER) + return 1; + vip->rlasts[i] = ev.e_c; + } + } + #endif /*MULTIBYTE*/ break; case E_ERR: case E_EOF: *************** *** 155,160 **** --- 188,203 ---- * a single new line. Users complained, so we match historic practice. */ if (!quote && vip->rvalue == K_CR || vip->rvalue == K_NL) { + #ifdef MULTIBYTE + /* + * set cnt to the count by characters in buffer. + * XXX meaning changed, assumes that cnt will not be used + * under previous meaning in the rest of the function. + */ + cnt = vp->m_stop.cno - vp->m_start.cno; + cnt += KEY_BLEN(sp, bp[vp->m_stop.cno]); + #endif /*MULTIBYTE*/ + /* Set return line. */ vp->m_stop.lno = vp->m_start.lno + 1; vp->m_stop.cno = 0; *************** *** 193,200 **** --- 236,282 ---- rval = 0; } } else { + #ifndef MULTIBYTE memset(bp + vp->m_start.cno, vip->rlast, cnt); rval = db_set(sp, vp->m_start.lno, bp, len); + #else + { + u_long i; /* i must be u_long, since cnt is u_long*/ + size_t nlen; + size_t orlen; + size_t nrlen; + + chlen = KEY_BLEN(sp, vip->rlasts[0]); + + /* + * calculate the length. + * orlen and nrlen denotes the region to be modified, + * counted from vp->m_starto.cno. + */ + orlen = vp->m_stop.cno - vp->m_start.cno; + orlen += KEY_BLEN(sp, bp[vp->m_stop.cno]); + nrlen = chlen * cnt; + + /* expand the region */ + nlen = len - orlen + nrlen; + ADD_SPACE_RET(sp, bp, blen, nlen); + + /* move trailing portion to safe place */ + memmove(bp + vp->m_start.cno + nrlen, + bp + vp->m_start.cno + orlen, + len - vp->m_start.cno - orlen); + + /* fill in the blank */ + for (i = 0; i < cnt; i++) { + memcpy(bp + vp->m_start.cno + chlen * i, + vip->rlasts, chlen); + } + + /* put it into database */ + rval = db_set(sp, vp->m_start.lno, bp, nlen); + vp->m_stop.cno = vp->m_start.cno + chlen * (cnt - 1); + } + #endif /*MULTIBYTE*/ } FREE_SPACE(sp, bp, blen); Index: vi/v_right.c Prereq: 10.7 *** nvi-1.79/vi/v_right.c Sat May 18 04:11:01 1996 --- nvi-1.79-m17n/vi/v_right.c Fri Feb 21 22:14:21 1997 *************** *** 37,44 **** { size_t len; int isempty; ! ! if (db_eget(sp, vp->m_start.lno, NULL, &len, &isempty)) { if (isempty) goto eol; return (1); --- 37,53 ---- { size_t len; int isempty; ! #ifdef MULTIBYTE ! CHAR_T *p; ! size_t lastcno; ! #endif ! ! #ifndef MULTIBYTE ! if (db_eget(sp, vp->m_start.lno, NULL, &len, &isempty)) ! #else ! if (db_eget(sp, vp->m_start.lno, &p, &len, &isempty)) ! #endif /*MULTIBYTE*/ ! { if (isempty) goto eol; return (1); *************** *** 50,55 **** --- 59,69 ---- return (1); } + #ifdef MULTIBYTE + /* how many bytes we need to subtract, to go to the last char? */ + lastcno = len - multi_back(sp, p, &p[len]); + #endif + /* * Non-motion commands move to the end of the range. Delete and * yank stay at the start. Ignore others. Adjust the end of the *************** *** 59,75 **** * Historically, "[cdsy]l" worked at the end of a line. Also, * EOL is a count sink. */ vp->m_stop.cno = vp->m_start.cno + (F_ISSET(vp, VC_C1SET) ? vp->count : 1); ! if (vp->m_start.cno == len - 1 && !ISMOTION(vp)) { v_eol(sp, NULL); return (1); } if (vp->m_stop.cno >= len) { vp->m_stop.cno = len - 1; vp->m_final = ISMOTION(vp) ? vp->m_start : vp->m_stop; } else if (ISMOTION(vp)) { --vp->m_stop.cno; vp->m_final = vp->m_start; } else vp->m_final = vp->m_stop; --- 73,116 ---- * Historically, "[cdsy]l" worked at the end of a line. Also, * EOL is a count sink. */ + #ifndef MULTIBYTE vp->m_stop.cno = vp->m_start.cno + (F_ISSET(vp, VC_C1SET) ? vp->count : 1); ! #else ! { ! int i; ! if (F_ISSET(vp, VC_C1SET)) { ! vp->m_stop.cno = vp->m_start.cno; ! for (i = 0; i < vp->count; i++) ! vp->m_stop.cno += KEY_BLEN(sp, p[vp->m_stop.cno]); ! } else { ! vp->m_stop.cno = vp->m_start.cno ! + KEY_BLEN(sp, p[vp->m_start.cno]); ! } ! } ! #endif /*MULTIBYTE*/ ! #ifndef MULTIBYTE ! if (vp->m_start.cno == len - 1 && !ISMOTION(vp)) ! #else ! if (vp->m_start.cno == lastcno && !ISMOTION(vp)) ! #endif ! { v_eol(sp, NULL); return (1); } if (vp->m_stop.cno >= len) { + #ifndef MULTIBYTE vp->m_stop.cno = len - 1; + #else + vp->m_stop.cno = lastcno; + #endif vp->m_final = ISMOTION(vp) ? vp->m_start : vp->m_stop; } else if (ISMOTION(vp)) { + #ifndef MULTIBYTE --vp->m_stop.cno; + #else + vp->m_stop.cno -= multi_back(sp, p, &p[vp->m_stop.cno]); + #endif vp->m_final = vp->m_start; } else vp->m_final = vp->m_stop; *************** *** 89,94 **** --- 130,138 ---- { size_t len; int isempty; + #ifdef MULTIBYTE + char *p; + #endif /* * !!! *************** *** 121,127 **** * To fix it, we let c$ go through, on the assumption that it's * not a problem for it to work. */ ! if (db_eget(sp, vp->m_stop.lno, NULL, &len, &isempty)) { if (!isempty) return (1); len = 0; --- 165,176 ---- * To fix it, we let c$ go through, on the assumption that it's * not a problem for it to work. */ ! #ifndef MULTIBYTE ! if (db_eget(sp, vp->m_stop.lno, NULL, &len, &isempty)) ! #else ! if (db_eget(sp, vp->m_stop.lno, &p, &len, &isempty)) ! #endif ! { if (!isempty) return (1); len = 0; *************** *** 139,145 **** --- 188,198 ---- * Non-motion commands move to the end of the range. Delete * and yank stay at the start. Ignore others. */ + #ifndef MULTIBYTE vp->m_stop.cno = len ? len - 1 : 0; + #else + vp->m_stop.cno = len ? len - multi_back(sp, p, &p[len]) : 0; + #endif vp->m_final = ISMOTION(vp) ? vp->m_start : vp->m_stop; return (0); } Index: vi/v_search.c Prereq: 10.18 *** nvi-1.79/vi/v_search.c Fri Sep 20 08:42:44 1996 --- nvi-1.79-m17n/vi/v_search.c Thu Feb 20 00:09:39 1997 *************** *** 76,82 **** --- 76,87 ---- recno_t s_lno; size_t len, s_cno, tlen; int err, nb, type; + #ifndef MULTIBYTE char *cmd, *t, buf[20]; + #else + char *cmd, buf[20]; + CHAR_T *t; + #endif /* * !!! *************** *** 425,430 **** --- 430,438 ---- dir_t dir; MARK m; size_t len; + #ifdef MULTIBYTE + CHAR_T *p; + #endif /* * !!! *************** *** 500,515 **** * nonblank and end at column 0 of another line. */ if (vp->m_start.lno < vp->m_stop.lno && vp->m_stop.cno == 0) { if (db_get(sp, --vp->m_stop.lno, DBG_FATAL, NULL, &len)) return (1); vp->m_stop.cno = len ? len - 1 : 0; len = 0; if (nonblank(sp, vp->m_start.lno, &len)) return (1); if (vp->m_start.cno <= len) F_SET(vp, VM_LMODE); ! } else --vp->m_stop.cno; return (0); } --- 508,536 ---- * nonblank and end at column 0 of another line. */ if (vp->m_start.lno < vp->m_stop.lno && vp->m_stop.cno == 0) { + #ifndef MULTIBYTE if (db_get(sp, --vp->m_stop.lno, DBG_FATAL, NULL, &len)) return (1); vp->m_stop.cno = len ? len - 1 : 0; + #else + if (db_get(sp, --vp->m_stop.lno, DBG_FATAL, &p, &len)) + return (1); + vp->m_stop.cno = len ? len - multi_back(sp, p, &p[len]) : 0; + #endif /*MULTIBYTE*/ len = 0; if (nonblank(sp, vp->m_start.lno, &len)) return (1); if (vp->m_start.cno <= len) F_SET(vp, VM_LMODE); ! } else { ! #ifndef MULTIBYTE --vp->m_stop.cno; + #else + if (db_get(sp, vp->m_stop.lno, DBG_FATAL, &p, &len)) + return (1); + vp->m_stop.cno -= multi_back(sp, p, &p[vp->m_stop.cno]); + #endif /*MULTIBYTE*/ + } return (0); } Index: vi/v_section.c Prereq: 10.7 *** nvi-1.79/vi/v_section.c Sun Apr 28 00:21:27 1996 --- nvi-1.79-m17n/vi/v_section.c Wed Nov 27 01:10:36 1996 *************** *** 145,154 **** return (1); } ! ret1: if (db_get(sp, --lno, DBG_FATAL, NULL, &len)) return (1); vp->m_stop.lno = lno; vp->m_stop.cno = len ? len - 1 : 0; /* * Non-motion commands go to the end of the range. Delete and --- 145,163 ---- return (1); } ! ret1: ! #ifndef MULTICOLUMN ! if (db_get(sp, --lno, DBG_FATAL, NULL, &len)) ! #else ! if (db_get(sp, --lno, DBG_FATAL, &p, &len)) ! #endif return (1); vp->m_stop.lno = lno; + #ifndef MULTICOLUMN vp->m_stop.cno = len ? len - 1 : 0; + #else + vp->m_stop.cno = len ? len - multi_back(sp, p, &p[len]) : 0; + #endif /* * Non-motion commands go to the end of the range. Delete and *************** *** 244,251 **** --vp->m_start.lno; F_SET(vp, VM_LMODE); ! } else --vp->m_start.cno; vp->m_final = vp->m_stop; return (0); --- 253,267 ---- --vp->m_start.lno; F_SET(vp, VM_LMODE); ! } else { ! #ifndef MULTIBYTE --vp->m_start.cno; + #else + if (db_get(sp, vp->m_start.cno, 0, &p, NULL)) + return 1; + vp->m_start.cno -= multi_back(sp, p, &p[vp->m_start.cno]); + #endif + } vp->m_final = vp->m_stop; return (0); Index: vi/v_sentence.c Prereq: 10.7 *** nvi-1.79/vi/v_sentence.c Sun Apr 28 00:21:27 1996 --- nvi-1.79-m17n/vi/v_sentence.c Sat Nov 30 11:09:03 1996 *************** *** 51,56 **** --- 51,62 ---- * * PUBLIC: int v_sentencef __P((SCR *, VICMD *)); */ + #ifdef MULTIBYTE + /* + * XXX + * there should be a way to handle multibyte sentence termination chars. + */ + #endif /*MULTIBYTE*/ int v_sentencef(sp, vp) SCR *sp; *************** *** 86,98 **** --- 92,112 ---- } for (state = NONE;;) { + #ifndef MULTIBYTE if (cs_next(sp, &cs)) + #else + if (cs_multi_next(sp, &cs)) + #endif return (1); if (cs.cs_flags == CS_EOF) break; if (cs.cs_flags == CS_EOL) { if ((state == PERIOD || state == BLANK) && --cnt == 0) { + #ifndef MULTIBYTE if (cs_next(sp, &cs)) + #else + if (cs_multi_next(sp, &cs)) + #endif return (1); if (cs.cs_flags == 0 && isblank(cs.cs_ch) && cs_fblank(sp, &cs)) *************** *** 192,197 **** --- 206,217 ---- * * PUBLIC: int v_sentenceb __P((SCR *, VICMD *)); */ + #ifdef MULTIBYTE + /* + * XXX + * there should be a way to handle multibyte sentence termination chars. + */ + #endif /*MULTIBYTE*/ int v_sentenceb(sp, vp) SCR *sp; *************** *** 232,252 **** --- 252,284 ---- if (cs_bblank(sp, &cs)) return (1); for (;;) { + #ifndef MULTIBYTE if (cs_prev(sp, &cs)) + #else + if (cs_multi_prev(sp, &cs)) + #endif return (1); if (cs.cs_flags != CS_EOL) break; } } else if (cs.cs_flags == 0 && !isblank(cs.cs_ch)) for (;;) { + #ifndef MULTIBYTE if (cs_prev(sp, &cs)) + #else + if (cs_multi_prev(sp, &cs)) + #endif return (1); if (cs.cs_flags != 0 || isblank(cs.cs_ch)) break; } for (last = 0;;) { + #ifndef MULTIBYTE if (cs_prev(sp, &cs)) + #else + if (cs_multi_prev(sp, &cs)) + #endif return (1); if (cs.cs_flags == CS_SOF) /* SOF is a movement sink. */ break; *************** *** 279,285 **** --- 311,321 ---- * and special characters. */ do { + #ifndef MULTIBYTE if (cs_next(sp, &cs)) + #else + if (cs_multi_next(sp, &cs)) + #endif return (1); } while (!cs.cs_flags && (cs.cs_ch == ')' || cs.cs_ch == ']' || *************** *** 303,309 **** --- 339,349 ---- * and the sentence, it could be a real sentence. */ for (;;) { + #ifndef MULTIBYTE if (cs_prev(sp, &cs)) + #else + if (cs_multi_prev(sp, &cs)) + #endif return (1); if (cs.cs_flags == CS_EOL) continue; Index: vi/v_txt.c Prereq: 10.87 *** nvi-1.79/vi/v_txt.c Mon Oct 14 03:25:23 1996 --- nvi-1.79-m17n/vi/v_txt.c Mon Jun 16 11:21:40 1997 *************** *** 30,35 **** --- 30,38 ---- #include "../common/common.h" #include "vi.h" + /* for CS_RAW0 */ + #include "../common/multibyte.h" + static int txt_abbrev __P((SCR *, TEXT *, CHAR_T *, int, int *, int *)); static void txt_ai_resolve __P((SCR *, TEXT *, int *)); static TEXT *txt_backup __P((SCR *, TEXTH *, TEXT *, u_int32_t *)); *************** *** 40,45 **** --- 43,51 ---- static int txt_fc_col __P((SCR *, int, ARGS **)); static int txt_hex __P((SCR *, TEXT *)); static int txt_insch __P((SCR *, TEXT *, CHAR_T *, u_int)); + #ifdef MULTIBYTE + static int txt_insmbch __P((SCR *, TEXT *, CHAR_T *, u_int)); + #endif static int txt_isrch __P((SCR *, VICMD *, TEXT *, u_int8_t *)); static int txt_map_end __P((SCR *)); static int txt_map_init __P((SCR *)); *************** *** 281,287 **** --- 287,305 ---- int showmatch; /* Showmatch set on this character. */ int wm_set, wm_skip; /* Wrapmargin happened, blank skip flags. */ int max, tmp; + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif + #ifdef MULTIBYTE + CHAR_T mbbuf[20]; + CHAR_T mbbuflen; + CHAR_T mbbufmax; + size_t mbtmp; + + mbbuflen = mbbufmax = 0; + #endif /*MULTIBYTE*/ gp = sp->gp; vip = VIP(sp); *************** *** 332,339 **** --- 350,364 ---- */ if (len) { if (LF_ISSET(TXT_OVERWRITE)) { + #ifndef MULTIBYTE tp->owrite = (tm->cno - tp->cno) + 1; tp->insert = (len - tm->cno) - 1; + #else + tp->owrite = (tm->cno - tp->cno) + + KEY_BLEN(sp, tp->lb[tm->cno]); + tp->insert = (len - tm->cno) + - KEY_BLEN(sp, tp->lb[tm->cno]); + #endif /*MULTIBYTE*/ } else tp->insert = len - tp->cno; *************** *** 532,537 **** --- 557,568 ---- goto k_escape; } + #ifdef MULTIBYTE + /* multibyte chars must go through */ + if (mbbufmax) + evp->e_value = 0; + #endif /*MULTIBYTE*/ + /* * !!! * If the first character of the input is a nul, replay the previous *************** *** 918,925 **** * Set the return cursor position to rest on the last * inserted character. */ ! if (tp->cno != 0) --tp->cno; /* Update the last line. */ if (vs_change(sp, tp->lno, LINE_RESET)) --- 949,961 ---- * Set the return cursor position to rest on the last * inserted character. */ ! if (tp->cno != 0) { ! #ifndef MULTIBYTE --tp->cno; + #else + tp->cno -= multi_back(sp, tp->lb, &tp->lb[tp->cno]); + #endif + } /* Update the last line. */ if (vs_change(sp, tp->lno, LINE_RESET)) *************** *** 1007,1013 **** --- 1043,1054 ---- } /* Drop back one character. */ + #ifndef MULTIBYTE --tp->cno; + #else + mbtmp = multi_back(sp, tp->lb, &tp->lb[tp->cno]); + tp->cno -= mbtmp; + #endif /*MULTIBYTE*/ /* * Historically, vi didn't replace the erased characters with *************** *** 1019,1026 **** * point in the screen. So, if incrementally searching, erase * the erased characters from the screen. */ ! if (FL_ISSET(is_flags, IS_RUNNING)) tp->lb[tp->cno] = ' '; /* * Increment overwrite, decrement ai if deleted. --- 1060,1076 ---- * point in the screen. So, if incrementally searching, erase * the erased characters from the screen. */ ! if (FL_ISSET(is_flags, IS_RUNNING)) { ! #ifndef MULTIBYTE tp->lb[tp->cno] = ' '; + #else + size_t off, blen; + + blen = KEY_BLEN(sp, tp->lb[tp->cno]); + for (off = 0; off < blen; off++) + tp->lb[tp->cno + off] = ' '; + #endif /*MULTIBYTE*/ + } /* * Increment overwrite, decrement ai if deleted. *************** *** 1030,1038 **** --- 1080,1094 ---- * to delete autoindent characters. We do. Eat hot death, * POSIX. */ + #ifndef MULTIBYTE ++tp->owrite; if (tp->cno < tp->ai) --tp->ai; + #else + tp->owrite += mbtmp; + if (tp->cno < tp->ai) + tp->ai -= mbtmp; + #endif /* Reset if we deleted an incremental search character. */ if (FL_ISSET(is_flags, IS_RUNNING)) *************** *** 1102,1108 **** * Overwrite erased characters if doing incremental search; * see comment above. */ ! if (LF_ISSET(TXT_TTYWERASE)) while (tp->cno > max) { --tp->cno; ++tp->owrite; --- 1158,1165 ---- * Overwrite erased characters if doing incremental search; * see comment above. */ ! if (LF_ISSET(TXT_TTYWERASE)) { ! #ifndef MULTIBYTE while (tp->cno > max) { --tp->cno; ++tp->owrite; *************** *** 1111,1125 **** if (isblank(tp->lb[tp->cno - 1])) break; } ! else { if (LF_ISSET(TXT_ALTWERASE)) { --tp->cno; ++tp->owrite; if (FL_ISSET(is_flags, IS_RUNNING)) tp->lb[tp->cno] = ' '; if (isblank(tp->lb[tp->cno - 1])) break; } if (tp->cno > max) tmp = inword(tp->lb[tp->cno - 1]); while (tp->cno > max) { --- 1168,1217 ---- if (isblank(tp->lb[tp->cno - 1])) break; } ! #else ! size_t blen; ! size_t off; ! ! blen = multi_back(sp, tp->lb, &tp->lb[tp->cno]); ! while (tp->cno > max) { ! tp->cno -= blen; ! tp->owrite += blen; ! if (FL_ISSET(is_flags, IS_RUNNING)) { ! for (off = 0; off < blen; off++) ! tp->lb[tp->cno + off] = ' '; ! } ! off = multi_back(sp, tp->lb, &tp->lb[tp->cno]); ! if (isblank(tp->lb[tp->cno - off])) ! break; ! blen = off; ! } ! #endif /*MULTIBYTE*/ ! } else { if (LF_ISSET(TXT_ALTWERASE)) { + #ifndef MULTIBYTE --tp->cno; ++tp->owrite; if (FL_ISSET(is_flags, IS_RUNNING)) tp->lb[tp->cno] = ' '; if (isblank(tp->lb[tp->cno - 1])) break; + #else + size_t blen; + size_t off; + + blen = multi_back(sp, tp->lb, &tp->lb[tp->cno]); + tp->cno -= blen; + tp->owrite += blen; + if (FL_ISSET(is_flags, IS_RUNNING)) { + for (off = 0; off < blen; off++) + tp->lb[tp->cno + off] = ' '; + } + blen = multi_back(sp, tp->lb, &tp->lb[tp->cno]); + if (isblank(tp->lb[tp->cno - blen])) + break; + #endif /*MULTIBYTE*/ } + #ifndef MULTIBYTE if (tp->cno > max) tmp = inword(tp->lb[tp->cno - 1]); while (tp->cno > max) { *************** *** 1131,1136 **** --- 1223,1270 ---- || isblank(tp->lb[tp->cno - 1])) break; } + #else + { + size_t blen; + size_t off; + + blen = multi_back(sp, tp->lb, &tp->lb[tp->cno]); + if (blen == 1) { + if (tp->cno > max) + tmp = inword(tp->lb[tp->cno - 1]); + while (tp->cno > max) { + --tp->cno; + ++tp->owrite; + if (FL_ISSET(is_flags, IS_RUNNING)) + tp->lb[tp->cno] = ' '; + blen = multi_back(sp, tp->lb, + &tp->lb[tp->cno]); + if (1 < blen) + break; + if (tmp != inword(tp->lb[tp->cno - 1]) + || isblank(tp->lb[tp->cno - 1])) + break; + } + } else { + u_int ochclass, chclass; + + if (tp->cno > max) + ochclass = multi_chclass(&tp->lb[tp->cno - blen], 0); + while (tp->cno > max) { + tp->cno -= blen; + tp->owrite += blen; + if (FL_ISSET(is_flags, IS_RUNNING)) { + for (off = 0; off < blen; off++) + tp->lb[tp->cno + off] = ' '; + } + blen = multi_back(sp, tp->lb, &tp->lb[tp->cno]); + chclass = multi_chclass(&tp->lb[tp->cno - blen], ochclass); + if (multi_wordbound(ochclass, chclass, 0)) + break; + } + } + } + #endif } /* Reset if we deleted an incremental search character. */ *************** *** 1247,1252 **** --- 1381,1447 ---- hexcnt = 1; goto insq_ch; default: /* Insert the character. */ + #ifdef MULTIBYTE + if (!mbbufmax) { + if (!(evp->e_c & 0x80)) + goto ins_ch; + + /* + * start buffering multibyte chars. + */ + mbbuflen = 0; + mbbufmax = KEY_BLEN(sp, evp->e_c); + mbbuf[mbbuflen++] = evp->e_c; + mbbuf[mbbuflen] = '\0'; + } else { + /* + * multibyte chars must go through. + */ + if (mbbufmax < mbbuflen) + abort(); + mbbuf[mbbuflen++] = evp->e_c; + mbbuf[mbbuflen] = '\0'; + if (mbbuflen == mbbufmax) { + mbbufmax = mbbuflen = 0; + goto ins_mbch; + } + } + break; + + /* + * Insert multibyte char. + */ + ins_mbch: if (txt_insmbch(sp, tp, mbbuf, flags)) + goto err; + + /* + * Check to see if we've crossed the margin. + * + * !!! + * In the historic vi, the wrapmargin value was figured out + * using the display widths of the characters, i.e. + * characters were counted as two characters if the list edit + * option is set, but as the tabstop edit option number of + * characters otherwise. That's what the vs_column() function + * gives us, so we use it. + */ + if (margin != 0) { + if (vs_column(sp, &tcol)) + goto err; + if (tcol >= margin) { + if (txt_margin(sp, tp, &wmt, &tmp, flags)) + goto err; + if (tmp) { + if (isblank(evp->e_c)) + wm_skip = 1; + wm_set = 1; + goto k_cr; + } + } + } + + goto ebuf_chk; + #endif /*MULTIBYTE*/ ins_ch: /* * Historically, vi eliminated nul's out of hand. If the * beautify option was set, it also deleted any unknown *************** *** 1475,1480 **** --- 1670,1678 ---- CHAR_T ch, *p; SEQ *qp; size_t len, off; + #ifdef MULTIBYTE + size_t mback; + #endif /* Check to make sure we're not at the start of an append. */ *didsubp = 0; *************** *** 1503,1522 **** --- 1701,1742 ---- * Terminate at the beginning of the insert or the character after the * offset character -- both can be tested for using tp->offset. */ + #ifndef MULTIBYTE off = tp->cno - 1; /* Previous character. */ + #else + off = tp->cno - multi_back(sp, tp->lb, &tp->lb[tp->cno]); + /* Previous character. */ + #endif /*MULTIBYTE*/ p = tp->lb + off; len = 1; /* One character test. */ if (off == tp->offset || isblank(p[-1])) goto search; + #ifndef MULTIBYTE if (inword(p[-1])) /* Move backward to change. */ + #else + if (multi_back(sp, tp->lb, p) == 1 && inword(p[-1])) + #endif for (;;) { --off; --p; ++len; + #ifdef MULTIBYTE + if (1 < multi_back(sp, tp->lb, p)) + break; + #endif /*MULTIBYTE*/ if (off == tp->offset || !inword(p[-1])) break; } else for (;;) { + #ifndef MULTIBYTE --off; --p; ++len; + #else + mback = multi_back(sp, tp->lb, p); + off -= mback; + p -= mback; + len += mback; + if (1 < multi_back(sp, tp->lb, p)) + break; + #endif /*MULTIBYTE*/ if (off == tp->offset || inword(p[-1]) || isblank(p[-1])) break; *************** *** 1641,1647 **** --- 1861,1871 ---- u_int32_t *ec_flagsp; { size_t len, off; + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif /* Find the beginning of this "word". */ for (off = tp->cno - 1, p = tp->lb + off, len = 0;; --p, --off) { *************** *** 1686,1692 **** --- 1910,1920 ---- u_long ts; int del; size_t cno, len, new, old, scno, spaces, tab_after_sp, tabs; + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif *changedp = 0; *************** *** 1775,1781 **** --- 2003,2013 ---- size_t len; { size_t nlen; + #ifndef MULTIBYTE char *p, *t; + #else + CHAR_T *p, *t; + #endif if (aitp == NULL) { /* *************** *** 2014,2020 **** --- 2246,2256 ---- EXCMD cmd; size_t indx, len, nlen, off; int argc, trydir; + #ifndef MULTIBYTE char *p, *t; + #else + CHAR_T *p, *t; + #endif trydir = 0; *redrawp = 0; *************** *** 2278,2287 **** --- 2514,2562 ---- { CHAR_T ch, *kp; size_t chlen, nlen, olen; + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif ch = CH_ENDMARK; + #ifdef MULTIBYTE + /* + * Multibyte case. + * We do need to care about multibyte chars. Hard one. + * We don't change screen width by filling the character by set of $s. + * We might need to change buffer for that. + * + * appearance buffer + * --- -- + * n = KEY_LEN(sp, tp->lb[cno]) KEY_BLEN(sp, tp->lb[cno]) + * v v + * 1 * n 1 * n + */ + if (1 < KEY_BLEN(sp, tp->lb[cno])) { + size_t nblen, oblen; + nlen = olen = KEY_LEN(sp, tp->lb[cno]); + nblen = KEY_LEN(sp, tp->lb[cno]); + oblen = KEY_BLEN(sp, tp->lb[cno]); + + if (nblen != oblen) { + BINC_RET(sp, tp->lb, tp->lb_len, tp->len - oblen + nblen); + if (tp->insert != 0) + memmove(tp->lb + cno + nblen, + tp->lb + cno + oblen, tp->insert); + + tp->len += (nblen - oblen); + tp->owrite += (nblen - oblen); + } + for (chlen = 0; chlen < nblen; chlen++) + tp->lb[cno + chlen] = ch; + + goto done; + } + #endif /*MULTIBYTE*/ + /* * The end mark may not be the same size as the current character. * Don't let the line shift. *************** *** 2315,2321 **** --- 2590,2600 ---- cno += chlen; chlen--;) *p++ = *kp++; } + tp->lb[cno] = ch; + #ifdef MULTIBYTE + done: + #endif return (vs_change(sp, tp->lno, LINE_RESET)); } *************** *** 2405,2411 **** --- 2684,2692 ---- /* Adjust the bookkeeping. */ tp->cno -= len; tp->len -= len; + #ifndef MULTIBYTE tp->lb[tp->cno - 1] = value; + #endif /* Copy down any overwrite characters. */ if (tp->owrite) *************** *** 2416,2421 **** --- 2697,2713 ---- memmove(tp->lb + tp->cno + tp->owrite, tp->lb + tp->cno + tp->owrite + len, tp->insert); + #ifdef MULTIBYTE + if (value & 0x80) { + CHAR_T ch; + ch = ' '; + (void)txt_insch(sp, tp, &ch, 0); + tp->lb[tp->cno - 2] = CS_RAW0 + v_key_len(sp, value); + tp->lb[tp->cno - 1] = value & 0x7f; + } else + tp->lb[tp->cno - 1] = value & 0x7f; + #endif + return (0); } *************** *** 2438,2443 **** --- 2730,2736 ---- * vi overwrite characters the user has committed to changing, on the basis * of the screen space they require, but that it not overwrite other characters. */ + #ifndef MULTIBYTE static int txt_insch(sp, tp, chp, flags) SCR *sp; *************** *** 2549,2554 **** --- 2842,3042 ---- tp->lb[tp->cno++] = *chp; return (0); } + #else + static int + txt_insch(sp, tp, chp, flags) + SCR *sp; + TEXT *tp; + CHAR_T *chp; + u_int flags; + { + CHAR_T buf[2]; + + buf[0] = *chp; + buf[1] = '\0'; + return txt_insmbch(sp, tp, buf, flags); + } + + static int + txt_insmbch(sp, tp, chp, flags) + SCR *sp; + TEXT *tp; + CHAR_T *chp; + u_int flags; + { + CHAR_T *kp, savech; + size_t chlen, cno, olen, nlen; + char *p; + size_t oblen, nblen; + size_t owriteblen, owritelen; + + nblen = KEY_BLEN(sp, chp[0]); + owriteblen = owritelen = 0; + /* + * What we have to care about: + * 1. relationship between nblen and owrite. + * a. if owrite = 0, that's fine. + * b. if nblen < owrite, that's fine too. + * c. if owrite < nblen, it would be very hard. + */ + /* + * The 'R' command does one-for-one replacement, because there's + * no way to know how many characters the user intends to replace. + */ + if (LF_ISSET(TXT_REPLACE)) { + if (tp->owrite) { + oblen = KEY_BLEN(sp, tp->lb[tp->cno]); + if (tp->owrite < oblen) { + /* + * Seems illegal. Part of multibyte char + * is target for overwrite. + * We die for now. + */ + abort(); + } + + /* + * Adjust buffer since the currently existing char + * has different bytewidth with the overwriting one. + */ + if (oblen != nblen) { + if (oblen < nblen) { + BINC_RET(sp, tp->lb, tp->lb_len, + tp->len + (nblen - oblen)); + } + memmove(tp->lb + tp->cno + nblen, + tp->lb + tp->cno + oblen, + tp->len - tp->cno - oblen); + tp->len += (nblen - oblen); + } + + /* + * Let me overwrite. + */ + tp->owrite -= oblen; + memmove(&tp->lb[tp->cno], chp, nblen); + tp->cno += nblen; + return 0; + } + } else if (tp->owrite) { /* Overwrite a character. */ + cno = tp->cno; + + /* + * If the old or new characters are tabs, then the length of the + * display depends on the character position in the display. We + * don't even try to handle this here, just ask the screen. + */ + if (*chp == '\t') { + savech = tp->lb[cno]; + tp->lb[cno] = '\t'; + (void)vs_columns(sp, tp->lb, tp->lno, &cno, &nlen); + tp->lb[cno] = savech; + } else + nlen = KEY_LEN(sp, *chp); + + /* + * Eat overwrite characters until we run out of them or we've + * handled the length of the new character. If we only eat + * part of an overwrite character, break it into its component + * elements and display the remaining components. + */ + while (owritelen < nlen && owriteblen < tp->owrite) { + /* + * Set oblen and olen by the current char. + */ + oblen = KEY_BLEN(sp, tp->lb[cno]); + if (tp->lb[cno] == '\t') + (void)vs_columns(sp, + tp->lb, tp->lno, &cno, &olen); + else + olen = KEY_LEN(sp, tp->lb[cno]); + + if (tp->owrite - owriteblen < oblen) { + /* + * Seems illegal. Part of multibyte char + * is target for overwrite. + * We die for now. + */ + abort(); + } + + if (olen <= nlen - owritelen) { + /* + * We will overwrite this character as a whole. + * Continue overwrite toward next char. + */ + owritelen += olen; + owriteblen += oblen; + cno += oblen; + continue; + } + + /* + * We must partially overwrite this character. + * Split the current char into single-bytes. + * + * before after + * --- --- + * LEN olen olen + * BLEN oblen olen + */ + if (oblen < olen) { + BINC_RET(sp, tp->lb, tp->lb_len, + tp->len + olen - oblen); + } + memmove(tp->lb + cno + olen, tp->lb + cno + oblen, + tp->owrite - oblen + tp->insert); + tp->len += (olen - oblen); + tp->owrite += (olen - oblen); + + if (tp->lb[cno] == '\t' || 1 < oblen) { + p = tp->lb + cno; + for (chlen = 0; chlen < olen; chlen++) + *p++ = ' '; + } else { + p = tp->lb + cno; + kp = KEY_NAME(sp, tp->lb[cno]); + for (chlen = 0; chlen < olen; chlen++) + *p++ = *kp++; + } + + cno += (nlen - owritelen); + owriteblen += (nlen - owritelen); + owritelen = nlen; + } + + /* + * If we had enough overwrite characters, we're done. + * simply overwrite that. + */ + if (nlen == owritelen) { + memmove(tp->lb + tp->cno + nblen, + tp->lb + tp->cno + owriteblen, + tp->owrite - owriteblen + tp->insert); + tp->len += (nblen - owriteblen); + memcpy(tp->lb + tp->cno, chp, nblen); + tp->cno += nblen; + tp->owrite -= owriteblen; + return 0; + } + } + + /* Check to see if the character fits into the input buffer. */ + if (owritelen < nblen) + BINC_RET(sp, tp->lb, tp->lb_len, tp->len + nblen - owriteblen); + + if (tp->insert) { /* Insert a character. */ + memmove(tp->lb + tp->cno + nblen, + tp->lb + tp->cno + owriteblen, + tp->owrite - owriteblen + tp->insert); + } + memcpy(tp->lb + tp->cno, chp, nblen); + tp->cno += nblen; + tp->owrite -= owriteblen; + tp->len += (nblen - owriteblen); + return 0; + } + #endif /*MULTIBYTE*/ /* * txt_isrch -- *************** *** 2743,2749 **** --- 3231,3243 ---- GS *gp; VCS cs; MARK m; + #ifndef MULTIBYTE int cnt, endc, startc; + #else + /* why endc and startc has to be int? */ + int cnt; + CHAR_T endc, startc; + #endif /*MULTIBYTE*/ gp = sp->gp; *************** *** 2771,2777 **** --- 3265,3275 ---- /* Search for the match. */ for (cnt = 1;;) { + #ifndef MULTIBYTE if (cs_prev(sp, &cs)) + #else + if (cs_multi_prev(sp, &cs)) + #endif return (1); if (cs.cs_flags != 0) { if (cs.cs_flags == CS_EOF || cs.cs_flags == CS_SOF) { *************** *** 2813,2821 **** --- 3311,3329 ---- { VI_PRIVATE *vip; size_t len, off; + #ifndef MULTIBYTE char *p, *wp; + #else + CHAR_T *p, *wp; + #endif + #ifdef MULTIBYTE + size_t mback; + int western; + u_int ochclass, chclass; + #endif /* Find the nearest previous blank. */ + #ifndef MULTIBYTE for (off = tp->cno - 1, p = tp->lb + off, len = 0;; --off, --p, ++len) { if (isblank(*p)) { wp = p + 1; *************** *** 2836,2841 **** --- 3344,3396 ---- return (0); } } + #else + /* + * When we divide the words, we have several possibilities. + * 1. blank character + * 2. word boundary of non-western character stream + * 3. boundary between western chars and non-western chars + */ + off = tp->cno - multi_back(sp, tp->lb, &tp->lb[tp->cno]); + p = tp->lb + off; + western = multi_iswestern(sp, *p); + ochclass = multi_chclass(p, 0); + wp = NULL; + len = 0; + while (1) { + chclass = multi_chclass(p, ochclass); + + if (isblank(*p)) { + wp = p + 1; + break; + } + + if (multi_Wordbound(ochclass, chclass, 0)) { + wp = p + KEY_BLEN(sp, *p); + break; + } + + /* + * If reach the start of the line, there's nowhere to break. + * + * !!! + * Historic vi belled each time a character was entered after + * crossing the margin until a space was entered which could + * be used to break the line. I don't as it tends to wake the + * cats. + */ + if (off == tp->ai || off == tp->offset) { + *didbreak = 0; + return (0); + } + + mback = multi_back(sp, tp->lb, &tp->lb[off]); + off -= mback; + p -= mback; + ochclass = chclass; + } + len = tp->cno - (wp - tp->lb); + #endif /*MULTIBYTE*/ /* * Store saved information about the rest of the line in the *************** *** 2848,2854 **** --- 3403,3413 ---- * move to the new line. */ vip = VIP(sp); + #ifndef MULTIBYTE wmtp->lb = p + 1; + #else + wmtp->lb = wp; + #endif wmtp->offset = len; wmtp->insert = LF_ISSET(TXT_APPENDEOL) ? tp->insert - 1 : tp->insert; wmtp->owrite = tp->owrite; *************** *** 2868,2873 **** --- 3427,3433 ---- * !!! * Delete any trailing whitespace from the current line. */ + #ifndef MULTIBYTE for (;; --p, --off) { if (!isblank(*p)) break; *************** *** 2876,2881 **** --- 3436,3459 ---- if (off == tp->ai || off == tp->offset) break; } + #else + while (1) { + if (!isblank(*p)) + break; + + mback = multi_back(sp, tp->lb, &tp->lb[tp->cno]); + tp->cno -= mback; + mback = multi_back(sp, tp->lb, &tp->lb[tp->len]); + tp->len -= mback; + + if (off == tp->ai || off == tp->offset) + break; + + mback = multi_back(sp, tp->lb, &tp->lb[off]); + p -= mback; + off -= mback; + } + #endif /*MULTIBYTE*/ *didbreak = 1; return (0); } *************** *** 2893,2899 **** --- 3471,3481 ---- { TEXT *ttp; size_t input_len, retain; + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif /* * Check to make sure that the cursor hasn't moved beyond *************** *** 2902,2907 **** --- 3484,3490 ---- if (tp->owrite == 0) return; + #ifndef MULTIBYTE /* * Calculate how many characters the user has entered, * plus the blanks erased by /s. *************** *** 2936,2941 **** --- 3519,3555 ---- tp->owrite = 0; tp->insert += retain; } + #else + /* + * Since R command in multibyte case does overwrite multibyte char + * by 1-byte char (and other way around too), it is not very trivial + * to understand the portion of old line buffer to be preserved. + * + * The key is that we overwrite character by character, regardess + * of their bytewidth. If we sum up the bytewidth, we can understand + * how many bytes has been prepared as new text, and how many bytes + * has been overwritten by the new text. We will replace overwritten + * portion of the new text string. + */ + { + size_t ocol; + size_t olen; + size_t ncol; + + if (db_get(sp, + tiqh->cqh_first->lno, DBG_FATAL | DBG_NOCACHE, &p, &olen)) + return; + ocol = ncol = 0; + while (ncol < tp->cno) { + ncol += KEY_BLEN(sp, tp->lb[ncol]); + ocol += KEY_BLEN(sp, p[ocol]); + } + memcpy(tp->lb + tp->cno, p + ocol, olen - ocol); + tp->len -= tp->owrite - (olen - ocol); + tp->owrite = 0; + tp->insert += (olen - ocol); + } + #endif /*MULTIBYTE*/ } /* Index: vi/v_ulcase.c Prereq: 10.7 *** nvi-1.79/vi/v_ulcase.c Sun Apr 28 00:21:27 1996 --- nvi-1.79-m17n/vi/v_ulcase.c Fri Feb 21 22:19:19 1997 *************** *** 54,60 **** --- 54,67 ---- recno_t lno; size_t cno, lcnt, len; u_long cnt; + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif + #ifdef MULTIBYTE + size_t i; + #endif lno = vp->m_start.lno; cno = vp->m_start.cno; *************** *** 77,82 **** --- 84,90 ---- continue; } + #ifndef MULTIBYTE if (cno + cnt >= len) { lcnt = len - 1; cnt -= len - cno; *************** *** 88,93 **** --- 96,123 ---- vp->m_final.cno = lcnt + 1; } + #else + { + size_t i; + + i = 0; + lcnt = cno; + while (i < cnt && lcnt < len) { + i++; + lcnt += KEY_BLEN(sp, p[lcnt]); + } + + if (len <= lcnt) { + lcnt = len - multi_back(sp, p, &p[len]); + vp->m_final.cno = lcnt; + cnt -= i; + } else { + vp->m_final.cno = lcnt; + cnt -= i; + lcnt -= multi_back(sp, p, &p[lcnt]); + } + } + #endif /*MULTIBYTE*/ if (ulcase(sp, lno, p, len, cno, lcnt)) return (1); *************** *** 169,174 **** --- 199,214 ---- *p = tolower(ch); change = 1; } + #ifdef MULTIBYTE + /* + * XXX + * there should be a way to define case-conversion function + * for multibyte chars. + */ + else if (1 < KEY_BLEN(sp, ch)) { + p += (KEY_BLEN(sp, ch) - 1); /*1 more at for loop*/ + } + #endif } if (change && db_set(sp, lno, bp, len)) Index: vi/v_util.c Prereq: 10.11 *** nvi-1.79/vi/v_util.c Mon Jul 1 06:50:34 1996 --- nvi-1.79-m17n/vi/v_util.c Thu Feb 20 00:08:37 1997 *************** *** 65,77 **** --- 65,88 ---- MARK *mp; { size_t len; + #ifdef MULTIBYTE + char *p; + #endif if (mp == NULL) v_emsg(sp, NULL, VIM_EOL); else { + #ifndef MULTIBYTE if (db_get(sp, mp->lno, DBG_FATAL, NULL, &len)) + #else + if (db_get(sp, mp->lno, DBG_FATAL, &p, &len)) + #endif return; + #ifndef MULTIBYTE if (mp->cno == len - 1) + #else + if (mp->cno == len - multi_back(sp, p, &p[len])) + #endif v_emsg(sp, NULL, VIM_EOL); else msgq(sp, M_BERR, "196|Movement past the end-of-line"); *************** *** 125,135 **** --- 136,154 ---- * v_isempty -- * Return if the line contains nothing but white-space characters. * + * PUBLIC: #ifndef MULTIBYTE * PUBLIC: int v_isempty __P((char *, size_t)); + * PUBLIC: #else + * PUBLIC: int v_isempty __P((CHAR_T *, size_t)); + * PUBLIC: #endif */ int v_isempty(p, len) + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif size_t len; { for (; len--; ++p) Index: vi/v_word.c Prereq: 10.5 *** nvi-1.79/vi/v_word.c Sun Apr 28 00:21:27 1996 --- nvi-1.79-m17n/vi/v_word.c Fri Feb 21 22:20:45 1997 *************** *** 111,116 **** --- 111,119 ---- enum { INWORD, NOTWORD } state; VCS cs; u_long cnt; + #ifdef MULTIBYTE + u_int ochclass, chclass; + #endif cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cs.cs_lno = vp->m_start.lno; *************** *** 148,161 **** --- 151,200 ---- */ if (type == BIGWORD) while (cnt--) { + #ifdef MULTIBYTE + if (cs.cs_flags != 0 || KEY_BLEN(sp, cs.cs_ch) == 1) + goto Singlebyte; + + /* + * Multibyte case. + * It is not very good to peep VCS structure directly, + * but it is the fastest and easiest way. + */ + ochclass = multi_chclass(&cs.cs_bp[cs.cs_cno], 0); + for (;;) { + if (cs_multi_next(sp, &cs)) + return 1; + if (cs.cs_flags == CS_EOF) + goto ret; + if (cs.cs_flags != 0 + || KEY_BLEN(sp, cs.cs_ch) == 1) + goto Taileater; + chclass = multi_chclass(&cs.cs_bp[cs.cs_cno], ochclass); + if (multi_Wordbound(ochclass, chclass, 1)) + goto Taileater; + ochclass = chclass; + } + Singlebyte:; + #endif /*MULTIBYTE*/ for (;;) { + #ifndef MULTIBYTE if (cs_next(sp, &cs)) + #else + if (cs_multi_next(sp, &cs)) + #endif return (1); if (cs.cs_flags == CS_EOF) goto ret; if (cs.cs_flags != 0 || isblank(cs.cs_ch)) break; + #ifdef MULTIBYTE + if (1 < KEY_BLEN(sp, cs.cs_ch)) + break; + #endif /*MULTIBYTE*/ } + #ifdef MULTIBYTE + Taileater:; + #endif /* * If a motion command and we're at the end of the * last word, we're done. Delete and yank eat any *************** *** 171,192 **** --- 210,271 ---- } /* Eat whitespace characters. */ + #ifndef MULTIBYTE if (cs_fblank(sp, &cs)) return (1); + #else + if (cs.cs_flags == 0 && 1 < KEY_BLEN(sp, cs.cs_ch)) + continue; + if (isblank(cs.cs_ch) && cs_fblank(sp, &cs)) + return (1); + #endif /*MULTIBYTE*/ if (cs.cs_flags == CS_EOF) goto ret; } else while (cnt--) { + #ifdef MULTIBYTE + if (cs.cs_flags != 0 || KEY_BLEN(sp, cs.cs_ch) == 1) + goto singlebyte; + + /* + * Multibyte case. + * It is not very good to peep VCS structure directly, + * but it is the fastest and easiest way. + */ + ochclass = multi_chclass(&cs.cs_bp[cs.cs_cno], 0); + for (;;) { + if (cs_multi_next(sp, &cs)) + return 1; + if (cs.cs_flags == CS_EOF) + goto ret; + if (cs.cs_flags != 0 + || KEY_BLEN(sp, cs.cs_ch) == 1) + goto taileater; + chclass = multi_chclass(&cs.cs_bp[cs.cs_cno], ochclass); + if (multi_wordbound(ochclass, chclass, 1)) + goto taileater; + ochclass = chclass; + } + singlebyte:; + #endif /*MULTIBYTE*/ state = cs.cs_flags == 0 && inword(cs.cs_ch) ? INWORD : NOTWORD; for (;;) { + #ifndef MULTIBYTE if (cs_next(sp, &cs)) + #else + if (cs_multi_next(sp, &cs)) + #endif return (1); if (cs.cs_flags == CS_EOF) goto ret; if (cs.cs_flags != 0 || isblank(cs.cs_ch)) break; + #ifdef MULTIBYTE + if (1 < KEY_BLEN(sp, cs.cs_ch)) + break; + #endif /*MULTIBYTE*/ if (state == INWORD) { if (!inword(cs.cs_ch)) break; *************** *** 194,199 **** --- 273,281 ---- if (inword(cs.cs_ch)) break; } + #ifdef MULTIBYTE + taileater:; + #endif /* See comment above. */ if (cnt == 0 && ISMOTION(vp)) { if ((ISCMD(vp->rkp, 'd') || *************** *** 204,209 **** --- 286,295 ---- } /* Eat whitespace characters. */ + #ifdef MULTIBYTE + if (cs.cs_flags == 0 && 1 < KEY_BLEN(sp, cs.cs_ch)) + continue; + #endif /*MULTIBYTE*/ if (cs.cs_flags != 0 || isblank(cs.cs_ch)) if (cs_fblank(sp, &cs)) return (1); *************** *** 227,233 **** --- 313,329 ---- vp->m_stop.lno = cs.cs_lno; vp->m_stop.cno = cs.cs_cno; if (ISMOTION(vp) && cs.cs_flags == 0) + #ifndef MULTIBYTE --vp->m_stop.cno; + #else + { + char *p; + if (db_eget(sp, vp->m_stop.lno, &p, NULL, NULL)) + return 1; + vp->m_stop.cno -= multi_back(sp, (CHAR_T *)p, + (CHAR_T *)&p[vp->m_stop.cno]); + } + #endif /*MULTIBYTE*/ /* * Non-motion commands move to the end of the range. Delete *************** *** 278,283 **** --- 374,382 ---- enum { INWORD, NOTWORD } state; VCS cs; u_long cnt; + #ifdef MULTIBYTE + u_int ochclass, chclass; + #endif cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cs.cs_lno = vp->m_start.lno; *************** *** 292,298 **** --- 391,401 ---- * past the current one, it sets word "state" for the 'e' command. */ if (cs.cs_flags == 0 && !isblank(cs.cs_ch)) { + #ifndef MULTIBYTE if (cs_next(sp, &cs)) + #else + if (cs_multi_next(sp, &cs)) + #endif return (1); if (cs.cs_flags == 0 && !isblank(cs.cs_ch)) goto start; *************** *** 308,349 **** --- 411,532 ---- */ start: if (type == BIGWORD) while (cnt--) { + #ifdef MULTIBYTE + if (cs.cs_flags != 0 || KEY_BLEN(sp, cs.cs_ch) == 1) + goto Singlebyte; + + /* + * Multibyte case. + * It is not very good to peep VCS structure directly, + * but it is the fastest and easiest way. + */ + ochclass = multi_chclass(&cs.cs_bp[cs.cs_cno], 0); for (;;) { + if (cs_multi_next(sp, &cs)) + return 1; + if (cs.cs_flags == CS_EOF) + goto ret; + if (cs.cs_flags != 0 + || KEY_BLEN(sp, cs.cs_ch) == 1) + goto Taileater; + chclass = multi_chclass(&cs.cs_bp[cs.cs_cno], ochclass); + if (multi_Wordbound(ochclass, chclass, 1)) + goto Taileater; + ochclass = chclass; + } + Singlebyte:; + #endif /*MULTIBYTE*/ + for (;;) { + #ifndef MULTIBYTE if (cs_next(sp, &cs)) + #else + if (cs_multi_next(sp, &cs)) + #endif return (1); if (cs.cs_flags == CS_EOF) goto ret; if (cs.cs_flags != 0 || isblank(cs.cs_ch)) break; + #ifdef MULTIBYTE + if (1 < KEY_BLEN(sp, cs.cs_ch)) + break; + #endif /*MULTIBYTE*/ } + #ifdef MULTIBYTE + Taileater:; + #endif /* * When we reach the start of the word after the last * word, we're done. If we changed state, back up one * to the end of the previous word. */ if (cnt == 0) { + #ifndef MULTIBYTE if (cs.cs_flags == 0 && cs_prev(sp, &cs)) + #else + if (cs.cs_flags == 0 && cs_multi_prev(sp, &cs)) + #endif return (1); break; } /* Eat whitespace characters. */ + #ifndef MULTIBYTE if (cs_fblank(sp, &cs)) return (1); + #else + if (cs.cs_flags == 0 && 1 < KEY_BLEN(sp, cs.cs_ch)) + continue; + if (isblank(cs.cs_ch) && cs_fblank(sp, &cs)) + return (1); + #endif /*MULTIBYTE*/ if (cs.cs_flags == CS_EOF) goto ret; } else while (cnt--) { + #ifdef MULTIBYTE + if (cs.cs_flags != 0 || KEY_BLEN(sp, cs.cs_ch) == 1) + goto singlebyte; + + /* + * Multibyte case. + * It is not very good to peep VCS structure directly, + * but it is the fastest and easiest way. + */ + ochclass = multi_chclass(&cs.cs_bp[cs.cs_cno], 0); + for (;;) { + if (cs_multi_next(sp, &cs)) + return 1; + if (cs.cs_flags == CS_EOF) + goto ret; + if (cs.cs_flags != 0 + || KEY_BLEN(sp, cs.cs_ch) == 1) + goto taileater; + chclass = multi_chclass(&cs.cs_bp[cs.cs_cno], ochclass); + if (multi_wordbound(ochclass, chclass, 1)) + goto taileater; + ochclass = chclass; + } + singlebyte:; + #endif /*MULTIBYTE*/ state = cs.cs_flags == 0 && inword(cs.cs_ch) ? INWORD : NOTWORD; for (;;) { + #ifndef MULTIBYTE if (cs_next(sp, &cs)) + #else + if (cs_multi_next(sp, &cs)) + #endif return (1); if (cs.cs_flags == CS_EOF) goto ret; if (cs.cs_flags != 0 || isblank(cs.cs_ch)) break; + #ifdef MULTIBYTE + if (1 < KEY_BLEN(sp, cs.cs_ch)) + break; + #endif /*MULTIBYTE*/ if (state == INWORD) { if (!inword(cs.cs_ch)) break; *************** *** 351,364 **** --- 534,558 ---- if (inword(cs.cs_ch)) break; } + #ifdef MULTIBYTE + taileater:; + #endif /* See comment above. */ if (cnt == 0) { + #ifndef MULTIBYTE if (cs.cs_flags == 0 && cs_prev(sp, &cs)) + #else + if (cs.cs_flags == 0 && cs_multi_prev(sp, &cs)) + #endif return (1); break; } /* Eat whitespace characters. */ + #ifdef MULTIBYTE + if (cs.cs_flags == 0 && 1 < KEY_BLEN(sp, cs.cs_ch)) + continue; + #endif /*MULTIBYTE*/ if (cs.cs_flags != 0 || isblank(cs.cs_ch)) if (cs_fblank(sp, &cs)) return (1); *************** *** 431,436 **** --- 625,633 ---- enum { INWORD, NOTWORD } state; VCS cs; u_long cnt; + #ifdef MULTIBYTE + u_int ochclass, chclass; + #endif cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cs.cs_lno = vp->m_start.lno; *************** *** 446,452 **** --- 643,653 ---- * 'b' command. */ if (cs.cs_flags == 0 && !isblank(cs.cs_ch)) { + #ifndef MULTIBYTE if (cs_prev(sp, &cs)) + #else + if (cs_multi_prev(sp, &cs)) + #endif return (1); if (cs.cs_flags == 0 && !isblank(cs.cs_ch)) goto start; *************** *** 462,487 **** --- 663,734 ---- */ start: if (type == BIGWORD) while (cnt--) { + #ifdef MULTIBYTE + if (cs.cs_flags != 0 || KEY_BLEN(sp, cs.cs_ch) == 1) + goto Singlebyte; + + /* + * Multibyte case. + * It is not very good to peep VCS structure directly, + * but it is the fastest and easiest way. + */ + ochclass = multi_chclass(&cs.cs_bp[cs.cs_cno], 0); for (;;) { + if (cs_multi_prev(sp, &cs)) + return 1; + if (cs.cs_flags == CS_SOF) + goto ret; + if (cs.cs_flags != 0 + || KEY_BLEN(sp, cs.cs_ch) == 1) + goto Cntmodify; + chclass = multi_chclass(&cs.cs_bp[cs.cs_cno], ochclass); + if (multi_Wordbound(ochclass, chclass, 0)) + goto Cntmodify; + ochclass = chclass; + } + Singlebyte:; + #endif /*MULTIBYTE*/ + for (;;) { + #ifndef MULTIBYTE if (cs_prev(sp, &cs)) + #else + if (cs_multi_prev(sp, &cs)) + #endif return (1); if (cs.cs_flags == CS_SOF) goto ret; if (cs.cs_flags != 0 || isblank(cs.cs_ch)) break; + #ifdef MULTIBYTE + if (1 < KEY_BLEN(sp, cs.cs_ch)) + break; + #endif /*MULTIBYTE*/ } + #ifdef MULTIBYTE + Cntmodify:; + #endif /* * When we reach the end of the word before the last * word, we're done. If we changed state, move forward * one to the end of the next word. */ if (cnt == 0) { + #ifndef MULTIBYTE if (cs.cs_flags == 0 && cs_next(sp, &cs)) + #else + if (cs.cs_flags == 0 && cs_multi_next(sp, &cs)) + #endif return (1); break; } /* Eat whitespace characters. */ + #ifdef MULTIBYTE + if (cs.cs_flags == 0 && 1 < KEY_BLEN(sp, cs.cs_ch)) + continue; + if (!isblank(cs.cs_ch)) + continue; + #endif /*MULTIBYTE*/ if (cs_bblank(sp, &cs)) return (1); if (cs.cs_flags == CS_SOF) *************** *** 489,503 **** --- 736,783 ---- } else while (cnt--) { + #ifdef MULTIBYTE + if (cs.cs_flags != 0 || KEY_BLEN(sp, cs.cs_ch) == 1) + goto singlebyte; + + /* + * Multibyte case. + * It is not very good to peep VCS structure directly, + * but it is the fastest and easiest way. + */ + ochclass = multi_chclass(&cs.cs_bp[cs.cs_cno], 0); + for (;;) { + if (cs_multi_prev(sp, &cs)) + return 1; + if (cs.cs_flags == CS_SOF) + goto ret; + if (cs.cs_flags != 0 + || KEY_BLEN(sp, cs.cs_ch) == 1) + goto cntmodify; + chclass = multi_chclass(&cs.cs_bp[cs.cs_cno], ochclass); + if (multi_wordbound(ochclass, chclass, 0)) + goto cntmodify; + ochclass = chclass; + } + singlebyte:; + #endif /*MULTIBYTE*/ state = cs.cs_flags == 0 && inword(cs.cs_ch) ? INWORD : NOTWORD; for (;;) { + #ifndef MULTIBYTE if (cs_prev(sp, &cs)) + #else + if (cs_multi_prev(sp, &cs)) + #endif return (1); if (cs.cs_flags == CS_SOF) goto ret; if (cs.cs_flags != 0 || isblank(cs.cs_ch)) break; + #ifdef MULTIBYTE + if (1 < KEY_BLEN(sp, cs.cs_ch)) + break; + #endif /*MULTIBYTE*/ if (state == INWORD) { if (!inword(cs.cs_ch)) break; *************** *** 505,518 **** --- 785,809 ---- if (inword(cs.cs_ch)) break; } + #ifdef MULTIBYTE + cntmodify:; + #endif /* See comment above. */ if (cnt == 0) { + #ifndef MULTIBYTE if (cs.cs_flags == 0 && cs_next(sp, &cs)) + #else + if (cs.cs_flags == 0 && cs_multi_next(sp, &cs)) + #endif return (1); break; } /* Eat whitespace characters. */ + #ifdef MULTIBYTE + if (cs.cs_flags == 0 && 1 < KEY_BLEN(sp, cs.cs_ch)) + continue; + #endif /*MULTIBYTE*/ if (cs.cs_flags != 0 || isblank(cs.cs_ch)) if (cs_bblank(sp, &cs)) return (1); *************** *** 542,547 **** --- 833,848 ---- */ vp->m_final = vp->m_stop; if (ISMOTION(vp)) + #ifndef MULTIBYTE --vp->m_start.cno; + #else + { + char *p; + if (db_eget(sp, vp->m_start.lno, &p, NULL, NULL)) + return 1; + vp->m_start.cno -= multi_back(sp, (CHAR_T *)p, + (CHAR_T *)&p[vp->m_start.cno]); + } + #endif /*MULTIBYTE*/ return (0); } Index: vi/v_xchar.c Prereq: 10.9 *** nvi-1.79/vi/v_xchar.c Wed Oct 23 22:31:52 1996 --- nvi-1.79-m17n/vi/v_xchar.c Tue Nov 26 00:24:09 1996 *************** *** 37,44 **** { size_t len; int isempty; ! ! if (db_eget(sp, vp->m_start.lno, NULL, &len, &isempty)) { if (isempty) goto nodel; return (1); --- 37,53 ---- { size_t len; int isempty; ! #ifdef MULTIBYTE ! CHAR_T *p; ! size_t lastlen; ! #endif ! ! #ifndef MULTIBYTE ! if (db_eget(sp, vp->m_start.lno, NULL, &len, &isempty)) ! #else ! if (db_eget(sp, vp->m_start.lno, &p, &len, &isempty)) ! #endif ! { if (isempty) goto nodel; return (1); *************** *** 57,68 **** * of the cursor as part of the 'x' command isn't taken into account. * Historically correct. */ ! if (F_ISSET(vp, VC_C1SET)) vp->m_stop.cno += vp->count - 1; if (vp->m_stop.cno >= len - 1) { vp->m_stop.cno = len - 1; vp->m_final.cno = vp->m_start.cno ? vp->m_start.cno - 1 : 0; ! } else vp->m_final.cno = vp->m_start.cno; if (cut(sp, --- 66,97 ---- * of the cursor as part of the 'x' command isn't taken into account. * Historically correct. */ ! if (F_ISSET(vp, VC_C1SET)) { ! #ifndef MULTIBYTE vp->m_stop.cno += vp->count - 1; + #else + int i; + for (i = 0; i < vp->count - 1; i++) + vp->m_stop.cno += KEY_BLEN(sp, p[vp->m_stop.cno]); + #endif /*MULTIBYTE*/ + } + #ifndef MULTIBYTE if (vp->m_stop.cno >= len - 1) { vp->m_stop.cno = len - 1; vp->m_final.cno = vp->m_start.cno ? vp->m_start.cno - 1 : 0; ! } ! #else ! lastlen = len - multi_back(sp, p, &p[len]); ! if (vp->m_stop.cno >= lastlen) { ! vp->m_stop.cno = lastlen; ! if (vp->m_start.cno) { ! vp->m_final.cno = vp->m_start.cno ! - multi_back(sp, p, &p[vp->m_start.cno]); ! } else ! vp->m_final.cno = 0; ! } ! #endif /*MULTIBYTE*/ ! else vp->m_final.cno = vp->m_start.cno; if (cut(sp, *************** *** 85,102 **** VICMD *vp; { u_long cnt; if (vp->m_start.cno == 0) { v_sol(sp); return (1); } cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; if (cnt >= vp->m_start.cno) vp->m_start.cno = 0; ! else vp->m_start.cno -= cnt; --vp->m_stop.cno; vp->m_final.cno = vp->m_start.cno; if (cut(sp, --- 114,151 ---- VICMD *vp; { u_long cnt; + #ifdef MULTIBYTE + CHAR_T *p; + #endif if (vp->m_start.cno == 0) { v_sol(sp); return (1); } + #ifdef MULTIBYTE + /* we need content of the line. */ + if (db_eget(sp, vp->m_start.lno, &p, NULL, NULL)) + return (1); + #endif + cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; if (cnt >= vp->m_start.cno) vp->m_start.cno = 0; ! else { ! #ifndef MULTIBYTE vp->m_start.cno -= cnt; + #else + int i; + for (i = 0; i < cnt; i++) + vp->m_start.cno -= multi_back(sp, p, &p[vp->m_start.cno]); + #endif /*MULTIBYTE*/ + } + #ifndef MULTIBYTE --vp->m_stop.cno; + #else + vp->m_stop.cno -= multi_back(sp, p, &p[vp->m_stop.cno]); + #endif vp->m_final.cno = vp->m_start.cno; if (cut(sp, Index: vi/v_yank.c Prereq: 10.9 *** nvi-1.79/vi/v_yank.c Mon May 20 01:02:04 1996 --- nvi-1.79-m17n/vi/v_yank.c Sat Feb 22 00:24:13 1997 *************** *** 75,82 **** F_SET(vp, VM_RCM_SET); /* Make sure the set cursor position exists. */ ! if (vp->m_final.cno >= len) vp->m_final.cno = len ? len - 1 : 0; } return (0); } --- 75,90 ---- F_SET(vp, VM_RCM_SET); /* Make sure the set cursor position exists. */ ! if (vp->m_final.cno >= len) { ! #ifndef MULTIBYTE vp->m_final.cno = len ? len - 1 : 0; + #else + CHAR_T *p; + if (db_get(sp, vp->m_final.lno, DBG_FATAL, &p, NULL)) + return (1); + vp->m_final.cno = len ? len - multi_back(sp, p, &p[len]) : 0; + #endif /*MULTIBYTE*/ + } } return (0); } Index: vi/vi.c Prereq: 10.57 *** nvi-1.79/vi/vi.c Wed Oct 23 22:31:58 1996 --- nvi-1.79-m17n/vi/vi.c Fri Mar 28 00:21:56 1997 *************** *** 91,96 **** --- 91,100 ---- (void)sp->gp->scr_rename(sp, sp->frp->name, 1); for (vip = VIP(sp), rval = 0;;) { + #if 0 + v_fep_force_off(sp); + #endif /*CANNA*/ + /* Resolve messages. */ if (!MAPPED_KEYS_WAITING(sp) && vs_resolve(sp, NULL, 0)) goto ret; *************** *** 232,239 **** --- 236,258 ---- v_comlog(sp, vp); #endif /* Call the function. */ + #ifndef MULTIBYTE ex_continue: if (vp->kp->func(sp, vp)) goto err; + #else + ex_continue: + { + int rval; + + if (strchr(O_STR(sp, O_FEPKEY), vp->key)) + v_fep_on(sp); + rval = vp->kp->func(sp, vp); + if (strchr(O_STR(sp, O_FEPKEY), vp->key)) + v_fep_off(sp); + if (rval) + goto err; + } + #endif /*MULTIBYTE*/ gc_event: #ifdef DEBUG /* Make sure no function left the temporary space locked. */ *************** *** 413,418 **** --- 432,438 ---- return (rval); } + #ifndef MULTIBYTE #define KEY(key, ec_flags) { \ if ((gcret = v_key(sp, 0, &ev, ec_flags)) != GC_OK) \ return (gcret); \ *************** *** 422,427 **** --- 442,470 ---- *mappedp = 1; \ key = ev.e_c; \ } + #else + #define KEY0(key, ec_flags) { \ + if ((gcret = v_key(sp, 0, &ev, ec_flags)) != GC_OK) \ + return (gcret); \ + if (ev.e_value == K_ESCAPE) \ + goto esc; \ + if (F_ISSET(&ev.e_ch, CH_MAPPED)) \ + *mappedp = 1; \ + key = ev.e_c; \ + } + + #define KEY(key, ec_flags) { \ + if ((gcret = v_key(sp, 0, &ev, ec_flags)) != GC_OK) \ + return (gcret); \ + if (ev.e_value == K_ESCAPE) \ + goto esc; \ + if (1 < KEY_BLEN(sp, ev.e_c)) \ + goto mbyte; \ + if (F_ISSET(&ev.e_ch, CH_MAPPED)) \ + *mappedp = 1; \ + key = ev.e_c; \ + } + #endif /*MULTIBYTE*/ /* * The O_TILDEOP option makes the ~ command take a motion instead *************** *** 466,471 **** --- 509,518 ---- CHAR_T key; char *s; + #ifdef MULTIBYTE + v_fep_force_off(sp); + #endif + /* * Get a key. * *************** *** 487,492 **** --- 534,543 ---- } if (ev.e_value == K_ESCAPE) goto esc; + #ifdef MULTIBYTE + if (1 < KEY_BLEN(sp, ev.e_c)) + goto mbyte; + #endif if (F_ISSET(&ev.e_ch, CH_MAPPED)) *mappedp = 1; key = ev.e_c; *************** *** 688,695 **** } /* Required character. */ ! if (LF_ISSET(V_CHAR)) KEY(vp->character, 0); /* Get any associated cursor word. */ if (F_ISSET(kp, V_KEYW) && v_keyword(sp)) --- 739,760 ---- } /* Required character. */ ! if (LF_ISSET(V_CHAR)) { ! #ifndef MULTIBYTE KEY(vp->character, 0); + #else + size_t i, blen; + + if (strchr(O_STR(sp, O_FEPKEY), vp->key)) + v_fep_on(sp); + KEY0(vp->characters[0], 0); + blen = KEY_BLEN(sp, vp->characters[0]); + for (i = 1; i < blen; i++) + KEY0(vp->characters[i], 0); + if (strchr(O_STR(sp, O_FEPKEY), vp->key)) + v_fep_off(sp); + #endif /*MULTIBYTE*/ + } /* Get any associated cursor word. */ if (F_ISSET(kp, V_KEYW) && v_keyword(sp)) *************** *** 708,713 **** --- 773,793 ---- break; } return (GC_ERR); + + #ifdef MULTIBYTE + mbyte: + { + size_t blen; + size_t i; + CHAR_T tmp; + + blen = KEY_BLEN(sp, ev.e_c); + for (i = 1; i < blen; i++) + KEY0(tmp, 0); + msgq(sp, M_BERR, "Illegal multibyte char in command"); + return GC_ERR; + } + #endif /*MULTIBYTE*/ } /* *************** *** 726,731 **** --- 806,814 ---- u_long cnt; u_int flags; int tilde_reset, notused; + #ifdef MULTIBYTE + CHAR_T *p0; + #endif /* * If '.' command, use the dot motion, else get the motion command. *************** *** 783,789 **** * text. */ vp->m_stop.lno = sp->lno + motion.count - 1; ! if (db_get(sp, vp->m_stop.lno, 0, NULL, &len)) { if (vp->m_stop.lno != 1 || vp->key != 'c' && vp->key != '!') { v_emsg(sp, NULL, VIM_EMPTY); --- 866,877 ---- * text. */ vp->m_stop.lno = sp->lno + motion.count - 1; ! #ifndef MULTIBYTE ! if (db_get(sp, vp->m_stop.lno, 0, NULL, &len)) ! #else ! if (db_get(sp, vp->m_stop.lno, 0, &p0, &len)) ! #endif ! { if (vp->m_stop.lno != 1 || vp->key != 'c' && vp->key != '!') { v_emsg(sp, NULL, VIM_EMPTY); *************** *** 791,797 **** --- 879,891 ---- } vp->m_stop.cno = 0; } else + #ifndef MULTIBYTE vp->m_stop.cno = len ? len - 1 : 0; + #else + vp->m_stop.cno = len + ? len - multi_back(sp, p0, &p0[len]) + : 0; + #endif /*MULTIBYTE*/ } else { /* * Motion commands change the underlying movement (*snarl*). *************** *** 846,853 **** --- 940,961 ---- motion.m_stop.cno = motion.m_start.cno = sp->cno; /* Run the function. */ + #ifndef MULTIBYTE if ((motion.kp->func)(sp, &motion)) return (1); + #else + { + int rval; + + if (strchr(O_STR(sp, O_FEPKEY), motion.key)) + v_fep_on(sp); + rval = (motion.kp->func)(sp, &motion); + if (strchr(O_STR(sp, O_FEPKEY), motion.key)) + v_fep_off(sp); + if (rval) + return 1; + } + #endif /*MULTIBYTE*/ /* * If the current line is missing, i.e. the file is empty, *************** *** 1044,1050 **** --- 1152,1162 ---- VI_PRIVATE *vip; size_t beg, end, len; int moved, state; + #ifndef MULTIBYTE char *p; + #else + CHAR_T *p; + #endif if (db_get(sp, sp->lno, DBG_FATAL, &p, &len)) return (1); Index: vi/vi.h Prereq: 10.19 *** nvi-1.79/vi/vi.h Sat Sep 21 08:05:19 1996 --- nvi-1.79-m17n/vi/vi.h Sun Feb 2 15:14:11 1997 *************** *** 18,24 **** --- 18,29 ---- typedef struct _vicmd { CHAR_T key; /* Command key. */ CHAR_T buffer; /* Buffer. */ + #ifndef MULTIBYTE CHAR_T character; /* Character. */ + #else + CHAR_T characters[10]; /* Character. */ + #define character characters[0] + #endif u_long count; /* Count. */ u_long count2; /* Second count (only used by z). */ EVENT ev; /* Associated event. */ *************** *** 167,172 **** --- 172,181 ---- int cs_init __P((SCR *, VCS *)); int cs_next __P((SCR *, VCS *)); int cs_prev __P((SCR *, VCS *)); + #ifdef MULTIBYTE + int cs_multi_next __P((SCR *, VCS *)); + int cs_multi_prev __P((SCR *, VCS *)); + #endif /* * We use a single "window" for each set of vi screens. The model would be *************** *** 216,222 **** --- 225,235 ---- typedef enum { CNOTSET, FSEARCH, fSEARCH, TSEARCH, tSEARCH } cdir_t; typedef enum { AB_NOTSET, AB_NOTWORD, AB_INWORD } abb_t; + #ifndef MULTIBYTE typedef enum { Q_NOTSET, Q_BNEXT, Q_BTHIS, Q_VNEXT, Q_VTHIS } quote_t; + #else + typedef enum { Q_NOTSET, Q_BNEXT, Q_BTHIS, Q_VNEXT, Q_VTHIS, Q_MULTIBYTE } quote_t; + #endif /* Vi private, per-screen memory. */ typedef struct _vi_private { *************** *** 235,241 **** --- 248,259 ---- size_t klen; /* Keyword length. */ size_t keywlen; /* Keyword buffer length. */ + #ifndef MULTIBYTE CHAR_T rlast; /* Last 'r' replacement character. */ + #else + CHAR_T rlasts[10]; /* Last 'r' replacement character. */ + #define rlast rlasts[0] + #endif e_key_t rvalue; /* Value of last replacement character. */ EVENT *rep; /* Input replay buffer. */ *************** *** 259,265 **** --- 277,288 ---- u_long u_ccnt; /* Undo command count. */ + #ifndef MULTIBYTE CHAR_T lastckey; /* Last search character. */ + #else + CHAR_T lastckeys[10]; /* Last search character. */ + #define lastckey lastckeys[0] + #endif /*MULTIBYTE*/ cdir_t csearchdir; /* Character search direction. */ SMAP *h_smap; /* First slot of the line map. */ Index: vi/vs_line.c Prereq: 10.19 *** nvi-1.79/vi/vs_line.c Fri Sep 27 11:55:47 1996 --- nvi-1.79-m17n/vi/vs_line.c Fri Feb 21 22:23:19 1997 *************** *** 49,57 **** --- 49,65 ---- size_t chlen, cno_cnt, cols_per_screen, len, nlen; size_t offset_in_char, offset_in_line, oldx, oldy; size_t scno, skip_cols, skip_screens; + #ifdef MULTIBYTE + /* XXX why ch has to be int? */ + #endif int ch, dne, is_cached, is_partial, is_tab; int list_tab, list_dollar; char *p, *cbp, *ecbp, cbuf[128]; + #ifdef MULTIBYTE + CHAR_T *p0; + CHAR_T *pch; + int fakeeol; + #endif /*MULTIBYTE*/ #if defined(DEBUG) && 0 TRACE(sp, "vs_line: row %u: line: %u off: %u\n", *************** *** 92,97 **** --- 100,108 ---- /* Get the line. */ dne = db_get(sp, smp->lno, 0, &p, &len); + #ifdef MULTIBYTE + p0 = p; + #endif /* * Special case if we're printing the info/mode line. Skip printing *************** *** 235,241 **** --- 246,257 ---- offset_in_line = tsmp->c_eboff; offset_in_char = tsmp->c_eclen; } else { + #ifndef MULTIBYTE offset_in_line = tsmp->c_eboff + 1; + #else + offset_in_line = tsmp->c_eboff + + KEY_BLEN(sp, p0[tsmp->c_eboff]); + #endif offset_in_char = 0; } *************** *** 256,261 **** --- 272,278 ---- /* Do it the hard way, for leftright scrolling screens. */ if (O_ISSET(sp, O_LEFTRIGHT)) { + #ifndef MULTIBYTE for (; offset_in_line < len; ++offset_in_line) { chlen = (ch = *(u_char *)p++) == '\t' && !list_tab ? TAB_OFF(scno) : KEY_LEN(sp, ch); *************** *** 276,285 **** --- 293,333 ---- smp->c_sboff = ++offset_in_line; smp->c_scoff = 0; } + #else + while (offset_in_line < len) { + ch = *(u_char *)p; + chlen = (ch == '\t' && !list_tab) ? + TAB_OFF(scno) : KEY_LEN(sp, ch); + + /* easy cases first. */ + if (scno + chlen < skip_cols) { + scno += chlen; + p += KEY_BLEN(sp, ch); + offset_in_line += KEY_BLEN(sp, ch); + continue; + } + + if (scno + chlen == skip_cols) { + scno += chlen; + p += KEY_BLEN(sp, ch); + offset_in_line += KEY_BLEN(sp, ch); + } + + break; + } + + /* Set cols_per_screen to 2nd and later line length. */ + cols_per_screen = sp->cols; + + /* Put starting info for this line in the cache. */ + smp->c_sboff = offset_in_line; + smp->c_scoff = offset_in_char = scno + chlen - skip_cols; + #endif /*MULTIBYTE*/ } /* Do it the hard way, for historic line-folding screens. */ else { + #ifndef MULTIBYTE for (; offset_in_line < len; ++offset_in_line) { chlen = (ch = *(u_char *)p++) == '\t' && !list_tab ? TAB_OFF(scno) : KEY_LEN(sp, ch); *************** *** 307,312 **** --- 355,414 ---- smp->c_sboff = ++offset_in_line; smp->c_scoff = 0; } + #else + while (offset_in_line < len) { + ch = *(u_char *)p; + chlen = (ch == '\t' && !list_tab) ? + TAB_OFF(scno) : KEY_LEN(sp, ch); + + /* Easy case first. */ + if (scno + chlen < cols_per_screen) { + scno += chlen; + p += KEY_BLEN(sp, ch); + offset_in_line += KEY_BLEN(sp, ch); + continue; + } + + /* + * Since we can't generally cross the rightmost column + * by displaying multibyte char, we must check if + * the to-be-displayed character crosses the rightmost + * column or not. + * In that case, we fake the scno so that you'll see + * that the line was already filled up completely. + */ + if (KEY_BLEN(sp, ch) == 1 + || scno + chlen == cols_per_screen) { + scno += chlen; + p += KEY_BLEN(sp, ch); + offset_in_line += KEY_BLEN(sp, ch); + } else + scno = cols_per_screen; + + scno -= cols_per_screen; + + /* Set cols_per_screen to 2nd and later line length. */ + cols_per_screen = sp->cols; + + /* + * If crossed the last skipped screen boundary, start + * displaying the characters. + */ + if (--skip_screens == 0) + break; + } + + /* Put starting info for this line in the cache. */ + if (scno != 0) { + smp->c_sboff = offset_in_line; + smp->c_scoff = offset_in_char = chlen - scno; + offset_in_line -= multi_back(sp, p0, p); + p -= multi_back(sp, p0, p); + } else { + smp->c_sboff = offset_in_line; + smp->c_scoff = 0; + } + #endif /*MULTIBYTE*/ } display: *************** *** 317,325 **** * Don't fill anything in unless it's the right line and the right * character, and the right part of the character... */ if (yp == NULL || smp->lno != sp->lno || sp->cno < offset_in_line || ! offset_in_line + cols_per_screen < sp->cno) { cno_cnt = 0; /* If the line is on the screen, quit. */ if (is_cached) --- 419,439 ---- * Don't fill anything in unless it's the right line and the right * character, and the right part of the character... */ + #ifndef MULTIBYTE if (yp == NULL || smp->lno != sp->lno || sp->cno < offset_in_line || ! offset_in_line + cols_per_screen < sp->cno) ! #else ! /* ! * In multibyte environment, it is not true that every byte ! * occupy at least single column. Therefore, we can't simply ! * compare offset_in_line+cols_per_screen against sp->cno. ! * Do it slowly. ! */ ! if (yp == NULL || ! smp->lno != sp->lno || sp->cno < offset_in_line) ! #endif /*MULTIBYTE*/ ! { cno_cnt = 0; /* If the line is on the screen, quit. */ if (is_cached) *************** *** 329,337 **** /* This is the loop that actually displays characters. */ ecbp = (cbp = cbuf) + sizeof(cbuf) - 1; for (is_partial = 0, scno = 0; offset_in_line < len; ++offset_in_line, offset_in_char = 0) { ! if ((ch = *(u_char *)p++) == '\t' && !list_tab) { scno += chlen = TAB_OFF(scno) - offset_in_char; is_tab = 1; } else { --- 443,465 ---- /* This is the loop that actually displays characters. */ ecbp = (cbp = cbuf) + sizeof(cbuf) - 1; + #ifdef MULTIBYTE + fakeeol = 0; + #endif for (is_partial = 0, scno = 0; offset_in_line < len; ++offset_in_line, offset_in_char = 0) { ! #ifndef MULTIBYTE ! if ((ch = *(u_char *)p++) == '\t' && !list_tab) ! #else ! ch = *(u_char *)p; ! pch = p; ! p += KEY_BLEN(sp, ch); ! if (1 < cno_cnt) ! cno_cnt -= (KEY_BLEN(sp, ch) - 1);/*subtract one later*/ ! ! if (ch == '\t' && !list_tab) ! #endif ! { scno += chlen = TAB_OFF(scno) - offset_in_char; is_tab = 1; } else { *************** *** 339,344 **** --- 467,496 ---- is_tab = 0; } + #ifdef MULTIBYTE + /* + * Since we can't generally cross the rightmost column + * by displaying multibyte char, we must check if + * the to-be-displayed character crosses the rightmost + * column or not. + * In that case, we fake the scno so that you'll see + * that the line was already filled up completely. + */ + if (offset_in_line + KEY_BLEN(sp, ch) < len + && 1 < KEY_BLEN(sp, *(u_char *)p) + && scno + KEY_LEN(sp, *(u_char *)p) > cols_per_screen) { + fakeeol++; + + smp->c_ecsize = chlen; + smp->c_eclen = chlen; + is_partial = 0; + + smp->c_eboff = offset_in_line + KEY_BLEN(sp, ch) - 1; + + /* Terminate the loop. */ + offset_in_line = len; + } else + #endif /*MULTIBYTE*/ /* * Only display up to the right-hand column. Set a flag if * the entire character wasn't displayed for use in setting *************** *** 379,384 **** --- 531,540 ---- *yp = smp - HMAP; if (F_ISSET(sp, SC_TINPUT)) *xp = scno - chlen; + #ifdef MULTIBYTE + else if (!multi_isnone(sp, ch)) + *xp = scno - chlen; + #endif /*MULTIBYTE*/ else *xp = scno - 1; if (O_ISSET(sp, O_NUMBER) && *************** *** 391,398 **** } /* If the line is on the screen, don't display anything. */ ! if (is_cached) continue; #define FLUSH { \ *cbp = '\0'; \ --- 547,560 ---- } /* If the line is on the screen, don't display anything. */ ! if (is_cached) { ! #ifdef MULTIBYTE ! offset_in_line += (KEY_BLEN(sp, ch) - 1); ! if (fakeeol) ! scno = cols_per_screen; ! #endif /*MULTIBYTE*/ continue; + } #define FLUSH { \ *cbp = '\0'; \ *************** *** 413,423 **** --- 575,622 ---- *cbp++ = TABCH; } else { + #ifndef MULTIBYTE if (cbp + chlen >= ecbp) FLUSH; for (kp = KEY_NAME(sp, ch) + offset_in_char; chlen--;) *cbp++ = *kp++; + #else + if (1 < KEY_BLEN(sp, ch)) { + if (offset_in_char) + kp = " "; /*enough?*/ + else { + /* + * Leave multibyte chars as is. + * In this case, actual chars emitted + * to screen library is not the same + * as its width! Be careful. + */ + kp = multi_rawname(sp, pch); + chlen = strlen(kp); + } + } else + kp = KEY_NAME(sp, ch) + offset_in_char; + if (cbp + chlen >= ecbp) + FLUSH; + while (chlen--) + *cbp++ = *kp++; + if (fakeeol) { + /* + * XXX + * Is it a good idea to fill with spaces? + * mule uses backslash. + */ + while (scno < cols_per_screen) { + *cbp++ = ' '; + scno++; + } + } + #endif /*MULTIBYTE*/ } + + #ifdef MULTIBYTE + offset_in_line += (KEY_BLEN(sp, ch) - 1); + #endif } if (scno < cols_per_screen) { Index: vi/vs_msg.c Prereq: 10.77 *** nvi-1.79/vi/vs_msg.c Mon Oct 14 03:25:23 1996 --- nvi-1.79-m17n/vi/vs_msg.c Thu Mar 27 13:31:27 1997 *************** *** 39,45 **** --- 39,49 ---- static void vs_divider __P((SCR *)); static void vs_msgsave __P((SCR *, mtype_t, char *, size_t)); + #ifndef MULTIBYTE static void vs_output __P((SCR *, mtype_t, const char *, int)); + #else + static void vs_output __P((SCR *, mtype_t, const CHAR_T *, int)); + #endif static void vs_scroll __P((SCR *, int *, sw_t)); static void vs_wait __P((SCR *, int *, sw_t)); *************** *** 225,237 **** --- 229,249 ---- * alternate method of displaying messages, e.g. dialog boxes, should set their * scr_msg function to the correct function before calling the editor. * + * PUBLIC: #ifndef MULTIBYTE * PUBLIC: void vs_msg __P((SCR *, mtype_t, char *, size_t)); + * PUBLIC: #else + * PUBLIC: void vs_msg __P((SCR *, mtype_t, CHAR_T *, size_t)); + * PUBLIC: #endif */ void vs_msg(sp, mtype, line, len) SCR *sp; mtype_t mtype; + #ifndef MULTIBYTE char *line; + #else + CHAR_T *line; + #endif size_t len; { GS *gp; *************** *** 289,295 **** --- 301,338 ---- if (mtype == M_ERR) (void)gp->scr_attr(sp, SA_INVERSE, 1); + #ifndef MULTIBYTE (void)printf("%.*s", (int)len, line); + #else + { + size_t i, j; + CHAR_T *p; + + i = 0; + while (i < len) { + /* output non multibyte chars in bulk */ + j = 0; + while (i + j < len && KEY_BLEN(sp, line[i + j]) == 1) + j++; + if (j) { + (void)printf("%.*s", (int)j, &line[i]); + i += j; + } + + /* + * output single multibyte char + * XXX quickhack + */ + if (i < len && 1 < KEY_BLEN(sp, line[i])) { + p = multi_name(sp, &line[i]); + (void)printf("%.*s", strlen(p), p); + if (p[0] == '\033') + (void)printf("\033(B"); + i += KEY_BLEN(sp, line[i]); + } + } + } + #endif /*MULTIBYTE*/ if (mtype == M_ERR) (void)gp->scr_attr(sp, SA_INVERSE, 0); (void)fflush(stdout); *************** *** 397,413 **** --- 440,471 ---- vs_output(sp, mtype, line, llen) SCR *sp; mtype_t mtype; + #ifndef MULTIBYTE const char *line; + #else + const CHAR_T *line; + #endif int llen; { CHAR_T *kp; GS *gp; VI_PRIVATE *vip; size_t chlen, notused; + #ifndef MULTIBYTE int ch, len, rlen, tlen; const char *p, *t; + #else + int len, rlen, tlen; + CHAR_T ch; + const CHAR_T *p, *t; + size_t blen; + size_t scrlen; + #endif char *cbp, *ecbp, cbuf[128]; + #ifdef CANNA + canna_modelinesw(sp, 0); + #endif gp = sp->gp; vip = VIP(sp); for (p = line, rlen = llen; llen > 0;) { *************** *** 417,428 **** --- 475,495 ---- else len = p - line; + #ifndef MULTIBYTE /* * The max is sp->cols characters, and we may have already * written part of the line. */ if (len + vip->lcontinue > sp->cols) len = sp->cols - vip->lcontinue; + #else + /* + * Single byte code assumes that, every byte occupies + * single column. In multibyte environment, it is not true. + * We check screen width separately from the string length. + */ + scrlen = sp->cols - vip->lcontinue; + #endif /*MULTIBYTE*/ /* * If the first line output, do nothing. If the second line *************** *** 471,476 **** --- 538,544 ---- cbp = cbuf; \ } ecbp = (cbp = cbuf) + sizeof(cbuf) - 1; + #ifndef MULTIBYTE for (t = line, tlen = len; tlen--; ++t) { ch = *t; /* *************** *** 488,493 **** --- 556,609 ---- for (kp = KEY_NAME(sp, ch); chlen--;) *cbp++ = *kp++; } + #else + t = line; + tlen = len; + while (0 < tlen && 0 < scrlen) { + ch = *t; + /* + * Replace tabs with spaces, there are places in + * ex that do column calculations without looking + * at -- and all routines that care about + * do their own expansions. This catches + * in things like tag search strings. + */ + if (ch == '\t') + ch = ' '; + + chlen = KEY_LEN(sp, ch); + blen = KEY_BLEN(sp, ch); + if (1 < blen) { + /* + * we transmit characters without conversion. + */ + kp = multi_rawname(sp, t); + chlen = blen; + + /* chlen is modified, don't use that */ + if (tlen < blen) + break; + if (scrlen < KEY_LEN(sp, ch)) + break; + t += blen; + tlen -= blen; + scrlen -= KEY_LEN(sp, ch); + } else { + kp = KEY_NAME(sp, ch); + + if (scrlen < chlen) + break; + t++; + tlen--; + scrlen -= chlen; + } + + if (cbp + chlen >= ecbp) + FLUSH; + while (chlen--) + *cbp++ = *kp++; + } + #endif /*MULTIBYTE*/ if (cbp > cbuf) FLUSH; if (mtype == M_ERR) *************** *** 500,511 **** --- 616,636 ---- vip->lcontinue = 0; /* Reset for the next line. */ + #ifndef MULTIBYTE line += len; llen -= len; if (p != NULL) { ++line; --llen; } + #else + llen -= (t - line); + line = t; + if (tlen == 0 && p != NULL) { + ++line; + --llen; + } + #endif /*MULTIBYTE*/ } /* Set up next continuation line. */ Index: vi/vs_refresh.c Prereq: 10.44 *** nvi-1.79/vi/vs_refresh.c Tue Oct 15 01:12:08 1996 --- nvi-1.79-m17n/vi/vs_refresh.c Thu Mar 27 13:17:20 1997 *************** *** 30,36 **** --- 30,38 ---- #define UPDATE_CURSOR 0x01 /* Update the cursor. */ #define UPDATE_SCREEN 0x02 /* Flush to screen. */ + #ifndef CANNA static void vs_modeline __P((SCR *)); + #endif static int vs_paint __P((SCR *, u_int)); /* *************** *** 139,144 **** --- 141,149 ---- if (F_ISSET(tsp, SC_STATUS)) { need_refresh = 1; vs_resolve(tsp, sp, 0); + #ifdef CANNA + canna_modelinesw(sp, 0); + #endif } if (need_refresh) (void)gp->scr_refresh(sp, 0); *************** *** 171,178 **** --- 176,194 ---- VI_PRIVATE *vip; recno_t lastline, lcnt; size_t cwtotal, cnt, len, notused, off, y; + #ifndef MULTIBYTE int ch, didpaint, isempty, leftright_warp; char *p; + #else + int didpaint, isempty, leftright_warp; + CHAR_T ch; + CHAR_T *p; + #endif /*MULTIBYTE*/ + #ifdef MULTIBYTE + char *p0; + + p = p0 = NULL; + #endif /*MULTIBYTE*/ #define LNO sp->lno /* Current file line. */ #define OLNO vip->olno /* Remembered file line. */ *************** *** 466,471 **** --- 482,490 ---- goto slow; return (1); } + #ifdef MULTIBYTE + p0 = p; + #endif #ifdef DEBUG /* Sanity checking. */ *************** *** 481,486 **** --- 500,506 ---- * screen, and therefore, how many screen positions to move. */ if (CNO < OCNO) { + #ifndef MULTIBYTE /* * 7a: Cursor moved left. * *************** *** 532,538 **** --- 552,632 ---- if (SCNO < cwtotal) goto slow; SCNO -= cwtotal; + #else + /* + * 7a: Cursor moved left. + * + * The old cursor position can be past EOL if, for example, + * we just deleted the rest of the line. + * In this case, since we don't know the width of + * the characters we traversed, we have to do it slowly. + */ + if (OCNO >= len) + goto slow; + + /* + * cwtotal acts as new value for SCNO. Set cwtotal to the + * first char for content on CNO byte, for ease handling + * of wide characters. + * + * If the character we're stepping on lies across + * cross a screen boundary, we have no hope to speed + * it up. Do it slowly. + */ + if (multi_isnone(sp, p0[OCNO])) { + if (p0[OCNO] == '\t') + goto slow; + if (SCNO + 1 < KEY_LEN(sp, p0[OCNO])) + goto slow; + cwtotal = SCNO + 1 - KEY_LEN(sp, p0[OCNO]); + } else + cwtotal = SCNO; + cnt = OCNO - CNO; + + /* + * Quick sanity check -- it's hard to figure out exactly when + * we cross a screen boundary as we do in the cursor right + * movement. If cnt is so large that we're going to cross the + * boundary no matter what, stop now. + */ + if (SCNO + 1 + MAX_CHARACTER_COLUMNS < cnt) + goto slow; + + /* + * Count up the widths of the characters. If it's a tab + * character, go do it the the slow way. + */ + while (cnt) { + size_t tlen; + + tlen = multi_back(sp, p0, &p0[CNO + cnt]); + if (cnt < tlen) + goto slow; + cnt -= tlen; + if (*((u_char *)&p0[CNO + cnt]) == '\t') + goto slow; + tlen = KEY_LEN(sp, p0[CNO + cnt]); + if (cwtotal < tlen) + goto slow; + cwtotal -= tlen; + } + + /* + * If we're moving left, and there's a wide character in the + * current position, go to the end of the character. + */ + if (1 < KEY_LEN(sp, p0[CNO + cnt])) { + if (multi_isnone(sp, p0[CNO + cnt])) + cwtotal += KEY_LEN(sp, p0[CNO + cnt]) - 1; + } + + /* + * At last, update the screen cursor. + */ + SCNO = cwtotal; + #endif /*MULTIBYTE*/ } else { + #ifndef MULTIBYTE /* * 7b: Cursor moved right. * *************** *** 562,567 **** --- 656,724 ---- /* See screen change comment in section 6a. */ if (SCNO >= SCREEN_COLS(sp)) goto slow; + #else + /* + * 7b: Cursor moved right. + * + * Point the character at the cursor. + * cwtotal acts as new value for SCNO. Set cwtotal to the + * first char for content on CNO byte, for ease handling + * of wide characters. + */ + if (OCNO >= len) + goto slow; + + if (multi_isnone(sp, p[OCNO])) + cwtotal = SCNO + 1 - KEY_LEN(sp, p[OCNO]); + else + cwtotal = SCNO; + + cnt = CNO - OCNO; + p = p + OCNO; + + /* + * Count up the widths of the characters. If it's a tab + * character, go do it the the slow way. + * If a multibyte char seems to occupy the screen boundary, + * that will be pushed to the next line. Adjust the cursor + * In that case. + * If we cross a screen boundary, we can quit. + */ + while (cnt) { + ch = *(u_char *)p; + if (ch == '\t') + goto slow; + cnt -= KEY_BLEN(sp, ch); + p += KEY_BLEN(sp, ch); + cwtotal += KEY_LEN(sp, ch); + if (1 < KEY_BLEN(sp, *p) + && cwtotal + KEY_LEN(sp, *p) >= SCREEN_COLS(sp)) + cwtotal = SCREEN_COLS(sp); + if (cwtotal >= SCREEN_COLS(sp)) + break; + } + + /* + * If we are on the tab character, we must do it slowly. + * If we're on a wide character in the current position, + * go to the end of the character. + */ + if (*p == '\t') + goto slow; + else if (1 < KEY_LEN(sp, *p)) { + if (multi_isnone(sp, *p)) + cwtotal += KEY_LEN(sp, *p) - 1; + } + + /* + * At last, update the screen cursor. + */ + SCNO = cwtotal; + + /* See screen change comment in section 6a. */ + if (SCNO >= SCREEN_COLS(sp)) + goto slow; + #endif /*MULTIBYTE*/ } /* *************** *** 590,600 **** --- 747,781 ---- * first screen as compared to subsequent ones. */ if (O_ISSET(sp, O_LEFTRIGHT)) { + #ifdef MULTIBYTE + size_t cnt0; + #endif /* * Get the screen column for this character, and correct * for the number option offset. */ cnt = vs_columns(sp, NULL, LNO, &CNO, NULL); + #ifdef MULTIBYTE + cnt0 = cnt; + /* + * For multibyte chars, we need to display the character + * as a whole. For that, we adjust the value returned by + * vs_columns() by the width of the character, to check + * for side scrolling possibility toward left. + * + * XXX + * Dirty hack. + */ + if (!p) { + if (db_eget(sp, LNO, &p, &len, &isempty)) { + if (!isempty) + return (1); + } + p0 = p; + } + if (!multi_isnone(sp, p0[CNO])) + cnt -= KEY_LEN(sp, p0[CNO]); + #endif /*MULTIBYTE*/ if (O_ISSET(sp, O_NUMBER)) cnt -= O_NUMBER_LENGTH; *************** *** 612,617 **** --- 793,805 ---- goto shifted; } + #ifdef MULTIBYTE + /* + * To check for side scroll toward right, we need to use the + * value returned by vs_columns(), not the adjusted one. + */ + cnt = cnt0; + #endif /*MULTIBYTE*/ /* Adjust the window towards the end of the line. */ if (off == 0 && off + SCREEN_COLS(sp) < cnt || off != 0 && off + sp->cols < cnt) { *************** *** 762,770 **** --- 950,969 ---- * vs_modeline -- * Update the mode line. */ + #ifndef CANNA static void vs_modeline(sp) SCR *sp; + #else + /* + * PUBLIC: #ifdef CANNA + * PUBLIC: void vs_modeline __P((SCR *)); + * PUBLIC: #endif + */ + void + vs_modeline(sp) + SCR *sp; + #endif { static char * const modes[] = { "215|Append", /* SM_APPEND */ *************** *** 777,782 **** --- 976,984 ---- size_t cols, curcol, curlen, endpoint, len, midpoint; const char *t; int ellipsis; + #ifdef MULTIBYTE + /* XXX p is ok to be char *, since p points to filename only. */ + #endif char *p, buf[20]; gp = sp->gp; *************** *** 796,803 **** --- 998,1014 ---- */ (void)gp->scr_move(sp, LASTLINE(sp), 0); + #ifdef CANNA + curlen = canna_modeline(sp); + canna_modelinesw(sp, 1); + if (sp->cols - 1 < curlen) + return; + #endif /*CANNA*/ + /* If more than one screen in the display, show the file name. */ + #ifndef CANNA curlen = 0; + #endif if (IS_SPLIT(sp)) { for (p = sp->frp->name; *p != '\0'; ++p); for (ellipsis = 0, cols = sp->cols / 2; --p > sp->frp->name;) { Index: vi/vs_relative.c Prereq: 10.11 *** nvi-1.79/vi/vs_relative.c Mon May 13 23:20:04 1996 --- nvi-1.79-m17n/vi/vs_relative.c Fri Feb 21 22:34:20 1997 *************** *** 108,129 **** size_t *cnop, *diffp; { size_t chlen, cno, curoff, last, len, scno; int ch, leftright, listset; char *p; /* Need the line to go any further. */ ! if (lp == NULL) { (void)db_get(sp, lno, 0, &lp, &len); - if (len == 0) - goto done; - } - - /* Missing or empty lines are easy. */ - if (lp == NULL) { - done: if (diffp != NULL) /* XXX */ - *diffp = 0; - return (0); - } /* Store away the values of the list and leftright edit options. */ listset = O_ISSET(sp, O_LIST); --- 108,125 ---- size_t *cnop, *diffp; { size_t chlen, cno, curoff, last, len, scno; + #ifndef MULTIBYTE int ch, leftright, listset; char *p; + #else + int leftright, listset; + CHAR_T ch; + CHAR_T *p; + #endif /*MULTIBYTE*/ /* Need the line to go any further. */ ! if (lp == NULL) (void)db_get(sp, lno, 0, &lp, &len); /* Store away the values of the list and leftright edit options. */ listset = O_ISSET(sp, O_LIST); *************** *** 140,145 **** --- 136,148 ---- if (O_ISSET(sp, O_NUMBER)) scno += O_NUMBER_LENGTH; + /* Missing or empty lines are easy. */ + if (len == 0 || lp == NULL) { + if (diffp != NULL) /* XXX */ + *diffp = 0; + return (scno); + } + /* Macro to return the display length of any signal character. */ #define CHLEN(val) (ch = *(u_char *)p++) == '\t' && \ !listset ? TAB_OFF(val) : KEY_LEN(sp, ch); *************** *** 161,173 **** --- 164,220 ---- curoff -= sp->cols; \ } if (cnop == NULL) + #ifndef MULTIBYTE while (len--) { chlen = CHLEN(curoff); last = scno; scno += chlen; TAB_RESET; } + #else + { + /* len designates bytes/line. */ + int mb; + int ml; + while (0 < len) { + if (1 < KEY_BLEN(sp, *p)) { + mb = KEY_BLEN(sp, *p); + ml = KEY_LEN(sp, *p); + if (len < mb) + break; + ch = *p; + chlen = ml; + last = scno; + scno += ml; + len -= mb; + p += mb; + + /* TAB_RESET is expanded here. */ + curoff += chlen; + if (!leftright && curoff >= sp->cols) { + if (ch == '\t') { + curoff = 0; + scno -= scno % sp->cols; + } else { + if (curoff == sp->cols) + curoff = 0; + else + curoff = chlen; + } + } + } else { + chlen = CHLEN(curoff); + last = scno; + scno += chlen; + len--; + /* p will be modified in CHLEN() */ + TAB_RESET; + } + } + } + #endif /*MULTIBYTE*/ else + #ifndef MULTIBYTE for (cno = *cnop;; --cno) { chlen = CHLEN(curoff); last = scno; *************** *** 176,181 **** --- 223,273 ---- if (cno == 0) break; } + #else + { + int mb; + int ml; + cno = *cnop; + while (1) { + if (1 < KEY_BLEN(sp, *p)) { + mb = KEY_BLEN(sp, *p); + ml = KEY_LEN(sp, *p); + ch = *p; + chlen = ml; + last = scno; + scno += ml; + p += mb; + + /* TAB_RESET is expanded here. */ + curoff += chlen; + if (!leftright && curoff >= sp->cols) { + if (ch == '\t') { + curoff = 0; + scno -= scno % sp->cols; + } else { + if (curoff == sp->cols) + curoff = 0; + else + curoff = chlen; + } + } + + if (cno < mb) + break; + cno -= mb; + } else { + chlen = CHLEN(curoff); + last = scno; + scno += chlen; + /* p will be modified in CHLEN() */ + TAB_RESET; + if (cno == 0) + break; + cno--; + } + } + } + #endif /*MULTIBYTE*/ /* Add the trailing '$' if the O_LIST option set. */ if (listset && cnop == NULL) *************** *** 209,217 **** --- 301,316 ---- /* Last character is easy, and common. */ if (islast) { + #ifndef MULTIBYTE if (db_get(sp, lno, 0, NULL, &len) || len == 0) return (0); return (len - 1); + #else + CHAR_T *p; + if (db_get(sp, lno, 0, &p, &len) || len == 0) + return (0); + return (len - multi_back(sp, p, &p[len])); + #endif /*MULTIBYTE*/ } /* First character is easy, and common. */ *************** *** 228,233 **** --- 327,339 ---- * * PUBLIC: size_t vs_colpos __P((SCR *, recno_t, size_t)); */ + #ifdef MULTIBYTE + /* + * XXX + * note that the third argument, cno, designate column on the screen, not + * the offset from the head of the buffer. + */ + #endif /*MULTIBYTE*/ size_t vs_colpos(sp, lno, cno) SCR *sp; *************** *** 235,242 **** --- 341,354 ---- size_t cno; { size_t chlen, curoff, len, llen, off, scno; + #ifndef MULTIBYTE int ch, leftright, listset; char *lp, *p; + #else + int leftright, listset; + CHAR_T ch; + CHAR_T *lp, *p; + #endif /*MULTIBYTE*/ /* Need the line to go any further. */ (void)db_get(sp, lno, 0, &lp, &llen); *************** *** 253,267 **** off = cno / sp->cols; cno %= sp->cols; for (scno = 0, p = lp, len = llen; off--;) { for (; len && scno < sp->cols; --len) scno += CHLEN(scno); /* * If reached the end of the physical line, return the last * physical character in the line. */ ! if (len == 0) return (llen - 1); /* * If folding screens (the historic vi screen format), past --- 365,437 ---- off = cno / sp->cols; cno %= sp->cols; for (scno = 0, p = lp, len = llen; off--;) { + #ifndef MULTIBYTE for (; len && scno < sp->cols; --len) scno += CHLEN(scno); + #else + { + size_t mb; + size_t ml; + int ch0; + + ch0 = ch = p[0]; /*for safety*/ + while (len && scno < sp->cols) { + ch0 = ch; + ch = p[0]; + if (ch == '\t' && !listset) { + scno += TAB_OFF(scno); + len--; + p++; + continue; + } + + mb = KEY_BLEN(sp, ch); + ml = KEY_LEN(sp, ch); + if (mb == 1 || scno + ml < sp->cols) { + /* + * Singlebyte char can be displayed across + * the end-of-screen. + * If a multibyte char fits into this line, + * put it here. + */ + scno += ml; + len -= mb; + p += mb; + } else if (leftright) { + /* + * side-scrolling screen is similar to + * singlebyte case. + */ + scno += ml; + len -= mb; + p += mb; + } else { + /* + * Multibyte char can't be displayed across + * the end-of-screen, in folding screen. + * If it crosses the end-of-screen, + * don't put it here. + * Put it on the next line. + * we must adjust ch to the last char of the + * line. + */ + scno = sp->cols; + } + } + } + #endif /*MULTIBYTE*/ /* * If reached the end of the physical line, return the last * physical character in the line. */ ! if (len == 0) { ! #ifndef MULTIBYTE return (llen - 1); + #else + return (llen - multi_back(sp, lp, &lp[llen])); + #endif + } /* * If folding screens (the historic vi screen format), past *************** *** 277,283 **** --- 447,471 ---- /* Step through the line until reach the right character or EOL. */ for (curoff = scno; len--;) { + #ifndef MULTIBYTE chlen = CHLEN(curoff); + #else + { + size_t mb; + size_t ml; + mb = KEY_BLEN(sp, *p); + ml = KEY_LEN(sp, *p); + if (*p == '\t' && !listset) { + chlen = TAB_OFF(curoff); + /* len will be modified in for loop */ + p++; + } else { + chlen = ml; + len -= (mb - 1); + p += mb; + } + } + #endif /*MULTIBYTE*/ /* * If we've reached the specific character, there are three *************** *** 293,305 **** --- 481,509 ---- */ if ((scno += chlen) >= cno) { off = p - lp; + #ifndef MULTIBYTE return (scno == cno ? (off < llen - 1 ? off : llen - 1) : off - 1); + #else + if (scno == cno) { + size_t lastlen; + lastlen = llen - multi_back(sp, lp, &lp[llen]); + if (off < lastlen) + return off; + else + return lastlen; + } else + return off - multi_back(sp, lp, &lp[off]); + #endif /*MULTIBYTE*/ } TAB_RESET; } /* No such character; return the start of the last character. */ + #ifndef MULTIBYTE return (llen - 1); + #else + return llen - multi_back(sp, lp, &lp[llen]); + #endif }