--- build/Makefile.in 2001/10/23 04:22:19 1.1.1.1 +++ build/Makefile.in 2001/10/23 04:33:20 1.2 @@ -41,7 +41,10 @@ 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 + 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,6 +92,10 @@ `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,7 +146,7 @@ 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 && \ + [ ! -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,6 +163,7 @@ 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,7 +193,7 @@ distclean maintainer-clean realclean: clean cleandocs -rm -f Makefile config.cache config.h config.log config.status - -rm -f pathnames.h port.h + -rm -f pathnames.h port.h regular qregular # Vi curses sources. cl_bsd.o: $(srcdir)/cl/cl_bsd.c @@ -627,4 +635,28 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/build/acconfig.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- build/acconfig.h 2001/10/23 04:22:19 1.1.1.1 +++ build/acconfig.h 2001/10/23 04:33:20 1.2 @@ -80,3 +80,13 @@ /* 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 =================================================================== RCS file: /cvsroot/itojun/nvi/build/config.h.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- build/config.h.in 2001/10/23 04:22:19 1.1.1.1 +++ build/config.h.in 2001/10/23 04:33:20 1.2 @@ -112,6 +112,15 @@ /* 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,8 +181,8 @@ /* 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 + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H Index: build/configure =================================================================== RCS file: /cvsroot/itojun/nvi/build/configure,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- build/configure 2001/10/23 04:22:19 1.1.1.1 +++ build/configure 2001/10/23 04:33:20 1.2 @@ -1,8 +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. +# Generated automatically using autoconf version 2.13 +# 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,16 +14,18 @@ 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." ac_help="$ac_help --enable-tclinterp Include a Tk/Tcl interpreter in vi." ac_help="$ac_help - --disable-curses DON'T use the nvi-provided curses routines." -ac_help="$ac_help --disable-db DON'T use the nvi-provided DB routines." ac_help="$ac_help --disable-re DON'T use the nvi-provided RE routines." @@ -65,6 +67,9 @@ # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 ac_prev= for ac_option @@ -346,7 +351,7 @@ verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.7" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -448,11 +453,14 @@ 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 +# 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,13 +519,13 @@ 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' +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross +ac_exeext= +ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -559,27 +567,30 @@ # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./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:576: 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}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. : else ac_cv_path_install="$ac_dir/$ac_prog -c" @@ -590,7 +601,7 @@ ;; esac done - IFS="$ac_save_ifs" + IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then @@ -609,32 +620,35 @@ # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Make sure we can run config.sub. -if $ac_config_sub sun4 >/dev/null 2>&1; then : +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:635: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) - if host_alias=`$ac_config_guess`; then : + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; 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/'` +host=`${CONFIG_SHELL-/bin/sh} $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,6 +672,7 @@ echo $ac_n "checking if --enable-debug option specified""... $ac_c" 1>&6 +echo "configure:676: 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,8 +691,37 @@ fi echo "$ac_t""$vi_cv_debug" 1>&6 +echo $ac_n "checking if --enable-multibyte option specified""... $ac_c" 1>&6 +echo "configure:696: 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 aix3.2.5) OPTFLAG=${OPTFLAG-"-O"};; aix4.1*) CFLAGS=${CFLAGS-"-qstrict"} @@ -686,21 +730,24 @@ LDFLAGS=${LDFLAGS-"-ZP"} OPTFLAG=${OPTFLAG-"-O"};; bsd4.4) OPTFLAG=${OPTFLAG-"-O2"};; -bsdi*) CC=${CC-"shlicc"} +bsdi3*) CC=${CC-"shlicc"} OPTFLAG=${OPTFLAG-"-O2"};; +bsdi*) OPTFLAG=${OPTFLAG-"-O2"};; irix6*) OPTFLAG=${OPTFLAG-"-O2"};; irix*) OPTFLAG=${OPTFLAG-"-O2"};; 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:742: 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}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -708,7 +755,6 @@ fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc" fi fi CC="$ac_cv_prog_CC" @@ -718,8 +764,141 @@ 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:772: 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=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; 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 + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:823: 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=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +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 + ;; + esac + 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:855: 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${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 866 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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* +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${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +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:897: 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:902: 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,7 +907,7 @@ yes; #endif EOF -if ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:911: \"$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,36 +915,50 @@ 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 +else + GCC= +fi + +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:930: 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_gcc_g=yes + ac_cv_prog_cc_g=yes else - ac_cv_prog_gcc_g=no + ac_cv_prog_cc_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 +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 + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" fi else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi fi echo $ac_n "checking for GNU C (gcc) version 2.x""... $ac_c" 1>&6 +echo "configure:962: 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,77 +1019,60 @@ 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 +echo "configure:1024: 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='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' +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $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${ac_exeext}; 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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:1058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 -fi rm -fr conftest* +fi +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${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + case "$am_cv_prog_cc_works" in *no) { echo "configure: error: Installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } ;; *yes) ;; @@ -909,6 +1085,7 @@ # 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:1089: 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 @@ -916,9 +1093,13 @@ /*) ac_cv_path_vi_cv_path_shell="$vi_cv_path_shell" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_shell="$vi_cv_path_shell" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_shell="$ac_dir/$ac_word" @@ -945,6 +1126,7 @@ # 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:1130: 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 @@ -952,9 +1134,13 @@ /*) ac_cv_path_vi_cv_path_sendmail="$vi_cv_path_sendmail" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_sendmail="$vi_cv_path_sendmail" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_sendmail="$ac_dir/$ac_word" @@ -984,6 +1170,7 @@ # 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:1174: 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 @@ -991,9 +1178,13 @@ /*) ac_cv_path_vi_cv_path_perl="$vi_cv_path_perl" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_perl="$vi_cv_path_perl" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_perl="$ac_dir/$ac_word" @@ -1018,6 +1209,7 @@ echo $ac_n "checking for preserve directory""... $ac_c" 1>&6 +echo "configure:1213: 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,6 +1241,7 @@ # 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:1245: 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 @@ -1056,9 +1249,13 @@ /*) ac_cv_path_vi_cv_path_chmod="$vi_cv_path_chmod" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_chmod="$vi_cv_path_chmod" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_chmod="$ac_dir/$ac_word" @@ -1080,6 +1277,7 @@ # 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:1281: 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 @@ -1087,9 +1285,13 @@ /*) ac_cv_path_vi_cv_path_cp="$vi_cv_path_cp" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_cp="$vi_cv_path_cp" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_cp="$ac_dir/$ac_word" @@ -1111,6 +1313,7 @@ # 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:1317: 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 @@ -1118,9 +1321,13 @@ /*) ac_cv_path_vi_cv_path_ln="$vi_cv_path_ln" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_ln="$vi_cv_path_ln" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_ln="$ac_dir/$ac_word" @@ -1142,6 +1349,7 @@ # 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:1353: 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 @@ -1149,9 +1357,13 @@ /*) ac_cv_path_vi_cv_path_mkdir="$vi_cv_path_mkdir" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_mkdir="$vi_cv_path_mkdir" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_mkdir="$ac_dir/$ac_word" @@ -1173,6 +1385,7 @@ # 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:1389: 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 @@ -1180,9 +1393,13 @@ /*) ac_cv_path_vi_cv_path_rm="$vi_cv_path_rm" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_rm="$vi_cv_path_rm" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_rm="$ac_dir/$ac_word" @@ -1204,6 +1421,7 @@ # 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:1425: 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 @@ -1211,9 +1429,13 @@ /*) ac_cv_path_vi_cv_path_strip="$vi_cv_path_strip" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_strip="$vi_cv_path_strip" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_strip="$ac_dir/$ac_word" @@ -1234,6 +1456,7 @@ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1460: 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,37 +1471,62 @@ # 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` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1481: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` 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:1498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +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} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -ac_err=`grep -v '^ *+' conftest.out` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` 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 rm -f conftest* fi rm -f conftest* +fi +rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" @@ -1292,6 +1540,7 @@ # 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:1544: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -1299,17 +1548,20 @@ : fi +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then - no_x=yes + # The user explicitly disabled X. + have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then - no_x= + # Both variables are already set. + have_x=yes else -if eval "test \"`echo '$''{'ac_cv_path_x'+set}'`\" = set"; then +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. -no_x=yes +ac_x_includes=NO ac_x_libraries=NO rm -fr conftestdir if mkdir conftestdir; then cd conftestdir @@ -1319,7 +1571,6 @@ @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. @@ -1329,7 +1580,9 @@ ac_im_usrlibdir=$ac_im_libdir; break fi done - # Screen out bogus values from the imake configuration. + # 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" ;; @@ -1342,46 +1595,52 @@ cd .. 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 -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 + # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -ac_err=`grep -v '^ *+' conftest.out` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1611: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* - no_x= ac_x_includes= + # 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* - for ac_dir in \ + # 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/X11/include \ - /usr/include/X11 \ - /usr/local/X11/include \ - /usr/local/include/X11 \ - \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ @@ -1398,56 +1657,65 @@ ; \ do if test -r "$ac_dir/$x_direct_test_include"; then - no_x= ac_x_includes=$ac_dir + ac_x_includes=$ac_dir break fi done fi rm -f conftest* +fi # $ac_x_includes = NO -# 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" +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - LIBS="$ac_save_LIBS" no_x= ac_x_libraries= + 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/X11/lib \ - /usr/lib/X11 \ - /usr/local/X11/lib \ - /usr/local/lib/X11 \ - \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ @@ -1458,6 +1726,7 @@ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ + /lib/usr/lib/X11 \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ @@ -1465,31 +1734,38 @@ 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 + ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest* +fi # $ac_x_libraries = NO -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" +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_path_x" + eval "$ac_cv_have_x" fi # $with_x != no -if test "$no_x" = yes; then - echo "$ac_t""no" 1>&6 +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 - ac_cv_path_x="no_x= ac_x_includes=$x_includes ac_x_libraries=$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,9 +1784,138 @@ fi fi +echo $ac_n "checking if --enable-canna option specified""... $ac_c" 1>&6 +echo "configure:1789: 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:1824: 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:1836: \"$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:1860: 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${ac_exeext}; 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:1919: 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" @@ -1521,6 +1926,10 @@ echo "$ac_t""$vi_cv_perlinterp" 1>&6 if test "$vi_cv_perlinterp" = "yes"; then + if test "$vi_cv_multibyte" = "yes"; then + echo "Fatal error: --enable-perlinterp does not work with --enable-multibyte." + exit 1 + fi if test "$vi_cv_path_perl" = no; then echo "Fatal error: no perl5 utility found." exit 1 @@ -1565,6 +1974,7 @@ echo $ac_n "checking if --enable-tknvi option specified""... $ac_c" 1>&6 +echo "configure:1978: 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,6 +1990,7 @@ fi echo $ac_n "checking if --enable-tclinterp option specified""... $ac_c" 1>&6 +echo "configure:1994: 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" @@ -1590,6 +2001,10 @@ echo "$ac_t""$vi_cv_tclinterp" 1>&6 if test "$vi_cv_tclinterp" = "yes"; then + if test "$vi_cv_multibyte" = "yes"; then + echo "Fatal error: --enable-tclinterp does not work with --enable-multibyte." + exit 1 + fi LIBOBJS="tcl.o $LIBOBJS" LIBS="-ltk -ltcl -lm $XLIBS $LIBS" cat >> confdefs.h <<\EOF @@ -1599,26 +2014,28 @@ 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'` + echo $ac_n "checking for main in -ltcl""... $ac_c" 1>&6 +echo "configure:2019: 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${ac_exeext}; 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,26 +2062,32 @@ LIBOBJS="api.o $LIBOBJS" fi -echo $ac_n "checking for -ltermlib""... $ac_c" 1>&6 -ac_lib_var=`echo termlib | tr '.-/+' '___p'` +echo $ac_n "checking for tgetent in -ltermlib""... $ac_c" 1>&6 +echo "configure:2067: 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${ac_exeext}; 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,26 +2104,32 @@ 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'` + echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 +echo "configure:2109: 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${ac_exeext}; 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 @@ -1721,16 +2150,12 @@ LIBS="$vi_cv_termlib $LIBS" fi -echo $ac_n "checking if --disable-curses option specified""... $ac_c" 1>&6 -# Check whether --enable-curses or --disable-curses was given. -if test "${enable_curses+set}" = set; then - enableval="$enable_curses" - vi_cv_curses="other curses" -else - vi_cv_curses="bundled curses" -fi - -echo "$ac_t""$vi_cv_curses" 1>&6 +#AC_MSG_CHECKING(if --disable-curses option specified) +#AC_ARG_ENABLE(curses, +# [ --disable-curses DON'T use the nvi-provided curses routines.], +# [vi_cv_curses="other curses"], [vi_cv_curses="bundled curses"]) +#AC_MSG_RESULT($vi_cv_curses) +vi_cv_curses="bundled curses" case "$vi_cv_curses" in "bundled curses") CPPFLAGS="-I\$(srcdir)/curses $CPPFLAGS" @@ -1740,21 +2165,25 @@ esac echo $ac_n "checking for sys/mman.h""... $ac_c" 1>&6 +echo "configure:2169: 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 -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -ac_err=`grep -v '^ *+' conftest.out` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2179: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` 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,21 +2199,25 @@ echo "$ac_t""$vi_cv_include_sys_mman" 1>&6 echo $ac_n "checking for sys/select.h""... $ac_c" 1>&6 +echo "configure:2203: 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 -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -ac_err=`grep -v '^ *+' conftest.out` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2213: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` 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,24 +2233,28 @@ 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:2237: 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 -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -ac_err=`grep -v '^ *+' conftest.out` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2250: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` 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,7 +2263,7 @@ 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,7 +2281,7 @@ 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,8 +2301,8 @@ if test "$cross_compiling" = yes; then : else -cat > conftest.$ac_ext < conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1876,15 +2313,19 @@ exit (0); } EOF -eval $ac_link -if test -s conftest && (./conftest; exit) 2>/dev/null; then +if { (eval echo configure:2317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 -fi rm -fr conftest* fi + +fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 @@ -1896,19 +2337,21 @@ fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 +echo "configure:2341: 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" >/dev/null 2>&1; then + egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_ssize_t=yes else @@ -1927,58 +2370,60 @@ fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 +echo "configure:2374: 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() { return 0; } -int t() { +int main() { #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:2392: \"$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() { return 0; } -int t() { +int main() { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:2407: \"$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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:2440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 -fi rm -fr conftest* fi + +fi fi echo "$ac_t""$ac_cv_c_bigendian" 1>&6 @@ -2011,15 +2460,15 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:2464: 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 <&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,28 +2535,29 @@ fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 +echo "configure:2539: 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() { return 0; } -int t() { +int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:2552: \"$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,19 +2569,21 @@ fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 +echo "configure:2573: 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" >/dev/null 2>&1; then + egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_mode_t=yes else @@ -2149,19 +2602,21 @@ fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 +echo "configure:2606: 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" >/dev/null 2>&1; then + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_off_t=yes else @@ -2180,19 +2635,21 @@ fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:2639: 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" >/dev/null 2>&1; then + egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_pid_t=yes else @@ -2211,19 +2668,21 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:2672: 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" >/dev/null 2>&1; then + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_size_t=yes else @@ -2242,28 +2701,29 @@ fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 +echo "configure:2705: 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() { return 0; } -int t() { +int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:2718: \"$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,20 +2738,22 @@ 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:2742: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2304,16 +2766,18 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:2770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,20 +2793,22 @@ 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:2797: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2355,43 +2821,51 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:2825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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" +LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" 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:2854: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2404,16 +2878,18 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:2882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,20 +2905,22 @@ 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:2909: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2455,43 +2933,51 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:2937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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" +LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" fi - done + for ac_func in strtoul vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2966: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2504,16 +2990,18 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:2994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,20 +3017,22 @@ for ac_func in strtoul vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3021: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2555,44 +3045,52 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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" +LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" fi - done + for ac_func in select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3079: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2605,16 +3103,18 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,20 +3130,22 @@ for ac_func in setenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3134: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2656,16 +3158,18 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,20 +3186,22 @@ for ac_func in strsep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3190: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2708,16 +3214,18 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,20 +3242,22 @@ for ac_func in unsetenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3246: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2760,16 +3270,18 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,23 +3296,65 @@ done -for ac_func in valloc getpagesize +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:3304: 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:3314: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +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:3343: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2813,16 +3367,18 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,117 +3392,197 @@ done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_func_mmap'+set}'`\" = set"; then +echo "configure:3396: 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=no + ac_cv_func_mmap_fixed_mapped=no else -cat > conftest.$ac_ext < conftest.$ac_ext < #include #include +/* This mess was copied from the GNU getpagesize.h. */ #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 +# ifdef HAVE_UNISTD_H +# include # endif -#endif -#ifndef HAVE_VALLOC -# define valloc malloc -#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 *valloc(unsigned), *malloc(unsigned); } +extern "C" { void *malloc(unsigned); } #else -char *valloc(), *malloc(); +char *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); + 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 -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 +if { (eval echo configure:3544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 -echo "$ac_t""$ac_cv_func_mmap" 1>&6 -if test $ac_cv_func_mmap = yes; then +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" | tr './\055' '___'` +ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 +echo "configure:3568: 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 -eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -ac_err=`grep -v '^ *+' conftest.out` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` 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,25 +3599,28 @@ fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then +echo "configure:3603: 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:3609: 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() { return 0; } -int t() { +int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -2994,16 +3633,18 @@ ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 : @@ -3011,9 +3652,10 @@ echo "$ac_t""no" 1>&6 fi +ac_cv_func_vfork_works=$ac_cv_func_vfork else -cat > conftest.$ac_ext < conftest.$ac_ext < @@ -3041,8 +3683,10 @@ static pid_t child; if (!child) { child = vfork (); - if (child < 0) + if (child < 0) { perror ("vfork"); + _exit(2); + } if (!child) { arg = getpid(); write(-1, "", 0); @@ -3106,18 +3750,22 @@ } } 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 +if { (eval echo configure:3754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 -echo "$ac_t""$ac_cv_func_vfork" 1>&6 -if test $ac_cv_func_vfork = no; then +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,6 +3782,7 @@ fi echo $ac_n "checking for fcntl/flock""... $ac_c" 1>&6 +echo "configure:3786: 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,37 +3792,39 @@ irix*);; *) cat > conftest.$ac_ext < -int main() { return 0; } -int t() { +int main() { flock(0, 0); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* vi_cv_lock=flock +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi -rm -f conftest* -;; +rm -f conftest*;; esac if test "$vi_cv_lock" = none; then cat > conftest.$ac_ext < -int main() { return 0; } -int t() { +int main() { fcntl(0, F_SETLK, 0); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,44 +3844,45 @@ echo "$ac_t""$vi_cv_lock" 1>&6 echo $ac_n "checking for ftruncate/chsize""... $ac_c" 1>&6 +echo "configure:3848: 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() { return 0; } -int t() { +int main() { ftruncate(0, 0); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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() { return 0; } -int t() { +int main() { chsize(0, 0); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,27 +3905,28 @@ echo "$ac_t""$vi_cv_ftruncate" 1>&6 echo $ac_n "checking for tigetstr/tigetnum""... $ac_c" 1>&6 +echo "configure:3909: 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() { return 0; } -int t() { +int main() { tigetstr(0); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,27 +3952,28 @@ else echo $ac_n "checking for addnstr""... $ac_c" 1>&6 +echo "configure:3956: 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() { return 0; } -int t() { +int main() { addnstr(0, 0); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:3968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,27 +3985,28 @@ echo "$ac_t""$vi_cv_have_curses_addnstr" 1>&6 echo $ac_n "checking for beep""... $ac_c" 1>&6 +echo "configure:3989: 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() { return 0; } -int t() { +int main() { beep(); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:4001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,27 +4018,28 @@ echo "$ac_t""$vi_cv_have_curses_beep" 1>&6 echo $ac_n "checking for flash""... $ac_c" 1>&6 +echo "configure:4022: 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() { return 0; } -int t() { +int main() { flash(); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:4034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,27 +4051,28 @@ echo "$ac_t""$vi_cv_have_curses_flash" 1>&6 echo $ac_n "checking for idlok""... $ac_c" 1>&6 +echo "configure:4055: 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() { return 0; } -int t() { +int main() { idlok(0, 0); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:4067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,27 +4084,28 @@ echo "$ac_t""$vi_cv_have_curses_idlok" 1>&6 echo $ac_n "checking for keypad""... $ac_c" 1>&6 +echo "configure:4088: 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() { return 0; } -int t() { +int main() { keypad(0, 0); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:4100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,27 +4117,28 @@ echo "$ac_t""$vi_cv_have_curses_keypad" 1>&6 echo $ac_n "checking for newterm""... $ac_c" 1>&6 +echo "configure:4121: 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() { return 0; } -int t() { +int main() { newterm(0, 0, 0); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:4133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,27 +4158,28 @@ fi echo $ac_n "checking for setupterm""... $ac_c" 1>&6 +echo "configure:4162: 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() { return 0; } -int t() { +int main() { setupterm(0, 0, 0); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:4174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,28 +4191,29 @@ 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:4195: 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() { return 0; } -int t() { +int main() { gettimeofday(0, 0); ; return 0; } EOF -if eval $ac_link; then +if { (eval echo configure:4208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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,27 +4225,28 @@ echo "$ac_t""$vi_cv_gettimeofday" 1>&6 echo $ac_n "checking for System V pty calls""... $ac_c" 1>&6 +echo "configure:4229: 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${ac_exeext}; 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,27 +4258,28 @@ echo "$ac_t""$vi_cv_sys5_pty" 1>&6 echo $ac_n "checking for revoke system call""... $ac_c" 1>&6 +echo "configure:4262: 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${ac_exeext}; 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,27 +4291,32 @@ echo "$ac_t""$vi_cv_revoke" 1>&6 echo $ac_n "checking for int type sprintf return value""... $ac_c" 1>&6 +echo "configure:4295: 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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:4307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 -fi rm -fr conftest* fi +fi + if test "$vi_cv_sprintf_count" = no; then cat >> confdefs.h <<\EOF #define SPRINTF_RET_CHARPNT 1 @@ -3658,6 +4326,7 @@ echo "$ac_t""$vi_cv_sprintf_count" 1>&6 echo $ac_n "checking if --disable-db option specified""... $ac_c" 1>&6 +echo "configure:4330: 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,6 +4345,7 @@ esac echo $ac_n "checking if --disable-re option specified""... $ac_c" 1>&6 +echo "configure:4349: 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,27 +4365,28 @@ echo $ac_n "checking for u_char""... $ac_c" 1>&6 +echo "configure:4369: 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() { return 0; } -int t() { +int main() { u_char foo; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:4381: \"$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,27 +4396,28 @@ echo $ac_n "checking for u_short""... $ac_c" 1>&6 +echo "configure:4400: 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() { return 0; } -int t() { +int main() { u_short foo; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:4412: \"$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,27 +4427,28 @@ echo $ac_n "checking for u_int""... $ac_c" 1>&6 +echo "configure:4431: 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() { return 0; } -int t() { +int main() { u_int foo; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:4443: \"$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,27 +4458,28 @@ echo $ac_n "checking for u_long""... $ac_c" 1>&6 +echo "configure:4462: 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() { return 0; } -int t() { +int main() { u_long foo; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:4474: \"$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,43 +4489,48 @@ echo $ac_n "checking for u_int8_t""... $ac_c" 1>&6 +echo "configure:4493: 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() { return 0; } -int t() { +int main() { u_int8_t foo; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:4505: \"$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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:4520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 -fi rm -fr conftest* fi -rm -f conftest* fi +rm -f conftest* +fi echo "$ac_t""$vi_cv_uint8" 1>&6 if test "$vi_cv_uint8" = no; then @@ -3865,58 +4544,67 @@ echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6 +echo "configure:4548: 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() { return 0; } -int t() { +int main() { u_int16_t foo; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:4560: \"$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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:4575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:4590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 -fi rm -fr conftest* fi + fi rm -fr conftest* fi -rm -f conftest* fi +rm -f conftest* +fi echo "$ac_t""$vi_cv_uint16" 1>&6 if test "$vi_cv_uint16" = no; then @@ -3930,58 +4618,67 @@ echo $ac_n "checking for int16_t""... $ac_c" 1>&6 +echo "configure:4622: 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() { return 0; } -int t() { +int main() { int16_t foo; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:4634: \"$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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:4649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:4664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 -fi rm -fr conftest* fi + fi rm -fr conftest* fi -rm -f conftest* fi +rm -f conftest* +fi echo "$ac_t""$vi_cv_int16" 1>&6 if test "$vi_cv_int16" = no; then @@ -3995,58 +4692,67 @@ echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6 +echo "configure:4696: 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() { return 0; } -int t() { +int main() { u_int32_t foo; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:4708: \"$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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:4723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:4738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 -fi rm -fr conftest* fi + fi rm -fr conftest* fi -rm -f conftest* fi +rm -f conftest* +fi echo "$ac_t""$vi_cv_uint32" 1>&6 if test "$vi_cv_uint32" = no; then @@ -4060,58 +4766,67 @@ echo $ac_n "checking for int32_t""... $ac_c" 1>&6 +echo "configure:4770: 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() { return 0; } -int t() { +int main() { int32_t foo; ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:4782: \"$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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:4797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 < conftest.$ac_ext </dev/null; then +if { (eval echo configure:4812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 -fi rm -fr conftest* fi + fi rm -fr conftest* fi -rm -f conftest* fi +rm -f conftest* +fi echo "$ac_t""$vi_cv_int32" 1>&6 if test "$vi_cv_int32" = no; then @@ -4140,11 +4855,25 @@ # --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 | - sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ - >> confcache + case `(ac_space=' '; set | grep ac_space) 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,7 +4928,7 @@ 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" + echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -4211,7 +4940,8 @@ 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 + pathnames.h:pathnames.h.in recover:recover.in + regular:regular.in qregular:qregular.in config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub +s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g @@ -4242,6 +4974,7 @@ s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@host@%$host%g s%@host_alias@%$host_alias%g @@ -4281,21 +5014,58 @@ 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]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + *:*) 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. + # 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,6 +5093,7 @@ [/$]*) 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,14 +5102,16 @@ # $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 -" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done -rm -f conftest.subs +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,11 +5132,17 @@ ac_eC=' ' ac_eD='%g' -CONFIG_HEADERS=${CONFIG_HEADERS-"config.h"} +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]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac @@ -4371,7 +5150,8 @@ echo creating $ac_file rm -f conftest.frag conftest.in conftest.out - cp $ac_given_srcdir/$ac_file_in conftest.in + 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,7 +5163,7 @@ 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%#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,8 +5179,6 @@ # 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 : @@ -4431,12 +5209,22 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/build/configure.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- build/configure.in 2001/10/23 04:22:19 1.1.1.1 +++ build/configure.in 2001/10/23 04:33:20 1.2 @@ -22,6 +22,21 @@ 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. @@ -39,8 +54,9 @@ LDFLAGS=${LDFLAGS-"-ZP"} OPTFLAG=${OPTFLAG-"-O"};; bsd4.4) OPTFLAG=${OPTFLAG-"-O2"};; -bsdi*) CC=${CC-"shlicc"} +bsdi3*) CC=${CC-"shlicc"} OPTFLAG=${OPTFLAG-"-O2"};; +bsdi*) OPTFLAG=${OPTFLAG-"-O2"};; irix6*) OPTFLAG=${OPTFLAG-"-O2"};; irix*) OPTFLAG=${OPTFLAG-"-O2"};; lynxos*) AC_PROG_CC() @@ -194,6 +210,71 @@ 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) @@ -203,6 +284,10 @@ [vi_cv_perlinterp="yes"], [vi_cv_perlinterp="no"]) AC_MSG_RESULT($vi_cv_perlinterp) if test "$vi_cv_perlinterp" = "yes"; then + if test "$vi_cv_multibyte" = "yes"; then + echo "Fatal error: --enable-perlinterp does not work with --enable-multibyte." + exit 1 + fi if test "$vi_cv_path_perl" = no; then echo "Fatal error: no perl5 utility found." exit 1 @@ -258,6 +343,10 @@ [vi_cv_tclinterp="yes"], [vi_cv_tclinterp="no"]) AC_MSG_RESULT($vi_cv_tclinterp) if test "$vi_cv_tclinterp" = "yes"; then + if test "$vi_cv_multibyte" = "yes"; then + echo "Fatal error: --enable-tclinterp does not work with --enable-multibyte." + exit 1 + fi LIBOBJS="tcl.o $LIBOBJS" LIBS="-ltk -ltcl -lm $XLIBS $LIBS" AC_DEFINE(HAVE_TCL_INTERP) @@ -292,11 +381,12 @@ LIBS="$vi_cv_termlib $LIBS" fi AC_SUBST(cobjs) -AC_MSG_CHECKING(if --disable-curses option specified) -AC_ARG_ENABLE(curses, - [ --disable-curses DON'T use the nvi-provided curses routines.], - [vi_cv_curses="other curses"], [vi_cv_curses="bundled curses"]) -AC_MSG_RESULT($vi_cv_curses) +#AC_MSG_CHECKING(if --disable-curses option specified) +#AC_ARG_ENABLE(curses, +# [ --disable-curses DON'T use the nvi-provided curses routines.], +# [vi_cv_curses="other curses"], [vi_cv_curses="bundled curses"]) +#AC_MSG_RESULT($vi_cv_curses) +vi_cv_curses="bundled curses" case "$vi_cv_curses" in "bundled curses") CPPFLAGS="-I\$(srcdir)/curses $CPPFLAGS" @@ -722,4 +812,5 @@ fi AC_OUTPUT(Makefile port.h:port.h.in - pathnames.h:pathnames.h.in recover:recover.in) + pathnames.h:pathnames.h.in recover:recover.in + regular:regular.in qregular:qregular.in) Index: build/distrib =================================================================== RCS file: /cvsroot/itojun/nvi/build/distrib,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- build/distrib 2001/10/23 04:22:19 1.1.1.1 +++ build/distrib 2001/10/23 04:33:20 1.2 @@ -2,8 +2,8 @@ # @(#)distrib 8.11 (Berkeley) 10/23/96 # Clean -#make -f Makefile.in clean -#rm -f configure config.h.in +make -f Makefile.in clean +rm -f configure config.h.in # Build autoconf structure. echo "Running autoheader" @@ -74,6 +74,12 @@ 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 =================================================================== RCS file: qregular.in diff -N qregular.in --- /dev/null Wed Oct 24 08:26:45 2001 +++ build/qregular.in Wed Oct 24 10:33:07 2001 @@ -0,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.1 2001/10/23 04:33:20 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 =================================================================== RCS file: regular.in diff -N regular.in --- /dev/null Wed Oct 24 08:26:45 2001 +++ build/regular.in Wed Oct 24 10:33:07 2001 @@ -0,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.1 2001/10/23 04:33:20 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: cl/cl.h =================================================================== RCS file: /cvsroot/itojun/nvi/cl/cl.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cl/cl.h 2001/10/23 04:22:17 1.1.1.1 +++ cl/cl.h 2001/10/23 04:33:22 1.2 @@ -12,6 +12,12 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/cl/cl_funcs.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cl/cl_funcs.c 2001/10/23 04:22:17 1.1.1.1 +++ cl/cl_funcs.c 2001/10/23 04:33:22 1.2 @@ -35,12 +35,20 @@ * 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,9 +69,37 @@ (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(); return (0); @@ -301,6 +337,7 @@ 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,6 +348,10 @@ (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 =================================================================== RCS file: /cvsroot/itojun/nvi/cl/cl_main.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cl/cl_main.c 2001/10/23 04:22:17 1.1.1.1 +++ cl/cl_main.c 2001/10/23 04:33:22 1.2 @@ -257,6 +257,11 @@ /* 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 =================================================================== RCS file: /cvsroot/itojun/nvi/cl/cl_read.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cl/cl_read.c 2001/10/23 04:22:17 1.1.1.1 +++ cl/cl_read.c 2001/10/23 04:33:22 1.2 @@ -38,7 +38,40 @@ 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 -- * Return a single event. @@ -56,7 +89,12 @@ 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, * so that we just keep returning them until the editor dies. @@ -66,8 +104,22 @@ if (F_ISSET(clp, CL_SIGINT)) { F_CLR(clp, CL_SIGINT); evp->e_event = E_INTERRUPT; - } else +#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,6 +144,9 @@ } } +#ifdef MULTIBYTE +again: +#endif /* Set timer. */ if (ms == 0) tp = NULL; @@ -102,9 +157,49 @@ } /* Read input characters. */ +#ifndef MULTIBYTE switch (cl_read(sp, LF_ISSET(EC_QUOTED | EC_RAW), - clp->ibuf, sizeof(clp->ibuf), &nr, tp)) { + 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,6 +213,13 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/common/cut.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/cut.c 2001/10/23 04:22:19 1.1.1.1 +++ common/cut.c 2001/10/23 04:33:22 1.2 @@ -144,12 +144,28 @@ 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,8 +174,14 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/common/cut.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/cut.h 2001/10/23 04:22:19 1.1.1.1 +++ common/cut.h 2001/10/23 04:33:22 1.2 @@ -26,7 +26,7 @@ /* 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. */ + CHAR_T *lb; /* Line buffer. */ size_t lb_len; /* Line buffer length. */ size_t len; /* Line length. */ Index: common/delete.c =================================================================== RCS file: /cvsroot/itojun/nvi/common/delete.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/delete.c 2001/10/23 04:22:19 1.1.1.1 +++ common/delete.c 2001/10/23 04:33:22 1.2 @@ -39,7 +39,11 @@ { 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,15 +94,27 @@ /* 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,14 +133,27 @@ /* 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) { +#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,8 +163,14 @@ } 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 =================================================================== RCS file: /cvsroot/itojun/nvi/common/exf.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/exf.c 2001/10/23 04:22:19 1.1.1.1 +++ common/exf.c 2001/10/23 04:33:22 1.2 @@ -135,6 +135,9 @@ size_t psize; int fd, exists, open_err, readonly; char *oname, tname[MAXPATHLEN]; +#ifdef MULTIBYTE + int notranslation; +#endif open_err = readonly = 0; @@ -145,11 +148,27 @@ * 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. @@ -403,6 +422,21 @@ 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); @@ -853,7 +887,7 @@ * Note that this code is harmless if you're using libc 4.6.x. */ if (LF_ISSET(FS_APPEND) && lseek(fd, (off_t)0, SEEK_END) < 0) { - msgq(sp, M_SYSERR, name); + msgq(sp, M_SYSERR, "%s", name); return (1); } #endif @@ -970,7 +1004,7 @@ *--s = '.'; } } - msgq(sp, M_INFO, s); + msgq(sp, M_INFO, "%s", s); if (nf) FREE_SPACE(sp, p, 0); return (0); Index: common/gs.h =================================================================== RCS file: /cvsroot/itojun/nvi/common/gs.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/gs.h 2001/10/23 04:22:19 1.1.1.1 +++ common/gs.h 2001/10/23 04:33:22 1.2 @@ -35,6 +35,9 @@ #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,7 +78,18 @@ #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,16 +128,38 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/common/key.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/key.c 2001/10/23 04:22:19 1.1.1.1 +++ common/key.c 2001/10/23 04:33:22 1.2 @@ -206,6 +206,7 @@ v_key_ilookup(sp) SCR *sp; { +#ifndef MULTIBYTE CHAR_T ch, *p, *t; GS *gp; size_t len; @@ -214,6 +215,17 @@ 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,7 +244,29 @@ 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 * is the backup for the KEY_NAME() macro. @@ -244,6 +278,7 @@ 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,7 +330,7 @@ #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]; + 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,7 +348,57 @@ 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 * for the KEY_VAL() macro. @@ -579,6 +664,16 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/common/msg.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/msg.c 2001/10/23 04:22:19 1.1.1.1 +++ common/msg.c 2001/10/23 04:33:23 1.2 @@ -604,6 +604,20 @@ 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 =================================================================== RCS file: multi_big5.c diff -N multi_big5.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multi_big5.c Wed Oct 24 10:33:18 2001 @@ -0,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 2001/10/23 04:33:23 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 =================================================================== RCS file: multi_canna.c diff -N multi_canna.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multi_canna.c Wed Oct 24 10:33:18 2001 @@ -0,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.1 2001/10/23 04:33:23 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 =================================================================== RCS file: multi_chclass.c diff -N multi_chclass.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multi_chclass.c Wed Oct 24 10:33:18 2001 @@ -0,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.1 2001/10/23 04:33:23 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 =================================================================== RCS file: multi_euc.c diff -N multi_euc.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multi_euc.c Wed Oct 24 10:33:18 2001 @@ -0,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.1 2001/10/23 04:33:23 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 =================================================================== RCS file: multi_eucjp.c diff -N multi_eucjp.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multi_eucjp.c Wed Oct 24 10:33:18 2001 @@ -0,0 +1,159 @@ +/* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_eucjp.c,v 1.1 2001/10/23 04:33:23 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_1990 || p[0] == CS_JISX0208_1983 + || p[0] == CS_JISX0208_1978 || p[0] == CS_JISX0213_2000_1) { + name[0] = p[1] | 0x80; + name[1] = p[2] | 0x80; + name[2] = '\0'; + return 1; + } + return 0; +} +#endif /*MULTIBYTE*/ Index: common/multi_euctw.c =================================================================== RCS file: multi_euctw.c diff -N multi_euctw.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multi_euctw.c Wed Oct 24 10:33:18 2001 @@ -0,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 2001/10/23 04:33:23 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 =================================================================== RCS file: multi_hz.c diff -N multi_hz.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multi_hz.c Wed Oct 24 10:33:18 2001 @@ -0,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.1 2001/10/23 04:33:23 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 =================================================================== RCS file: multi_iso2022.c diff -N multi_iso2022.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multi_iso2022.c Wed Oct 24 10:33:18 2001 @@ -0,0 +1,1750 @@ +/* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_iso2022.c,v 1.1 2001/10/23 04:33:23 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 /* last resort */ + 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); +} + + +/* + * special treatment for iso-2022-jp-3. + * it must turn JIS X0208 designation into JIS X0213.1. + */ +int +iso2022jp3_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; + size_t i; + + ret = iso2022_to_int(sp, e, dst, pdlen, src, slen, pflags, state); + if (!dst || !pdlen) + return ret; + + for (i = 0; i < *pdlen; i++) { + if (dst[i] == CS_JISX0208_1983) + dst[i] = CS_JISX0213_2000_1; + } + return ret; +} + + +/* + * 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; +} + + +/* XXX need heavy rework! */ +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; + CHAR_T c; + int shifttype; + + 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)]) + + shifttype = e->shifttype; +#if 0 + /* + * if you think this is important to accept all available shift + * sequences, enable the following. + */ + shifttype = S_ALL; +#endif + + /* + * 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", c = kbuf[i + 1])) { + c = c - 'n' + 2; + if ((c == 2 && (shifttype & S_LS2)) + || (c == 3 && (shifttype & S_LS3))) { + isostate.gl = c; + i += 2; + consumed += 2; + continue; + } else { + /* + * LS[23] not supported in this charset + */ + goto raw; + } + } + if (strchr("~}|", c = kbuf[i + 1])) { + c = 3 - (c - '|'); + if ((c == 1 && (shifttype & S_LS1R)) + || (c == 2 && (shifttype & S_LS2R)) + || (c == 3 && (shifttype & S_LS3R))) { + isostate.gr = c; + i += 2; + consumed += 2; + continue; + } else { + /* + * LS[123]R not supported in this + * charset + */ + goto raw; + } + } + + 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; + } + + /* + * 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", c = kbuf[i + 1])) { + c = c - 'N' + 2; + if ((c == 2 && (shifttype & S_SS2)) + || (c == 3 && (shifttype & S_SS3))) { + cs = isostate.charsets[c]; + 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 = c; + i += 2; + consumed += 2; + goto characters; + } else { + /* + * SS[23] not supported in this charset + */ + goto raw; + } + } + + if (i + 3 == 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; + } + } + } + + if (i + 4 == kbuflen) { + i = kbuflen; + continue; + } + + /* + * more-than-4 chars sequence + */ + if (i + 6 <= kbuflen + && memcmp(&kbuf[i + 1], "&@\033", 3) == 0 + && strchr("()*+", kbuf[i + 4]) + && isecma(kbuf[i + 5])) { + sequencelen = 6; + goto tryit; + } + if (i + 6 <= kbuflen + && memcmp(&kbuf[i + 1], "&@\033$", 4) == 0 + && isecma(kbuf[i + 5])) { + sequencelen = 6; + goto tryit; + } + if (i + 7 <= kbuflen + && memcmp(&kbuf[i + 1], "&@\033$", 4) == 0 + && strchr("()*+", kbuf[i + 5]) + && isecma(kbuf[i + 6])) { + sequencelen = 7; + goto tryit; + } + } + + /* + * locking shift + */ + if (kbuf[i] == SI && (shifttype & S_SI)) { + isostate.gl = 0; + i++; + consumed++; + continue; + } + if (kbuf[i] == SO && (shifttype & S_SO)) { + isostate.gl = 1; + i++; + consumed++; + continue; + } + if ((kbuf[i] == 0x8e && (shifttype & S_SS3R)) + || (kbuf[i] == 0x8f && (shifttype & S_SS3R))) { + 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 =================================================================== RCS file: multi_none.c diff -N multi_none.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multi_none.c Wed Oct 24 10:33:18 2001 @@ -0,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 2001/10/23 04:33:23 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 =================================================================== RCS file: multi_sjis.c diff -N multi_sjis.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multi_sjis.c Wed Oct 24 10:33:18 2001 @@ -0,0 +1,343 @@ +/* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_sjis.c,v 1.1 2001/10/23 04:33:23 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. + */ + int t; + + t = charset(p[0]).blen; + p += t; + i += t - 1; /*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 =================================================================== RCS file: multibyte.awk diff -N multibyte.awk --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multibyte.awk Wed Oct 24 10:33:19 2001 @@ -0,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 =================================================================== RCS file: multibyte.c diff -N multibyte.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multibyte.c Wed Oct 24 10:33:19 2001 @@ -0,0 +1,2399 @@ +/* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multibyte.c,v 1.1 2001/10/23 04:33:23 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_JISX0213_2000_1 */ + { "JIS x0213-2000-1", 3, 2, jis0208_chclass, CS9494, 'O', '\0', 0, 0, }, +/* CS_JISX0213_2000_2 */ + { "JIS x0213-2000-2", 3, 2, NULL, CS9494, 'P', '\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, }, +/* CS_PRIVATE94_0 */ + { "Private 94-0", 2, 1, NULL, CS94, '0', '\0', 0, 1, }, +/* CS_PRIVATE94_1 */ + { "Private 94-1", 2, 1, NULL, CS94, '1', '\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, }, +/* CS_PRIVATE96_0 */ + { "Private 96-0", 2, 1, NULL, CS96, '0', '\0', 0, 1, }, +/* CS_PRIVATE96_1 */ + { "Private 96-1", 2, 1, NULL, CS96, '1', '\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-jp-0213", + iso2022_to_int, int_to_iso2022, iso2022_keyinput, eucjp_display, + CS_NONE, CS_JISX0213_2000_1, CS_JISX0201_RIGHT, CS_JISX0213_2000_2, + 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-jp-3", + iso2022jp3_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_iso2022jp3 __P((SCR *, CHAR_T *, size_t)); +static int multi_predict_iso2022jp2 __P((SCR *, CHAR_T *, size_t)); +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_iso2022jp3(sp, p, len) + SCR *sp; + CHAR_T *p; + size_t len; +{ + int ret; + + ret = multi_predict_iso2022(sp, p, len); +} + +static int +multi_predict_iso2022jp2(sp, p, len) + SCR *sp; + CHAR_T *p; + size_t len; +{ + int ret; + int i; + + ret = multi_predict_iso2022(sp, p, len); + if (ret < 0) + return ret; + i = 0; + while (i < len) { + if (i + 4 < len && p[i] == '\033' && p[i + 1] == '$' && + p[i + 2] == '(' && strchr("OP", p[i + 3])) { + ret = -1; + break; + } + i++; + } + return ret; +} + +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_iso2022jp3, + multi_predict_iso2022jp2, + multi_predict_euc, + multi_predict_sjis, + NULL, }, + { "iso-2022-jp-3", + "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 =================================================================== RCS file: multibyte.h diff -N multibyte.h --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/multibyte.h Wed Oct 24 10:33:19 2001 @@ -0,0 +1,225 @@ +/* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multibyte.h,v 1.1 2001/10/23 04:33:23 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 iso2022jp3_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 =================================================================== RCS file: /cvsroot/itojun/nvi/common/options.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/options.c 2001/10/23 04:22:19 1.1.1.1 +++ common/options.c 2001/10/23 04:33:23 1.2 @@ -46,6 +46,12 @@ 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,6 +62,30 @@ {"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,6 +96,12 @@ {"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,8 +112,20 @@ {"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,6 +134,12 @@ {"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,6 +227,12 @@ {"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,17 +295,29 @@ } 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,6 +326,9 @@ {"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,6 +400,19 @@ 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,6 +450,21 @@ 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,8 +553,15 @@ 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) { @@ -1088,7 +1198,7 @@ /* Copy the string edit options. */ for (cnt = rval = 0; cnt < O_OPTIONCOUNT; ++cnt) { if (optlist[cnt].type != OPT_STR || - F_ISSET(&optlist[cnt], OPT_GLOBAL)) + F_ISSET(&sp->opts[cnt], OPT_GLOBAL)) continue; /* * If never set, or already failed, NULL out the entries -- @@ -1131,7 +1241,7 @@ for (cnt = 0; cnt < O_OPTIONCOUNT; ++cnt) { if (optlist[cnt].type != OPT_STR || - F_ISSET(&optlist[cnt], OPT_GLOBAL)) + F_ISSET(&sp->opts[cnt], OPT_GLOBAL)) continue; if (O_STR(sp, cnt) != NULL) free(O_STR(sp, cnt)); Index: common/options_f.c =================================================================== RCS file: /cvsroot/itojun/nvi/common/options_f.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/options_f.c 2001/10/23 04:22:19 1.1.1.1 +++ common/options_f.c 2001/10/23 04:33:23 1.2 @@ -365,3 +365,152 @@ *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 =================================================================== RCS file: /cvsroot/itojun/nvi/common/put.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/put.c 2001/10/23 04:22:19 1.1.1.1 +++ common/put.c 2001/10/23 04:33:23 1.2 @@ -45,6 +45,9 @@ size_t blen, clen, len; int rval; char *bp, *p, *t; +#ifdef MULTIBYTE + CHAR_T *p0; +#endif if (cbp == NULL) if (namep == NULL) { @@ -119,12 +122,20 @@ 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. */ - if (len > 0 && (clen = cp->cno + (append ? 1 : 0)) > 0) { +#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,7 +148,11 @@ } /* 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,7 +168,11 @@ * 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 =================================================================== RCS file: /cvsroot/itojun/nvi/common/screen.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/screen.h 2001/10/23 04:22:19 1.1.1.1 +++ common/screen.h 2001/10/23 04:33:23 1.2 @@ -119,12 +119,24 @@ /* 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 =================================================================== RCS file: /cvsroot/itojun/nvi/common/search.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/search.c 2001/10/23 04:22:19 1.1.1.1 +++ common/search.c 2001/10/23 04:33:23 1.2 @@ -46,7 +46,12 @@ { 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,6 +119,19 @@ ++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,7 +174,11 @@ 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,8 +217,13 @@ } lno = 1; } - } else + } else { +#ifndef MULTIBYTE coff = fm->cno + 1; +#else + coff = fm->cno + KEY_BLEN(sp, l[fm->cno]); +#endif + } } btype = BUSY_ON; @@ -268,8 +295,15 @@ * "c?$"). Not all that sure this gets it right, there * are lots of strange cases. */ - if (!LF_ISSET(SEARCH_EOL) && rm->cno >= len) + 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,6 +352,9 @@ 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,9 +466,14 @@ rm->lno = lno; /* See comment in f_search(). */ - if (!LF_ISSET(SEARCH_EOL) && last >= len) + if (!LF_ISSET(SEARCH_EOL) && last >= len) { +#ifndef MULTIBYTE rm->cno = len != 0 ? len - 1 : 0; - else +#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 =================================================================== RCS file: /cvsroot/itojun/nvi/common/seq.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/seq.c 2001/10/23 04:22:19 1.1.1.1 +++ common/seq.c 2001/10/23 04:33:23 1.2 @@ -342,7 +342,11 @@ 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/util.c =================================================================== RCS file: /cvsroot/itojun/nvi/common/util.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- common/util.c 2001/10/23 04:22:19 1.1.1.1 +++ common/util.c 2001/10/23 04:33:23 1.2 @@ -78,7 +78,11 @@ recno_t lno; size_t *cnop; { +#ifndef MULTIBYTE char *p; +#else + CHAR_T *p; +#endif size_t cnt, len, off; int isempty; Index: common/test/multi_quail.c =================================================================== RCS file: multi_quail.c diff -N multi_quail.c --- /dev/null Wed Oct 24 08:26:45 2001 +++ common/test/multi_quail.c Wed Oct 24 10:33:28 2001 @@ -0,0 +1,2751 @@ +/* + * multilingual support for nvi + * Copyright(c) 1996, 1997 by Jun-ichiro Itoh. All rights reserved. + * Author contact: + * $Id: multi_quail.c,v 1.1 2001/10/23 04:33:23 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: curses/README.m17n =================================================================== RCS file: README.m17n diff -N README.m17n --- /dev/null Wed Oct 24 08:26:45 2001 +++ curses/README.m17n Wed Oct 24 10:33:38 2001 @@ -0,0 +1,55 @@ +notes on curses multilingual patch +Jun-ichiro itojun Itoh +$Id: README.m17n,v 1.1 2001/10/23 04:33:25 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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/addbytes.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/addbytes.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/addbytes.c 2001/10/23 04:33:25 1.2 @@ -52,6 +52,7 @@ register const char *bytes; register int count; int so; +#ifndef MULTIBYTE { static char blanks[] = " "; register int c, newx, x, y; @@ -157,3 +158,275 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/addch.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/addch.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/addch.c 2001/10/23 04:33:25 1.2 @@ -51,6 +51,9 @@ buf.ch = ch; buf.attr = 0; +#ifdef MULTIBYTE + buf.desig = 0; +#endif return (__waddch(win, &buf)); } Index: curses/box.c =================================================================== RCS file: /cvsroot/itojun/nvi/curses/box.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/box.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/box.c 2001/10/23 04:33:25 1.2 @@ -56,22 +56,59 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/clrtobot.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/clrtobot.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/clrtobot.c 2001/10/23 04:33:25 1.2 @@ -65,6 +65,9 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/clrtoeol.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/clrtoeol.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/clrtoeol.c 2001/10/23 04:33:25 1.2 @@ -67,6 +67,9 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/cr_put.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/cr_put.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/cr_put.c 2001/10/23 04:33:25 1.2 @@ -379,10 +379,17 @@ } } 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,9 +397,16 @@ i = curscr->lines[outline]->line[outcol].ch; if ((curscr->lines[outline]->line[outcol].attr & __STANDOUT) == - (curscr->flags & __WSTANDOUT)) + (curscr->flags & __WSTANDOUT)) { +#ifndef MULTIBYTE putchar(i); - else +#else + if (ND) + tputs(ND, 0, plodput); + else + putchar(i); +#endif /*MULTIBYTE*/ + } else goto nondes; } else Index: curses/curses.h =================================================================== RCS file: /cvsroot/itojun/nvi/curses/curses.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/curses.h 2001/10/23 04:22:19 1.1.1.1 +++ curses/curses.h 2001/10/23 04:33:25 1.2 @@ -120,7 +120,15 @@ 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,8 +243,13 @@ ((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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/delch.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/delch.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/delch.c 2001/10/23 04:33:25 1.2 @@ -58,6 +58,9 @@ } 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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/deleteln.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/deleteln.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/deleteln.c 2001/10/23 04:33:25 1.2 @@ -74,6 +74,9 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/erase.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/erase.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/erase.c 2001/10/23 04:33:25 1.2 @@ -63,6 +63,9 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/insch.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/insch.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/insch.c 2001/10/23 04:33:25 1.2 @@ -54,12 +54,37 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/insertln.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/insertln.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/insertln.c 2001/10/23 04:33:25 1.2 @@ -74,6 +74,9 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/newwin.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/newwin.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/newwin.c 2001/10/23 04:33:25 1.2 @@ -80,6 +80,9 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/curses/overlay.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/overlay.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/overlay.c 2001/10/23 04:33:25 1.2 @@ -71,7 +71,12 @@ x = startx - win2->begx; for (sp = &win1->lines[y1]->line[startx - win1->begx]; sp < end; sp++) { - if (!isspace(sp->ch)) { +#ifndef MULTIBYTE + if (!isspace(sp->ch)) +#else + if (!isspace(sp->ch & 0xff)) +#endif + { wmove(win2, y2, x); __waddch(win2, sp); } Index: curses/refresh.c =================================================================== RCS file: /cvsroot/itojun/nvi/curses/refresh.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- curses/refresh.c 2001/10/23 04:22:19 1.1.1.1 +++ curses/refresh.c 2001/10/23 04:33:25 1.2 @@ -47,6 +47,50 @@ 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,19 +316,49 @@ } while (wx <= lch) { - if (!force && memcmp(nsp, csp, sizeof(__LDATA)) == 0) { +#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) { + 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,8 +367,15 @@ #endif ly = y; lx = wx + win->begx; +#ifndef MULTIBYTE while (wx <= lch && - (force || memcmp(nsp, csp, sizeof(__LDATA)) != 0)) { + (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,6 +393,9 @@ 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,6 +405,9 @@ while (wx++ <= clsp) { csp->ch = ' '; csp->attr = 0; +#ifdef MULTIBYTE + csp->desig = 0; +#endif csp++; } return (OK); @@ -336,17 +423,30 @@ 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,37 +459,109 @@ } 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,6 +572,9 @@ 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,6 +585,9 @@ } /* 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,6 +746,9 @@ 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 =================================================================== RCS file: CHANGELOG diff -N CHANGELOG --- /dev/null Wed Oct 24 08:26:45 2001 +++ docs.m17n/CHANGELOG Wed Oct 24 10:33:41 2001 @@ -0,0 +1,976 @@ +The following part is progress log, written in japanese. +--- + Æä˵­½Ò¤Î¤Ê¤¤µ¡Ç½¤Ï¡Ö¤Þ¤À¼ê¤â¤Ä¤±¤Æ¤Ê¤¤¡×¤Ã¤Æ¤³¤È¤ò°ÕÌ£¤·¤Þ¤¹¡£ + + ̤²ò·è: ÆÃÄê¾ò·ï²¼¤Ç¡¢²èÌÌ°ìÈÖº¸(80»úÌÜ)¤Îmultibyteʸ»ú¤¬ÉÁ²è¤µ¤ì¤Ê¤¤¡£ + ̤²ò·è: multi_ext2int_region¤Î°ú¿ô´Ø·¸À°Íý(4/4) + Æä˹Կô¤¬ÊѲ½¤¹¤ë¤È¤­¤Î½èÍý¤Ë¤Ä¤¤¤Æ¡£ + ̤²ò·è: sjis/euc-jp¤Ç¤ÎJIS X0201º¸È¾Ê¬¤Î¼è°·¤¤¡£(4/2) + - ½ñ¤­½Ð¤·/ɽ¼¨»þ¤ËASCII¤À¤È¤ª¤â¤Ã¤Æ½ÐÎÏ + yen mark¤Èbackslash¤Î¶èÊ̤ϰìÀ¸¤Ä¤«¤Ê¤¤ + - ½ñ¤­½Ð¤·/ɽ¼¨»þ¤Ë¶èÊ̤·¤Æ½ÐÎÏ + ¶èÊ̤ϤĤ¯¤±¤Éescape sequence¤¬... + + -> encoding̾¤Ë¥ª¥×¥·¥ç¥ó¤¬½ñ¤±¤ë¤è¤¦¤Ë¤¹¤ë? + fileencoding=sjis:nantara:kantara + Ê£»¨¤Ç¤ï¤«¤ê¤Ë¤¯¤¤¡£Ã¯¤¬parse¤¹¤ë¤Î? + ̤²ò·è: leftright¤Î¤È¤­¡¢¹Ôº¸Ã¼¤Î°ÌÃÖ¤¬¤ª¤«¤·¤¤¡£(2/21) + Æäˡ¢¤¤¤Á¤Ð¤óº¸¤Î·å¤«¤émultibyteʸ»ú¤¬»Ï¤Þ¤ë¤È¤­¡£ + ̤²ò·è: isblank()´Ø·¸¤Î¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¡£(2/19) + °ìÉô¤ÎOS¤ËÉÕ°¤Î¤Ï¥Þ¥¤¥Ê¥¹¤ÎÃͤòÅϤ¹¤Èȯ¶¸¤¹¤ë¡£ + -> char *¤Ï¤Û¤ÜÁ´ÉôCHAR_T¤Ë¡£ + printf´Ø·¸ÌÌÅÝ¡£ -> CHAR_T¤òu_int¤Ë¤·¤è¤¦·×²è¤Ø + ̤²ò·è: ex¤Îechoback¤ò¤É¤¦¤·¤è¤¦? (2/14) + ̤²ò·è: esc¤Î¥¿¥¤¥à¥¢¥¦¥È¤¬ÇÜŤ¤¡£¤Þ¤¢¤¤¤¤¤«¤¢?(2/7) + ̤²ò·è: :r¤Ç¥Õ¥¡¥¤¥ë¤òÆɤó¤À¤¢¤Èundo¤¹¤ë¤È¡¢ÆâÉôɽ¸½¤Ë + ÊÑ´¹¤ò¤ä¤Ã¤¿¹Ô¿ô¤¬¥Ð¥ì¤Æ¤·¤Þ¤¦¡£(2/4) + ¤³¤ìƨ¤²¤ë¤ÎÁêÅöÆñ¤·¤¤¤Ç¤¹¡£undo log management¤Î¤È¤³¤í¤ò + ±³¤Ä¤«¤Ê¤¤¤È¤¤¤±¤Ê¤¤¤ó¤À¤â¤ó¤Í¡£ + ̤²ò·è: wrapmargin/wraplen¤Î´°Á´²½¡£¹Ô¤òÀÚ¤ë¾ò·ï¤ÎÄ´À°¡£(2/15) + ÅÓÃæ: JIS X0201-left¤Îʸ»ú¤ÈASCII¤Îʸ»ú¤È¤«¡¢¸¡º÷¤È¤«¤Î¤È¤­¤Ë + Ʊ°ì»ë¤·¤¿¤¤Ê¸»ú¤Ï¤É¤¦¤¹¤ì¤Ð¤¤¤¤¤«?(2/4) + 1. Àµµ¬²½¥Ä¡¼¥ë¤ò¤Ä¤±¤Æfilter¤·¤Æ¤â¤é¤¦(2/11 ok) + 2. Ʊ°ì»ë¤¹¤ë¥ª¥×¥·¥ç¥ó¤ò¤Ä¤±¤ë --- ÌÌÅÝ + ̤²ò·è: cl_deleteln()¤Ï¸½ºß°Ü¿¢À­¤¬¤Ê¤¤¤Î¤Çľ¤¹(2/3) + inch()¤Îmultibyte²½¤Ã¤Æ¤É¤¦¤ä¤ì¤Ð¤¤¤¤¤ó¤À¡£ + ̤²ò·è: Wnn¤È¤Î¥ê¥ó¥¯¤Ï²Äǽ¤«?(2/2) + ¤­¤Ã¤È¤á¤ó¤É¤¯¤µ¤¤¤È¤ª¤â¤¦¡£ + cserver¤È¤«»È¤¨¤ë¤È¤­¤Ã¤È¤¤¤¤¤ó¤À¤±¤É¤Ê¡£ + ̤²ò·è: ±Ñ¸ìnvi/vi¤È¤Î.exrc¤Î¥³¥ó¥Õ¥ê¥¯¥È¤ò¤É¤¦¤·¤è¤¦¡£(2/2) + 1. ¥³¥á¥ó¥È¤Ë¤·¤Æ¤ª¤¯ + 2. ¥Õ¥¡¥¤¥ë̾¤òÊѤ¨¤ë + 3. wrapper¤Çƨ¤²¤ë + 4. µ¤¤Ë¤·¤Ê¤¤ + ̤²ò·è: Àµµ¬É½¸½¤ò¤¬¤ó¤Ð¤í¤¦(12/30) + »Ä¤ë¤Ïñ¸ì¶­³¦Ç§¼±¡£ + Í×Ä´ºº: ³Æ¼ïiso-2022-*·ÏüËö¥½¥Õ¥È¤ÎÀ¸À®¤¹¤ë¥­¡¼¥Ü¡¼¥ÉÆþÎÏ¥³¡¼¥É¡£ + ¤É¤³¤Þ¤Ç¤Þ¤¸¤á¤Ë²ò¼á¤¹¤ëɬÍפ¬¤¢¤ë?(12/29) + Í׺ƹÍ: ¼«Æ°È½Ê̤ˤĤ¤¤ÆºÆ¹Í¡£(12/26) + Æɤ߹þ¤ßŪÌäÂê: ȽÊ̤Ǥ­¤Ê¤¤¤ä¤Ä¤ò¤É¤¦¤¹¤ë¤« + ½ñ¤­½Ð¤·ÅªÌäÂê: ¥Õ¥¡¥¤¥ëÆâ¤Îcharset¤òÁ´Éôencode¤Ç¤­¤ë¤« + ̤²ò·è: ¼«Æ°È½ÊÌÀäÂФǤ­¤Ê¤¤¤ä¤Ä¤Ï¤É¤¦¤ä¤Ã¤ÆÁª¤Ù¤Ð¤¤¤¤?(12/26) + ¼Â¤Ïeuc-*¤Ã¤Æ¶èÊ̤¬¸ú¤«¤Ê¤¤¤Î¤Ç¤µ¤¢¤É¤¦¤·¤è¤¦¡£ + ¤¢¤Èlatin*¤È¤«¤Ï¶èÊ̤Ǥ­¤Ê¤¤¤Í¡£ + ̤²ò·è: multi_predict_region()¤ÎencodingȽÊ̤ò¤â¤Ã¤ÈºÙ¤«¤¯(12/24) + Í׺ƹÍ: multi_ext2int_region()¤Î¥¨¥é¡¼½èÍý(12/24) + ´í¤Ê¤¤¤³¤È¤¹¤ë¤Î¤Ë¡¢¸½ºß¤Ï¤Ø¤¯¤Ã¤¿¤éabort()¡£ÌîÈÚ¡£ + ̤²ò·è: ÃΤé¤Ê¤¤ISO-2022-*¤Îescape sequence¤ÎÂнè(12/23) + ¤¤¤Þ¤ÏASCII¤È»×¤Ã¤Æ¤ë¤Î¤Ç¡¢ASCII in¤¬¤Ç¤Ê¤¤¡£ + Í׺ƹÍ: ñ°ì¸À¸ìencoding¤Î¥Ñ¡¼¥µ¤ÇÃΤé¤Ê¤¤charset¤¬Í褿¤é¤É¤¦¤¹¤ë? + (12/23) + ¤¤¤Þ¤Ï¼Î¤Æ¤Æ¤ë¡£ + Í׺ƹÍ: ¹ÔËö¤Þ¤¿¤¤¤Çmultibyte¤¬Í褿»þ¤Ï¹ÔËö¥¹¥Ú¡¼¥¹Ëä¤á¤Ç¤¤¤¤?(12/23) + mule¤ß¤¿¤¤¤ËbackslashËä¤á¤â¥Æ¤À¤Ê¡£ + ̤²ò·è: :set leftright»þ¤Îmultibyte¤Î¹ÔËö½èÍý(12/22) + ÅÓÃæ: join¥³¥Þ¥ó¥É¤ÎmultibyteÂбþºÆ¹Í(12/8) + ʸ»ú¼ï¤´¤È¤ËÆ°ºî¤òÊѤ¨¤é¤ì¤ë¤è¤¦¤Ë¡£ + ÅÓÃæ: (¥³¥Þ¥ó¥É¤È)¥³¥Þ¥ó¥É(multibyteʸ»ú¤Î¾å¤ÏÄ̤êÈ´¤±¤ë¤À¤±) (11/30) + ÅÓÃæ: %¥³¥Þ¥ó¥É(multibyteʸ»ú¤Î¾å¤ÏÄ̤êÈ´¤±¤ë¤À¤±) (11/30) + ÅÓÃæ: ~¥³¥Þ¥ó¥É(multibyteʸ»ú¤Î¾å¤ÏÄ̤êÈ´¤±¤ë¤À¤±) (11/30) + +2001/10/24 + plug a printf string vulnerability. +2000/4/7 + iso-2022-jp-3¼«Æ°Ç§¼± + common/multibyte.c +99/11/17 + ºî¶È: ¹ÔËö¤Ëmultibyteʸ»ú¤¬¤«¤Ö¤Ã¤¿¤È¤­¤Î½èÍý¤Î½¤Àµ(¥«¡¼¥½¥ë°ÌÃÖ·×»»¤Ë + ¼ºÇÔ¤·abort¤·¤Æ¤¤¤¿) + vi/vs_relative.c + vi/vs_line.c +99/8/11 + ºî¶È: iso-2022-jp-3Âбþ + common/multi_iso2022.c +99/8/9 + ºî¶È: JIS X0213Âбþ + common/multibyte.c +99/3/10 + ºî¶È: 98/9/30¤ÎÊѹ¹¤Î·ç¤±¤ò½¤Àµ¡£¤º¤±¤é¤ó@²­ÆìÍÍ¡¢´¶¼Õ¡£ + common/multi_iso2022.c +98/11/5 + ºî¶È: indentation¤ÎÃæ¤Ë¥«¡¼¥½¥ë¤¬¤¢¤ë¾ì¹ç¡¢shift(<<)¤Î¤È¤­¤Ë + sp->cno¤Ï½¤Àµ¤µ¤ì¤Ê¤¤¤Î¤Ç¡¢¤¿¤Þ¤Ëmultibyte¤ÎÃæ¤òƧ¤à¤³¤È¤¬¤¢¤Ã¤¿¡£ + Àµ¤·¤¤¤Õ¤ë¤Þ¤¤¤¬¤è¤¯¤ï¤«¤é¤Ê¤¤¤«¤é¡¢¤È¤ê¤¢¤¨¤ºsp->cno¤ÎÊäÀµ¤ò + ¤¹¤ë¤³¤È¤Ë¤·¤¿¡£ + ex/ex_shift.c +98/9/30 + ºî¶È: e->shifttype¤ÎÃͤˤè¤Ã¤Æ¡¢¥­¡¼ÆþÎϤκݤÎlocking shift/single + shift¤ò¼õ¤±ÉÕ¤±¤¿¤ê̵»ë¤·¤¿¤ê¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£ + Î㤨¤Ð¡¢euc·Ï¤Îencoding¤Î¾ì¹ç¡¢SS2R¤ÈSS3R(0x8e¤È0x8f)¤·¤« + ¼õ¤±ÉÕ¤±¤Ê¤¤¡£ + onoe@sm.sony.co.jp¤ÎÍ×˾¤Ë¤è¤ë¡£ + common/multi_iso2022.c +98/6/16@new orleans + ºî¶È: ESC ( 0¤ÈESC ( 1¡¢ESC , 0¤ÈESC , 1¤òprivate character set¤È¤·¤Æ + ǧ¼±¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£ +98/2/22 + ºî¶È: 0x80¤Î²èÌ̽ÐÎϤ¬¤ª¤«¤·¤«¤Ã¤¿¤Î¤ò½¤Àµ¡£ + vi/vs_line.c + ²ò·è: binary¤Ç0x80¤òÆþ¤ì¤ë¤È¥Ø¥ó¤Ë¤Ê¤ë¡£Â¿Ê¬¡¢2byte¤á¤¬0x00¤Ë + ¤Ê¤ë¤¿¤á¡£(97/9/1) +9/25 + ºî¶È: solaris¤Ç--enable-canna¤¹¤ë¤È¥Ø¥ó¤À¤Ã¤¿¤Î¤ò½¤Àµ + (thanks to senda@ic.rdc.ricoh.co.jp) + build/configure.in +9/23 + ºî¶È: ¥½¡¼¥¹´ÉÍý¤òcvs¤Ë°Ü¹Ô + ºî¶È: :set foobaa="baz" -> :set foobaa=baz + docs.m17n/README.english + docs.m17n/README.japanese +8/22 + ºî¶È: fileencoding=sjis¤Î¤È¤­¡¢¥µ¥Ý¡¼¥È³°¤Îcharacter set¤ò + »È¤Ã¤¿¤È¤­¤ÎµóÆ°¤¬¤ª¤«¤·¤«¤Ã¤¿¤Î¤Ç½¤Àµ¡£ + common/multi_sjis.c +8/20 + ºî¶È: typo fix: s/JIS X0208-1976/JIS X0208-1978/ + common/multibyte.c + common/multi_iso2022.c + ºî¶È: character set̾¤ÎÀ°Íý¡£ + common/multibyte.c + ºî¶È: multibyteʸ»ú¤Î¾å¤Ç"r\r"¤¹¤ë¤È²½¤±¤Æ¤¤¤¿¤Î¤ò½¤Àµ¡£ + vi/v_replace.c + ºî¶È: JIS X0208-1990¥µ¥Ý¡¼¥È¡£ESC & x¤Î¥µ¥Ý¡¼¥È´Þ¤à¡£ + common/multibyte.c + common/multibyte.h + common/multi_iso2022.h +6/17 + ºî¶È: memory leak´Ø·¸¤Î½¤Àµ¡£ +6/2 + ºî¶È: sjis¤Î¼«Æ°È½Ä꤬´Ö°ã¤Ã¤Æ¤¤¤¿(0x8e¤È0x8f¤¬¸½¤ì¤¿¤È¤­¤Î½èÍý)¤Î¤Ç + ½¤Àµ¡£serow¤µ¤ó¤Î¥ì¥Ý¡¼¥È¤Î¤ª¤«¤²¤Ç¤¹¡£ + common/multibyte.c +5/24 + ºî¶È: sizeof(size_t) != sizeof(int)¤Ê¥Þ¥·¥ó¤Î¤¿¤á¤Î½¤Àµ¡£ + cl/cl_read.c +4/11 + ºî¶È: ¥Ý¥«¥ß¥¹½¤Àµ¡£thanks to dsp@aries.bekkoame.or.jp + common/multibyte.h +4/10 + ºî¶È: ¥Ý¥«¥ß¥¹½¤Àµ¡£ + regex/regcomp.c +4/8 23:00 + ºî¶È: canna fence¤¬¤¤¤­¤Ê¤ê²èÌ̲¼¤Ë¤Ç¤Ê¤¤¤È¤¤¤±¤Ê¤¤¤È¤­¤Ë + ¸ºß¤·¤Ê¤¤¹Ô¤Îrepaint¤Ë¹Ô¤Ã¤Æ¤¤¤¿¤Î¤ò½¤Àµ¡£ + canna´Ø·¸¡¢¤â¤¦¤Á¤ç¤Ã¤ÈÀ°Íý¤·¤Ê¤¤¤È¤Ê¤¢... + common/multi_canna.c + ºî¶È: ¥É¥­¥å¥á¥ó¥Èľ¤·¡£ +4/6 + ºî¶È: multi_predict_iso2022()¤Îbugfix¡£SS2¤¬Íè¤ë¤ÈÍî¤Á¤Æ¤¤¤¿¡£ + common/multibyte.c + common/multibyte.h + ºî¶È: autodetect=tw + common/multibyte.c + common/multibyte.h +4/4 + ºî¶È: :r¤·¤Æ¤«¤éundo¤·¤¿¤È¤­¤Î"n lines changed"¤Îɽ¼¨¤¬¤Ç¤Ê¤¤¤è¤¦¤Ë + ¤Ç¤­¤Ê¤¤¤«¤Ê¡¢¤È»×¤Ã¤¿¤¬¡¢ÌµÍý¤À¤Ã¤¿¡£ + ºî¶È: iso2022·Ï¤Î¤È¤­¤Î¡¢¹ÔËö¤Î¥ê¥»¥Ã¥ÈÊýË¡¤òÊѹ¹¡£ + common/multi_iso2022.c + ºî¶È: MB_JOIN¤Î½èÍý¡£¤­¤¿¤Ê¤¤¤¾¡£ + common/multibyte.c + common/exf.c + ex/ex_read.c + ex/ex_script.c + ²ò·è: hz encoding»þ¤Î¹ÔÏ¢·ë¤Îescape(¹ÔËö¤Î~)¡£(12/26) + ²ò·è: iso-2022-kr¤ÎÆÃÊÌ°·¤¤¡£(4/1) + 1. designation¤Ï¹ÔƬ¤Ç¤ä¤é¤Í¤Ð¤Ê¤é¤Ê¤¤(4/2 ok) + 2. designation¤Î¤ß¤Î¹Ô¤¬¤¢¤Ã¤¿¤éÆɤßÈô¤Ð¤µ¤Í¤Ð¤Ê¤é¤Ê¤¤ + (RFC1557¤Ë¤Ï½ñ¤¤¤Æ¤Ê¤¤¤±¤É¡¢½¬´·¾å) +4/3 10:00 + ºî¶È: hz¤Î¹ÔËö¥¨¥¹¥±¡¼¥×¤Èiso-2022-kr¤Î¤¿¤á¤Ë¤Á¤ç¤Ã¤È¤·¤¿½àÈ÷¡£ + MB_JOIN¤ÎÄêµÁ¡£¤Þ¤À½èÍý¤¹¤ë¤È¤³¤í¤Ï½ñ¤¤¤Æ¤Ê¤¤¡£ + common/multi_iso2022.c + common/multi_hz.c + common/multibyte.h + ºî¶È: selcharset()¤òselcharset()¤Ècallcharset()¤Ëʬ³ä¡£ + ¤Á¤ç¤Ã¤È¤·¤¿À°ÆÜ¡£ + common/multi_iso2022.c +4/2 + ºî¶È: iso-8859-[1234789]¤òÍÑ°Õ¡£iso-8859-10 additions(ESC , X)¤òÄɲᣠ+ common/multibyte.c + common/multibyte.h +4/2 14:00 + ºî¶È: iso-2022-kr¤Ë¤Ä¤¤¤Æ°ìÉô²ò·è¡£designation¤ò¹ÔƬ¤ËÅǤ¯¡£ + Thanks to Jungshik Shin + common/multibyte.c + common/multibyte.h +3/30 + ºî¶È: euc-tw¥µ¥Ý¡¼¥È¡£curses¿¹ñ¸ì²½¤ÎÀ©Ì󤫤éCNS11643-1°Ê³°¤Ï²èÌÌ¤Ë + ½Ð¤»¤Ê¤¤¤±¤É¡¢¤Þ¤¢¤È¤ê¤¢¤¨¤º¡£ + common/multibyte.c + common/multibyte.h + common/multi_euctw.c +3/28 + ºî¶È: iso-2022-cn/-ext¤¬¤¤¤Þ¤¤¤Á¤À¤Ã¤¿¤Î¤ò½¤Àµ¡£ + encoding̾¤È¤·¤Æ¡¢iso-2022-jp-2¤Èiso-2022-cn-ext¤òÍÑ°Õ¡£ + ÆâÍÆŪ¤Ë¤Ï¤ª¤Ê¤¸¡£ + common/multi_iso2022.c + common/multibyte.c + ºî¶È: regular/qregular¤Î¶¯²½¡£ISO646 character set¤Ç¡¢Ãæ´Öʸ»ú¤Î + ¤Ê¤¤¤â¤Î¤Ï¤À¤¤¤¿¤¤¥Õ¥©¥í¡¼¡£ + http://www.kudpc.kyoto-u.ac.jp/~yasuoka/CJK.html¤Î¤ª¤«¤²¤Ç¤¹¡£ + build/regular.in + build/qregular.in +3/27 + ºî¶È: v_fep_on()¤È¤«¤ò¿·Àß¡¢fepctrl´Ø·¸¤ò¼ã´³À°Íý¡£ + common/multibyte.c + vi/vi.c + ºî¶È: qregular¤Îsmall bug fix + build/qregular.in + ºî¶È: canna modeline¤Îechoback¤Ë¤Ä¤¤¤Æ¤Á¤ç¤Ã¤ÈºÆ¹Í¡£ + cannactrl¤òon¤Ë¤·¤Æ¤¤¤ë¤È¤­¡¢"Pattern not found"¤¬½Ð¤Ê¤¤¡£ + ²ò·è: canna modeline¤ÎÀ©¸æÍ׺ƹ͡£(3/24) + µ¯¤³¤·¤Æ°ìȯÌܤΤȤ­¡¢modelineismine == 0¤Ê¤Î¤Ç¡¢ + ¤¿¤¤¤Æ¤¤modeline¤¬½Ð¤Ê¤¤¡£ + common/multi_canna.c + vi/vs_refresh.c + vi/vs_msg.c +3/24 + ºî¶È: ÆþÎϥ⡼¥É¤Çcontrol-X¤Ç0x80°Ê¾å¤Îʸ»ú¤ò¤Ä¤Ã¤³¤à¤È¤­¤Î + ½èÍý¤ò½¤Àµ¡£ + vi/v_txt.c +3/17 + ºî¶È: ¥­¡¼ÆþÎϤÎmultibyte·ÏÆâÉô¾õÂÖ¤òcontrol-C¤Ç¥ê¥»¥Ã¥È¤¹¤ë¤è¤¦¤Ë + ¤·¤¿¡£ + iso-2022-*·Ï¤Îencoding¤ò¥­¡¼ÆþÎϤ˻ȤäƤ¤¤Æ¡¢LS3¤È¤«¤¬ + Æþ¤Ã¤Æ¤Ë¤Ã¤Á¤â¤µ¤Ã¤Á¤â¤¤¤«¤Ê¤¯¤Ê¤Ã¤¿Îã¤òʹ¤¤¤¿¤Î¤Ç¡£(thanks tate) + cl/cl_read.c +3/6 + ºî¶È: configure.in¤«¤éconfigure¤òÀ¸À®¤¹¤ó¤Î¤ò˺¤ì¤Æ¤¤¤¿¡£ +3/1 24:00 + ÂÎÄ´ºÇ°­... Àº¿ÀŪ¤Ë¤¤¤Þ¤Ò¤È¤Ä¤Ê¤Î¤ÇÂÎÄ´Ìá¤ê¤ã¤·¤Ê¤¤¡£ + ºî¶È: set canna cannactrl¤·¤Æ¤¤¤Æ¡¢"/¤¢"¤È¤«¤·¤¿¤È¤­¤Ë¡¢ + "Pattern not found"¤Îɽ¼¨¤¬¤Ç¤«¤Ã¤¿¤Î¤ò½¤Àµ¡£ + ¶ñÂÎŪ¤Ë¤Ïcanna modeline¤Î¾Ãµî½èÍý¤òÄûÀµ¡£ + ¤È¤Æ¤âquickhack¤Ç¤ï¤«¤ê¤Ë¤¯¤¤¤Î¤ÇÍ×À°Íý¡£ + common/multi_canna.c + vi/vs_refresh.c +2/28 + ºî¶È: regexp¤Î[^¤¢]¤È¤«¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¤Î¤ò½¤Àµ¡£ + ¤ä¤Ã¤Ñ¤êregexp¤Þ¤ï¤ê¤Ï¥ß¥¹¤¬¤¢¤ë¤Ê¡£ + regex/engine.c + ºî¶È: regexp replacement¤Î\1¤È¤«¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¤Î¤ò½¤Àµ¡£ + regex/engine.c + ºî¶È: ex¤Î:print¤È¤«¤Î¹ÔËö½èÍý¤¬´Å¤«¤Ã¤¿¤Î¤ò½¤Àµ¡£ + vi/vs_msg.c +2/24 + ºî¶È: regular¤¬¤¢¤ó¤Þ¤êÃÙ¤¤¤Î¤Çqregular¤òÍÑ°Õ¡£ + build/configure.in + build/qregular.in +2/22 24:00 + ºî¶È: CHAR_T´ØÏ¢À°Íý¤ò¼ã´³¡£ + ºî¶È: encoding¤¬¤ß¤¢¤¿¤ó¤Ê¤¤¤È¤­¤Ëmulti_name()¤ÇÍî¤Á¤Æ¤¤¤¿¡£ + common/multibyte.c +2/21 24:00 + ÅÓÃæ: char -> CHAR_T¡£KEY_BLEN()¤È¤«¤Î°ú¿ô¡£ + KEY_BLEN()¤È¤«¤ÎÄêµÁ¤â¤Á¤ç¤Ã¤Èľ¤·¡£¤³¤ì¤Ç­¤ê¤ë¤È¤¤¤¤¤Ê... + */*.c + common/gs.h +2/20 + ºî¶È: mailing list²þ̾¡£nvi-jp@dit.co.jp -> nvi-m17n@dit.co.jp + docs.m17n/README.* +2/20 16:00 + ºî¶È: bcopy()/index()¤òÇÓ½ü¡£ + */*.c + ºî¶È: ¹ÔËö¤Ç¥Ð¥¤¥È¿ô¤¬Áý¤¨¤ë¤è¤¦¤Êoverwrite¤ò¤¹¤ë¤ÈÉå¤ë¤Î¤òfix. + (Îã: ¹ÔËö¤Î"a"¤ò"¤¢"¤Çoverwrite) + vi/v_txt.c +2/19 + ÅÓÃæ: char -> CHAR_T¡£¤È¤ê¤¢¤¨¤ºisxxxxx()¤Î°ú¿ô¤È»×¤ï¤ì¤ë¤â¤Î¤À¤±¡£ + */*.c +2/17 + ºî¶È: recovery¤Î¤È¤­Í¾·×¤Ë³°Éô¥³¡¼¥É->ÆâÉô¥³¡¼¥É¤ÎÊÑ´¹¤¬Í¾·×¤Ë + µ¯¤­¤ë¤Î¤ò½¤Àµ¡£¤¿¤À¤·¡¢¤Ò¤¸¤ç¡¼¤Ë±ø¤¤patch¤Ç¤¹¡£ + (thanks for trouble report: tate@nerv.org) + common/exf.c + common/gs.h +2/16 + ºî¶È: autodetect=nantara+¤Î¤È¤­¡¢ctrl-G¤Çfileencoding¤¬É½¼¨¤µ¤ì¤ë + ¤è¤¦¤Ë¤·¤¿¡£ + common/msg.c + ºî¶È: ¥³¥á¥ó¥ÈÀ°Íý¡£ + common/multibyte.c + ºî¶È: :set autodetect=jp+¤È¤«¤¹¤ë¤È¡¢fileencoding¤òoverwrite¤¹¤ë¡£ + common/multibyte.c + ²ò·è: elvis¤Ç¸À¤¦¤È¤³¤í¤Î:set kfilecode=euc-jp+¡£(12/24) + (¼«Æ°È½Ê̤ηë²Ì¤Çoption¤ò¾å½ñ¤­¤¹¤ë) + ºî¶È: autodetect¤Þ¤ï¤ê¤Î¸«Ä¾¤·¡£¤À¤¤¤Ö¤è¤¯¤Ê¤Ã¤¿¤È»×¤¤¤Þ¤¹¤¬¡¢ + iso-2022-kr/cn¤Ë¤Ä¤¤¤Æ¤Ï¤Á¤ç¤Ã¤ÈÉ԰¤À... + common/multibyte.c +2/15 + ºî¶È: canna fence¤Îechoback¤òÀ°Íý¡£ + common/multi_canna.c + ºî¶È: JIS X0208-1983/1976¤Îñ¸ìǧ¼±¤¬¤¤¤Þ¤Ò¤È¤Ä¤À¤Ã¤¿¤Î¤Ç½¤Àµ¡£ + common/multi_chclass.c +2/14 + ºî¶È: wrapmargin¤Î½èÍý¤ò¤Þ¤È¤â¤Ë¤·¤¿¡£¤³¤ì¤Ç¤¿¤Ö¤óÍî¤Á¤Ê¤¤¡£ + ¤¿¤À¡¢¤¤¤¤Æ°ºî¤«¤É¤¦¤«¤Ë¤ÏÉÔËþ¤¬»Ä¤ë¡£ + vi/v_txt.c + ²ò·è: ÆüËܸì¤Îwrapmargin¤Ë¤è¤ë¹Ôwrap(12/21) + ¤Ç¤­¤¿¤éñ¸ì¶èÀÚ¤ê¤Ç¶Ê¤²¤ë? ¤½¤³¤Þ¤Ç¤»¤ó¤Ç¤¨¤¨? +2/13 + ºî¶È: ex¤Î²èÌ̽ÐÎϤΤ¢¤Èdesignation¤Î¥ê¥»¥Ã¥È¤¬¤Ê¤«¤Ã¤¿¡£ + ¤È¤Ã¤Æ¤âquickhack¡¢¤«¤ÄËèÅÙËèÅÙASCII¤òdesignate¤¹¤ë¤Î¤Ç + ¤«¤Ã¤³¤ï¤ë¤¤¡£ + vi/vs_msg.c +2/11 + ºî¶È: regular¤È¤¤¤¦¥Ä¡¼¥ë¤ò¤Ä¤±¤¿¡£¤³¤ì¤ÇJIS X0201 roman¤Î"a"¤È¤«¤ò + Á´ÉôASCII¤Î"a"¤Ëľ¤»¤Þ¤¹¡£ + build/regular.in + ¤Á¤ç¤Ã¤È¤À¤±²ò·è: JIS X0201-left¤Îʸ»ú¤ÈASCII¤Îʸ»ú¤È¤«¡¢ + ¸¡º÷¤È¤«¤Î¤È¤­¤ËƱ°ì»ë¤·¤¿¤¤Ê¸»ú¤Ï¤É¤¦¤¹¤ì¤Ð¤¤¤¤¤«? + ºî¶È: ctext¤Çʸ»ú¥»¥Ã¥È¤ò¸Æ¤Ó½Ð¤¹Àè¤ò·è¤á¤ë¥¢¥ë¥´¥ê¥º¥à¤¬ + ´Ö°ã¤Ã¤Æ¤¿¤Î¤Ç½¤Àµ¡£ + ¹ÔËö¤Îdesignation¤Î½èÍý(eolreset)¤ò½¤Àµ¡£ + ctext¤Î¾ì¹ç¤Î¤è¤¦¤Ë¡¢ESC $ ( B¤ÇJIS X0208-1983¤ò¸Æ¤Ó½Ð¤¹ + ¤â¤Î¤ËÂбþ¤·¤¿½èÍý¤òÄɲÃ(nooldstyle¤ògrep¤¹¤ë¤È¤ï¤«¤ë)¡£ + common/multi_iso2022.c + common/multibyte.c + common/multibyte.h +2/7 + ºî¶È: W¤ÈB¤ÎÆ°ºî(ÆäËcount¤òÍ¿¤¨¤¿¤È¤­¡¢ASCII¤È¤½¤ì°Ê³°¤¬º®¤¶¤Ã¤Æ¤ë + ¤È¤­)¤¬¥Ø¥ó¤À¤Ã¤¿¤Î¤òľ¤·¤¿¡£ + vi/v_word.c +2/5 + ºî¶È: canna_echoback()¤Î¥ß¥¹½¤Àµ¡£²èÌÌ°ìÈÖ²¼¹Ô¤ò;·×¤Ëredraw¤·¤Æ¤¤¤¿¡£ + common/multi_canna.c + ºî¶È: tab¤Î¾å¤Î±¦°ÜÆ°¤¬¥Ø¥ó¤À¤Ã¤¿¤Î¤ò²þÁ±¡£ + vi/vs_refresh.c + ºî¶È: showmatch¤Î¤È¤­¤Îcanna fence¤ÎºÆɽ¼¨¤ò²þÁ±¡£ + canna_echoback()¤¬Ä¶Ê£»¨¤Ë¤Ê¤Ã¤Æ¤­¤Þ¤·¤¿¡£º¤¤Ã¤¿¤¾¡£ + cl/cl_read.c + common/multi_canna.c + ²ò·è: set showmatch¤·¤Æ¤ë¾ì¹ç¡¢³ç¸Ì¤ÎÂбþɽ¼¨Ãæ¤Ë + ¥­¡¼ÆþÎϤ¹¤ë¤È¡¢fence¤¬³«¤­³ç¸Ì¤Î¾å¤Ëɽ¼¨¤µ¤ì¤ë¡£(2/4) +2/5 11:00 + ºî¶È: v_replace()¤ÎÃæ¤ÎÊÑ¿ô̾¥Ð¥Ã¥Æ¥£¥ó¥°¤ò²ò·è¡£(mblen) + vi/v_replace.c + ºî¶È: canna_on/off´Ø·¸¤ò¤â¤¦¤Á¤ç¤Ã¤ÈÄ´À°¡£fepkey¤Ë»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤ + ¥³¥Þ¥ó¥É¤Î½èÍý¤ò¤Ê¤á¤é¤«¤Ë¡£ + vi/vi.c + ºî¶È: range»ØÄê¤Ë"/"¤È¤«¤ò»È¤¦¤È²èÌ̤¬Êø¤ì¤Æ¤¤¤¿¤Î¤òľ¤·¤¿¡£ + vi/v_search.c + ºî¶È: ²èÌ̤¤¤Á¤Ð¤ó²¼¤Î¹Ô¤ÇŤ¹¤®¤ëfence¤ò½Ð¤·¤¿¤È¤­¤Ë²èÌ̤¬ + Éå¤Ã¤Æ¤¤¤¿¤Î¤Ç½¤Àµ¡£ + common/multi_canna.c + ²ò·è: canna´ØÏ¢: fence¤¬Ä¹¤¹¤®¤ë¤È¤­¤ÎÂнè(2/3) + ºî¶È: :r¤·¤¿¤È¤­¤ËÀ¹Âç¤Ëʸ»ú²½¤±¤¹¤ë¤Î¤ò½¤Àµ¡£¤¿¤À¤·¡¢¤Á¤ç¤Ã¤È + ¡Öƨ¤²¡×¤Ç¤¹¡£ + ex/ex_read.c +2/4 15:00 + ºî¶È: ´Á»ú¤òȾʬ¤À¤±½ñ¤­ÄÙ¤¹¤È¤­¤Î½èÍý¤òÄɲᣠ+ ¤¶¤Ã¤¯¤ê½ñ¤­´¹¤¨¤Æ¤·¤Þ¤¤¤Þ¤·¤¿¡£ + curses/addbytes.c + ºî¶È: configure¤Îcanna´ØÏ¢¤òľ¤·¡£ + build/configure.in +2/3 26:00 + ºî¶È: ȿž¤·¤¿¹Ô¤Î¥¹¥¯¥í¡¼¥ë¤Î¤È¤­¤Ë¡¢multibyte´ØÏ¢¤Î¾ðÊó¤¬ + ¤´¤Ã¤½¤ê¾Ã¤¨¤Æ¤¤¤¿¤Î¤ò½¤Àµ¡£¤¿¤À¤·¡¢°Ü¿¢À­¤Î¤³¤È¤ò¹Í¤¨¤Ê¤¤ + µ­½Ò¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Î¤Ç¤¢¤È¤Çľ¤¹¤Ù¤·¡£cl_deleteln()¤Í¡£ + cl/cl_funcs.c + ºî¶È: ´Á»ú¤òȾʬ¤À¤±½ñ¤­ÄÙ¤¹¤È¤­¤Î½èÍý¤òÄɲᣥ¨¥ó¥Ð¥°¤³¤¤¤Æ¤¿¤Î¤Ç + ¤Á¤ç¤¤½¤Àµ¡£ + curses/addbytes.c + ºî¶È: fence¤¬²èÌ̺¸Ã¼¤ò±Û¤¨¤¿¤È¤­¤Î½èÍý¡£colon mode¤Ç¤â¤Á¤ã¤ó¤È + fence¤¬²èÌ̲¼¤Ëƨ¤²¤ë¡£Ä¹¤¹¤®¤ëfence¤Ï¤Þ¤À¤À¤á¤Í¡£ + common/multi_canna.c +2/3 21:00 + ºî¶È: fence¤¬²èÌ̺¸Ã¼¤ò±Û¤¨¤¿¤È¤­¤Î½èÍý¡£²èÌ̺Dz¼¹Ô¤Ë°Ü¤ë¡£ + ¤â¤È¤â¤ÈºÇ²¼¹Ô¤Ë¤¤¤ë¤È¤­¤Ï¤É¤¦¤·¤è¤¦¤«¤Ê¤¢¡£ + common/multi_canna.c + vi/vs_refresh.c + ºî¶È: ´Á»ú¤òȾʬ¤À¤±½ñ¤­ÄÙ¤¹¤È¤­¤Î½èÍý¤òÄɲ᣷빽ÂçÎÌ¤Ë + ½ñ¤­´¹¤¨¤Æ¤·¤Þ¤¤¤Þ¤·¤¿¤¬¡¢Æ±¤¸°ÕÌ£¤Î¤³¤È¤ò½ñ¤­Ä¾¤·¤Æ + ¤¤¤ë¤À¤±¤Ê¤Î¤ÇÌäÂê¤Ï¤Ê¤¤¤Ï¤º¤Ç¤¹¡£ + curses/addbytes.c + ºî¶È: canna´Ø·¸¡£fence¤¬on¤ÎºÇÃæ¡¢control-O¤¬canna¦¤ËÅÏ¤Ã¤Æ + ¤¤¤Ê¤«¤Ã¤¿(ʸÀ᤬¿­¤Ð¤»¤Ê¤¤)¡£ + common/multibyte.c + ºî¶È: canna´Ø·¸¡£jrKanjiString()¤ÎÊÖ¤êÃͤˤĤ¤¤ÆÌäÂêÅÀ¤¬¤¢¤Ã¤¿¤Î¤Ç + ľ¤·¡£ks.length == -1¤Î¤È¤­¤Î½èÍý¤ò˺¤ì¤Æ¤¿¡£ + ¾¤Î¤³¤È¤Ï¤À¤¤¤¿¤¤client¦¤Ïstateless¤Ç¤¤¤¤¤Î¤Ë¡¢¤³¤³¤À¤± + ¤Á¤ç¤Ã¤Èstateful¤Ê¤Î¤Í¡¢fence¤Îʸ»úÎó³Ð¤¨¤È¤«¤Ê¤¤¤È + ¤¤¤±¤Ê¤¤¤«¤é¡£echoback¤µ¤Ü¤ë½èÍý¤Ïclient¦¤Ç¤â¤ä¤ì¤ë¤«¤é¡¢ + stateless¤Ç¤¢¤Ã¤ÆÍߤ·¤«¤Ã¤¿¡£ + common/multi_canna.c + ºî¶È: canna¤Îcontrol-CÂкö¤Î¥ß¥¹¤ò½¤Àµ¡£ + cl/cl_read.c + ºî¶È: fepkey¤Î˺¤ì¤Æ¤¿¤È¤³¤í½¤Àµ¡£rangeÆþÎϤκݤÎcanna_on/off¡£ + vi/vi.c +2/2 26:00 + ºî¶È: configure.in¤Î¸«Ä¾¤·¡£FreeBSD¤È¤«¡¢¥Ç¥£¥ì¥¯¥È¥ê̾¤Îprefix¤¬ + °ã¤¦¤ä¤ÄÂкö¤È¤«¤½¤Î¤Û¤«¡£ + build/configure.in +2/2 22:00 + ºî¶È: cannakey¤ÎÊѹ¹¡£°ÊÁ°¤Ï¡Öcontrol-O¤Ë¤¹¤ë¤Ê¤é"O"¡×¤À¤Ã¤¿¤¬¡¢ + ´Êñ¤Î¤¿¤ácontrol-O¤È¤«¤ò¤½¤Î¤Þ¤Þ»ØÄꤷ¤Æ¤â¤é¤¦¤³¤È¤Ë¤·¤¿¡£ + (¤È¤¤¤¦¤«¡¢:set filec¤È¤«¤â¤½¤Î¤Þ¤Þ»ØÄê¤Ê¤Î¤Ç) + common/options.c + common/multibyte.c + ºî¶È: fepkey´Ø·¸¤ÎÄ´À°¡£·ë¹½¤«¤ï¤¤¤¯Æ°¤¯¤¾¡£ + :set fepkey="?/aioAIOcCrRtfTF" + ¤È¤«¤¤¤¦ÌµÃ㤷¤Æ¤âÊ¿µ¤¡£ + common/options.c + vi/v_txt.c + vi/vi.c + ºî¶È: cannaÍøÍÑÃæ¤Ëcontrol-C¤¬²¡¤µ¤ì¤¿¤È¤­¤ÎÆ°ºî¤òÊѹ¹¡£ + control-C¤¬Íè¤ë¤Ècanna_force_off()¤·¤Þ¤¹¡£ + cl/cl_read.c + common/multi_canna.c + ºî¶È: canna´ØÏ¢¤ÎºÆÉÁ²è¤ò¥Á¥§¥Ã¥¯¡£¤³¤ì¤Ç¤«¤Ê¤ê´°àú¤Ç¤·¤ç¤¦¡£ + common/multi_canna.c + ºî¶È: curses¤Îmultibyte²½¤ÎÂç¥Ý¥«¤ò½¤Àµ¡£Á´Á³½é´ü²½¤¬Â­¤ê¤Ê¤«¤Ã¤¿... + ¤Þ¤¢ÌµÂ̤ËÉÁ²è¤¹¤ë¤À¤±¤Ç¼Â³²¤Ê¤«¤Ã¤¿¤Î¤Ï¤µ¤¤¤ï¤¤¡£ + curses/*.h + curses/*.c + ºî¶È: ʸ»ú¤ò°ú¿ô¤Ë¤È¤ë¥³¥Þ¥ó¥É(r¤È¤«f¤È¤«t¤È¤«)¤ÎmultibyteÂбþ¡£ + vi/v_ch.h + vi/v_init.c + vi/v_replace.h + vi/vi.c + vi/vi.h + ²ò·è: f¤È¤«t¤È¤«(multibyteʸ»ú¤Ï¸¡º÷¤Ç¤­¤Ê¤¤) (11/25) + ºî¶È: vi¥³¥Þ¥ó¥É¥â¡¼¥É¤Çmultibyteʸ»ú¤ò¤Ä¤Ã¤³¤ó¤À¤È¤­¤Ë¤Ï¤Í¤ë + ¤è¤¦¤Ë¤·¤¿¡£ + vi/vi.c + ºî¶È: ºî¶È˺¤ì¤Î½¤Àµ¡£¥«¡¼¥½¥ë°ÜÆ°Á°¤ËASCII¤ËÌ᤹¤Î˺¤ì¤Æ¤¿¡£ + curses/refresh.c + ºî¶È: :set searchincr¤Î¤È¤­¤ÎÆ°ºî¤Î½¤Àµ¡£ + vi/v_txt.c + ºî¶È: word erase(control-W)¤ÎmultibyteÂбþ¡£ + vi/v_txt.c +2/2 12:00 + ºî¶È: canna¥µ¥Ý¡¼¥È¡£¤¤¤í¤¤¤íº¤¤Ã¤¿¤Á¤ã¤ó¤Ê¤È¤³¤í¤Ï»Ä¤Ã¤Æ¤¤¤ë¤Î¤Ç¡¢ + multi_canna.c¤Ç¤â¸«¤Æ¤¯¤À¤µ¤¤¡£ + common/multi_canna.c + common/multibyte.c + common/options.c + common/options_f.c + vi/v_txt.c + vi/vi.c + vi/vs_refresh.c +2/1 + ºî¶È: ¹Ô¤ÎÀ޶ʤ²½èÍý¤ËÉÔ´°Á´¤Ê¤È¤³¤í¤¬¤¢¤Ã¤¿¤Î¤Ç½¤Àµ¡£ + vi/vs_line.c +1/30 + ÅÓÃæ: wrapmargin¤ËÄ©Àï¡£¤Þ¤ÀÉÔ´°Á´¤Ê¤Î¤Ç¤È¤­¤É¤­Íî¤Á¤ë¡£ + ¼«Ê¬¤Ç¤¢¤Þ¤ê»È¤ï¤Ê¤¤¥ª¥×¥·¥ç¥ó¤Ê¤Î¤Çµ¤¹ç¤¤¤¬Æþ¤é¤Ê¤¤¡£ + vi/v_txt.c +1/29 + ºî¶È: ºÇ¶á¥Ð¥°¥ì¥Ý¤â¤Ê¤¤¤Î¤Çpublic release¤·¤Æ¤ß¤ë¡£ +1/14 + ºî¶È: encoding¤È¤·¤Æctext¤ò¤¤¤ì¤Þ¤·¤¿¡£»ÅÍͽñ¤¬¤Ê¤¤¤ó¤Ç¤¹¤¬ + 狼»ý¤Ã¤Æ¤Ê¤¤? + ESC $ @¤È¤«¤òESC $ ( @¤Ë¤·¤Ê¤¤¤È¤¤¤±¤Ê¤¤¤é¤·¤¤¤ó¤Ç¤¹¤¬¤½¤³¤Ï + ¤ä¤Ã¤Æ¤¤¤Þ¤»¤ó¡£ + ¸½¾õ¤À¤ÈG1(GR)¤Ï96 charset¤Ë¤·¤«»È¤ï¤ì¤Ê¤¤¤±¤É¤³¤ì¤Ç¤¤¤¤¤Î¤«¤Ê? + common/multi_iso2022.h + common/multibyte.c + common/multibyte.h +1/10 + ºî¶È: :set leftright¤Î²þÁ±¡£¤¢¤È¤â¤¦¤¹¤³¤·¤«¤Ê¡£ + vi/vs_refresh.c + vi/vs_relative.c + ºî¶È: iso-2022 7bit encoding¤Î¤È¤­¡¢CS_RAW¤Î¥Ç¡¼¥¿¤ò½ñ¤­½Ð¤½¤¦¤È¤¹¤ë¤È + Íî¤Á¤Æ¤¿¤Î¤ò½¤Àµ¡£ + common/multi_iso2022.c +1/9 + ºî¶È: ·¿¤Ë¶ËÎÏconst½¤¾þ»Ò¤ò¤Ä¤±¤¿¡£ + common/multi* + ²ò·è: multibyte.c¤ÎÃæ¤Î¥Ý¥¤¥ó¥¿¤ò¤¿¤À¤·¤¯const char *¤È¤«¤Ë + ľ¤¹(1/6) +1/4 27:00 + ºî¶È: :set autodetect=cn¤Î¤È¤­¤Ë¡¢hz¤Îǧ¼±¤òÄɲᣠ+ :set autodetect=cn Ãæ¹ñ¸ìÍÑ(euc-cn/big5/others) + common/multibyte.c +1/4 26:00 + ºî¶È: autodetect¤Î»ÅÍÍÊѹ¹¡£¹ñÊ̤ÎÀßÄê(ʸ»úÎó¤Ç)¤Ë¤·¤¿¡£ + ¤ä¤Ã¤Ñ¤êeuc-cn¤Èbig5¤Ï¶èÊ̤¹¤ó¤Î¤Û¤Ü̵Íý¤À¡£ + :set autodetect=jp ÆüËܸìÍÑ(euc-jp/sjis/others) + :set autodetect=cn Ãæ¹ñ¸ìÍÑ(euc-cn/big5/others) + :set autodetect=kr ´Ú¹ñ¸ìÍÑ(euc-kr/others) + :set autodetect=¤½¤ì°Ê³° autodetect¤·¤Ê¤¤ + common/exf.c + common/multibyte.c + common/options.c + ex/ex_read.c + ex/ex_script.c +1/4 16:00 + ºî¶È: ²èÌ̤Îrefresh¤Þ¤ï¤ê¤òÀ°Íý¡¦ºÆ¥Á¥§¥Ã¥¯¡£¤À¤¤¤Ö¤ó¤Þ¤È¤â¤Ë¤Ê¤Ã¤¿¤È + »×¤¤¤Þ¤¹¡£:set leftright¤Ï¤Þ¤À¤è¡£ + vi/vs_line.c + vi/vs_refresh.c + ºî¶È: quail¤â¤É¤­¼Â¸³Ãæ¤Î¥Ð¥°¤È¤ê¡£xxx_keyinput¤È¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹ÌäÂê¡£ + cl/cl_read.c + ºî¶È: quail¤â¤É¤­¼Â¸³Ã档ɸ½àÇÛÉۤξõÂ֤ǤÏcompile in¤µ¤ì¤Þ¤»¤ó¡£ + ¼ê¤Çmakefile¤È¥½¡¼¥¹¤ò¤¤¤¸¤Ã¤Æ¤Í¡£¤³¤ó¤Ê¤Î¼ûÍפ¢¤ë¤Î¤«¤Ê¡£ + ¤½¤³¤½¤³¤À¤¬1ÂÐ1°Ê¾å¤Îmapping¤Ï¿É¤¤¤¾¡£ + common/test/multi_quail.c +1/3 + ºî¶È: :set inputencoding¤¢¤¿¤ê¤Î¥¨¥é¡¼¥Á¥§¥Ã¥¯¶¯²½¡£ + common/options_f.c + common/multibyte.c + ºî¶È: cannaÁȤ߹þ¤ß¼Â¸³Ã档ɸ½àÇÛÉۤˤÏÆþ¤Ã¤Æ¤Þ¤»¤ó¡£ + ¤ä¤Ã¤Ñ¤êinput method¤Ï³°¤ÎÊý¤¬¤¤¤¤¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£ + ¤¤¤í¤ó¤Ê°ÕÌ£¤Ç¡£¤È¤¤¤¦¤ï¤±¤ÇÅÓÃæ¤Þ¤Ç¤·¤«¤ä¤é¤º¤ËÃæ»ß¡£ + ºî¶È: abbrev¤òmultibyteʸ»ú¤Î¶á½ê¤Ç¤ä¤Ã¤Æ¤âȯ¶¸¤·¤Ê¤¤¤è¤¦½¤Àµ¡£ + vi/v_txt.c +1/2 + ºî¶È: displayencoding¤òglobal option¤ËÊѹ¹¡£ + common/gs.h + common/options.c + ºî¶È: multibyte¤ÎÀµµ¬É½¸½¡¢range»ØÄê¡£ + regex/regcomp.c + regex/engine.c +1/1 + ºî¶È: ¤Ê¤ó¤È¡¢Àµµ¬É½¸½¸¡º÷¤Ë´Ø¤·¤Æ¤Ïrange»ØÄê¤Èñ¸ì¶èÀÚ¤ê°Ê³° + ¤À¤¤¤¿¤¤¤Ç¤­¤Æ¤¤¤ë¤³¤È¤¬È½ÌÀ¤·¤¿(:set extended¤»¤º¤Ë»î¤·¤Æ¤¤¤¿)¡£ + ¤ä¤Ã¤¿¤¼¡£ + ºî¶È: common/multibyte.c¤¬¤Ç¤«¤¤¤Î¤Çʬ³ä¡£¤Ä¤¤¤Ç¤Ëcharset̾¤Î + #define´Ø·¸¤ò¼«Æ°À¸À®²½¡£¤Á¤ç¤Ã¤È¥½¡¼¥¹Ê¬¤±¤¹¤®¤¿? + multi_chclass.c¤À¤±Ê¬¤±Êý¤¬encoding¤¸¤ã¤Ê¤¤¤Î¤¬µ¤¤Ë¤Ê¤ë¤±¤É + ¤Þ¤¢¤¤¤¤¤«¡£ + 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 + ºî¶È: korean(KSC5601)¤Îñ¸ì°ÜÆ°¡£»î¤·¤Æ¤Ê¤¤¤¾¡£ + common/multibyte.c +12/31 30:00 + ¤¢¤±¤Þ¤·¤Æ¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£¿·Ç¯(1:00AM)¤Î»Íë±Ø¤Î¥Û¡¼¥à¤Çhack + ¤¹¤ë²ø¤·¤¤¤Ò¤È¤Ç¤¹¡£ + + ºî¶È: big5¥µ¥Ý¡¼¥È¡£Â¿Ê¬Æ°¤¯¤È»×¤¦¤±¤É¡¢»î¤·¤è¤¦¤¬¤Ê¤¤¡£ + iso-2022-*¤Î¤È¤­¤Îencoding¤ÈÆâÉôɽ¸½¤Ïmule¤È¹ç¤ï¤»¤Æ¤¢¤ê¤Þ¤¹¡£ + ("ESC $ ( 0"¤È"ESC $ ( 1") + big5¤â¼«Æ°È½ÊÌÂоݤˤ·¤Æ¥í¥¸¥Ã¥¯¤Ï½ñ¤¤¤Æ¤¢¤ê¤Þ¤¹¤¬¡¢Â¿Ê¬È½ÊÌ + ¤¹¤ó¤Î¤ÏÆñ¤·¤¤¤Ç¤·¤ç¤¦¡£ÆäËû¤¤Ê¸½ñ¤Î¤È¤­¡£ + ²ò·è: big5¤ÏɬÍס£(12/27) + common/multibyte.c +12/30 25:30 + ºî¶È: ¤¿¤¤¤·¤¿¤³¤È¤¸¤ã¤Ê¤¤¤±¤É¡¢:ver¤Ç¥Ð¡¼¥¸¥ç¥ó¤¬¤Ç¤ë¤è¤¦¤Ë¤·¤¿¡£ + ex/ex_version.c + ex/mversion.h + ºî¶È: :script¤ÎmultibyteÂбþ¡£:script¤Ã¤Æ½é¤á¤ÆÃΤ俤ó¤À¤±¤É¡¢ + ¤¹¤²¤¨²÷Ä´¡£¤³¤ê¤ã¤¨¤¨¤ï¡£¤ä¤á¤é¤ì¤Þ¤Ø¤ó¡£ + ¤³¤Î¤¿¤á¤Ëmulti_ext2int_region()¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ò¼ã´³ÊѤ¨¤¿¡£ + common/multibyte.c + common/exf.c + ex/ex_read.c + ex/ex_script.c + ºî¶È: :global¤òmultibyteÂбþ¡£ + ex/ex_global.c +12/30 20:00 + ºî¶È: multibyteʸ»ú¤ÎÀµµ¬É½¸½¸¡º÷¤ò¤Á¤ç¤Ã¤È¤Å¤Ä¤ä¤Ã¤Æ¤Þ¤¹¡£¤È¤ê¤¢¤¨¤º + "."¤Ïmultibyteʸ»ú¤Ò¤È¤â¤¸¤Èmatch¤·¤Þ¤¹¡£ + multibyteʸ»ú¤Î¾å¤òrange»ØÄê¤ÇƧ¤ó¤Ç¤âȯ¶¸¤·¤Þ¤»¤ó¡£ + word¶­³¦Ç§¼±¤ò¤·¤è¤¦¤È¤¹¤ë¤Èȯ¶¸¤¹¤ë¤Ï¤º¤Ç¤¹¡£ + patch¤Ï¤È¤Ã¤Æ¤â±ø¤¤¤¾¡£ + regex/regcomp.c + regex/engine.c + regex/regex2.c + ºî¶È: multibyteʸ»ú¤Î¸¡º÷/ÃÖ´¹(vi¤Ç¸À¤¦"/"¤È"?")¡£Àµµ¬É½¸½¤Ï¤Þ¤À¥Ê¥·¤Í¡£ + ¤Ä¤¤¤Ç¤Ë¡¢range»ØÄê¤Ëmultibyteʸ»ú»È¤Ã¤Æ¤âÊ¿µ¤¡£ + common/search.c + ex/ex.c + ex/ex_subst.c + regex/regcomp.c + ºî¶È: ¥Õ¥¡¥¤¥ë¤Îencoding¼«Æ°È½Ê̤ò¤Á¤ç¤Ã¤È²þÁ±¡£ + common/multibyte.c +12/29 + ºî¶È: ÈÆÍÑiso-2022-*¥­¡¼¥Ü¡¼¥ÉÆþÎÏ¡£¥­¡¼¥Ü¡¼¥ÉÆþÎÏ¥³¡¼¥É¤ÎÊÑ´¹¤Ï + event managerÉô¤ËÆͤùþ¤Þ¤ì¤Þ¤·¤¿¡£ + iso-2022-jp°Ê³°¤Ç»î¤·¤Æ¤¤¤Þ¤»¤ó¡£¤¤¤Â¤á¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£ + ¤¢¡¢¤½¤¦¤½¤¦¡¢control-N/O¤Ï¾ï¤Ë¿©¤ï¤ì¤Á¤ã¤¦(SO¤ÈSI¤À¤â¤ó¤Í)¤Î¤Ç¡¢ + vi command¥â¡¼¥É¤Çcontrol-N¤È¤«¤òÂǤäƤ⡢vi¤Î¥³¥Þ¥ó¥É¤È¤Ï + ǧ¼±¤µ¤ì¤Þ¤»¤ó¡£SO/SI²ò¼á¤¹¤ë¤Î¤ä¤á¤è¤¦¤«¤Ê... + ²ò·è: ¥­¡¼ÆþÎϤÎmultibyteÂбþºÆ¹Í (12/21) + keyboard event engine¤ËÆͤùþ¤Þ¤Ê¤¤¤Èiso-2022-*¤Î + ¤È¤­¤ËÇËþ¤¹¤ë?(ESC¤Î¥Ï¥ó¥É¥ê¥ó¥°) + 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 + ºî¶È: ¥É¥­¥å¥á¥ó¥È¤Î¹¹¿·¡£ +12/28 15:30 + ºî¶È: curses¤ÎÅ°ÄìmultibyteÂбþ¡£sjis¤Çx0201 kana¤â»È¤¨¤ë¤¾¡£ + ¾ÜºÙ¤Ïcurses/README.jnvi»²¾È¡£ + ²ò·è: curses¦¤Î¹ÔËö½èÍý¤¬¤Þ¤À¤Ê¤Î¤Ç¤È¤­¤É¤­²½¤±¤ë¡£(12/27) + ²ò·è: curses¤Îmultibyte½èÍý(12/1) + curses¤ËÅϤ¹Ê¸»úÎó¤Ï¤É¤¦¥¨¥ó¥³¡¼¥É¤¹¤ë¤Ù¤­¤«? + ¤¢¤ë¤¤¤Ïstandout()¤ß¤¿¤¤¤ËÊÌ´Ø¿ô? + curses/README.jnvi + curses/addbytes.c + curses/box.c + curses/cr_put.c + curses/curses.h + curses/insch.c + curses/refresh.c + ºî¶È: multi_name()¤ò¤Á¤ç¤Ã¤È½ñ¤­Ä¾¤·¡£euc/sjis¤Î¥µ¥Ý¡¼¥È¤òåºÎï¤Ë¡£ + :set skipdisplay¤Ç"?"¤Ç¤Îɽ¼¨¤ÎÀÚÂؤ¨¡£ + ²ò·è: multi_name()¤ÎÃæ¤ÇÆüËܸì¤À¤±¤º¤ë¤·¤Æ¤¤¤ë¡£(12/27) + x0208.1973¤Èx0208.1983¤òξÊýɽ¼¨¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£ + common/multibyte.c + common/options.c +12/27 + kinput2¤òinstall¤·¤Ê¤ª¤·¤¿¤Î¤Ç¡¢¤È¤¦¤È¤¦¤³¤Î¥³¥á¥ó¥Èʸ¼«ÂΤâ + jnvi¤Ç½ñ¤¤¤Æ¤Þ¤¹¡£ + + ºî¶È: curses¤Îiso-2022-*Âбþ(²¾)¡£¤Ê¤ó¤Ç¤âG0¤Ëdesignate¤·¤Æ¤·¤Þ¤¤¤Þ¤¹¡£ + ¤¢¤ï¤»¤Æ²èÌ̽ÐÎϤÎiso-2022-*²½¡£ + curses¤Çiso-2022-*¤ò»È¤¦¤È¤­¤Ï¡¢¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤Èʸ»ú¤ò + °ìµ¤¤Ëaddnstr()¤·¤Ê¤¤¤È¤¦¤Þ¤¯Æ°¤­¤Þ¤»¤ó¡£Ãí°Õ¡£ + curses/addbytes.c + curses/refresh.c + curses/cr_put.c + common/multibyte.c + ºî¶È: curses¤Îeuc 2byteÂбþÉÔ­¤Îľ¤·¡£ÆüËܸì¤Î¾ì¹ç¥Ð¥¤¥È¤á¤«¤ò + µ­Ï¿¤·¤Æ¤ª¤«¤Ê¤¤¤È¤¢¤È¤ÇÌÌÅÝ¡£ + curses/addbytes.c + curses/refresh.c + ºî¶È: vs_msg()¤ÎmultibyteÂбþ¡£ + multi_name()¤Î¥¿¥¤¥ß¥ó¥°¤ò¤º¤é¤·¤¿¡£printf()¤Þ¤¿¤Ïaddnstr¤¹¤ë + ¤È¤­¤Þ¤Ç²æ¡¹¤ÎencodingÊý¼°¤Ç»ý¤Ã¤Æ¤¤¤¯ + ²ò·è: vi¤«¤é:p¤·¤¿¤È¤­¤Î½èÍý¡£(12/27) + vs_msg()¤È°ì½ï¤Ç¡¢2ÅÙKEY_NAME()¤¹¤ë¤³¤È¤Ë¤Ê¤ë¡£ + ¥¿¥Á°­¤¤¡£ + ²ò·è: vs_msg()¤ÎmultibyteÂбþ (12/1) + ex_print()¤Èvs_msg()¤È2²óKEY_NAME()¤òÄ̤ë¤Î¤Ç + ¥¿¥Á¤¬°­¤¤ + cl/cl_funcs.c + common/multibyte.c + ex/ex_print.c + vi/vs_line.c + vi/vs_msg.c + ÅÓÃæ: vs_msg()¤ÎmultibyteÂбþ(12/1) + ºî¶È: indentation¤ÎÄ´À°¤ò¤¹¤ë¤ÈÍî¤Á¤ë¥Ð¥°¤ò½¤Àµ¡£ + ¼Â¤Ïñ¤Ê¤ë¤Ò¤È¤â¤¸typo¤À¤Ã¤¿... + vi/v_txt.c + ºî¶È: ex¤Î¥Æ¥­¥¹¥ÈÆþÎÏ(:append¤È¤«)¤òmultibyteÂбþ¡£ + inputencoding¤Ë½¾¤¤¤Þ¤¹¡£ + ex/ex_txt.c + ºî¶È: iso-2022-jp2¤Ç¤Ïlatin1¤Ê¤É¤Î96 charsets¤ÏG2¤Ëdesignate + ¤¹¤ë¤è¡¼¤Ë¡¢¤È½ñ¤¤¤Æ¤¢¤ê¤Þ¤·¤¿¡£¸«Íî¤È¤·¤Æ¤¿¡£ + ¤³¤ì¤Ë½¾¤¦¤è¤¦¡¢iso2022jp´ØÏ¢¤Î½èÍý¤òÊѹ¹¡£ + 12/27 13:00ÈǤÎREADME.jnvi¤Ë¤Ï±³¤¬¤¢¤ê¤Þ¤·¤¿¡£ + common/multibyte.c + ºî¶È: 0x8e/0x8f(single shift G2/G3)¤Î¤¢¤È¤Ï8bit¤á¤ò¤ß¤Ê¤¤¡¢¤Ã¤Æ¤³¤È¤Ï + GL/GR¤ÎξÊý¤ËG2(¤Þ¤¿¤ÏG3)¤¬Å½¤é¤ì¤ë¤ó¤Ç¤¹¤Í¡£¤Õ¡¼¤à¡£ + common/multibyte.c +12/27 13:00 + ºî¶È: ¥Ç¥Õ¥©¥ë¥È¤Îencoding¤òconfigure¤Î¥Ñ¥é¥á¥¿¤ËÄɤ¤½Ð¤·¡£ + Á´¤Æ¤Îencoding(input/display/file)¤Î¥Ç¥Õ¥©¥ë¥ÈÃͤ¬±Æ¶Á¤µ¤ì¤Þ¤¹¡£ + Ê̤Ëeuc-*°Ê³°¸À¤Ã¤Æ¤â¤¤¤¤¤±¤É¡¢É½¼¨¤Ç¤­¤Ê¤¤¤«¤é¤Í¡£ + % ./configure --enable-multibyte (euc-jp¤Ë¤Ê¤ë) + % ./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 + ºî¶È: euc-jp/cn/kr¤Îɽ¼¨¤ò¥µ¥Ý¡¼¥È¡£ + common/multibyte.c +12/26 24:00 + ºî¶È: euc-jp/cn/kr¤Î¥­¡¼¥Ü¡¼¥ÉÆþÎϤò¶¦Ä̲½¡£ + :set inputencoding=euc-jp ¥­¡¼ÆþÎϤÏeuc-jp + :set inputencoding=euc-cn ¥­¡¼ÆþÎϤÏeuc-cn + :set inputencoding=euc-kr ¥­¡¼ÆþÎϤÏeuc-kr + common/multibyte.c + ºî¶È: euc-jp/cn/kr¤Îfile conversion¤òiso-2022-*¤Î°ìÉô¤È¤·¤Æ°ìÈ̲½¡£ + ¶ñÂÎŪ¤Ë¤Ï¡¢SS2/SS3¤òiso-2022-*¤Çhandle¤Ç¤­¤ë¤è¤¦¤Ë¤·¤¿¡£ + selcharset()¤Ï¤Ð¤Ã¤Á¤¤¤Î¤Ç¤â¤¦¤¹¤³¤·¤Þ¤È¤â¤Ë¤·¤¿¤¤... + common/multibyte.c +12/26 20:00 + ºî¶È: ¼«Æ°È½Ê̤ζ¯²½ + hz/sjis/iso-2022-jp/iso-2022-kr/iso-2022-cn/euc-jp¤¬¶èÊ̤Ǥ­¤ë¡£ + iso-2022-*¤ÏSI/SO/SS2/SS3¤Î¤Ç¤«¤¿¤Ç¶èÊ̤·¤Æ¤Þ¤¹¡£ + ¤¤¤Þ¤ÏÆɤ߹þ¤ó¤ÀÈÏ°ÏÁ´Éôparse¤·¤Æ¤ë¤Î¤Ç¤¹¤¬¡¢¤¢¤¿¤Þ10¹Ô¤¯¤é¤¤¤Ë + ¸º¤é¤·¤Æ¤â¤¤¤¤¤Ç¤¹¡£¤Ï¤¤¡£ + iso-2022-kr¤Ï¤¢¤Þ¤ê¼«¿È¤Ê¤·¡£ + ºî¶È: iso2022¥Ñ¡¼¥µ¤ÎÅ°Äì½ñ¤­Ä¾¤·¡£ + - ¹ÔËö¤ò±Û¤¨¤Æ¾õÂ֤λĤëencoding¤ËÂбþ(iso-2022-kr) + - G0/G1/G2/G3Á´Éô»È¤¦¤è¤¦¤Êencoding¤ËÂбþ(iso-2022-cn) + - ½ñ¤±¤Ê¤¤charset¤Îʸ»ú¤¬¤Ç¤ÆÍ褿»þ¤Ë¥Õ¥é¥°¤ò¤¿¤Æ¤ë + (:w¤·¤¿¤È¤­¡¢½ñ¤±¤Ê¤¤charset¤¬¤Ç¤Ç¤¿¤é·Ù¹ð¤·¤è¤¦¤«?) + - SS2/SS3 (ESC N¤ÈESC O)¤òÆɤá¤ë + - ¤½¤Î¤Û¤«¤¿¤¯¤µ¤ó + ·ë²Ì¤È¤·¤Æ¡¢°Ê²¼¤¬»È¤¨¤Þ¤¹¡£latin*¤È¤«¤Ï¤Þ¤À¤Þ¤ÀÁý¤ä¤»¤ë¤¾¡£ + iso-2022-7-2¤È¤«¤Ï°ÕÌ£¤¬¤É¤ì¤À¤±¤¢¤ë¤«¤è¤¯¤ï¤«¤é¤Ê¤¤¡£ + ¸½ºß¤Ï¥í¥¸¥Ã¥¯¤¬°­¤¤¤Î¤Ç¡¢²Äǽ¤Ê¤â¤Î¤ÏÁ´ÉôG0¤Ëdesignate + ¤µ¤ì¤Á¤ã¤¤¤Þ¤¹¡£¤É¤¦¤¹¤ê¤ã¤¤¤¤¤ó¤À¤«¡£ + :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¡¢G0¤Î¤ß + :set fileencoding=iso-2022-7-2 7bit¡¢G0/G1 + :set fileencoding=iso-2022-8-2 8bit¡¢G0/G1 + :set fileencoding=iso-2022-cn 7bit¡¢G0-3 + :set fileencoding=iso-2022-jp 7bit¡¢G0¤Î¤ß + :set fileencoding=iso-2022-kr 7bit¡¢G0/G1 + :set fileencoding=sjis + :set fileencoding=hz + + ²ò·è: ISO-2022-*·Ï¤Î½ÐÎϤÏÀµ¤·¤¤¤±¤ÉÀ©Ì󤬴ˤ¹¤®(12/24) + ¤â¤Ã¤È¤¤¤í¤¤¤íÀ©Ì󤫤±¤é¤ì¤Æ¤â¤¤¤¤¤Î¤Ç¤Ï? + - ISO-2022-JP/2¤ò¼é¤Ã¤Æ¤¤¤Ê¤¤(ESC $ B¤¸¤ã¤Ê¤¯¤Æ + ESC $ ( B¤¬¤Ç¤ë) + ²ò·è: multi_*¤ò¸Æ¤Ö¤È¤­¤ÎÆâÉô¾õÂÖ¤ò³°¤Ë½Ð¤¹¡£(12/23) + ¹Ô¤ò¤Þ¤¿¤¤¤Çdesignation¤Î¾õÂÖ¤¬»Ä¤ë¥³¡¼¥É·Ï¤Î + ¥µ¥Ý¡¼¥È¤ËɬÍס£ + common/multibyte.c + ºî¶È: :set autodetect¤òʬΥ¡£¤è¤Ã¤Æ¡¢:set fileencoding=euc-jp*¤Î + ¤«¤ï¤ê¤Ë¡¢:set fileencoding=euc-jp¤·¤Æ¡¢:set autodetect + ¤·¤Æ¤¯¤À¤µ¤¤¡£ + common/multibyte.c + common/options.c + common/options_f.c +12/25 + ºî¶È: hz¥Ñ¡¼¥µ¤òºîÀ®¡£ + common/multibyte.c + ºî¶È: euc¥Ñ¡¼¥µ´ØÏ¢¤òÀ°Íý¡£euc-jp/euc-kr/euc-cn¤ò¤Ä¤±¤ë¡£ + (euc-tw¤Ï¤Á¤ç¤Ã¤ÈÂԤäÆ) + common/multibyte.c + ºî¶È: :set noleftright¤Î¤È¤­¤Î¹ÔËö¤ò±Û¤¨¤ë¹Ô¤Î¹ÔËö½èÍý + ¤Á¤ç¤¤¤ÈÃî¤È¤ê¡£ + vi/vs_line.c + vi/vs_refresh.c + vi/vs_relative.c + ºî¶È: Èóascii/controʸ»ú¤Î¥«¡¼¥½¥ëÀ©¸æ¤òÊѹ¹¡£¥«¡¼¥½¥ë¤Ïº¸Ã¼¤Ë¾è¤ë¡£ + ²ò·è: Èóascii¤ÇÈócontrolʸ»ú¤Î¾ì¹ç(´Á»ú¤È¤«¥Ï¥ó¥°¥ë¤È¤«)¡¢ + ¥«¡¼¥½¥ë¤òʸ»ú¤Îº¸Ã¼¤Ë(12/25) + vi/vs_line.c + vi/vs_refresh.c + vi/vs_relative.c +12/24 24:00°Ê¹ß + ºî¶È: R¥³¥Þ¥ó¥É¤ÎmultibyteÂбþ¡£ + ²ò·è: R¥³¥Þ¥ó¥É¤ÎmultibyteÂбþ¡£(12/23) + v_txt.c¤Îv_Rresolve()¤ÎÃæ¤òmultibyteÂбþ¤¹¤ë¤Î¤¬ + ¤È¤Æ¤â¤á¤ó¤É¤¯¤µ¤¤¡£ + vi/v_txt.c + ºî¶È: ¥Õ¥¡¥¤¥ëÆþ½ÐÎÏ¥³¡¼¥É¤Î¼«Æ°È½ÊÌ + recovery/logging´Ø·¸¤ÎºÙ¤«¤¤¥ß¥¹¤ò½¤Àµ¡£À°Íý¡£ + µ¤¤Å¤¤¤¿¤³¤È: file_init()¤ÎÃæ¤Ç¤Ïdb_get()¤È¤«¤ò»È¤Ã¤Á¤ã¤¤¤±¤Ê¤¤¡£ + common/exf.c + common/multibyte.c + ex/ex_read.c +12/24(Merry Christmas!) + ºî¶È: ¥Õ¥¡¥¤¥ëÆþ½ÐÎÏ¥³¡¼¥É¤Î¼«Æ°È½ÊÌ¡£ + ȽÊ̤·¤Æ¤â¡¢fileencoding¤ÎÃͤÏÊѲ½¤·¤Ê¤¤¡£ + ¤Á¤Ê¤ß¤Ë¡¢!¤È¤«¤Î½èÍý¥³¡¼¥É¤â:set fileencoding¤ÇÀßÄꤵ¤ì¤Æ¤ë + ¤ä¤Ä¤È°ì½ï¤Ç¤¹¡£ + :set fileencoding=euc-jp euc-jp + :set fileencoding=iso-2022-jp iso-2022-jp + :set fileencoding=sjis sjis + :set fileencoding=euc-jp* ¼«Æ°È½ÊÌ/ÉÔÌÀ¤Ê¤éeuc-jp + :set fileencoding=iso-2022-jp* ¼«Æ°È½ÊÌ/ÉÔÌÀ¤Ê¤éiso-2022-jp + :set fileencoding=sjis* ¼«Æ°È½ÊÌ/ÉÔÌÀ¤Ê¤ésjis + ²ò·è: ¥Õ¥¡¥¤¥ëÆþÎϤκݤÎencoding¼«Æ°È½ÊÌ(12/10) + common/exf.c + common/multibyte.c + ex/ex_read.c + ºî¶È: ¥Õ¥¡¥¤¥ëÆɤ߽Ф·»þ¤Î¥³¡¼¥ÉÊÑ´¹¤Î¾ì½ê¤òÊѹ¹¡£ + db¤ËÁ´ÉôÆɤ߹þ¤ß½ª¤Ã¤Æ¤«¤éÁ´Éô¤Ê¤á¤ë¡£ + ²ò·è: ¥Õ¥¡¥¤¥ëopen»þ¤Î¥³¡¼¥ÉÊÑ´¹hook¤Î°ÌÃÖ¡£(12/23) + db¥é¥¤¥Ö¥é¥ê¤Ë¼ê¤ò¤Ä¤Ã¤³¤Þ¤º¤Ë¤Ï¤Ç¤­¤Ê¤¤? + ¤Ê¤ó¤«ÃΤé¤ó¤¬²ò·è: + dG¤¹¤ë¤È¤¿¤Þ¤Ësegmentation fault¤¬¤¢¤ë¡£(12/23) + :set fileencoding=iso-2022-jp¤Ç¡¢¥Õ¥¡¥¤¥ëÆɤ߹þ¤ßľ¸å¡£ + ¤É¤ó¤Êʸ½ñ¤Ç¤â¡¢3¹ÔÌܺï½ü¤·¤Æ¤¤¤ë¤È¤­(¤Ê¤ó¤Ç3¹ÔÌܤʤ櫓?) + text_init()¤«¤é¸Æ¤Ð¤ì¤¿calloc()¤ÎºÇÃæ¡£ + ¤É¤Ã¤«¥á¥â¥ê²õ¤·¤Æ¤ë?? + common/exf.c + common/multibyte.c + db/recno/rec_get.c + ex/ex_read.c +12/23 + ºî¶È: sjis¤ÎJIS X0201º¸Â¦(1¥Ð¥¤¥È¥«¥¿¥«¥Ê)¥µ¥Ý¡¼¥È¡£»î¤·¤Æ¤Ê¤¤¤¾¡£ + ²ò·è: sjis¤Î¤È¤­¤ÎJIS X0201¥«¥¿¥«¥ÊÂбþ(12/22) + common/multibyte.c + ºî¶È: euc-jp¤ÎJIS X0212-1990(Êä½õ´Á»ú)/JIS X0201º¸Â¦(1¥Ð¥¤¥È¥«¥¿¥«¥Ê) + ¥µ¥Ý¡¼¥È¡£»î¤·¤Æ¤Ê¤¤¤¾¡£ + common/multibyte.c + ºî¶È: JIS X0212-1990(Êä½õ´Á»ú)¥µ¥Ý¡¼¥È¡£»î¤·¤Æ¤Ê¤¤¤¾¡£ + common/multibyte.c + ºî¶È: ɽ¼¨¤â¤Ç¤­¤Ê¤¤¤Î¤ËcharsetÁý¤ä¤·¤Þ¤¯¤ê¡£¤¢¤È»Ä¤ë¤Ïbig5? + ²ò·è: charset¤ò¤â¤Ã¤ÈÁý¤ä¤½¤¦(12/10) + common/multibyte.c + ºî¶È: ISO-2022-*·Ï¤Î¤½¤³¤½¤³¤Ð¤Ã¤Á¤ê¤Ê¥Ñ¡¼¥µ¡£ + ¤¿¤À¤·¡¢³Æ¹Ô¤´¤È¤Ëdesignation¤Î¾õÂÖ¤¬¤â¤È¤ËÌá¤ë¤ä¤Ä¤Ë¸Â¤ë¡£ + common/multibyte.c +12/22 + ºî¶È: ftp.foretune.co.jp¤Ëftp directory¤òÍÑ°Õ¡£ + ºî¶È: :set noleftright¤Î¤È¤­¤Î¹ÔËö¤ò±Û¤¨¤ë¹Ô¤Î¹ÔËö½èÍý + vi/vs_line.c + vi/vs_refresh.c + vi/vs_relative.c + ²ò·è: ¹ÔËö¤ò±Û¤¨¤ë¹Ô¤Î½èÍý(12/1) + ºî¶È: v_ex_done()¤ÎmultibyteÂбþ + vi/v_ex.c + ºî¶È: multibyteʸ»ú¤ÎÅÓÃæ¤òƧ¤ó¤Ç¤¿¤È¤³¤í¤¬¤¢¤Ã¤¿¤Î¤Ç½¤Àµ + (#ifdef MULTIBYTE¤Îtypo!) + vi/v_txt.c +12/21 + ºî¶È: prototypeÀë¸À¤ÎÉղá£CHAR_T -> ARG_CHAR_T¡¢chclass¤òu_int¤Ë + common/multibyte.c + vi/v_word.c + ²ò·è: include¤Î²¼¤Î¥Õ¥¡¥¤¥ë¤Î¼«Æ°À¸À®²½(12/10) + ºî¶È: wrapmargin¤ÎÁàºî¤¬ÆüËܸìƧ¤ó¤Ç¤âȯ¶¸¤·¤Ê¤¤ + vi/v_txt.c + ºî¶È: ¥­¡¼ÆþÎϤÎeuc-jp/sjisÂбþ + illegal¤ÊÆþÎÏ(eucȾʬ¤À¤±¤È¤«)¡¢timeout´ØÏ¢¤Ï¤Þ¤ÀÉ԰¡£ + Æͤùþ¤à¤È¤³¤í¤òÊѤ¨¤¿Êý¤¬¤¤¤¤? + :set inputencoding=euc-jp euc-jp + :set inputencoding=sjis sjis + common/multibyte.c + vi/v_txt.c +12/10 26:30°Ê¹ß + ºî¶È: E/e/B/b¥³¥Þ¥ó¥É¤Ë¤Ä¤¤¤Æ¤âmultibyteÂбþ¡£ + W/w¥³¥Þ¥ó¥É¤Î½èÍýÆâÍƤòÊѤ¨¤Á¤ã¤Ã¤¿¥¨¥ó¥Ð¥°¤òľ¤¹¡£ + vi/v_word.c +12/10 17:30°Ê¹ß + ºî¶È: ¤È¤ê¤¢¤¨¤ºW¤Èw¥³¥Þ¥ó¥É¤À¤±multibyteÂбþ¡£Æ°ºî¤Ïjelvis¤È°ì½ï¡£ + ¾¤Ë¤Ä¤¤¤Æ¤â˽Áö¤Ï¤·¤Ê¤¤¡£ + ²ò·è: word movement¤ÎmultibyteÂбþ(12/10) + vi/v_word.c + common/multibyte.c + ºî¶È: ºÆÉÁ²èÉô¤Ë¡Ö1¥Ð¥¤¥È¤Ë¤Ä¤­1·å°Ê¾åɽ¼¨¤µ¤ì¤ë¡×¤Ã¤Æ¤Î¤òÁ°Äó¤Ë + ¤¹¤ë¥³¡¼¥É¤¬»Ä¤Ã¤Æ¤¤¤¿¤Î¤Ç½üµî¡£ + vi/vs_line.c + ºî¶È: word movement¤Ç¤È¤ê¤¢¤¨¤ºË½Áö¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£ + vi/v_word.c + ºî¶È: ÆâÉô¥³¡¼¥É´ØÏ¢¤Î¥¨¥ó¥Ð¥°¤·¤¿¤È¤³¤í¤Î½¤Àµ¡£multi_back()¤È¤«¡£ + common/multibyte.c + ºî¶È: 0x80¤«¤é0xff¤Î¥Ð¥¤¥Ê¥ê¤¬Í褿¤È¤­¤ÎÂн衣ɽ¼¨·Ï¤â¡£ + ¼ã´³¥¨¥ó¥Ð¥°¤È¤ê¤â¤¢¤ê¡£ + common/key.c + common/gs.h + ex/ex_print.c + ²ò·è: ¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤ò¤¤¤¸¤¯¤í¤¦¤È¤·¤¿¤È¤­¤ÎÂкö (12/1) + ¿¥Ð¥¤¥Èʸ»ú¤Ï1byte¤á¤Ç¸¡½Ð¤Ç¤­¤ë¤«¤é¡¢Æɤ߹þ¤ß/ + ½ñ¤­½Ð¤·»þ¤ËÃí°Õ¤¹¤ì¤ÐÂç¾æÉפÀ¤È¤ª¤â¤¦¡£ + ²ò·è: KEY_LEN(sp, x)¤Ç¡¢x=0x80¤Î¤È¤­¤Î½èÍý(12/10) + CS_RAW +12/10 17:30¤Þ¤Ç + ºî¶È: ¥Õ¥¡¥¤¥ëÆþ½ÐÎÏÍÑencoding¤ÎÀÚÂؤ¨¡£¼«Æ°È½Ê̤Ϥʤ·¡£ + ²èÌÌɽ¼¨¤Ïeuc-jp¤Î¤ß(curses²þ¤¤¬Â­¤ê¤Ê¤¤) + ¥­¡¼¥Ü¡¼¥É¤«¤é¤ÏÆüËܸ줬ÂǤƤʤ¤¡£ + :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 + ºî¶È: ÆâÉô¥³¡¼¥É¤Ïeuc-jp¤ò¤ä¤á¤Æmule¤Ã¤Ý¤¯¡£Ê£¿ôcharset¤Î¥µ¥Ý¡¼¥È¡£ + common/multibyte.c +12/8 + ºî¶È: :j¥³¥Þ¥ó¥É¤ÎmultibyteÂбþ(Æ°ºî¤Ïjelvis¤ÈƱÍÍ) + ¤Û¤ó¤È¤Ïʸ»ú¼ï¤´¤È¤ËÆ°ºî¤òÄêµÁ¤Ç¤­¤ë¤è¤¦¤Ë¤·¤Æ¤ª¤­¤¿¤¤¡£ + ex/ex_join.c + ºî¶È: curses¤ÎEUC-JPÂбþ¤Î¤ä¤ê»Ä¤· ÆâÍƤÏtokuÈǤÈƱÍÍ + curses/refresh.c + ²ò·è: ´Á»ú¤Î2¥Ð¥¤¥È¤á¤òƧ¤à¤è¤¦¤Ê¥«¡¼¥½¥ë°ÜÆ°¤ò¤¹¤ë¤È¡¢ + ¥«¡¼¥½¥ë¤¬¤º¤ì¤Á¤ã¤¦(12/1) + ²ò·è: x¤ÇÆüËܸì¤òºï½ü¤¹¤ë¤È¤Ê¤ó¤«¥Ø¥ó(12/8) + redraw¤¬Á´Á³¤µ¤ì¤Ê¤¤ + undo¤â¤¢¤«¤ó + cursesÌäÂê¡£ºï½ü¤·¤¿¤È¤­¤Îbyte compare¤¬ + ¤¦¤Þ¤¯¤¤¤Ã¤Æ¤Ê¤¤ + ºî¶È: c¥³¥Þ¥ó¥É¤Î½ñ¤­´¹¤¨ÈϰϤÎ"$"¤Î½èÍý + byte¿ô¤Èɽ¼¨Éý¤¬¤ª¤Ê¤¸¤¸¤ã¤Ê¤¯¤Æ¤âok + vi/v_txt.c + ²ò·è: c¥³¥Þ¥ó¥É¤Î½ñ¤­´¹¤¨ÈϰϤÎ"$"¤Î½èÍý¤ÎmultibyteÂбþ (12/7) +12/7 + ÅÓÃæ: c¥³¥Þ¥ó¥É¤Î½ñ¤­´¹¤¨ÈϰϤÎ"$"¤Î½èÍý + byte¿ô¤Èɽ¼¨Éý¤¬¤ª¤Ê¤¸¤¸¤ã¤Ê¤¤¤ÈÆ°¤«¤Ê¤¤ + vi/v_txt.c +12/1 + ÅÓÃæ: ÆþÎÏ¥³¥Þ¥ó¥É´ØÏ¢¤ÎmultibyteÂбþ + vi/v_itxt.c + ºî¶È: curses¤ÎEUC-JPÂбþ(¤È¤ê¤¢¤¨¤º¡¢²¾¤Ë) ÆâÍƤÏtokuÈǤÈƱÍÍ + ²ò·è: ´Á»ú¤Î2¥Ð¥¤¥È¤á¤òƧ¤à¤è¤¦¤Ê¥«¡¼¥½¥ë°ÜÆ°¤ò¤¹¤ë¤È¡¢ + ¥«¡¼¥½¥ë¤¬¤º¤ì¤Á¤ã¤¦(12/1) + curses/cr_put.c + curses/refresh.c + ºî¶È: vs_line()¤Î¸«Ä¾¤· + vi/vs_line.c + vi/vs_refresh.c + ²ò·è: ´Á»ú¤Î¾å¤ò±Û¤¨¤Æ~¤¹¤ë¤È¥«¡¼¥½¥ë¤¬¤º¤ì¤ë(11/29) + ²ò·è: ¾å²¼°ÜÆ°¤¬¤Á¤ç¤Ã¤È¥Ø¥ó¡£¤È¤­¤É¤­abort()¤¹¤ë(12/1) + ²ò·è: d¸å¤Îredraw(11/25) + ²ò·è: p¸å¤Îredraw¤Ç¥«¡¼¥½¥ë¤¬¤º¤ì¤ë(11/26) + ²ò·è: ¤Ò¤È¤â¤¸ºï½ü¸å¤Îredraw(11/25) +11/30 + ºî¶È: cs_next()/cs_prev()¤ÎmultibyteÈǤòÍÑ°Õ + vi/getc.c vi/vi.h + ºî¶È: (¥³¥Þ¥ó¥É¤È)¥³¥Þ¥ó¥É(multibyteʸ»ú¤Î¾å¤ÏÄ̤êÈ´¤±¤ë¤À¤±) + vi/v_sentence.c + ºî¶È: %¥³¥Þ¥ó¥É(multibyteʸ»ú¤Î¾å¤ÏÄ̤êÈ´¤±¤ë¤À¤±) + vi/v_match.c + ºî¶È: vs_colpos()¤Î½ñ¤­Ä¾¤· + vi/vs_relative.c +11/29 + ºî¶È: ~¥³¥Þ¥ó¥É(multibyteʸ»ú¤Î¾å¤ÏÄ̤êÈ´¤±¤ë¤À¤±) + vi/v_ulcase.c +11/26 + ÅÓÃæ: %¥³¥Þ¥ó¥É(ºî¶ÈÅÓÃæ¤Çvi/getc.c¤ÎÂçÉýÊѹ¹¤ÎɬÍפ˵¤¤Å¤­ÃÇÇ°) + vi/v_match.c + ºî¶È: p/P¥³¥Þ¥ó¥É + common/put.c +11/25 + ºî¶È: d¥³¥Þ¥ó¥É + vi/v_delete.c + ºî¶È: f¤È¤«t¤È¤«(multibyteʸ»ú¤Ï¸¡º÷¤Ç¤­¤Ê¤¤) + vi/v_ch.c + ºî¶È: vi¤Î¤Ò¤È¤â¤¸ºï½ü + vi/v_xchar.c + common/cut.c + common/delete.c + ºî¶È: vi¤Îredraw + vi/vs_refresh.c +11/24 + ºî¶È: vi¤Îredraw + vi/vs_refresh.c + ºî¶È: vi¤ÎÁêÂаÜÆ° + vi/vs_relative.c + ºî¶È: vi¤Îº¸±¦°ÜÆ° + vi/v_right.c + vi/v_left.c +11/23 + ºî¶È³«»Ï + + ºî¶È: ¥Þ¥ë¥Á¥Ð¥¤¥ÈȽÊÌ + common/multibyte.c + common/key.c + common/gs.h + ºî¶È: Makefile¤Èconfigure + build/Makefile + build/configure.in + ºî¶È: ex¤Î¹Ôɽ¼¨ + ex/ex_print.c + ºî¶È: vi¤Îº¸±¦°ÜÆ° + vi/v_right.c + vi/v_left.c + ºî¶È: vi¤Îredraw + vi/vs_refresh.c Index: docs.m17n/README.english =================================================================== RCS file: README.english diff -N README.english --- /dev/null Wed Oct 24 08:26:45 2001 +++ docs.m17n/README.english Wed Oct 24 10:33:41 2001 @@ -0,0 +1,865 @@ +multilingual patch for Keith Bostic's nvi +Jun-ichiro itojun Hagino +$Id: README.english,v 1.1 2001/10/23 04:33:25 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-jp-0213 G0=ascii, G1=JIS X0213-1, + G2=JIS X0201 kana, + G3=JIS X0213-2. + 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-jp-3 JIS X0213 document G0=ascii + SS2 used + *! 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 ascii/JIS X0208.1983 + * big5 + * euc-tw G0=ascii, G1=CNS11643-1, + G2=CNS11643-[2-7] + hz rfc1842 + + + euc-jp series feature: + nvi uses ASCII for G0 character set. This conforms to AT&T document + where EUC is defined. + You may notice that JIS X0201-left is specified for G0 character + set in JIS X0208.1997, and some of old IANA document, however, + they are incorrect. IANA charset registry document was corrected + in early 1998 to conform to AT&T document. + euc-cn feature: + We do not support G2 character set (row 8 of GB2312-80, with + thin glyphs) in euc-cn. + iso-2022-jp-3 feature: + Specification says that if there is JIS X0208.1983 designation, + that should be treated as JIS X0213-1 character iff the codepoint + is compatible across two character sets. + The implementation treats all JIS X0208.1983 designation as JIS + X0213-1 designation, without checking codepoint compatibility. + 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. + sjis feature: + JIS X0208.1997 specifies Shift JIS encoding a bit. The + specification says that JIS X0201-left should be used instead + of ASCII. It is not a happy choice for most of users, so we'll + use ASCII instead. + Also, JIS X0208.1983 is chosen for kanji character set. JIS + X0208.1997 uses JIS X0208.1990 instead. We may eventually change + this. + (But anyway, no sjis user is aware of JIS X0208 variants!) + + +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 + Private 94-0 ESC ( 0 no specific spec + Private 94-1 ESC ( 1 no specific spec + + 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 + Private 96-0 ESC , 0 no specific spec + Private 96-1 ESC , 1 no specific spec + + 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 + JIS X0213-1 ESC $ ( O + JIS X0213-2 ESC $ ( P + 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 ASCII will be displayed as G0(GL) chars (0x21-0x7e). + JIS X0208.1990/1983/1978 chars will be displayed + as G1(GR) chars (0x8181-0xfefe). + There's no way to distinguish between JIS X0208 + variants. It depends on your terminal how they + will be rendered. + NOTE: JIS X0201-left won't be treated in a special + manner. + euc-cn + euc-kr + euc-tw G0/G1 only (G0=ASCII, G1=CNS11643-1) + sjis ASCII will be displayed as G0(GL) chars (0x21-0x7e). + JIS X0208.1990/1983/1978 chars and JIS X0201 kana chars + are encoded by sjis convention, and displayed properly. + There's no way to distinguish between JIS X0208 + variants. It depends on your terminal how they + will be rendered. + NOTE: JIS X0201-left won't be treated in a special + manner. + 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. + + Single and locking shift sequences will be accepted if it is + allowed in the encoding type. For example, euc-* encoding + accepts SS2R and SS3R (0x8e and 0x8f) only. + 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. + + If you use nvi-m17n on some of the non iso-2022 capable terminals, + you'll see strange "B" character at the top-left of the screen on + startup. The character is the remains of "ESC ( B", which was not + properly handled by your terminal. nvi-m17n will generate the + sequence initializing G0(=GL) character set to ASCII. + If you are annoyed by the character, modify the following line + in curses/refresh.c (in function putdesig()). +default: static enum { NO, ASCII, CACHED } prevstate = NO; +modified: static enum { NO, ASCII, CACHED } prevstate = ASCII; + In this case, nvi-m17n will assume that the terminal has ASCII + character set as G0(=GL) character set on startup. (and this + assumption is incorrect in many cases) + + Cursor keys (i.e. escape sequence defined in termcap :ku: or :kd: + capability) may not be recognized correctly. The situation has + multiple reasons, it seems. The author rarely uses cursor keys. + so please fill him in with the steps needed to repeat the problem. + + When using Canna with nvi, Canna library API gives nvi an euc-jp + encoded stream when Japanese text is entered. Japanese letters in + the stream will be recognized as chars in JIS X0208.1983 character set. + Sometimes this may not be the natural behavior, for example when + you are manipulating iso-2022-jp-3 text (where JIS X0213-1 should + be used where JIS X0208 designation appears). + +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@foretune.co.jp + Please specify the version number of the patch you've tried. + +CONTACTING THE AUTHOR + + Jun-ichiro itojun Hagino (Jun-ichiro Itoh) + itojun@itojun.org + Contribution to the author, in any form (example: just say "thanks"), + is always appreciated. Index: docs.m17n/README.japanese =================================================================== RCS file: README.japanese diff -N README.japanese --- /dev/null Wed Oct 24 08:26:45 2001 +++ docs.m17n/README.japanese Wed Oct 24 10:33:42 2001 @@ -0,0 +1,800 @@ +multilingual patch for Keith Bostic's nvi +Jun-ichiro itojun Hagino +$Id: README.japanese,v 1.1 2001/10/23 04:33:25 itojun Exp $ + + + vi users of the world, unite! + + + ¤³¤Îʸ½ñ¤Ï¡¢±Ñ¸ìÈǤÎËÝÌõ¤Ç¤¹¡£±Ñ¸ìÈǤÎÊý¤¬¹¹¿·¤µ¤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç + ¼ÂºÝ¤È°Û¤Ê¤ëÅÀ¤¬¤¢¤Ã¤¿¤é±Ñ¸ìÈǤò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ + +¤³¤ì¤Ê¤¢¤Ë? + + ¤³¤Îpatchkit¤Ï¡¢nvi 1.79¤ËÂФ¹¤ë¿¹ñ¸ì²½¥Ñ¥Ã¥Á¤Ç¤¹¡£ + ¤³¤Î¥Ñ¥Ã¥Á¤Î¤³¤È¤ò"nvi-m17n"¤ÈÆɤó¤Ç¤¤¤Þ¤¹¡£"m17n"¤È¤Ï¡¢ + multilingualization¤Î¤³¤È(m + 17ʸ»ú + n)¤Ç¤¹¡£ + + nvi¤ÎºÇ¿·ÈǤϡ¢°Ê²¼¤«¤éÆÀ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹: + ftp://ftp.cs.berkeley.edu/ucb/4bsd/ + ¤³¤Î¥Ñ¥Ã¥±¡¼¥¸¤ÎºÇ¿·ÈǤϡ¢°Ê²¼¤«¤éÆÀ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹: + ftp://ftp.foretune.co.jp/pub/tools/nvi-m17n/ + + ÆüËܸ첽¥Ñ¥Ã¥Á¤«¤é¥¹¥¿¡¼¥È¤·¤¿¤Î¤Ç¡¢°ÊÁ°¤Ï"jnvi"¤È¸Æ¤ó¤Ç¤Þ¤·¤¿¡£ + ¤³¤Î¤¿¤á¡¢"jnvi"¤È¤¤¤¦µ­½Ò¤¬»Ä¤Ã¤Æ¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£ + "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. + +ɽµ­¤Ë¤Ä¤¤¤Æ + + ÌÀÇò¤Ê¾ì¹ç¡¢"¿¹ñ¸ì²½nvi"¤Î¤³¤È¤ò"nvi"¤Èɽµ­¤·¤Þ¤¹¡£ + ¶èÊ̤·¤¿¤¤¾ì¹ç¤Ë¤Ï"nvi-m17n"¤È¸Æ¤ó¤Ç¤¤¤Þ¤¹¡£ + +¤È¤ê¤¢¤¨¤º»È¤¤¤¿¤¤(¤¤¤é¤Á¤Ê¤Ò¤È¤Ë) + + ¤Þ¤º¡¢¤³¤Îpatch¤Ï¤â¤È¤Învi¤ÎÁ´¤Æ¤Îµ¡Ç½¤ò¿¹ñ¸ì²½¤·¤Æ¤ë¤ÈÊݾڤµ¤ì¤Æ¤ë + ¤ï¤±¤Ç¤Ï¤Ê¤¤¡¢¤È¤¤¤¦¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ + ¤¤¤¯¤Ä¤«¤Îµ¡Ç½¤Ï¤Þ¤À»È¤Ã¤Æ¤Ï¤¤¤±¤Ê¤¤¾ì¹ç¤¬¤¢¤ê¤Þ¤¹¡£ + "¿¹ñ¸ì²½ºÑ¤ß"¤È"¿¹ñ¸ì̤Âбþ"¤ÎÀá¤ò¸«¤ë¤È¤É¤Îµ¡Ç½¤¬ok¤Ç¤É¤Îµ¡Ç½¤¬ + ¤Þ¤À¤«¤ï¤«¤ê¤Þ¤¹¡£ + + 0. nvi¤Î¥Ñ¥Ã¥±¡¼¥¸¤Ëpatch¤ò¤¢¤Æ¤Þ¤¹¡£ + % cd nvi-1.79 + % patch -p1 < nvi-m17n.diff + 1. ¿¹ñ¸ì¥Ñ¥Ã¥Á¤ò³è¤«¤·¤Æconfigure¤·¤Þ¤¹¡£ + % cd build + % ./configure --enable-multibyte + nvi¤«¤éľÀÜcanna¤ò»È¤¤¤¿¤¤¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤Ëconfigure¤ò¸Æ¤Ó½Ð¤·¤Æ + ¤¯¤À¤µ¤¤¡£°Ê²¼¤ÎÎã¤À¤È¡¢/usr/local/canna¤Ëcanna¤Î¥é¥¤¥Ö¥é¥ê¤ä + ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ + % ./configure --enable-multibyte --enable-canna=/usr/local/canna + + 2. make¤·¤Æ¥¤¥ó¥¹¥È¡¼¥ë¤·¤Þ¤·¤ç¤¦¡£ + % make + % su + password: xxxx + # make install + + 3. X¤ò»È¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢Â¿¹ñ¸ìɽ¼¨¤Î¤¿¤á¤Ëkterm 6.2.0¤ò¥¤¥ó¥¹¥È¡¼¥ë + ¤¹¤ë¤³¤È¤ò¤ª¤¹¤¹¤á¤·¤Þ¤¹¡£kterm 6.2.0¤ÏX11R6 contrib¤Î¥ß¥é¡¼¤ò + ¤·¤Æ¤¤¤ëftp¥µ¡¼¥Ð¤«¤é»ý¤Ã¤Æ¤³¤ì¤Þ¤¹¡£¥Õ¥©¥ó¥È¤âÄɲ夥󥹥ȡ¼¥ë + ¤·¤Þ¤·¤ç¤¦¡£ + ñ¤ËÆüËܸ줬»È¤¤¤¿¤¤¤À¤±¤Ê¤é¸Å¤¤kterm¤Ç¤âÊ¿µ¤¤Ç¤¹¡£ + + 4. ÀßÄê¥Õ¥¡¥¤¥ë¤òÊÔ½¸¤·¤Þ¤·¤ç¤¦¡£(~/.exrc) + 4-a. iso-2022-*¤Îɽ¼¨ + iso-2022-*Âбþ¤ÎüËö¥½¥Õ¥È¤ò»È¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢°Ê²¼¤Î¹Ô¤ò + ­¤·¤Þ¤·¤ç¤¦(kterm¤Î¾ì¹ç¤³¤Ã¤Á¤Ç¤¹): + set noskipdisplay + ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢°Ê²¼¤Î¹Ô¤ò­¤·¤Þ¤·¤ç¤¦: + set skipdisplay + 4-b. ɽ¼¨¤Îencoding + Ê̤ÎÀá¤Ë¤¢¤ë¥ê¥¹¥È¤«¤é¡¢Ã¼Ëö¤Ø¤Îɽ¼¨¤Ë»È¤¦encoding¤òÁª¤Ó¡¢ + °Ê²¼¤Î¤è¤¦¤ËÀßÄꤷ¤Þ¤·¤ç¤¦: + set displayencoding=iso-2022-jp + set displayencoding=sjis + set displayencoding=euc-jp + set displayencoding=big5 + ¤¤¤¯¤Ä¤«¤Îencoding¤ò»ØÄꤷ¤¿¾ì¹ç¡¢Æ°ºî¤Ë¥¯¥»¤¬¤¢¤ê¤Þ¤¹¡£ + "¿¹ñ¸ìÂбþºÑ¤ß"¤ÎÀá¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ + 4-c. ¥­¡¼ÆþÎϤÎencoding + Ê̤ÎÀá¤Ë¤¢¤ë¥ê¥¹¥È¤«¤é¡¢¥­¡¼ÆþÎϤ˻Ȥ¦encoding¤òÁª¤Ó¡¢ + °Ê²¼¤Î¤è¤¦¤ËÀßÄꤷ¤Þ¤·¤ç¤¦: + set inputencoding=euc-jp + °ìÉô¤Îencoding¤Ï¥­¡¼ÆþÎϤˤϻȤ¨¤Þ¤»¤ó¤Î¤ÇÃí°Õ¤·¤Þ¤·¤ç¤¦¡£ + 4-d. ¥Õ¥¡¥¤¥ë¤Îencoding + ƱÍͤ˥ե¡¥¤¥ëÆþ½ÐÎϤ˻Ȥ¦encoding¤òÁª¤Ó¡¢°Ê²¼¤Î¤è¤¦¤Ë + ÀßÄꤷ¤Þ¤·¤ç¤¦: + set fileencoding=iso-2022-jp + ¤Þ¤¿¡¢¥Õ¥¡¥¤¥ë¥ª¡¼¥×¥ó/ÆþÎÏ»þ¤Ë¥Õ¥¡¥¤¥ë¤Îencoding¤ò¼«Æ°È½ÊÌ + ¤·¤¿¤±¤ì¤Ð¡¢°Ê²¼¤òÀßÄꤷ¤Þ¤·¤ç¤¦: + set autodetect=jp (euc-jp/sjis/iso-2022-jp¡¢¤òȽÄê) + set autodetect=cn (euc-cn/big5/hz/iso-2022-cn¡¢others¤òȽÄê) + set autodetect=tw (euc-tw/big5/hz/iso-2022-cn¡¢others¤òȽÄê) + set autodetect=kr (euc-kr/iso-2022-kr¡¢¤òȽÄê) + ¤Þ¤¿¡¢¥Õ¥¡¥¤¥ë¤Î¥ª¡¼¥×¥ó»þ¤Ë(:e/:n¥³¥Þ¥ó¥É¤Ç)¼«Æ°È½Äê·ë²Ì¤Ç + fileencoding¤ÎÃͤò¾å½ñ¤­¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£ + ¤³¤Î¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤ËÀßÄꤷ¤Þ¤¹¡£¤³¤¦¤¹¤ë¤³¤È¤Ç¡¢ + ¥Õ¥¡¥¤¥ë¤Îencoding¤¬¥Õ¥¡¥¤¥ëÊÔ½¸Á°¤ÈÊÔ½¸¸å¤Ç + ÊѤï¤é¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤¿¤È¤¨¤Ð: + set autodetect=jp+ + set autodetect=cn+ + + Ãæ¹ñ¸ì¤Î¼«Æ°È½Ê̤ò¤·¤¿¤¤¾ì¹ç(:set autodetect=cn)¡¢ + fileencoding¤ò"euc-cn"¤Þ¤¿¤Ï"big5"¤ËÀßÄꤹ¤ë¤³¤È¤ò¤ª´«¤á¤·¤Þ¤¹¡£ + euc-cn¤Èbig5¤ò¼«Æ°È½Ê̤¹¤ë¤Î¤Ï¤Û¤È¤ó¤ÉÉÔ²Äǽ¤Ê¤Î¤Ç¡¢ + ¼«Æ°È½Ê̤Ϥ¿¤¤¤Æ¤¤¼ºÇÔ¤·¤Þ¤¹¡£¼«Æ°È½Ê̤¬¼ºÇÔ¤·¤¿¾ì¹ç¡¢ + fileencoding¤ËÀßÄꤵ¤ì¤¿encoding¤¬»È¤ï¤ì¤Þ¤¹¡£ + ¤Î¤Ç¡¢big5¤ò¤è¤¯»È¤¦¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤·¤ç¤¦: + set autodetect=cn fileencoding=big5 + euc-cn¤ò¤è¤¯»È¤¦¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤·¤ç¤¦: + set autodetect=cn fileencoding=euc-cn + Ãæ¹ñ¸ì¤Î¼«Æ°È½Ê̤ò¤¹¤ë¾ì¹ç¡¢¤³¤ì°Ê³°¤ÎÀßÄê¤Ï¤ª´«¤á¤·¤Þ¤»¤ó¡£ + + ÂæÏѸì(?)¤Î¼«Æ°È½Ê̤ò¤·¤¿¤¤¾ì¹ç(:set autodetect=tw)¤â¡¢ + ¾åµ­¤Îµ­½Ò¤Ï¤¢¤Æ¤Ï¤Þ¤ê¤Þ¤¹¡£fileencoding¤Ï"euc-tw"¤«"big5"¤Î + ¤É¤Á¤é¤«¤ËÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£ + + 4-e. canna¥µ¥Ý¡¼¥È + canna¤Ë¤è¤ëÆüËܸìÆþÎϤò»È¤¤¤¿¤¤¾ì¹ç¡¢°Ê²¼¤Î¹Ô¤òÄɲä·¤Þ¤¹: + set canna + canna¤ÎÆþÎϥ⡼¥É(¥Õ¥§¥ó¥¹)¤Îon/off¤Î¼«Æ°À©¸æ¤ò»È¤¤¤¿¤¤¾ì¹ç¡¢ + °Ê²¼¤âÀßÄꤷ¤Æ¤¯¤À¤µ¤¤(¤¢¤È¡¢fepkey¤ò¹¥¤ß¤Ë¤¢¤ï¤»¤Æ¤¯¤À¤µ¤¤): + set cannactrl + canna¥µ¡¼¥Ð¤ò»ØÄꤹ¤ë¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤¹: + set cannaserver=somehost.your.domain + cannaÆþÎϥ⡼¥É¤ËÆþ¤ë¥­¡¼¤òÊѤ¨¤¿¤¤¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£ + ¤³¤ÎÀßÄê¤ò¤¹¤ë¤ÈÆþÎϥ⡼¥É¤ËÆþ¤ë¥­¡¼¤¬control-O¤Ë¤Ê¤ê¤Þ¤¹¡£ + ¥­¡¼¤Ï*¿µ½Å¤Ë*Áª¤ó¤Ç²¼¤µ¤¤!: + set cannakey=^O + + 5. ¤³¤Î¥Ñ¥Ã¥Á¤ò¤¢¤Æ¤¿¾ì¹ç¡¢¸¶ºînvi¤Î¥É¥­¥å¥á¥ó¥È¤Ë½Ò¤Ù¤é¤ì¤Æ¤¤¤ë + ÀâÌÀʸ¤Î°ìÉô¤ÏŬÍѤµ¤ì¤Ê¤¯¤Ê¤ë¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ + Î㤨¤Ð¡¢locale´ØÏ¢¤Î¤â¤Î(nvi-1.79/FAQ¤Î¤¤¤Á¤Ð¤óºÇ½é¤Î¼ÁÌä¡¢¤È¤«) + ¤Ïnvi-m17n¤Ë´Ø¤·¤ÆÀµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£ + + 6. ¤³¤ì¤Ç¤¢¤¬¤ê¤Ç¤¹¡£Enjoy! + + .exrc¤ÎÎãÂê¤ò¤¤¤¯¤Ä¤«: + + Îã1: iso-2022-*ɽ¼¨¤Î¤Ç¤­¤ëüËö¤ò»È¤Ã¤Æ¤¤¤Æ¡¢euc-jp¤òencoding¤È¤·¤Æ + »È¤¤¤Þ¤¹¡£ÆüËܸì¤Î¥Õ¥¡¥¤¥ëencoding¼«Æ°È½Ê̤ò»È¤¤¤Þ¤¹¡£ + set noskipdisplay + set displayencoding=euc-jp + set inputencoding=euc-jp + set fileencoding=euc-jp + set autodetect=jp + + Îã2: iso-2022-*ɽ¼¨¤Î¤Ç¤­¤ëüËö¤ò»È¤Ã¤Æ¤¤¤Æ¡¢iso-2022-jp¤òencoding + ¤È¤·¤Æ»È¤¤¤Þ¤¹¡£ÆüËܸì¤Î¥Õ¥¡¥¤¥ëencoding¼«Æ°È½Ê̤ò»È¤¤¤Þ¤¹¡£ + canna¤È¡¢¼«Æ°canna¥â¡¼¥ÉÀ©¸æ¤ò»È¤¤¤Þ¤¹¡£ + set noskipdisplay + set displayencoding=iso-2022-jp + set inputencoding=iso-2022-jp + set fileencoding=iso-2022-jp + set autodetect=jp + set canna cannactrl + + Îã2: iso-2022-*ɽ¼¨¤Î¤Ç¤­¤ëüËö¤ò»È¤Ã¤Æ¤¤¤Æ¡¢big5¤òencoding + ¤È¤·¤Æ»È¤¤¤Þ¤¹¡£Ãæ¹ñ¸ì¤Î¥Õ¥¡¥¤¥ëencoding¼«Æ°È½Ê̤ò»È¤¤¤Þ¤¹¡£ + set noskipdisplay + set displayencoding=big5 + set inputencoding=big5 + set fileencoding=big5 + set autodetect=cn + +encoding + + ¹Ôº¸Ã¼¤Î"*"°õ¤Ï¡¢¤³¤Îencoding¤ò¥­¡¼ÆþÎϤÎencoding¤Ë»È¤¨¤ë¤³¤È¤ò + ¼¨¤·¤Æ¤¤¤Þ¤¹¡£(:set inputencoding=xxx) + + ¹Ôº¸Ã¼¤Î"!"°õ¤Ï¡¢¤³¤Îencoding¤Î¼ÂÁõ¤Ï»ÅÍͤò´°Á´¤ËËþ¤¿¤·¤Æ¤¤¤Ê¤¤¤³¤È¤ò + ¼¨¤·¤Þ¤¹¡£É½¤Î¼¡¤Ë¤¢¤ëÃð¤òÆɤó¤Ç²¼¤µ¤¤¡£ + + encoding¤Î»ÅÍͤˤʤ¤Â¿¹ñ¸ì¤òencode¤¹¤ë¾ì¹ç¡¢iso-2022-*Ū¤Ê»Ø¼¨¤¬ + »È¤ï¤ì¤Þ¤¹¡£ + (Î㤨¤Ð¡¢iso-2022-krÃæ¤Îlatin-1¤È¤«¡¢iso-2022-cnÃæ¤Îcyrillic¤È¤«) + ñ°ì¸À¸ìencoding¤Î¾ì¹ç¡¢ÃΤé¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤Ïñ¤ËÈô¤Ð¤µ¤ì¤Þ¤¹¡£ + + encoding¤Î°·¤ï¤ìÊý¤Î¾ÜºÙ¤Ï"¿¹ñ¸ì²½ºÑ¤ß"¤ÎÀá¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ + + ¿¹ñ¸ìencoding: + 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¤ÎÊÌ̾ + * latin2 8bit iso-8859-2¤ÎÊÌ̾ + * iso-2022-cn-ext G0=ascii + rfc1922 SI, SO, SS2 and SS3 used + * iso-2022-cn rfc1922 iso-2022-cn-ext¤ÎÊÌ̾ + (»ÅÍͤ¬¸ß´¹) + * iso-2022-jp-2 rfc1554 G0=ascii + SS2 used + * iso-2022-jp rfc1468 iso-2022-jp-2¤ÎÊÌ̾ + (»ÅÍͤ¬¸ß´¹) + *! iso-2022-jp-3 JIS X0213 document G0=ascii + SS2 used + *! 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 ¥Æ¥¹¥ÈÍѤÎÈÆÍÑ7bit¡¢G0¤Î¤ß»ÈÍÑ + * iso-2022-7-2 ¥Æ¥¹¥ÈÍѤÎÈÆÍÑ7bit¡¢G0/1¤Î¤ß»ÈÍÑ + * iso-2022-8-2 ¥Æ¥¹¥ÈÍѤÎÈÆÍÑ8bit¡¢G0/1¤Î¤ß»ÈÍÑ + + ñ°ì¸À¸ìencoding: + name note charsets + --- --- --- + * none ¥Ñ¥Ã¥ÁÁ°¤Î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¤Î²ò¼á: + rfc1557¤Ë¤Ï½Ò¤Ù¤é¤ì¤Æ¤¤¤Þ¤»¤ó¤¬¡¢¼ÂºÝ¤Î±¿ÍѤǤÏKSC5601¤Î»Ø¼¨¤À¤±¤Î + ¹Ô¤¬¤¢¤ë¤È¡¢¤½¤Î¹Ô¤Ï¼Î¤Æ¤é¤ì¤Þ¤¹(¹ÔËöʸ»ú¤ò̵»ë)¡£ + nvi-m17n¤Ï¤³¤ÎµóÆ°¤ò¼ÂÁõ¤·¤Æ¤¤¤Þ¤¹¡£ + +ʸ»ú¥»¥Ã¥È + + nvi¤Ï¡¢°Ê²¼¤Ë¤¢¤²¤é¤ì¤Æ¤¤¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤Î»Ø¼¨¤òǧ¼±¤·¤Þ¤»¤ó¡£ + ¤¢¤ëʸ»ú¥»¥Ã¥È¤òǧ¼±¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤Û¤·¤¤¾ì¹ç¡¢ºî¼Ô¤Ë¥³¥ó¥¿¥¯¥È + ¤·¤Æ¤¯¤À¤µ¤¤¡£ + + 94ʸ»ú¥»¥Ã¥È: + name designation to G0 note + --- --- --- + IRV ESC ( @ + UK ESC ( A + ASCII ESC ( B hardcoded + Swedish ESC ( C + Norwegian ESC ( E + JIS X0201 right ESC ( I 1¥Ð¥¤¥È¥«¥¿¥«¥Ê + JIS X0201 left ESC ( J + German ESC ( K + French ESC ( R + Italian ESC ( Y + Spanish ESC ( Z + + 96ʸ»ú¥»¥Ã¥È: + 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ʸ»ú¥»¥Ã¥È: + name designation to G0 note + --- --- --- + JIS X0208.1976 ESC $ ( @ or ESC $ @ + GB2312 ESC $ ( A or ESC $ A + JIS X0208.1983 ESC $ ( B or ESC $ B + KSC5601 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 Èó¸ø¼°¡¢Mule¤ËÎà»÷ + Big5-2 ESC $ ( 1 Èó¸ø¼°¡¢Mule¤ËÎà»÷ + +Áý¤¨¤¿¥ª¥×¥·¥ç¥ó + + name type range description + --- --- --- --- + autodetect(ad) str - ¥Õ¥¡¥¤¥ëÆþÎÏencoding¼«Æ°È½ÊÌ + displayencoding(de) str global ɽ¼¨encoding + fepkey str - fence¤ò¼«Æ°À©¸æ¤¹¤ë¥³¥Þ¥ó¥É̾ + fileencoding(fe) str - ¥Õ¥¡¥¤¥ëÆþ½ÐÎÏencoding + inputencoding(ie) str - ¥­¡¼ÆþÎÏencoding + skipdisplay(sd) bool - ɽ¼¨¤Ç¤­¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ÏÈô¤Ð¤¹ + +cannaÍøÍÑ»þ¤ËÁý¤¨¤ë¥ª¥×¥·¥ç¥ó + + name type range description + --- --- --- --- + canna bool global canna¤ò»È¤¦/»È¤ï¤Ê¤¤ + cannactrl bool - fence¼«Æ°À©¸æ + cannakey str - cannaÆþÎϥ⡼¥É¤ËÆþ¤ë¥­¡¼ + cannaserver str global canna¥µ¡¼¥Ð + +configure¤ÎÀßÄê + + ¿¹ñ¸ì²½ + + configure¤¹¤ë¤È¤­¤Ë¡¢"--enable-multibyte"¤ò¤Ä¤±¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ + Ä̾ï¤Î¥¤¥ó¥¹¥È¡¼¥ë¼ê½ç¤Ï°Ê²¼¤ÎÄ̤ê: + % cd build + % ./configure --enable-multibyte + % make + configure¤Î¤È¤­¤Ëencoding¤Î¥Ç¥Õ¥©¥ë¥ÈÃͤò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹: + % ./configure --enable-multibyte=euc-kr + % ./configure --enable-multibyte=iso-2022-jp + % ./configure --enable-multibyte=euc-cn + encoding¤ò»ØÄꤷ¤Ê¤¤¤È¡¢"none"¤Ë¤Ê¤ê¤Þ¤¹¡£ + + canna + + canna¤Ë¤è¤ëÆüËܸìÆþÎϤò»È¤¦¾ì¹ç¡¢"--enable-canna"¤òconfigure¤Î + °ú¿ô¤Ë¤Ä¤±¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£"--enable-multibyte"¤¬É¬ÍפǤ¹¡£ + % cd build + % ./configure --enable-multibyte --enable-canna + + ¥Ø¥Ã¥À¤ä¥é¥¤¥Ö¥é¥ê¤Î¤¢¤ë¥Ç¥£¥ì¥¯¥È¥ê¤ò»ØÄꤹ¤ëɬÍפ¬¤¢¤ë¤«¤â + ¤·¤ì¤Þ¤»¤ó¡£ + --enable-canna¤Î¸å¤Ë¥Ç¥£¥ì¥¯¥È¥êSOMEWHERE¤ò»ØÄꤷ¤¿¾ì¹ç: + % ./configure --enable-multibyte --enable-canna=SOMEWHERE + °Ê²¼¤Ë¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤È¥é¥¤¥Ö¥é¥ê¥Õ¥¡¥¤¥ë¤¬¤¢¤ë¤³¤È¤ò°ÕÌ£¤·¤Þ¤¹: + SOMEWHERE/include/canna/jrkanji.h + SOMEWHERE/lib/libcanna.a + + Èó°ìÈÌŪ¤ÊÀßÄê¤ò¤·¤Æ¤¤¤Æ¡¢¥Ø¥Ã¥À¤È¥é¥¤¥Ö¥é¥ê¤Î¥Ñ¥¹Ì¾¤Îprefix¤¬ + °ã¤¦¾ì¹ç¡¢¥Ç¥£¥ì¥¯¥È¥ê¤ò¸ÄÊ̤˻ØÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ + Î㤨¤Ð°Ê²¼¤Î¤È¤³¤í¤Ë¥Õ¥¡¥¤¥ë¤¬¤¢¤ë¾ì¹ç: + SOMEWHERE/canna/jrkanji.h + ELSEWHERE/libcanna.a + °Ê²¼¤Î¤è¤¦¤Ëconfigure¤òµ¯Æ°¤·¤Þ¤¹: + % env CFLAGS=-ISOMEWHERE LDFLAGS=-LELSEWHERE \ + ./configure --enable-multibyte --enable-canna + + ¤¿¤¤¤Æ¤¤¤Î¾ì¹ç¡¢°Ê²¼¤ÎÀßÄê¤Ç¤¦¤Þ¤¯¤¤¤­¤Þ¤¹: + % ./configure --enable-multibyte --enable-canna=/usr/local/canna + +¿¹ñ¸ì²½ºÑ¤ß + + ¿¹ñ¸ìʸ»ú¤Î¾å¤Î°ÜÆ°/¿¹ñ¸ìʸ»ú¤ÎÆþÎÏ¡£ + + ¿¹ñ¸ì¤Îñ¸ì°ÜÆ°(ÆüËܸì/´Ú¹ñ¸ì¤Î¤ß) + + iso-2022-*¤ò¥µ¥Ý¡¼¥È¤¹¤ëüËö¤Î¤¿¤á¤Î¿¹ñ¸ìɽ¼¨¡£ + euc-jp/euc-cn/euc-kr/euc-tw/sjis/big5üËö¤Î¤¿¤á¤Î´ðËÜŪ¤Ê¥µ¥Ý¡¼¥È¤â + ¤·¤Æ¤Þ¤¹¡£ + ɽ¼¨¤Î¤¿¤á¤Îencoding¤Ï¤³¤ó¤ÊÉ÷¤ËÀßÄꤷ¤Ê¤¤¤È¤¤¤±¤Þ¤»¤ó: + :set displayencoding=foobaa + + ɽ¼¨¤Ë»È¤¨¤ëencoding¤Ï"encoding"¤ÎÀá¤ËÎóµó¤·¤Æ¤¢¤ê¤Þ¤¹¡£ + »ÄÇ°¤Ê¤¬¤é¡¢É½¼¨ÊýË¡¤Ïľ´ÑŪ¤Ç¤Ï¤Ê¤¤¤Î¤Ç¡¢°Ê²¼¤òÃí°Õ¿¼¤¯ + Æɤó¤Ç²¼¤µ¤¤¡£ + + ¿¹ñ¸ìʸ»ú¤Ï°Ê²¼¤ÎÊýË¡¤Çɽ¼¨¤µ¤ì¤Þ¤¹: + + 1. ¤½¤ÎencodingÍѤËÆÃÊ̤ÎÊýË¡¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤¿¤é¡¢¤½¤ì¤ò»È¤¤¤Þ¤¹¡£ + ¤³¤ì¤Ï¡¢8bit·Ï¤Îencoding¤Î¾ì¹ç¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ + name note + --- --- + euc-jp G0/G1¤Î¤ß + G0=ASCII, G1=JIS X0208-1983/1976 + euc-cn + euc-kr + euc-tw G0/G1¤Î¤ß (G0=ASCII, G1=CNS11643-1) + sjis X0208-1983/1976¤ÈJIS X0201¥«¥¿¥«¥Ê + big5 + + 2. ":set skipdisplay"¤ÎÀßÄê¤Î¾ì¹ç¡¢Â¿¹ñ¸ìʸ»ú¤Ï"?"¤«"??"¤È¤·¤Æ + ɽ¼¨¤µ¤ì¤Þ¤¹¡£ + + 3. ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢É½¼¨ÂоݤÎʸ»ú¥»¥Ã¥È¤òiso-2022-*¤Î¥¨¥¹¥±¡¼¥× + ¥·¡¼¥±¥ó¥¹¤ò»È¤Ã¤ÆG0¤Ë»Ø¼¨¤·¤Æɽ¼¨¤·¤Þ¤¹¡£ + Î㤨¤Ð¡¢JIS X0208-1983¤Î¾ì¹ç"ESC $ B"¡¢latin-1¤Î¾ì¹ç"ESC , A" + G0¤À¤±¤ò»È¤¦¤Î¤Ïñ½ã²½¤Î¤¿¤á¤Ç¤¹¡£¤³¤ì¤Ïnvi¤Îencoding¤Î + "iso-2022-7-1"¤Ë»÷¤Æ¤¤¤Þ¤¹¡£ + + ¿¹ñ¸ìɽ¼¨¤Î¤¿¤á¤Ë¤Ï(¾åµ­¤Î3.¤Î¾ì¹ç)iso-2022-*´°Á´Âбþ¤ÎüËö¤Î + ÍøÍѤò¤ª´«¤á¤·¤Þ¤¹¡£Î㤨¤Ð¡¢kterm-6.2.0¤ò»î¤¹¤È¤è¤¤¤Ç¤·¤ç¤¦¡£ + X11R6 contrib¤Î¤¢¤ëftp¥µ¡¼¥Ð¤Ë¤Ï¤¿¤¤¤Æ¤¤ÃÖ¤¤¤Æ¤¢¤ê¤Þ¤¹¡£ + + curses¤Î¿¹ñ¸ì²½¤Ë¤Ä¤¤¤Æ¾ÜºÙ¤¬ÃΤꤿ¤±¤ì¤Ð¡¢curses/README.m17n¤ò + ¸«¤Æ²¼¤µ¤¤ + + :set displayencoding=xxx¤È¤¤¤¦ÀßÄê¤ÏnviÁ´ÂΤˤĤ¤¤Æ¤ÎÀßÄê¤Ê¤Î¤Ç¡¢ + Á´¤Æ¤Î¥µ¥Ö²èÌ̤ËÂФ·¤Æ¸ú¤­¤Þ¤¹¡£:set skipdisplay¤Ï¥µ¥Ö²èÌ̤´¤È¤Ë + ÀßÄê¤Ç¤­¤Þ¤¹¡£ + + ¥Õ¥¡¥¤¥ëÆþ½ÐÎÏencoding¤ÏÀÚÂؤ¨²Äǽ¤Ç¤¹¡£ + »È¤¨¤ëencoding¤Ï"encoding"¤ÎÀá¤ËÎóµó¤·¤Æ¤¢¤ê¤Þ¤¹¡£ + + ¤Û¤È¤ó¤É¤Î¿¹ñ¸ìencoding¤ÏÈÆÍÑiso-2022-*²òÀÏ´ï/À¸À®´ï¤Ç + ¼è¤ê°·¤ï¤ì¤Æ¤¤¤Þ¤¹¡£ + °ìÉô¤Îencoding¤Î»ÅÍͤϡ¢°ìÉô¤Îʸ»ú¥»¥Ã¥È¤ò¤É¤¦»Ø¼¨¤¹¤ë¤« + µ¬Äꤷ¤Æ¤¤¤Ê¤¤¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£Î㤨¤Ð¡¢iso-2022-jp2(RFC1544) + ¤Ç¤ÏÁ´¤Æ¤Îʸ»ú¥»¥Ã¥È¤Ë¤Ä¤¤¤Æ¤É¤¦»Ø¼¨¤¹¤ë¤«¤òµ¬Äꤷ¤Æ¤¤¤Þ¤¹¤¬¡¢ + iso-2022-kr(RFC1557)¤Ç¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ + ¤³¤Î¤è¤¦¤Ê¾ì¹ç¤Ë¤Ï¡¢nvi¤Ïiso-2022-*¤Î¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤ò + ²ò¼á/À¸À®¤·¤Þ¤¹¡£ + Îã: + ":set fileencoding=latin1"¤È»ØÄꤷ¤Æ¤¤¤ë¤È¤­¤ËJIS X0208-1983¤ò + »È¤Ã¤¿¾ì¹ç¡¢nvi¤Ï"ESC $ B ¤Û¤²¤Û¤² ESC ( B"¤ò½ÐÎϤ·¤Þ¤¹¡£ + ¤³¤ì¤ÏJIS X0208-1983¤ò»ØÄꤹ¤ëÊýË¡¤È¤·¤ÆÀµÅö¤Ç¤¹¡£ + + ñ°ì¸À¸ìencoding(ÆäËsjis¤Èhz)¤Ï¥×¥í¥°¥é¥à¥³¡¼¥É¤È¤·¤ÆÆ°ºî¤¬ + ·è¤áÂǤÁ¤µ¤ì¤Æ¤¤¤Æ¡¢ÃΤé¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ÏÁ´¤ÆÈô¤Ð¤¹¤è¤¦¤Ë + ¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£ + + :set fileencoding=xxx¤Ï¥Õ¥£¥ë¥¿·Ï¤Î¥³¥Þ¥ó¥É(vi¤Î!¥³¥Þ¥ó¥É)¡¢ + ¥Õ¥¡¥¤¥ë¤Î¥ª¡¼¥×¥ó/ÆþÎÏ/½ÐÎÏ(:r¡¢:w¡¢:e¤ä:n)¡¢¤ª¤è¤Óshell¤È¤Î + Æþ½ÐÎÏ(:script)¤Ë±Æ¶Á¤·¤Þ¤¹¡£ + + ¥Õ¥¡¥¤¥ë¥ª¡¼¥×¥ó/ÆþÎÏ»þ¤Îencoding¼«Æ°È½ÊÌ¡£ + °ìÉô¤Îencoding¤òɬÍפʤȤ­¤Ë¼«Æ°È½Ê̤Ǥ­¤Þ¤¹¡£ + 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) + ¾¤ÎÃͤòÀßÄꤹ¤ë¤È¡¢¼«Æ°È½Ê̤ÏƯ¤­¤Þ¤»¤ó¡£ + + ¥Õ¥¡¥¤¥ëÊÔ½¸³«»Ï»þ(:n¤È¤«:e¤È¤«)¤Þ¤¿¤Ï¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß»þ(:r)¤Ë¡¢ + ¥Õ¥¡¥¤¥ë¤ÎÆâÍƤϥǡ¼¥¿¥Ù¡¼¥¹¤ËÆɤ߹þ¤Þ¤ì¡¢¤½¤Î¤¢¤È¼«Æ°È½Ê̤Π+ ¤¿¤á¤Î¥×¥í¥°¥é¥à¥³¡¼¥É¤¬¸Æ¤Ð¤ì¤Þ¤¹¡£¼«Æ°È½Ê̤Τ¿¤á¤Î¥³¡¼¥É¤Ï + encoding¤òȽÊ̤·¡¢¤½¤ì¤Ë½¾¤¤¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÆâÍƤòŬÀÚ¤ÊÊýË¡¤Ç + ÆâÉôɽ¸½¤ËÊÑ´¹¤·¤Þ¤¹¡£ + ¼«Æ°È½Ê̤¬À®¸ù¤·¤Ê¤«¤Ã¤¿¾ì¹ç¡¢fileencoding¤Ë»ØÄꤵ¤ì¤Æ¤¤¤ëÃͤ¬ + ¥Ç¥Õ¥©¥ë¥ÈÃͤȤ·¤Æ»È¤ï¤ì¤Þ¤¹¡£ + + ¤Þ¤¿¡¢¥Õ¥¡¥¤¥ë¤Î¥ª¡¼¥×¥ó»þ¤Ë(:e/:n¥³¥Þ¥ó¥É¤Ç)¼«Æ°È½Äê·ë²Ì¤Ç + fileencoding¤ÎÃͤò¾å½ñ¤­¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£ + ¤³¤¦¤¹¤ë¤³¤È¤Ç¡¢¥Õ¥¡¥¤¥ë¤Îencoding¤¬¥Õ¥¡¥¤¥ëÊÔ½¸Á°¤ÈÊÔ½¸¸å¤Ç + ÊѤï¤é¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ + ¤³¤Î¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤ËËöÈø¤Ë"+"¤ò²Ã¤¨¤ÆÀßÄꤷ¤Þ¤¹: + set autodetect=jp+ + set autodetect=cn+ + ¤³¤ÎÀßÄê¤ò»È¤¦¤È¡¢vi¥³¥Þ¥ó¥É¤Îcontrol-G¤Çfileencoding¤ÎÃͤ¬ + ɽ¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£ + + Â礭¤Ê¥Õ¥¡¥¤¥ë¤ò°·¤¦¤È¡¢¼«Æ°È½Ê̤˻þ´Ö¤¬¤«¤«¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£ + ¼«Æ°È½ÊÌ¥³¡¼¥É¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¤ËÆɤ߹þ¤Þ¤ì¤¿¥Õ¥¡¥¤¥ë¤ò¡¢¼«Æ°È½Ê̤¬ + ½ª¤ë¤Þ¤ÇÄ´¤Ù¤Ë¤¤¤¯¤«¤é¤Ç¤¹(¤Ä¤Þ¤ê¡¢Á´¹ÔÄ´¤Ù¤Á¤ã¤¦¾ì¹ç¤¬¤¢¤ë)¡£ + (ºÇÂç¹Ô¿ô¤Ïcommon/multibyte.c¤ÎÃæ¤ÎPREDICT_MAXLINES¤ÎÀßÄê¤òÊѤ¨¤ë¤È + Êѹ¹¤Ç¤­¤Þ¤¹) + ¼«Æ°È½Ê̤¬ÉÔ²Äǽ¤Ê¾ì¹ç¤È¤¤¤¦¤Î¤â¤¢¤ê¤Þ¤¹¡£Æä˥ե¡¥¤¥ë¤¬Ã»¤¤ + ¾ì¹ç¤Ï̵Íý¤Ê¾ì¹ç¤¬¤¢¤ê¤Þ¤¹¡£ + ¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¾ì¹ç¡¢¼«Æ°È½ÊÌ¤Ï + ¤­¤Ã¤È¤¦¤Þ¤¯¤¤¤­¤Þ¤»¤ó¡£Ãí°Õ¤·¤Æ²¼¤µ¤¤¡£ + + :set autodetect=xxx¤Ï¥Õ¥¡¥¤¥ë¤Î¥ª¡¼¥×¥ó/ÆþÎϤˤÀ¤±±Æ¶Á¤·¤Þ¤¹ + (:r¡¢:e¤È:n)¡£ + + Ãæ¹ñ¸ì¤Î¼«Æ°È½Ê̤ò¤·¤¿¤¤¾ì¹ç(:set autodetect=cn)¡¢ + fileencoding¤ò"euc-cn"¤Þ¤¿¤Ï"big5"¤ËÀßÄꤹ¤ë¤³¤È¤ò¤ª´«¤á¤·¤Þ¤¹¡£ + euc-cn¤Èbig5¤ò¼«Æ°È½Ê̤¹¤ë¤Î¤Ï¤Û¤È¤ó¤ÉÉÔ²Äǽ¤Ê¤Î¤Ç¡¢ + ¼«Æ°È½Ê̤Ϥ¿¤¤¤Æ¤¤¼ºÇÔ¤·¤Þ¤¹¡£¼«Æ°È½Ê̤¬¼ºÇÔ¤·¤¿¾ì¹ç¡¢ + fileencoding¤ËÀßÄꤵ¤ì¤¿encoding¤¬»È¤ï¤ì¤Þ¤¹¡£ + ¤Î¤Ç¡¢big5¤ò¤è¤¯»È¤¦¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤·¤ç¤¦: + set autodetect=cn fileencoding=big5 + euc-cn¤ò¤è¤¯»È¤¦¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤·¤ç¤¦: + set autodetect=cn fileencoding=euc-cn + Ãæ¹ñ¸ì¤Î¼«Æ°È½Ê̤ò¤¹¤ë¾ì¹ç¡¢¤³¤ì°Ê³°¤ÎÀßÄê¤Ï¤ª´«¤á¤·¤Þ¤»¤ó¡£ + + ÂæÏѸì(?)¤Î¼«Æ°È½Ê̤ò¤·¤¿¤¤¾ì¹ç(:set autodetect=tw)¤â¡¢ + ¾åµ­¤Îµ­½Ò¤Ï¤¢¤Æ¤Ï¤Þ¤ê¤Þ¤¹¡£fileencoding¤Ï"euc-tw"¤«"big5"¤Î + ¤É¤Á¤é¤«¤ËÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£ + + ¿¹ñ¸ì¥­¡¼ÆþÎÏ¡£ + ¥­¡¼ÆþÎÏencoding¤ò»ØÄꤹ¤ë¤Ë¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤¹: + :set inputencoding=euc-jp + :set inputencoding=iso-2022-jp + euc-jp/kr/cn¤Èiso-2022-*¤ò»ØÄꤷ¤¿¾ì¹ç¡¢ÈÆÍÑiso-2022-*²òÀϴ郎 + »È¤ï¤ì¤Þ¤¹¡£¤³¤Î¤¿¤á¡¢¤³¤ì¤é¤Î¾ì¹ç´°Á´Â¿¹ñ¸ì¥­¡¼ÆþÎϤ¬ + ²Äǽ¤Ç¤¹¡£ + + ¼õ¤±ÉÕ¤±²Äǽ¤Êsingle shift¤Èlocking shift¤Î¼ïÎà¤Ï¡¢encoding¤Ë + ²¿¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤«¤Ç·è¤Þ¤ê¤Þ¤¹¡£Î㤨¤Ð¡¢euc-*¤ò»ØÄꤷ¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢ + SS2R¤ÈSS3R(0x8e¤È0x8f)¤·¤«²ò¼á¤µ¤ì¤Þ¤»¤ó¡£ + iso-2022-*·Ï¤Îencoding¤ò¥­¡¼ÆþÎϤ˻Ȥ¦¾ì¹ç¡¢Ê¸»ú¥³¡¼¥É»ØÄê¤Î + ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤ÈESC¥­¡¼¤È¤Î¶èÊ̤¬Æñ¤·¤¯¤Ê¤ê¤Þ¤¹¡£ + ¤³¤ì¤é¤Ï¥¿¥¤¥à¥¢¥¦¥È¤ò»È¤Ã¤ÆȽÊ̤µ¤ì¤Þ¤¹¡£Èó¾ï¤ËÃÙ¤¤²óÀþ±Û¤·¤Ë + nvi¤ò»È¤¦¾ì¹ç¡¢ÌäÂ꤬À¸¤¸¤ë¾ì¹ç¤¬¤¢¤êÆÀ¤Þ¤¹¡£ + + ¿¹ñ¸ì¤ÎÀµµ¬É½¸½¸¡º÷¤¬²Äǽ¤Ç¤¹¡£ + À©Ìó»ö¹à¤Ë¤Ä¤¤¤Æ¤Ïregex/README.m17n»²¾È¡£ + + canna¤Ë¤è¤ëÆüËܸìÆþÎϤò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£ + "canna"¤Ï¥¯¥é¥¤¥¢¥ó¥È¥µ¡¼¥Ð·Á¼°¤ÎÆüËܸìÊÑ´¹¥·¥¹¥Æ¥à¤Ç¤¹¡£ + canna¤ò»È¤¦¾ì¹ç¤ËÄɲ䵤ì¤ë¥ª¥×¥·¥ç¥ó¤Î¥ê¥¹¥È¤ÏÊ̤ÎÀá¤Ë + µó¤²¤Æ¤¢¤ê¤Þ¤¹¡£ + canna¤Î¥µ¥Ý¡¼¥È¤Ïvi¥â¡¼¥É¤Î¾ì¹ç¤Î¤ß¤Ç¤¹¡£ex¥â¡¼¥É¤Ç¤Ï¡¢ + canna¤Ë¤è¤ëÆüËܸìÆþÎϤϤǤ­¤Þ¤»¤ó¡£ + + canna¤òÍøÍѤ¹¤ë¾ì¹ç¡¢°Ê²¼¤ò¹Ô¤¤¤Þ¤¹: + :set canna + ¤³¤¦¤¹¤ë¤Ènvi¤Ïcanna¥µ¡¼¥Ð¤ÈÀܳ¤·¤Þ¤¹¡£canna¥µ¡¼¥Ð¤È¤ÎÀܳ¤ò + ÀÚ¤ë¤Ë¤Ï¤³¤¦¤·¤Þ¤¹: + :set nocanna + + cannaÆþÎϥ⡼¥É¤ËÆþ¤Ã¤¿¤êÈ´¤±¤¿¤ê¤¹¤ë¤Ë¤Ï¡¢control-O¤òÂǤÁ¤Þ¤¹¡£ + ¤³¤Î¥­¡¼¥¹¥È¥í¡¼¥¯(control-O)¤Ïcannakey¥ª¥×¥·¥ç¥ó¤Ç·è¤á¤é¤ì¤Æ + ¤¤¤Þ¤¹¡£ + cannakey¥ª¥×¥·¥ç¥ó¤òÊѤ¨¤ë¤È¥­¡¼¥¹¥È¥í¡¼¥¯¤òÊѤ¨¤é¤ì¤Þ¤¹¡£ + Î㤨¤Ð¡¢control-X¤ÇcannaÆþÎϥ⡼¥É¤ÎÀÚÂؤ¨¤ò¤¹¤ë¾ì¹ç¤Ï¤³¤ó¤Ê + ¤«¤ó¤¸: + :set cannakey=^X (colon¥â¡¼¥É¤ÇÆþÎϤ¹¤ë¤Ë¤Ï^V^X) + cannakey¤ÎÀßÄê¤Ë¤Ï*ºÙ¿´¤ÎÃí°Õ¤òʧ¤Ã¤Æ²¼¤µ¤¤*¡£¤³¤³¤ÇÁªÂò¤µ¤ì¤¿ + ¥­¡¼¥¹¥È¥í¡¼¥¯¤ÏÁ´¤Æ¤ËÍ¥À褷¡¢¤³¤Î¥­¡¼¥¹¥È¥í¡¼¥¯¤Ïcanna + ¥ª¥×¥·¥ç¥ó¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë´Ö¡¢ÆóÅÙ¤Ènvi¼«ÂΤËÅϤé¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£ + + vi¥³¥Þ¥ó¥É¥â¡¼¥É¤Çcanna¤Îfence¤¬¤Ç¤Æ¤¤¤ë¤Î¤¬¼ÙËâ¤Ë¤Ê¤ë¤³¤È¤¬ + ¤¢¤ê¤Þ¤»¤ó¤«? nvi¤ÏcannaÆþÎϥ⡼¥É¤ò¼«Æ°À©¸æ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ + ¤³¤Îµ¡Ç½¤ò»È¤¦¤Ë¤Ï°Ê²¼¤Î¥³¥Þ¥ó¥É¤òÆþÎϤ·¤Þ¤¹: + :set cannactrl + ¤³¤Î¥ª¥×¥·¥ç¥ó¤òÀßÄꤷ¤¿¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹: + - (ÆÃÄê¤Î¥³¥Þ¥ó¥É¤Ë¤Ä¤¤¤Æ)¥Æ¥­¥¹¥ÈÆþÎϤò½ª¤ë¤È¡¢canna¤Îfence¤¬ + ¼«Æ°Åª¤Ëoff¤Ë¤Ê¤ê¤Þ¤¹¡£ + - (ÆÃÄê¤Î¥³¥Þ¥ó¥É¤Ë¤Ä¤¤¤Æ)¥Æ¥­¥¹¥ÈÆþÎϤξìÌ̤ˤʤë¤È¡¢canna¤Î + fence¤¬¼«Æ°Åª¤Ëon¤Ë¤Ê¤ê¤Þ¤¹¡£ + - (Á´¤Æ¤Î¥³¥Þ¥ó¥É¤Ë¤Ä¤¤¤Æ)vi¥³¥Þ¥ó¥É¥â¡¼¥É¤ËÌá¤ë¤È¡¢canna¤Î + fence¤¬¼«Æ°Åª¤Ëoff¤Ë¤Ê¤ê¤Þ¤¹¡£ + ¡ÖÆÃÄê¤Î¥³¥Þ¥ó¥É¡×¤Ï¡¢fepkey¥ª¥×¥·¥ç¥ó¤òÀßÄꤹ¤ë¤³¤È¤Ç + »ØÄê¤Ç¤­¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï"/?aioAIO"¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡£ + ¤Ê¤ó¤Ç¤â»ØÄꤷ¤¿¤¤¾ì¹ç¡¢¤³¤ó¤Ê¤³¤È¤â¤Ç¤­¤Þ¤¹: + :set fepkey=?/aioAIOcCrRtfTF + ¤³¤ÎÀßÄê¤Ï¤Á¤ã¤ó¤ÈÆ°¤­¤Þ¤¹¡£±³¤¸¤ã¤Ê¤¤¤è¡£ + + canna¥µ¡¼¥Ð¤òÀÚÂؤ¨¤ë¾ì¹ç¡¢°Ê²¼¤ò¼Â¹Ô¤·¤Þ¤¹: + :set cannaserver=hostname.your.domain + + canna¥µ¥Ý¡¼¥È¤Ë¤Ï¤¤¤¯¤Ä¤«Ä¾´ÑŪ¤Ç¤Ê¤¤¤È¤³¤í¤¬¤¢¤ê¤Þ¤¹¡£ + "¤Ò¤Í¤¯¤ì¤Æ¤¤¤ë¤È¤³¤í"¤ÎÀá¤ò¤ß¤Æ¤¯¤À¤µ¤¤¡£ + +nvi-m17nÆÃÍ­¤Î¤Ç¥ª¥×¥·¥ç¥ó¤òÀßÄꤹ¤ë + + °Ê¾å¤Ç½Ò¤Ù¤¿¤è¤¦¤Ë¡¢nvi-m17n¤Ç¤Ïnvi¤ËÂФ·¤¤¤¯¤Ä¤«¥ª¥×¥·¥ç¥ó¤ò + Äɲ䷤Ƥ¤¤Þ¤¹¡£¤·¤«¤·¡¢¤¤¤¯¤Ä¤«¤Î¾ì¹ç¡¢.exrc¤Ë½ñ¤¤¤¿¥ª¥×¥·¥ç¥ó + ÀßÄê¤Çº¤¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹: + 1. nvi-m17n¤Ènvi(¤Þ¤¿¤Ï¾¤Î¥¯¥í¡¼¥óvi)¤òξÊý»È¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢nvi¤ä¾¤Î + vi¥¯¥í¡¼¥ó¤Ïnvi-m17n¤¬³ÈÄ¥¤·¤¿¥ª¥×¥·¥ç¥ó¤ò²ò¼á¤·¤Æ¤¯¤ì¤Ê¤¤¾ì¹ç¤¬ + ¤¢¤ê¤Þ¤¹¡£¤³¤Î¾ì¹ç¡¢µ¯Æ°»þ¤Ë¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤¬¤Ç¤¿¤ê¡¢ + ¾¤Îvi¤¬µ¯Æ°¤·¤Ê¤«¤Ã¤¿¤ê¤·¤Þ¤¹¡£ + 2. Ê£¿ô¤ÎÀßÄê¤òÉÑÈˤËÀÚÂؤ¨¤Æ»È¤¦¾ì¹ç¡¢´Êñ¤ËÀÚÂؤ¨¤é¤ì¤ë¤ÈÁÇŨ¤Ç¤¹¡£ + + 1.¤Î¾ì¹ç¡¢3¤Ä¤Îƨ¤²Êý¤¬¤¢¤ê¤Þ¤¹: + - ¾¤Îvi(¥¯¥í¡¼¥ó)¤Ènvi¤Î´Ö¤Î¥ª¥×¥·¥ç¥óÀßÄê¤ò»È¤¤Ê¬¤±¤ë¤¿¤á¤Ë¡¢ + .exrc¤Î¤«¤ï¤ê¤Ë.nexrc¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ + .nexrc¤Ï¥ª¥ê¥¸¥Ê¥ë¤Învi¤ÇƳÆþ¤µ¤ì¤¿¤â¤Î¤Ê¤Î¤Ç¡¢¥ª¥ê¥¸¥Ê¥ë¤Învi¤È + nvi-m17n¤Î´Ö¤Ç¥ª¥×¥·¥ç¥óÀßÄê¤ò¶èÊ̤¹¤ë¤¿¤á¤Ë¤Ï»È¤¨¤Þ¤»¤ó¡£ + - ƱÍͤˡ¢´Ä¶­ÊÑ¿ôNEXINIT¤â»È¤¨¤Þ¤¹¡£¤³¤ì¤ÏEXINIT¤ÈƱÍÍ¤Ë + Ư¤­¤Þ¤¹¤¬¡¢¥ª¥ê¥¸¥Ê¥ë¤Învi¤Ènvi-m17n¤Ç¤·¤«»È¤ï¤ì¤Þ¤»¤ó¡£ + - wrapper¥¹¥¯¥ê¥×¥È¤ò»È¤¤¤Þ¤¹¡£°Ê²¼»²¾È¡£ + 2.¤Î¾ì¹ç¡¢wrapper¥¹¥¯¥ê¥×¥È¤¬ÊØÍø¤Ç¤·¤ç¤¦¡£ + + wrapper¥¹¥¯¥ê¥×¥È + °Ê²¼¤Î¤è¤¦¤Êwrapper¥¹¥¯¥ê¥×¥È¤ò»È¤¦¤È¡¢nvi-m17n¤ËÆÃÄê¤Î¥ª¥×¥·¥ç¥ó¤ò + ÅϤ¹¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤³¤ì¤ò»È¤¦¤È¡¢.exrc¤ËÈó°ìÈÌŪ¤Ê¥ª¥×¥·¥ç¥ó¤ò + ´Þ¤á¤º¤ËºÑ¤ß¤Þ¤¹: + +--->8 ÆüËܸì¤òÊÔ½¸¤¹¤ë¾ì¹ç¤ÎÎã(¤¿¤È¤¨¤Ð"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 + +Äɲåġ¼¥ë + + nvi-m17n¤Ç¤Ï"regular"¤È¤¤¤¦¥¹¥¯¥ê¥×¥È¤¬Äɲ䵤ì¤Æ¤¤¤Þ¤¹¡£ + + regular [-options] + + °ìÉô¤Îʸ½ñ¤Ë¤Ï¡¢ASCII¤Çɽ¸½¤Ç¤­¤ëʸ»ú¤ËÂФ·¤Æ;ʬ¤Êʸ»ú¥»¥Ã¥È¤Î + »Ø¼¨¤¬¤Ä¤±¤é¤ì¤Æ¤¤¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢UKʸ»ú¥»¥Ã¥È¤Î"a"¤È¤« + JIS X0201º¸Â¦(JIS roman)ʸ»ú¥»¥Ã¥È¤Î"a"¤È¤«¤¬¤½¤¦¤Ç¤¹¡£ + ¤³¤Î¤è¤¦¤Ê»Ø¼¨¤Ï´Ö°ã¤Ã¤Æ¤Ï¤¤¤Ê¤¤¤Î¤Ç¤¹¤¬¡¢¤¿¤Þ¤Ënvi-m17n¤Î + ¥æ¡¼¥¶¤ò¤¤¤é¤Ä¤«¤»¤ë¸¶°ø¤Ë¤Ê¤ê¤Þ¤¹¡£¤Ê¤¼¤Ê¤é¡¢ASCII¤Î"a"°Ê³°¤ò + ¥­¡¼¥Ü¡¼¥É¤«¤éÆþÎϤ¹¤ë¤Î¤Ï·ë¹½Æñ¤·¤«¤Ã¤¿¤êÉÔ²Äǽ¤À¤Ã¤¿¤ê¤¹¤ë¤«¤é¤Ç¤¹¡£ + Regular¤Ï¡¢¤³¤Î¤è¤¦¤Êʸ»ú¤òÁ´ÉôASCII¤Î"a"¤ËÊÑ´¹¤·¤Þ¤¹¡£ + + Regular¤Ë¤Ï¤¤¤¯¤Ä¤«¤Î¥ª¥×¥·¥ç¥ó¤¬¤¢¤ê¤Þ¤¹¡£ + -7 + ½ÐÎϤò¡¢nvi¤Îencoding¤Ç¤¤¤¦¤Èiso-2022-7-1¤Ë¤·¤Þ¤¹¡£ + Á´¤Æ¤Îʸ»ú¥»¥Ã¥È¤ÏG0¤Ë¸Æ¤Ó½Ð¤µ¤ì¤Þ¤¹¡£ + 1ocking shift¤äsingle shift¤Ï»È¤ï¤ì¤Þ¤»¤ó¡£ + ¥ª¥×¥·¥ç¥ó¤ò¤Ê¤Ë¤â»ØÄꤷ¤Ê¤«¤Ã¤¿¾ì¹ç¡¢¤³¤ÎÆ°ºî¤ò + ¤·¤Þ¤¹¡£ + -8 + ½ÐÎϤò¡¢nvi¤Îencoding¤Ç¤¤¤¦¤Èiso-2022-8-2¤Ë¤·¤Þ¤¹¡£ + 94/94x94ʸ»ú¥»¥Ã¥È¤ÏG0¤Ë¡¢96/96x96ʸ»ú¥»¥Ã¥È¤ÏG1¤Ë + ¸Æ¤Ó½Ð¤µ¤ì¤Þ¤¹¡£locking shift¤äsingle shift¤Ï + »È¤ï¤ì¤Þ¤»¤ó¡£ + -kr + ÆþÎϤ¬iso-2022-kr¤È²¾Äꤷ¤Þ¤¹¡£ + ¤¹¤Ê¤ï¤Á¡¢G0/G1/¤½¤Î¾¤Ë¸Æ¤Ó½Ð¤µ¤ì¤¿Ê¸»ú¥»¥Ã¥È¤Ï + ¹Ô¤ò±Û¤¨¤ÆÊݸ¤µ¤ì¤Þ¤¹¡£ + -kr¤ò»ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢²þ¹Ô¤´¤È¤Ë + G0=ASCII/G1=G2=G3=¤Ê¤· + ¤È¤¤¤¦¤è¤¦¤Ë¥ê¥»¥Ã¥È¤µ¤ì¤Þ¤¹¡£ + Regular¤Ïɸ½àÆþÎϤ«¤é¥Æ¥­¥¹¥È¤òÆɤߡ¢É¸½à½ÐÎϤ˷ë²Ì¤ò½ÐÎϤ·¤Þ¤¹¡£ + % regular < source.txt > dst.txt + ¤Î¤è¤¦¤Ë»È¤¦¤«¡¢¤¢¤ë¤¤¤Ï¥Õ¥£¥ë¥¿¥³¥Þ¥ó¥É(vi¥â¡¼¥É¤Î!¥³¥Þ¥ó¥É)¤Ç + ¸Æ¤Ó½Ð¤¹¤«¤·¤Æ¤¯¤À¤µ¤¤¡£ + + ¤Ò¤Í¤¯¤ì¤Æ¤¤¤ë¤È¤³¤í: + - nvi-m17n¤Ïregular¤Î½ÐÎÏencoding¤ò½èÍý¤Ç¤­¤Þ¤¹¤¬¡¢regular¤Î½ÐÎÏ + encoding¤Ï°ìÈÌŪ¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£ + regular¤ÏÈÆÍѥġ¼¥ë¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£nvi-m17n¤Î¥µ¥Ý¡¼¥ÈÀìÍÑ¤È + »×¤Ã¤Æ²¼¤µ¤¤¡£ + - euc-*/sjis/big5Åù¤Îencoding¤Ç½ñ¤«¤ì¤¿¥Õ¥¡¥¤¥ë¤ò°ÂÁ´¤Ë¼è¤ê°·¤¦ + ¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£¥Õ¥£¥ë¥¿¥³¥Þ¥ó¥É¤ò»È¤¦¾ì¹ç¡¢nvi-m17n¤Îfileencoding + ¥ª¥×¥·¥ç¥ó¤òiso-2022-*·Ï¤Îencoding¤Ë¤·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ê¤Þ¤¹¡£ + - regular¤ÎÆ°ºî¤ÏÈó¾ï¤ËÄ㮤Ǥ¹¡£ + ¤â¤·ÃÙ¤¹¤®¤Æº¤¤Ã¤¿¤é¡¢"qregular"¤ò¤«¤ï¤ê¤Ë»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£ + ¤¿¤À¤·¡¢qregular¤ÏG0/G1¤Ø¤ÎľÀܤλؼ¨¤·¤«¹Íθ¤·¤Þ¤»¤ó + (SI¤È¤«SO¤È¤«¤Ï²ò¼á¤Ç¤­¤Þ¤»¤ó)¡£ + +¿¹ñ¸ì̤Âбþ + + ¤³¤Îpatch¤Ïnvi¤ÎÁ´µ¡Ç½¤ò¿¹ñ¸ì²½¤¹¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£ + ¤³¤Î¤¿¤á¡¢¤¤¤¯¤Ä¤«¤Îµ¡Ç½¤Ï»È¤¦¤Ù¤­¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£ + ¤½¤Î¤¦¤Á*°ìÉô*¤ò¤³¤³¤Ëʤ٤Ƥª¤­¤Þ¤¹¡£¤è¤êºÙ¤«¤¯À©Ìó¤òÃΤꤿ¤¤¾ì¹ç¤Ï + ¥½¡¼¥¹¥³¡¼¥É¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£ + - ²£¥¹¥¯¥í¡¼¥ë²èÌ̥⡼¥É(:set leftright)¤Ï¤È¤­¤É¤­core¤òÅǤ¤¤¿¤ê + ̵¸Â¥ë¡¼¥×¤ËÍî¤Á¤¿¤ê¤·¤Þ¤¹¡£ + - curses°Ê³°¤Î²èÌ̽ÐÎÏ¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤ÏÆ°¤­¤Þ¤»¤ó¡£ + - perl¤òlink¤¹¤ë¤³¤È¤Ï¤Ç¤­¤ë¤è¤¦¤Ç¤¹¡£¤¬¡¢Â¿Ê¬Ìò¤Ë¤¿¤Á¤Þ¤»¤ó¡£ + ¤Ê¤¼¤Ê¤é¡¢perl¥¹¥¯¥ê¥×¥ÈÆâ¤Ç¤Ïnvi¤ÎÆâÉô¥³¡¼¥É¤ò°·¤ï¤Ê¤¤¤È + ¤¤¤±¤Ê¤¤¤«¤é¤Ç¤¹¡£ + - tcl¤òlink¤·¤¿¾ì¹ç¡¢¤­¤Ã¤ÈÆ°¤­¤Þ¤»¤ó¡£ + - ex¥â¡¼¥É¤Ç¤Ï¡¢¥­¡¼ÆþÎϤΥ¨¥³¡¼¥Ð¥Ã¥¯¤Ïnvi¤Ç¤Ï¤Ê¤¯Ã¼Ëö¥½¥Õ¥È¥¦¥§¥¢ + ¤Ë¤è¤Ã¤Æ½èÍý¤µ¤ì¤Þ¤¹(¥ª¥ê¥¸¥Ê¥ë¤Învi¤¬¤½¤¦¤Ê¤Ã¤Æ¤¤¤Þ¤¹)¡£ + ¤³¤Î¤¿¤á¡¢Ã¼Ëö¥½¥Õ¥È¥¦¥§¥¢¤¬Àµ¤·¤¯½èÍý¤·¤Ê¤¤¾ì¹ç¡¢Ê¸»ú¤¬²½¤±¤Æ + ¥¨¥³¡¼¥Ð¥Ã¥¯¤µ¤ì¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£ + - canna¥µ¥Ý¡¼¥È¤Ïex¥â¡¼¥É¤Ç¤ÏÆ°¤­¤Þ¤»¤ó¡£ttyÀ©¸æ¤Î¤·¤«¤¿¤¬ + vi¥â¡¼¥É¤È°ã¤Ã¤Æcooked¥â¡¼¥É¤À¤«¤é¤Ç¤¹(vi¤Î¥³¥í¥ó¥â¡¼¥É¤Ç¤Ï + canna¤¬»È¤¨¤Þ¤¹) + +¤Ò¤Í¤¯¤ì¤Æ¤¤¤ë¤È¤³¤í/¤Ð¤°(nvi 1.79¤Ë¤Ä¤¤¤Æ) + + tcsh 6.05.00¤Î¥Ð¥°¤Î¤»¤¤¤Ç¡¢tcsh 6.05.00¤Ènvi¤ò°ì½ï¤Ë»È¤¦¤È + ¥È¥é¥Ö¥ë¤¬È¯À¸¤¹¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£ + tcsh 6.05.00¤Ç¤Ï + % echo -n 'hoge' | tcsh -c cat + ¤ò¤¹¤ë¤È¥Ï¥ó¥°¤·¤Þ¤¹¡£¤Þ¤¿¡¢ + % ( echo 'hoge'; echo -n 'hoge') | tcsh -c cat + ¤È¤¹¤ë¤È¡¢ºÇ½é¤Î1¹Ô¤À¤±¤¬½ÐÎϤµ¤ì¤Þ¤¹¡£¤³¤ì¤Ïɸ½à¤Îcsh¤ÎÆ°ºî¤È¤Ï + °Û¤Ê¤ê¤Þ¤¹¡£ + ¤³¤Î¤¿¤á¡¢login shell¤¬tcsh 6.05.00¤Î¤È¤­¤Ë¡¢nvi¤«¤é"1¹Ô¤À¤±filter" + ¤¹¤ë¥³¥Þ¥ó¥É("!!cat"¤È¤«"!!fmt"¤È¤«)¤ò¼Â¹Ô¤¹¤ë¤È¡¢nvi¤Ïtcsh¤Î + ƻϢ¤ì¤Ë¤Ê¤Ã¤Æ¥Ï¥ó¥°¤·¤Þ¤¹¡£ + °ìÈÖ´Êñ¤ÊÈ´¤±Æ»¤Ï¡¢nvi¤È°ì½ï¤Ëtcsh¤ò»È¤ï¤Ê¤¤¤³¤È¤Ç¤¹¡£ + Î㤨¤Ð¡¢°Ê²¼¤ò.exrc¤Ë­¤»¤Ð²óÈò¤Ç¤­¤Þ¤¹: + set shell=/bin/csh + + :set + ¤Îľ¸å¤Ë + :set all + ¤¹¤ë¤È¡¢²èÌ̤¬É¬ÍפÊÎ̤è¤ê1¹Ô¿¤¯¥¹¥¯¥í¡¼¥ë¤·¤Þ¤¹¡£ + ¤³¤Î¤¿¤á¡¢:set all¤Î½ÐÎϤΰìÈÖ¾å¤Î¹Ô¤¬¸«¤¨¤Þ¤»¤ó¡£ + + ¸¶ºînvi¤Î¥³¡¼¥É¤Ë¤Ï¡¢ctype.h¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¥Þ¥¯¥í(isprint()¤È¤« + isblank()¤È¤«)¤ËÉé¤Î¿ô¤ò¤Ä¤Ã¤³¤ó¤À¤È¤­¤Ë¤â¤Á¤ã¤ó¤ÈÆ°¤¯¤³¤È¤ò + ²¾Äꤷ¤Æ½ñ¤«¤ì¤¿Éôʬ¤¬¤¢¤ê¤Þ¤¹¡£ + (Ãð: ¤³¤ì¤ÏANSI C¤Î»ÅÍͤˤϤ¢¤ê¤Þ¤»¤ó!) + ¤â¤·¤³¤ì¤¬Ëþ¤¿¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢8¥Ó¥Ã¥È¤á¤¬Î©¤Ã¤Æ¤¤¤ëÃÍ(0x80-0xff)¤¬ + ʸ½ñÃæ¤Ë¸½¤ì¤ë¤Ènvi¤Ï¥Ï¥ó¥°¥¢¥Ã¥×¤¹¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£ + ¿¹ñ¸ì²½¤ÎºÝ¤Ë¡¢8¥Ó¥Ã¥È¤á¤¬Î©¤Ã¤¿Ãͤò¤«¤Ê¤ê¤ÎÉÑÅ٤ǻȤäƤ¤¤ë¤¿¤á¡¢ + ¤³¤ì¤Ï¤«¤Ê¤êÂ礭¤ÊÌäÂê¤Ë¤Ê¤ê¤Þ¤¹¡£ + ¤Û¤È¤ó¤É¤ÎÉôʬ¤ÏÌäÂê¤Ê¤¤¤è¤¦¤Ë½¤Àµ¤·¤Æ¤¢¤ê¤Þ¤¹¤¬¡¢¤ä¤ê¤Î¤³¤·¤¬ + ¤¢¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£nvi¤¬¥Ï¥ó¥°¥¢¥Ã¥×¤·¤¿¤é¡¢¾õ¶·¤òºÆ¸½¤¹¤ë¤¿¤á¤Î + Áàºî¼ê½ç¤òºî¼Ô¤Þ¤ÇÁ÷¤Ã¤Æ¤¯¤À¤µ¤¤¡£ + +¤Ò¤Í¤¯¤ì¤Æ¤¤¤ë¤È¤³¤í/¤Ð¤°(nvi-m17n¤Ë¤Ä¤¤¤Æ) + + iso-2022-*¤ò¥­¡¼ÆþÎÏencoding¤Ë»È¤Ã¤Æ¤¤¤ë¾ì¹ç(:set inputencoding=xxx)¡¢ + control-O¤Ècontrol-N¤Ï¾ï¤ËSI/SO¤È¤·¤Æ¼è¤ê°·¤ï¤ì¤Þ¤¹¡£ + ¤³¤Î¤¿¤á¡¢control-N¤òvi¤Î¡Ö¼¡¤Î¹Ô¤Ø¡×¥³¥Þ¥ó¥É¤È¤·¤Æ»È¤¦¤³¤È¤Ï + ¤Ç¤­¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£ + (canna¤ò»È¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢cannaÆþÎϥ⡼¥É¤Ø¤Î°Ü¹Ô¥­¡¼¤Ï¤³¤³¤Ç¤Î + ÀâÌÀ¤è¤êÍ¥À褷¤Æcanna¤Î¤¿¤á¤Ë»È¤ï¤ì¤Þ¤¹) + ¤³¤ì¤é¤Î¤è¤¦¤Ê¥­¡¼¤òÆþÎϤ·¤¿¤¤¾ì¹ç¡¢°Ê²¼¤Î¤è¤¦¤Ë°ì»þŪ¤Ë¥­¡¼ÆþÎÏ + encoding¤òÀÚÂؤ¨¤ëɬÍפ¬¤¢¤ê¤Þ¤¹: + :set inputencoding=none + + ¥­¡¼ÆþÎÏ¡¢Ã¼Ëö½ÐÎÏ¡¢¥Õ¥¡¥¤¥ëÆþ½ÐÎϤΤ¿¤á¤Î¿¹ñ¸ìencoding²òÀÏ´ï/ + À¸À®´ï¤Ï¤½¤ì¤¾¤ìÊÌ¡¹¤Ë¼ÂÁõ¤µ¤ì¤Æ¤¤¤Æ¡¢Æ°ºî¤¬¤½¤ì¤¾¤ì°Û¤Ê¤ê¤Þ¤¹¡£ + ¤³¤ì¤Ï°Ê²¼¤ÎÍýͳ¤Ë¤è¤ê¤Þ¤¹: + - ¥­¡¼ÆþÎϤÏÃæÅÓȾü¤Ê¾õÂÖ¤ÎÆþÎϤò½èÍý¤·¤Ê¤¤¤È¤¤¤±¤Þ¤»¤ó¡£ + - üËö½ÐÎϤÏcurses¤ÎÀ©¸Â¤«¤éÁ´¤Æ¤Îʸ»ú¥»¥Ã¥È¤òG0¤Ë»Ø¼¨¤·¤Ê¤¤¤È + ¤¤¤±¤Þ¤»¤ó(sjisÅù¤Îñ°ì¸À¸ìencoding¤Î¾ì¹ç8bit¤â»È¤¨¤Þ¤¹¤¬)¡£ + - ¥Õ¥¡¥¤¥ëÆþ½ÐÎϤÏÃæ¤Ç¤Ï°ìÈÖ´Êñ¤Ê¤Î¤Ç¡¢·ë¹½´°Á´¤Ë¤Ç¤­¤Þ¤¹¡£ + + Ãæ¹ñ¸ì¤Îencoding¤Î¼«Æ°È½Ê̤ϸ¶ÍýŪ¤Ë¤Û¤È¤ó¤ÉÉÔ²Äǽ¤Ç¤¹¡£ + + cannaÆþÎϥ⡼¥É¤Ø¤Î°Ü¹Ô¥­¡¼(:set cannakey¤ÇÀßÄê)¤ÏÁ´¤Æ¤ËÍ¥À褷¤Þ¤¹¡£ + ¤³¤Î¤¿¤á¡¢Î㤨¤Ð¤³¤ì¤òcontrol-O¤ËÀßÄꤹ¤ë¤È¡¢¥­¡¼ÆþÎϤËcontrol-O¤¬ + ¤¢¤Ã¤¿¾ì¹ç¤½¤ì¤òSI¤È²ò¼á¤Ç¤­¤Þ¤»¤ó¡£ + ¤â¤·cannakey¤òcontrol-M¤ËÀßÄꤹ¤ë¤È¡¢¥ê¥¿¡¼¥ó¤¬ÆóÅÙ¤ÈÂǤƤʤ¯¤Ê¤ê¤Þ¤¹! + cannaÆþÎϥ⡼¥É¤Ø¤Î°Ü¹Ô¥­¡¼¤Ï¿µ½Å¤ËÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£ + + vi¥³¥Þ¥ó¥É¤Î¤¦¤Á¤¤¤¯¤Ä¤«¤Ï¡¢Â¾¤Îvi¥³¥Þ¥ó¥É¤ÎÁȤߤ¢¤ï¤»¤Ç¼Â¸½ + ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Î㤨¤Ð¡¢S¥³¥Þ¥ó¥É¤Ïc_¥³¥Þ¥ó¥É¤È¤·¤Æ¼Â¸½¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ + C/D/S/Y¤Î¥³¥Þ¥ó¥É¤Ï¤³¤Î¤è¤¦¤Ëºî¤é¤ì¤Æ¤¤¤Þ¤¹¡£fepkey¥ª¥×¥·¥ç¥ó¤Ï + ¼ÂºÝ¤Î¼Â¸½¤Ë»È¤ï¤ì¤ë¥³¥Þ¥ó¥É̾¤òÂоݤËfenceÀ©¸æ¤ò¹Ô¤¤¤Þ¤¹¡£ + ¤³¤Î¤¿¤á¡¢c¥³¥Þ¥ó¥É¤Ë¤Ä¤¤¤ÆfenceÀ©¸æ¤òon¤Ë¤¹¤ë¤È¡¢S¥³¥Þ¥ó¥É¤Ë¤Ä¤¤¤Æ¤â + ¼«Æ°Åª¤ËfenceÀ©¸æ¤¬on¤Ë¤Ê¤ê¤Þ¤¹¡£ + ¾ÜºÙ¤Ïvi/vi.c¤Îv_alias()¤ò»²¾È¡£ + + wrapmargin/wraplen¥ª¥×¥·¥ç¥ó¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢vi¤ÎW/B¥³¥Þ¥ó¥É¤Ç + ǧ¼±¤µ¤ì¤ëñ¸ì¶­³¦¤Ç¹Ô¤¬¶èÀÚ¤é¤ì¤Þ¤¹¡£¤³¤Î¤¿¤á¡¢±Ñ¸ì°Ê³°¤Î¹Ô¤Ç¤Ï + ¤È¤­¤É¤­¹ÔËö¤ÎŤµ¤¬Â·¤ï¤Ê¤«¤Ã¤¿¤ê¤·¤Þ¤¹¡£ + ¿¹ñ¸ì¤Î¹Ô¤Î¶èÀÚ¤êÊý¤Ë¤Ä¤¤¤Æ¤è¤¤ÊýË¡¤Ï¤Ê¤¤¤«ÌϺ÷¤·¤Æ¤¤¤ë¤È¤³¤í¤Ç¤¹¡£ + ¤Ê¤Ë¤«°Õ¸«¤¬¤¢¤Ã¤¿¤é¤ªÃΤ餻¤¯¤À¤µ¤¤¡£ + + Ãæ¹ñ¸ì/´Ú¹ñ¸ì¤Î¼«Æ°È½Ê̤ˤĤ¤¤Æ¤Ï¥Á¥§¥Ã¥¯¤¬´Å¤¤¤Ç¤¹¡£ + ¤ªµ¤·Ú¤Ë¸æ°Õ¸«¤ò¤ª´ó¤»¤¯¤À¤µ¤¤¡£ + + iso-2022-*·Ï¤Î¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ò¥­¡¼¥Ü¡¼¥ÉÆþÎϤËÍøÍѤ·¤Æ¤¤¤ë¾ì¹ç¡¢ + ESC¤Î¤¢¤È¤Î¥¿¥¤¥à¥¢¥¦¥È¤¬Ä¹¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤Æ¤¤¤Þ¤¹(2Çܤ˱ä¤Ó¤Æ + ¤·¤Þ¤¤¤Þ¤¹)¡£ + + ¤³¤Î¥Ñ¥Ã¥Á¤ò¤¢¤Æ¤¿¾ì¹ç¡¢¸¶ºînvi¤Î¥É¥­¥å¥á¥ó¥È¤Ë½Ò¤Ù¤é¤ì¤Æ¤¤¤ë + ÀâÌÀʸ¤Î°ìÉô¤ÏŬÍѤµ¤ì¤Ê¤¯¤Ê¤ë¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ + Î㤨¤Ð¡¢locale´ØÏ¢¤Î¤â¤Î(nvi-1.79/FAQ¤Î¤¤¤Á¤Ð¤óºÇ½é¤Î¼ÁÌä¡¢¤È¤«) + ¤Ïnvi-m17n¤Ë´Ø¤·¤ÆÀµ¤·¤¯¤¢¤ê¤Þ¤»¤ó¡£ + + nvi-m17n¤òiso-2022¤Î¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤òÀµ¤·¤¯¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤ + üËö¾å¤ÇÍøÍѤ·¤¿¾ì¹ç¡¢nvi-m17n¤Îµ¯Æ°»þ¤Ë¡¢²èÌ̺¸¾å¤Ë"B"¤¬»Ä¤ë + ¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£¤³¤ì¤Ï¡¢ASCIIʸ»ú¥»¥Ã¥È¤òG0(=GL)¤Ë¸Æ¤Ó½Ð¤¹¤¿¤á¤Î + "ESC ( B"¤¬Ã¼Ëö¤ËÀµ¤·¤¯½èÍý¤µ¤ì¤Ê¤«¤Ã¤¿¤¿¤á¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£ + nvi-m17n¤Ïµ¯Æ°»þ¤Ë¡¢ASCIIʸ»ú¥»¥Ã¥È¤òG0(=GL)¤Ë¸Æ¤Ó½Ð¤¹¤¿¤á¤Ë + ɬ¤º¤³¤Î¥·¡¼¥±¥ó¥¹¤ò½ÐÎϤ·¤Þ¤¹¡£ + ¤â¤·¤³¤ÎµóÆ°¤¬µ¤¤Ë¤Ê¤ë¾ì¹ç¤Ë¤Ï¡¢curses/refresh.c¤Î°Ê²¼¤Î¹Ô¤ò + Êѹ¹¤·¤Æ¤¯¤À¤µ¤¤(´Ø¿ôputdesig()¤ÎÃæ¤Ç¤¹): +ÇÛÉÛ»þ: static enum { NO, ASCII, CACHED } prevstate = NO; +Êѹ¹¸å: static enum { NO, ASCII, CACHED } prevstate = ASCII; + ¤³¤Î¾ì¹ç¡¢nvi-m17n¤Ï¡¢nvi-m17n¤Îµ¯Æ°»þ¤Ë¤ÏASCIIʸ»ú¥»¥Ã¥È¤¬ + G0(=GL)¤Ë¸Æ¤Ó½Ð¤µ¤ì¤Æ¤¤¤ë¤È²¾Äꤷ¤ÆÆ°ºî¤·¤Þ¤¹(¿¤¯¤Î¾ì¹ç¡¢ + ¤³¤ì¤ÏÀµ¤·¤¤²¾Äê¤È¤Ï¸À¤¨¤Þ¤»¤ó)¡£ + + ¥«¡¼¥½¥ë¥­¡¼(termcap¤Îku/kd¤Ê¤É¤ÇÄêµÁ¤µ¤ì¤¿¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤Î + ÆþÎÏ)¤Ë¤è¤ë°ÜÆ°¤Ï¡¢¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¤³¤È¤¬¤¢¤ë¤è¤¦¤Ç¤¹¡£¤³¤ì¤Ï¤«¤Ê¤ê + ¿¿ô¤Î¸¶°ø¤¬º®¤¸¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢ºî¼Ô¤¬¥«¡¼¥½¥ë¥­¡¼¤Ê¤ó¤Æ»È¤¦µ¤¤¬¤Ê¤¤ + ¤¿¤á¡¢¤¢¤Þ¤ê¤Þ¤¸¤á¤Ë¤ª¤Ã¤«¤±¤ëµ¤¤¬¤¢¤ê¤Þ¤»¤ó¡£ + +´¶ÁÛ¡¦°Õ¸« + + ¥Ð¥°¤ä¥³¥á¥ó¥È¤Ï°Ê²¼¤Î¤¤¤º¤ì¤«¤ÎÊýË¡¤ÇÁ÷¤Ã¤Æ¤¯¤À¤µ¤¤: + web: http://www.itojun.org/cgi-bin/gnats-send-pr + e-mail: nvi-m17n@foretune.co.jp + ¤½¤ÎºÝ¡¢patch¤Î¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òÌÀ¼¨¤·¤Æ¤¯¤À¤µ¤¤¡£ + +ºî¼Ô + + Jun-ichiro itojun Hagino (Jun-ichiro Itoh) + itojun@itojun.org + Contribution to the author, in any form (example: just say "thanks"), + is always appreciated. Index: ex/ex.c =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex.c 2001/10/23 04:33:25 1.2 @@ -205,9 +205,18 @@ u_int32_t flags; long ltmp; int at_found, gv_found; +#ifndef MULTIBYTE int ch, cnt, delim, isaddr, namelen; +#else + CHAR_T ch; + int cnt, delim, isaddr, namelen; +#endif /*MULTIBYTE*/ int newscreen, notempty, tmp, vi_address; +#ifndef MULTIBYTE char *arg1, *p, *s, *t; +#else + CHAR_T *arg1, *p, *s, *t; +#endif gp = sp->gp; exp = EXP(sp); @@ -755,6 +764,15 @@ --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,6 +810,19 @@ --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,7 +1854,11 @@ 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); @@ -2307,7 +2342,7 @@ * underlying file, that's the real problem. */ if (sp->ep == NULL) { - ex_emsg(sp, cp->name, EXM_NOFILEYET); + ex_emsg(sp, cp ? cp->name : NULL, EXM_NOFILEYET); return; } Index: ex/ex.h =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex.h 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex.h 2001/10/23 04:33:25 1.2 @@ -80,10 +80,18 @@ 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,7 +99,11 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_argv.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_argv.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_argv.c 2001/10/23 04:33:25 1.2 @@ -100,7 +100,12 @@ { 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,7 +148,12 @@ { 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,7 +266,12 @@ 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,7 +636,12 @@ 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_cscope.c =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_cscope.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_cscope.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_cscope.c 2001/10/23 04:33:25 1.2 @@ -232,14 +232,14 @@ * name regardless so that we can use it as a base for searches. */ if (stat(dname, &sb)) { - msgq(sp, M_SYSERR, dname); + msgq(sp, M_SYSERR, "%s", dname); return (1); } if (S_ISDIR(sb.st_mode)) { (void)snprintf(path, sizeof(path), "%s/%s", dname, CSCOPE_DBFILE); if (stat(path, &sb)) { - msgq(sp, M_SYSERR, path); + msgq(sp, M_SYSERR, "%s", path); return (1); } dbname = CSCOPE_DBFILE; @@ -762,7 +762,7 @@ io_err: if (feof(csc->from_fp)) errno = EIO; - msgq_str(sp, M_SYSERR, "%s", csc->dname); + msgq_str(sp, M_SYSERR, csc->dname, "%s"); terminate(sp, csc, 0); return (1); } Index: ex/ex_global.c =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_global.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_global.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_global.c 2001/10/23 04:33:25 1.2 @@ -128,6 +128,16 @@ ++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 =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_join.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_join.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_join.c 2001/10/23 04:33:25 1.2 @@ -38,8 +38,15 @@ { 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,6 +118,29 @@ */ 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,7 +159,11 @@ 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,10 +187,25 @@ * line. */ if (first) { +#ifndef MULTIBYTE sp->cno = (tbp - bp) - (1 + extra); +#else + sp->cno = (tbp - bp); + sp->cno -= multi_back(sp, bp, &bp[sp->cno]); + if (extra) + sp->cno -= multi_back(sp, bp, &bp[sp->cno]); +#endif /*MULTIBYTE*/ first = 0; - } else + } 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 =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_print.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_print.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_print.c 2001/10/23 04:33:25 1.2 @@ -30,7 +30,11 @@ #include "../common/common.h" +#ifndef MULTIBYTE static int ex_prchars __P((SCR *, const char *, size_t *, size_t, u_int, int)); +#else +static int ex_prchars __P((SCR *, const CHAR_T *, size_t *, size_t, u_int, int)); +#endif /* * ex_list -- :[line [,line]] l[ist] [count] [flags] @@ -220,7 +224,11 @@ 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,13 +236,16 @@ 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 (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,6 +253,29 @@ 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,6 +294,8 @@ goto intr; } } + p++; + } intr: *colp = col; return (0); } Index: ex/ex_read.c =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_read.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_read.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_read.c 2001/10/23 04:33:25 1.2 @@ -317,20 +317,54 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_script.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_script.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_script.c 2001/10/23 04:33:25 1.2 @@ -344,8 +344,45 @@ /* 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,10 +468,16 @@ 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,9 +536,31 @@ 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_shift.c =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_shift.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_shift.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_shift.c 2001/10/23 04:33:25 1.2 @@ -176,6 +176,36 @@ sp->cno += newidx - oldidx; else if (sp->cno >= oldidx - newidx) sp->cno -= oldidx - newidx; +#ifdef MULTIBYTE + else { + /* + * If the cursor is originally placed in the + * indent area, you will come to here. + * Original nvi does nothing about this case, + * and cno will left unchanged, and cursor will + * point the character at the same byte offset + * as before (not column, this is byte offset). + * I don't very much understand the reason for + * this behavior. We'll at least fix up + * cursor position so that we never step + * inbetween multibyte sequence. + * NOTE: This is BYTEWISE adjustment, + * not an column-wise adjustment. The + * behavior may not look natural to human. + */ + size_t cno; + cno = newidx; + do { + if (cno + KEY_BLEN(sp, bp[cno]) + < sp->cno) { + cno += KEY_BLEN(sp, bp[cno]); + } else + break; + } while (cno < len - oldidx + newidx); + if (cno != sp->cno) + sp->cno = cno; + } +#endif /*MULTIBYTE*/ } } if (!curset) { Index: ex/ex_subst.c =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_subst.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_subst.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_subst.c 2001/10/23 04:33:25 1.2 @@ -32,11 +32,20 @@ #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,8 +64,14 @@ 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,6 +141,16 @@ ++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,8 +223,14 @@ } 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,6 +258,17 @@ 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,10 +670,21 @@ * 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,13 +1078,21 @@ 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,6 +1150,16 @@ } 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,6 +1227,20 @@ *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,13 +1258,21 @@ 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,6 +1283,14 @@ 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,6 +1302,9 @@ } 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,6 +1326,16 @@ 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,12 +1356,20 @@ 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,6 +1401,17 @@ 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,10 +1468,20 @@ 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,6 +1591,32 @@ ++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 =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_txt.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_txt.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_txt.c 2001/10/23 04:33:25 1.2 @@ -168,8 +168,13 @@ * 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,8 +192,14 @@ * '.' 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] == '.') { + 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,7 +349,14 @@ } /* 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 =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_usage.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_usage.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_usage.c 2001/10/23 04:33:25 1.2 @@ -146,7 +146,11 @@ { 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 =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_version.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_version.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_version.c 2001/10/23 04:33:25 1.2 @@ -22,6 +22,9 @@ #include "../common/common.h" #include "version.h" +#ifdef MULTIBYTE +#include "mversion.h" +#endif /* * ex_version -- :version @@ -35,5 +38,8 @@ EXCMD *cmdp; { msgq(sp, M_INFO, VI_VERSION); +#ifdef MULTIBYTE + msgq(sp, M_INFO, MULTIBYTE_VERSION); +#endif return (0); } Index: ex/ex_write.c =================================================================== RCS file: /cvsroot/itojun/nvi/ex/ex_write.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ex/ex_write.c 2001/10/23 04:22:15 1.1.1.1 +++ ex/ex_write.c 2001/10/23 04:33:25 1.2 @@ -138,7 +138,12 @@ { MARK rm; int flags; +#ifndef MULTIBYTE char *name, *p; +#else + char *name; + CHAR_T *p; +#endif NEEDFILE(sp, cmdp); @@ -319,7 +324,15 @@ ccnt = 0; lcnt = 0; msg = "253|Writing..."; - if (tline != 0) + 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,15 +344,60 @@ 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,6 +415,9 @@ 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 =================================================================== RCS file: mversion.h diff -N mversion.h --- /dev/null Wed Oct 24 08:26:45 2001 +++ ex/mversion.h Wed Oct 24 10:33:47 2001 @@ -0,0 +1,2 @@ +#define MULTIBYTE_VERSION \ +"multilingualization patch version Nov 17, 1999 by Jun-ichiro itojun Hagino." Index: include/cl_extern.h =================================================================== RCS file: /cvsroot/itojun/nvi/include/cl_extern.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- include/cl_extern.h 2001/10/23 04:22:15 1.1.1.1 +++ include/cl_extern.h 2001/10/23 04:33:25 1.2 @@ -27,7 +27,11 @@ #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 =================================================================== RCS file: /cvsroot/itojun/nvi/include/com_extern.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- include/com_extern.h 2001/10/23 04:22:15 1.1.1.1 +++ include/com_extern.h 2001/10/23 04:33:25 1.2 @@ -101,7 +101,10 @@ 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,6 +143,117 @@ 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,6 +280,21 @@ 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 =================================================================== RCS file: multibyte_def.h diff -N multibyte_def.h --- /dev/null Wed Oct 24 08:26:45 2001 +++ include/multibyte_def.h Wed Oct 24 10:33:52 2001 @@ -0,0 +1,53 @@ +#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_JISX0213_2000_1 0x96 +#define CS_JISX0213_2000_2 0x97 +#define CS_BIG5_1 0x98 +#define CS_BIG5_2 0x99 +#define CS_IRV 0x9a +#define CS_UK 0x9b +#define CS_SWEDISH 0x9c +#define CS_NORWEGIAN 0x9d +#define CS_JISX0201_RIGHT 0x9e +#define CS_JISX0201_LEFT 0x9f +#define CS_GERMAN 0xa0 +#define CS_FRENCH 0xa1 +#define CS_ITALIAN 0xa2 +#define CS_SPANISH 0xa3 +#define CS_PRIVATE94_0 0xa4 +#define CS_PRIVATE94_1 0xa5 +#define CS_LATIN1 0xa6 +#define CS_LATIN2 0xa7 +#define CS_LATIN3 0xa8 +#define CS_LATIN4 0xa9 +#define CS_GREEK 0xaa +#define CS_ARABIC 0xab +#define CS_HEBREW 0xac +#define CS_CYRILLIC 0xad +#define CS_LATIN5R 0xae +#define CS_THAI 0xaf +#define CS_LATIN6 0xb0 +#define CS_LATIN6ADD 0xb1 +#define CS_PRIVATE96_0 0xb2 +#define CS_PRIVATE96_1 0xb3 +#define CS_MAX 0xb4 Index: include/options_def.h =================================================================== RCS file: /cvsroot/itojun/nvi/include/options_def.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- include/options_def.h 2001/10/23 04:22:15 1.1.1.1 +++ include/options_def.h 2001/10/23 04:33:25 1.2 @@ -1,79 +1,89 @@ #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 +#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 =================================================================== RCS file: /cvsroot/itojun/nvi/include/vi_extern.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- include/vi_extern.h 2001/10/23 04:22:15 1.1.1.1 +++ include/vi_extern.h 2001/10/23 04:33:25 1.2 @@ -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,7 +100,11 @@ 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,11 +124,18 @@ 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 =================================================================== RCS file: README.m17n diff -N README.m17n --- /dev/null Wed Oct 24 08:26:45 2001 +++ regex/README.m17n Wed Oct 24 10:33:54 2001 @@ -0,0 +1,21 @@ +notes on regex multilingual patch +Jun-ichiro itojun Itoh +$Id: README.m17n,v 1.1 2001/10/23 04:33:26 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 =================================================================== RCS file: /cvsroot/itojun/nvi/regex/engine.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- regex/engine.c 2001/10/23 04:22:20 1.1.1.1 +++ regex/engine.c 2001/10/23 04:33:26 1.2 @@ -51,6 +51,10 @@ #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,6 +66,10 @@ #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,6 +92,11 @@ 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,6 +109,10 @@ 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,7 +266,13 @@ 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,12 +371,26 @@ 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,17 +559,55 @@ 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,6 +624,13 @@ 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,6 +642,13 @@ 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,7 +794,13 @@ 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,6 +839,11 @@ } /* 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,6 +856,9 @@ 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,10 +868,21 @@ 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,7 +910,13 @@ 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,6 +952,11 @@ 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,6 +970,9 @@ 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,10 +984,20 @@ 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,6 +1046,11 @@ 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,6 +1137,187 @@ 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,6 +1410,10 @@ #undef dissect #undef backref #undef step +#ifdef MULTIBYTE +#undef mstep +#undef mbchin +#endif #undef print #undef at #undef match Index: regex/regcomp.c =================================================================== RCS file: /cvsroot/itojun/nvi/regex/regcomp.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- regex/regcomp.c 2001/10/23 04:22:20 1.1.1.1 +++ regex/regcomp.c 2001/10/23 04:33:26 1.2 @@ -94,6 +94,9 @@ 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,13 +403,21 @@ 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,8 +490,13 @@ register struct parse *p; { REQUIRE(MORE(), REG_EMPTY); - while (MORE()) + while (MORE()) { +#ifndef MULTIBYTE ordinary(p, GETNEXT()); +#else + mordinary(p, GETNEXT()); +#endif + } } /* @@ -609,7 +625,11 @@ REQUIRE(starordinary, REG_BADRPT); /* FALLTHROUGH */ default: +#ifndef MULTIBYTE ordinary(p, c &~ BACKSL); +#else + mordinary(p, c &~ BACKSL); +#endif break; } @@ -731,7 +751,9 @@ 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,8 +809,72 @@ 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,7 +1057,50 @@ } } +#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,6 +1265,9 @@ cs->hash = 0; cs->smultis = 0; cs->multis = NULL; +#ifdef MULTIBYTE + cs->multiinvert = 0; +#endif return(cs); } @@ -1260,7 +1392,7 @@ return; } - (void) strcpy(cs->multis + oldend - 1, cp); + (void) strcpy(cs->multis + oldend, cp); cs->multis[cs->smultis - 1] = '\0'; } @@ -1334,7 +1466,11 @@ register struct parse *p; register cset *cs; { +#ifndef MULTIBYTE assert(cs->multis == NULL); /* xxx */ +#else + cs->multiinvert = cs->multiinvert ? 0 : 1; +#endif } /* @@ -1349,7 +1485,9 @@ register struct parse *p; register cset *cs; { +#ifndef MULTIBYTE assert(cs->multis == NULL); /* xxx */ +#endif } /* Index: regex/regex2.h =================================================================== RCS file: /cvsroot/itojun/nvi/regex/regex2.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- regex/regex2.h 2001/10/23 04:22:20 1.1.1.1 +++ regex/regex2.h 2001/10/23 04:33:26 1.2 @@ -105,6 +105,8 @@ #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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/getc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/getc.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/getc.c 2001/10/23 04:33:26 1.2 @@ -77,6 +77,11 @@ { 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,6 +115,63 @@ 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,7 +192,11 @@ 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,7 +216,11 @@ 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,6 +241,11 @@ 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,6 +286,68 @@ 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,7 +360,11 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_ch.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_ch.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_ch.c 2001/10/23 04:33:26 1.2 @@ -25,7 +25,11 @@ #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,7 +43,11 @@ 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,7 +81,11 @@ 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,15 +123,29 @@ 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,17 +172,31 @@ { 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,7 +213,13 @@ 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,15 +248,29 @@ 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,8 +291,15 @@ { 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,9 +307,16 @@ * 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,7 +333,13 @@ 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,8 +354,13 @@ * one. */ vp->m_final = vp->m_stop; - if (ISMOTION(vp)) + 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,6 +371,7 @@ msgq(sp, M_BERR, "178|No previous F, f, T or t search"); } +#ifndef MULTIBYTE static void notfound(sp, ch) SCR *sp; @@ -293,3 +379,22 @@ { 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_delete.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_delete.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_delete.c 2001/10/23 04:33:26 1.2 @@ -90,8 +90,22 @@ F_SET(vp, VM_RCM_SET); /* Make sure the set cursor position exists. */ - if (vp->m_final.cno >= len) + 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_ex.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_ex.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_ex.c 2001/10/23 04:33:26 1.2 @@ -506,6 +506,9 @@ VICMD *vp; { size_t len; +#ifdef MULTIBYTE + CHAR_T *p; +#endif /* * The only cursor modifications are real, however, the underlying @@ -521,11 +524,21 @@ * 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)) { +#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) + } 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_increment.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_increment.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_increment.c 2001/10/23 04:33:26 1.2 @@ -59,7 +59,12 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_init.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_init.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_init.c 2001/10/23 04:33:26 1.2 @@ -63,7 +63,12 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_itxt.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_itxt.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_itxt.c 2001/10/23 04:33:26 1.2 @@ -71,9 +71,17 @@ 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,7 +103,11 @@ 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,11 +120,21 @@ len = 0; LF_SET(TXT_APPENDEOL); } else if (len) { - if (len == sp->cno + 1) { +#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 + } else { +#ifndef MULTIBYTE ++sp->cno; +#else + sp->cno += KEY_BLEN(sp, p[sp->cno]); +#endif + } } else LF_SET(TXT_APPENDEOL); @@ -422,7 +444,11 @@ 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,7 +468,11 @@ 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,10 +489,26 @@ } 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_left.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_left.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_left.c 2001/10/23 04:33:26 1.2 @@ -36,6 +36,9 @@ VICMD *vp; { recno_t cnt; +#ifdef MULTIBYTE + CHAR_T *p; +#endif /* * !!! @@ -46,11 +49,23 @@ 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) + if (vp->m_start.cno > cnt) { +#ifndef MULTIBYTE vp->m_stop.cno = vp->m_start.cno - cnt; - else +#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,8 +73,13 @@ * adjust the starting point to the character before the current * one. */ - if (ISMOTION(vp)) + 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,6 +164,10 @@ SCR *sp; VICMD *vp; { +#ifdef MULTIBYTE + CHAR_T *p; +#endif + /* * !!! * Yielding to none in our quest for compatibility with every @@ -172,6 +196,14 @@ 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,13 +215,22 @@ */ 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)) + 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,6 +249,10 @@ 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,6 +281,14 @@ 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,13 +300,22 @@ */ 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)) + 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,6 +332,10 @@ SCR *sp; VICMD *vp; { +#ifdef MULTIBYTE + CHAR_T *p; +#endif + /* * !!! * The 0 command succeeded if used as a command in the first column @@ -286,8 +352,18 @@ * one. */ vp->m_stop.cno = 0; - if (ISMOTION(vp)) + 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_match.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_match.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_match.c 2001/10/23 04:33:26 1.2 @@ -31,6 +31,12 @@ * * 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,7 +46,11 @@ 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,7 +65,12 @@ goto nomatch; return (1); } - for (off = vp->m_start.cno;; ++off) { +#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,6 +114,13 @@ 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,9 +184,22 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_paragraph.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_paragraph.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_paragraph.c 2001/10/23 04:33:26 1.2 @@ -145,7 +145,11 @@ */ 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,7 +177,12 @@ vp->m_start.cno = 0; return (0); } - if (vp->m_start.cno == (len ? len - 1 : 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,7 +200,11 @@ 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,8 +253,18 @@ } else --vp->m_start.lno; F_SET(vp, VM_LMODE); - } else + } 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_replace.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_replace.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_replace.c 2001/10/23 04:33:26 1.2 @@ -53,7 +53,14 @@ 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,8 +94,22 @@ */ 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; - if (vp->m_stop.cno > len - 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,6 +142,18 @@ } 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,6 +188,16 @@ * 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,8 +236,47 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_right.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_right.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_right.c 2001/10/23 04:33:26 1.2 @@ -37,8 +37,17 @@ { size_t len; int isempty; - - if (db_eget(sp, vp->m_start.lno, NULL, &len, &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,6 +59,11 @@ 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,17 +73,44 @@ * 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); - if (vp->m_start.cno == len - 1 && !ISMOTION(vp)) { +#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,6 +130,9 @@ { size_t len; int isempty; +#ifdef MULTIBYTE + char *p; +#endif /* * !!! @@ -121,7 +165,12 @@ * 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)) { +#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,7 +188,11 @@ * 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_search.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_search.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_search.c 2001/10/23 04:33:26 1.2 @@ -76,7 +76,12 @@ 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,6 +430,9 @@ dir_t dir; MARK m; size_t len; +#ifdef MULTIBYTE + CHAR_T *p; +#endif /* * !!! @@ -500,16 +508,29 @@ * 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 + } 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_section.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_section.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_section.c 2001/10/23 04:33:26 1.2 @@ -145,10 +145,19 @@ return (1); } -ret1: if (db_get(sp, --lno, DBG_FATAL, NULL, &len)) +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,8 +253,15 @@ --vp->m_start.lno; F_SET(vp, VM_LMODE); - } else + } 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_sentence.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_sentence.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_sentence.c 2001/10/23 04:33:26 1.2 @@ -51,6 +51,12 @@ * * 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,13 +92,21 @@ } 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,6 +206,12 @@ * * 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,21 +252,33 @@ 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,7 +311,11 @@ * 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,7 +339,11 @@ * 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_txt.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_txt.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_txt.c 2001/10/23 04:33:26 1.2 @@ -30,6 +30,9 @@ #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,6 +43,9 @@ 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,8 +287,20 @@ 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,8 +350,15 @@ */ 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,6 +557,12 @@ 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,8 +949,13 @@ * Set the return cursor position to rest on the last * inserted character. */ - if (tp->cno != 0) + 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,7 +1043,12 @@ } /* 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,8 +1060,17 @@ * point in the screen. So, if incrementally searching, erase * the erased characters from the screen. */ - if (FL_ISSET(is_flags, IS_RUNNING)) + 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,9 +1080,15 @@ * 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,7 +1158,8 @@ * Overwrite erased characters if doing incremental search; * see comment above. */ - if (LF_ISSET(TXT_TTYWERASE)) + if (LF_ISSET(TXT_TTYWERASE)) { +#ifndef MULTIBYTE while (tp->cno > max) { --tp->cno; ++tp->owrite; @@ -1111,15 +1168,50 @@ if (isblank(tp->lb[tp->cno - 1])) break; } - else { +#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,6 +1223,48 @@ || 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,6 +1381,67 @@ 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,6 +1670,9 @@ 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,20 +1701,42 @@ * 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,7 +1861,11 @@ 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,7 +1910,11 @@ u_long ts; int del; size_t cno, len, new, old, scno, spaces, tab_after_sp, tabs; +#if 0 char *p; +#else + CHAR_T *p; +#endif *changedp = 0; @@ -1775,7 +2003,11 @@ size_t len; { size_t nlen; +#ifndef MULTIBYTE char *p, *t; +#else + CHAR_T *p, *t; +#endif if (aitp == NULL) { /* @@ -2014,7 +2246,11 @@ EXCMD cmd; size_t indx, len, nlen, off; int argc, trydir; +#if 0 char *p, *t; +#else + CHAR_T *p, *t; +#endif trydir = 0; *redrawp = 0; @@ -2278,10 +2514,49 @@ { 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,7 +2590,11 @@ cno += chlen; chlen--;) *p++ = *kp++; } + tp->lb[cno] = ch; +#ifdef MULTIBYTE +done: +#endif return (vs_change(sp, tp->lno, LINE_RESET)); } @@ -2405,7 +2684,9 @@ /* 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,6 +2697,17 @@ 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,6 +2730,7 @@ * 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,6 +2842,201 @@ 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,7 +3231,13 @@ 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,7 +3265,11 @@ /* 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,9 +3311,19 @@ { 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,6 +3344,53 @@ 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,7 +3403,11 @@ * 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,6 +3427,7 @@ * !!! * Delete any trailing whitespace from the current line. */ +#ifndef MULTIBYTE for (;; --p, --off) { if (!isblank(*p)) break; @@ -2876,6 +3436,24 @@ 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,7 +3471,11 @@ { 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,6 +3484,7 @@ if (tp->owrite == 0) return; +#ifndef MULTIBYTE /* * Calculate how many characters the user has entered, * plus the blanks erased by /s. @@ -2936,6 +3519,37 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_ulcase.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_ulcase.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_ulcase.c 2001/10/23 04:33:26 1.2 @@ -54,7 +54,14 @@ 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,6 +84,7 @@ continue; } +#ifndef MULTIBYTE if (cno + cnt >= len) { lcnt = len - 1; cnt -= len - cno; @@ -88,6 +96,28 @@ 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,6 +199,16 @@ *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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_util.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_util.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_util.c 2001/10/23 04:33:26 1.2 @@ -65,13 +65,24 @@ 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,11 +136,19 @@ * 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_word.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_word.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_word.c 2001/10/23 04:33:26 1.2 @@ -111,6 +111,9 @@ 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,14 +151,50 @@ */ 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,22 +210,62 @@ } /* 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,6 +273,9 @@ if (inword(cs.cs_ch)) break; } +#ifdef MULTIBYTE +taileater:; +#endif /* See comment above. */ if (cnt == 0 && ISMOTION(vp)) { if ((ISCMD(vp->rkp, 'd') || @@ -204,6 +286,10 @@ } /* 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,7 +313,17 @@ 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,6 +374,9 @@ 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,7 +391,11 @@ * 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,42 +411,122 @@ */ 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,14 +534,25 @@ 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,6 +625,9 @@ 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,7 +643,11 @@ * '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,26 +663,72 @@ */ 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,15 +736,48 @@ } 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,14 +785,25 @@ 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,6 +833,16 @@ */ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_xchar.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_xchar.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_xchar.c 2001/10/23 04:33:26 1.2 @@ -37,8 +37,17 @@ { size_t len; int isempty; - - if (db_eget(sp, vp->m_start.lno, NULL, &len, &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,12 +66,32 @@ * of the cursor as part of the 'x' command isn't taken into account. * Historically correct. */ - if (F_ISSET(vp, VC_C1SET)) + 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 + } +#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,18 +114,38 @@ 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 + 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/v_yank.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/v_yank.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/v_yank.c 2001/10/23 04:33:26 1.2 @@ -75,8 +75,16 @@ F_SET(vp, VM_RCM_SET); /* Make sure the set cursor position exists. */ - if (vp->m_final.cno >= len) + 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/vi.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/vi.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/vi.c 2001/10/23 04:33:26 1.2 @@ -91,6 +91,10 @@ (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,8 +236,23 @@ 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,6 +432,7 @@ return (rval); } +#ifndef MULTIBYTE #define KEY(key, ec_flags) { \ if ((gcret = v_key(sp, 0, &ev, ec_flags)) != GC_OK) \ return (gcret); \ @@ -422,7 +442,30 @@ *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 * of a straight count. This is the replacement structure we use @@ -466,6 +509,10 @@ CHAR_T key; char *s; +#ifdef MULTIBYTE + v_fep_force_off(sp); +#endif + /* * Get a key. * @@ -487,6 +534,10 @@ } 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,8 +739,22 @@ } /* Required character. */ - if (LF_ISSET(V_CHAR)) + 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,6 +773,21 @@ 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,6 +806,9 @@ 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,7 +866,12 @@ * text. */ vp->m_stop.lno = sp->lno + motion.count - 1; - if (db_get(sp, vp->m_stop.lno, 0, NULL, &len)) { +#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,7 +879,13 @@ } 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,8 +940,22 @@ 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,7 +1152,11 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/vi.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/vi.h 2001/10/23 04:22:17 1.1.1.1 +++ vi/vi.h 2001/10/23 04:33:26 1.2 @@ -18,7 +18,12 @@ 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,6 +172,10 @@ 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,7 +225,11 @@ 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,7 +248,12 @@ 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,7 +277,12 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/vs_line.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/vs_line.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/vs_line.c 2001/10/23 04:33:26 1.2 @@ -49,13 +49,20 @@ 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; +#endif /*MULTIBYTE*/ #if defined(DEBUG) && 0 - TRACE(sp, "vs_line: row %u: line: %u off: %u\n", - smp - HMAP, smp->lno, smp->off); + TRACE(sp, "vs_line: row %u: line: %u coff: %u soff: %u\n", + smp - HMAP, smp->lno, smp->coff, smp->soff); #endif /* * If ex modifies the screen after ex output is already on the screen, @@ -92,6 +99,9 @@ /* 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,7 +245,12 @@ 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,6 +271,7 @@ /* 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,10 +292,41 @@ 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,6 +354,60 @@ 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,9 +418,24 @@ * 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) { + offset_in_line + cols_per_screen < sp->cno) +#else + /* + * In multibyte environment, it is not true that every byte + * occupy at least single column. + * - It is safe to compare sp->cno and offset_in_line since they + * are both byte offset. + * - we can't simply compare offset_in_line + cols_per_screen against + * sp->cno, since cols_per_screen is screen column, not byte offset. + * 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,9 +445,21 @@ /* 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) { + + is_partial = 0, scno = 0; + while (offset_in_line < len) { +#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,6 +467,26 @@ 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 (1 < KEY_BLEN(sp, ch) && scno > cols_per_screen) { + smp->c_ecsize = chlen; + smp->c_eclen = 0; + is_partial = 1; + + smp->c_eboff = offset_in_line; + + /* 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,6 +527,10 @@ *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,8 +543,16 @@ } /* If the line is on the screen, don't display anything. */ - if (is_cached) + if (is_cached) { +#ifndef MULTIBYTE + offset_in_line++; + offset_in_char = 0; +#else + offset_in_line += KEY_BLEN(sp, ch); + offset_in_char = 0; +#endif /*MULTIBYTE*/ continue; + } #define FLUSH { \ *cbp = '\0'; \ @@ -413,11 +573,41 @@ *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 = KEY_BLEN(sp, ch); + } + } else + kp = KEY_NAME(sp, ch) + offset_in_char; + if (cbp + chlen >= ecbp) + FLUSH; + while (chlen--) + *cbp++ = *kp++; +#endif /*MULTIBYTE*/ } + +#ifndef MULTIBYTE + offset_in_line++; + offset_in_char = 0; +#else + offset_in_line += KEY_BLEN(sp, ch); + offset_in_char = 0; +#endif } if (scno < cols_per_screen) { Index: vi/vs_msg.c =================================================================== RCS file: /cvsroot/itojun/nvi/vi/vs_msg.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/vs_msg.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/vs_msg.c 2001/10/23 04:33:26 1.2 @@ -39,7 +39,11 @@ 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,13 +229,21 @@ * 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,7 +301,38 @@ 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,17 +440,32 @@ 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,12 +475,21 @@ 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,6 +538,7 @@ cbp = cbuf; \ } ecbp = (cbp = cbuf) + sizeof(cbuf) - 1; +#ifndef MULTIBYTE for (t = line, tlen = len; tlen--; ++t) { ch = *t; /* @@ -488,6 +556,54 @@ 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,12 +616,21 @@ 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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/vs_refresh.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/vs_refresh.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/vs_refresh.c 2001/10/23 04:33:26 1.2 @@ -30,7 +30,9 @@ #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,6 +141,9 @@ 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,8 +176,19 @@ 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,6 +482,9 @@ goto slow; return (1); } +#ifdef MULTIBYTE + p0 = p; +#endif #ifdef DEBUG /* Sanity checking. */ @@ -481,6 +500,7 @@ * screen, and therefore, how many screen positions to move. */ if (CNO < OCNO) { +#ifndef MULTIBYTE /* * 7a: Cursor moved left. * @@ -532,7 +552,81 @@ 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,6 +656,73 @@ /* 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)) +#if 1 + cwtotal = SCREEN_COLS(sp); +#else + goto slow; +#endif + 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,12 +751,36 @@ * 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); - if (O_ISSET(sp, O_NUMBER)) +#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 (p0 && !multi_isnone(sp, p0[CNO])) + cnt -= KEY_LEN(sp, p0[CNO]); +#endif /*MULTIBYTE*/ + if (O_ISSET(sp, O_NUMBER) && cnt >= O_NUMBER_LENGTH) cnt -= O_NUMBER_LENGTH; /* Adjust the window towards the beginning of the line. */ @@ -612,6 +797,13 @@ 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,9 +954,20 @@ * 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,6 +980,9 @@ 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,8 +1002,17 @@ */ (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 =================================================================== RCS file: /cvsroot/itojun/nvi/vi/vs_relative.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vi/vs_relative.c 2001/10/23 04:22:17 1.1.1.1 +++ vi/vs_relative.c 2001/10/23 04:33:26 1.2 @@ -108,23 +108,19 @@ 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) { + 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); leftright = O_ISSET(sp, O_LEFTRIGHT); @@ -140,6 +136,13 @@ 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); @@ -151,7 +154,7 @@ * last column of the screen. Otherwise, display the rest of the * character in the next screen. */ -#define TAB_RESET { \ +#define TAB_RESET do { \ curoff += chlen; \ if (!leftright && curoff >= sp->cols) \ if (ch == '\t') { \ @@ -159,15 +162,64 @@ scno -= scno % sp->cols; \ } else \ curoff -= sp->cols; \ -} - if (cnop == NULL) +} while (0) + if (cnop == NULL) { +#ifndef MULTIBYTE while (len--) { chlen = CHLEN(curoff); last = scno; scno += chlen; TAB_RESET; } - else +#else + /* len designates bytes/line. */ + int mb; + int ml; + while (0 < len) { + mb = KEY_BLEN(sp, *p); + + /* singlebyte case */ + if (mb == 1) { + chlen = CHLEN(curoff); + last = scno; + scno += chlen; + len--; + /* p will be modified in CHLEN() */ + TAB_RESET; + continue; + } + + /* multibyte case */ + if (len < mb) + break; + ml = KEY_LEN(sp, *p); + 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 { + scno -= scno % sp->cols; + scno += chlen; + curoff = chlen; + } + } + } + } +#endif /*MULTIBYTE*/ + } else { +#ifndef MULTIBYTE for (cno = *cnop;; --cno) { chlen = CHLEN(curoff); last = scno; @@ -176,6 +228,57 @@ if (cno == 0) break; } +#else + int mb; + int ml; + cno = *cnop; + while (1) { + mb = KEY_BLEN(sp, *p); + + /* singlebyte case */ + if (mb == 1) { + chlen = CHLEN(curoff); + last = scno; + scno += chlen; + /* p will be modified in CHLEN() */ + TAB_RESET; + if (cno == 0) + break; + cno--; + continue; + } + + /* multibyte case */ + 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 { + scno -= scno % sp->cols; + scno += chlen; + curoff = chlen; + } + } + } + + if (cno < mb) + break; + cno -= mb; + } +#endif /*MULTIBYTE*/ + } /* Add the trailing '$' if the O_LIST option set. */ if (listset && cnop == NULL) @@ -209,9 +312,16 @@ /* 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,6 +338,13 @@ * * 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,8 +352,14 @@ 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,15 +376,70 @@ 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; + + while (len && scno < sp->cols) { + 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) + 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,7 +455,25 @@ /* 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,13 +489,29 @@ */ 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 }