/ Check-in [8390f652]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:i18n changes (CVS 201)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8390f6521af0f1c5cd0298cc4a1dfa3f092c1e15
User & Date: drh 2001-04-05 15:57:13
Context
2001-04-05
16:25
:-) (CVS 202) check-in: 04530e45 user: drh tags: trunk
15:57
i18n changes (CVS 201) check-in: 8390f652 user: drh tags: trunk
2001-04-04
21:30
Version 1.0.28 (CVS 475) check-in: 8b4c87e8 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.in.

   135    135   parse.h:	parse.c
   136    136   
   137    137   parse.c:	$(TOP)/src/parse.y lemon
   138    138   	cp $(TOP)/src/parse.y .
   139    139   	./lemon parse.y
   140    140   
   141    141   sqlite.h:	$(TOP)/src/sqlite.h.in 
   142         -	sed -e s/--VERS--/`cat ${TOP}/VERSION`/ $(TOP)/src/sqlite.h.in >sqlite.h
          142  +	sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
          143  +            -e s/--ENCODING--/@ENCODING@/ \
          144  +                 $(TOP)/src/sqlite.h.in >sqlite.h
   143    145   
   144    146   tokenize.o:	$(TOP)/src/tokenize.c $(HDR)
   145    147   	$(TCC) $(GDBM_FLAGS) -c $(TOP)/src/tokenize.c
   146    148   
   147    149   util.o:	$(TOP)/src/util.c $(HDR)
   148    150   	$(TCC) $(GDBM_FLAGS) -c $(TOP)/src/util.c
   149    151   

Changes to configure.

     9      9   
    10     10   # Defaults:
    11     11   ac_help=
    12     12   ac_default_prefix=/usr/local
    13     13   # Any additions from configure.in:
    14     14   ac_help="$ac_help
    15     15     --with-hints=FILE       Read configuration options from FILE"
           16  +ac_help="$ac_help
           17  +  --enable-utf8           Use UTF-8 encodings"
    16     18   
    17     19   # Initialize some variables set by options.
    18     20   # The variables have the same names as the options, with
    19     21   # dashes changed to underlines.
    20     22   build=NONE
    21     23   cache_file=./config.cache
    22     24   exec_prefix=NONE
................................................................................
   521    523   else
   522    524     ac_n= ac_c='\c' ac_t=
   523    525   fi
   524    526   
   525    527   
   526    528   
   527    529   # The following RCS revision string applies to configure.in
   528         -# $Revision: 1.8 $
          530  +# $Revision: 1.9 $
   529    531   
   530    532   #########
   531    533   # Make sure we are not building in a subdirectory of the source tree.
   532    534   #
   533    535   
   534    536   temp=`echo $srcdir | grep '[^./]'`
   535    537   
................................................................................
   596    598   # generate command-line programs that run on the build machine.
   597    599   #
   598    600   default_build_cflags="-g"
   599    601   if test "$config_BUILD_CC" = ""; then
   600    602     # Extract the first word of "gcc", so it can be a program name with args.
   601    603   set dummy gcc; ac_word=$2
   602    604   echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
   603         -echo "configure:604: checking for $ac_word" >&5
          605  +echo "configure:606: checking for $ac_word" >&5
   604    606   if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   605    607     echo $ac_n "(cached) $ac_c" 1>&6
   606    608   else
   607    609     if test -n "$CC"; then
   608    610     ac_cv_prog_CC="$CC" # Let the user override the test.
   609    611   else
   610    612     IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
................................................................................
   626    628     echo "$ac_t""no" 1>&6
   627    629   fi
   628    630   
   629    631   if test -z "$CC"; then
   630    632     # Extract the first word of "cc", so it can be a program name with args.
   631    633   set dummy cc; ac_word=$2
   632    634   echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
   633         -echo "configure:634: checking for $ac_word" >&5
          635  +echo "configure:636: checking for $ac_word" >&5
   634    636   if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   635    637     echo $ac_n "(cached) $ac_c" 1>&6
   636    638   else
   637    639     if test -n "$CC"; then
   638    640     ac_cv_prog_CC="$CC" # Let the user override the test.
   639    641   else
   640    642     IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
................................................................................
   677    679   
   678    680     if test -z "$CC"; then
   679    681       case "`uname -s`" in
   680    682       *win32* | *WIN32*)
   681    683         # Extract the first word of "cl", so it can be a program name with args.
   682    684   set dummy cl; ac_word=$2
   683    685   echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
   684         -echo "configure:685: checking for $ac_word" >&5
          686  +echo "configure:687: checking for $ac_word" >&5
   685    687   if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   686    688     echo $ac_n "(cached) $ac_c" 1>&6
   687    689   else
   688    690     if test -n "$CC"; then
   689    691     ac_cv_prog_CC="$CC" # Let the user override the test.
   690    692   else
   691    693     IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
................................................................................
   709    711    ;;
   710    712       esac
   711    713     fi
   712    714     test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
   713    715   fi
   714    716   
   715    717   echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
   716         -echo "configure:717: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
          718  +echo "configure:719: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
   717    719   
   718    720   ac_ext=c
   719    721   # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
   720    722   ac_cpp='$CPP $CPPFLAGS'
   721    723   ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
   722    724   ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
   723    725   cross_compiling=$ac_cv_prog_cc_cross
   724    726   
   725    727   cat > conftest.$ac_ext << EOF
   726    728   
   727         -#line 728 "configure"
          729  +#line 730 "configure"
   728    730   #include "confdefs.h"
   729    731   
   730    732   main(){return(0);}
   731    733   EOF
   732         -if { (eval echo configure:733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
          734  +if { (eval echo configure:735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   733    735     ac_cv_prog_cc_works=yes
   734    736     # If we can't run a trivial program, we are probably using a cross compiler.
   735    737     if (./conftest; exit) 2>/dev/null; then
   736    738       ac_cv_prog_cc_cross=no
   737    739     else
   738    740       ac_cv_prog_cc_cross=yes
   739    741     fi
................................................................................
   751    753   cross_compiling=$ac_cv_prog_cc_cross
   752    754   
   753    755   echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
   754    756   if test $ac_cv_prog_cc_works = no; then
   755    757     { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
   756    758   fi
   757    759   echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
   758         -echo "configure:759: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
          760  +echo "configure:761: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
   759    761   echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
   760    762   cross_compiling=$ac_cv_prog_cc_cross
   761    763   
   762    764   echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
   763         -echo "configure:764: checking whether we are using GNU C" >&5
          765  +echo "configure:766: checking whether we are using GNU C" >&5
   764    766   if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   765    767     echo $ac_n "(cached) $ac_c" 1>&6
   766    768   else
   767    769     cat > conftest.c <<EOF
   768    770   #ifdef __GNUC__
   769    771     yes;
   770    772   #endif
   771    773   EOF
   772         -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:773: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
          774  +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   773    775     ac_cv_prog_gcc=yes
   774    776   else
   775    777     ac_cv_prog_gcc=no
   776    778   fi
   777    779   fi
   778    780   
   779    781   echo "$ac_t""$ac_cv_prog_gcc" 1>&6
................................................................................
   784    786     GCC=
   785    787   fi
   786    788   
   787    789   ac_test_CFLAGS="${CFLAGS+set}"
   788    790   ac_save_CFLAGS="$CFLAGS"
   789    791   CFLAGS=
   790    792   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
   791         -echo "configure:792: checking whether ${CC-cc} accepts -g" >&5
          793  +echo "configure:794: checking whether ${CC-cc} accepts -g" >&5
   792    794   if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   793    795     echo $ac_n "(cached) $ac_c" 1>&6
   794    796   else
   795    797     echo 'void f(){}' > conftest.c
   796    798   if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
   797    799     ac_cv_prog_cc_g=yes
   798    800   else
................................................................................
   823    825       { echo "configure: error: unable to find a compiler for building build tools" 1>&2; exit 1; }
   824    826     fi
   825    827     BUILD_CC=$CC
   826    828     default_build_cflags=$CFLAGS
   827    829   else
   828    830     BUILD_CC=$config_BUILD_CC
   829    831     echo $ac_n "checking host compiler""... $ac_c" 1>&6
   830         -echo "configure:831: checking host compiler" >&5
          832  +echo "configure:833: checking host compiler" >&5
   831    833     CC=$BUILD_CC
   832    834     echo "$ac_t""$BUILD_CC" 1>&6
   833    835   fi
   834    836   echo $ac_n "checking switches for the host compiler""... $ac_c" 1>&6
   835         -echo "configure:836: checking switches for the host compiler" >&5
          837  +echo "configure:838: checking switches for the host compiler" >&5
   836    838   if test "$config_BUILD_CFLAGS" != ""; then
   837    839     CFLAGS=$config_BUILD_CFLAGS
   838    840     BUILD_CFLAGS=$config_BUILD_CFLAGS
   839    841   else
   840    842     BUILD_CFLAGS=$default_build_cflags
   841    843   fi
   842    844   echo "$ac_t""$BUILD_CFLAGS" 1>&6
................................................................................
   848    850   
   849    851   
   850    852   ##########
   851    853   # Locate a compiler that converts C code into *.o files that run on
   852    854   # the target machine.
   853    855   #
   854    856   echo $ac_n "checking target compiler""... $ac_c" 1>&6
   855         -echo "configure:856: checking target compiler" >&5
          857  +echo "configure:858: checking target compiler" >&5
   856    858   if test "$config_TARGET_CC" != ""; then
   857    859     TARGET_CC=$config_TARGET_CC
   858    860   else
   859    861     TARGET_CC=$BUILD_CC
   860    862   fi
   861    863   echo "$ac_t""$TARGET_CC" 1>&6
   862    864   echo $ac_n "checking switches on the target compiler""... $ac_c" 1>&6
   863         -echo "configure:864: checking switches on the target compiler" >&5
          865  +echo "configure:866: checking switches on the target compiler" >&5
   864    866   if test "$config_TARGET_CFLAGS" != ""; then
   865    867     TARGET_CFLAGS=$config_TARGET_CFLAGS
   866    868   else
   867    869     TARGET_CFLAGS=$BUILD_CFLAGS
   868    870   fi
   869    871   echo "$ac_t""$TARGET_CFLAGS" 1>&6
   870    872   echo $ac_n "checking target linker""... $ac_c" 1>&6
   871         -echo "configure:872: checking target linker" >&5
          873  +echo "configure:874: checking target linker" >&5
   872    874   if test "$config_TARGET_LINK" = ""; then
   873    875     TARGET_LINK=$TARGET_CC
   874    876   else
   875    877     TARGET_LINK=$config_TARGET_LINK
   876    878   fi
   877    879   echo "$ac_t""$TARGET_LINK" 1>&6
   878    880   echo $ac_n "checking switches on the target compiler""... $ac_c" 1>&6
   879         -echo "configure:880: checking switches on the target compiler" >&5
          881  +echo "configure:882: checking switches on the target compiler" >&5
   880    882   if test "$config_TARGET_TFLAGS" != ""; then
   881    883     TARGET_TFLAGS=$config_TARGET_TFLAGS
   882    884   else
   883    885     TARGET_TFLAGS=$BUILD_CFLAGS
   884    886   fi
   885    887   if test "$config_TARGET_RANLIB" != ""; then
   886    888     TARGET_RANLIB=$config_TARGET_RANLIB
   887    889   else
   888    890     # Extract the first word of "ranlib", so it can be a program name with args.
   889    891   set dummy ranlib; ac_word=$2
   890    892   echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
   891         -echo "configure:892: checking for $ac_word" >&5
          893  +echo "configure:894: checking for $ac_word" >&5
   892    894   if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   893    895     echo $ac_n "(cached) $ac_c" 1>&6
   894    896   else
   895    897     if test -n "$RANLIB"; then
   896    898     ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
   897    899   else
   898    900     IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
................................................................................
   930    932   
   931    933   
   932    934   
   933    935   # Set the $cross variable if we are cross-compiling.  Make
   934    936   # it 0 if we are not.
   935    937   #
   936    938   echo $ac_n "checking if host and target compilers are the same""... $ac_c" 1>&6
   937         -echo "configure:938: checking if host and target compilers are the same" >&5
          939  +echo "configure:940: checking if host and target compilers are the same" >&5
   938    940   if test "$BUILD_CC" = "$TARGET_CC"; then
   939    941     cross=0
   940    942     echo "$ac_t""yes" 1>&6
   941    943   else
   942    944     cross=1
   943    945     echo "$ac_t""no" 1>&6
   944    946   fi
          947  +
          948  +##########
          949  +# Are we using UTF-8 or iso8859 encodings?
          950  +#
          951  +# Check whether --enable-utf8 or --disable-utf8 was given.
          952  +if test "${enable_utf8+set}" = set; then
          953  +  enableval="$enable_utf8"
          954  +  :
          955  +else
          956  +  enable_utf8=no
          957  +fi
          958  +
          959  +echo $ac_n "checking character encoding""... $ac_c" 1>&6
          960  +echo "configure:961: checking character encoding" >&5
          961  +if test "$enable_utf8" = "no"; then
          962  +  ENCODING=ISO8859
          963  +  echo "$ac_t""iso8859" 1>&6
          964  +else
          965  +  ENCODING=UTF8
          966  +  echo "$ac_t""UTF-8" 1>&6
          967  +fi
          968  +
   945    969   
   946    970   ###########
   947    971   # Lots of things are different if we are compiling for Windows using
   948    972   # the CYGWIN environment.  So check for that special case and handle
   949    973   # things accordingly.
   950    974   #
   951    975   echo $ac_n "checking if executables have the .exe suffix""... $ac_c" 1>&6
   952         -echo "configure:953: checking if executables have the .exe suffix" >&5
          976  +echo "configure:977: checking if executables have the .exe suffix" >&5
   953    977   if test "$config_BUILD_EXEEXT" = ".exe"; then
   954    978     CYGWIN=yes
   955    979     echo "$ac_t""yes" 1>&6
   956    980   else
   957    981     echo "$ac_t""unknown" 1>&6
   958    982   fi
   959    983   if test "$CYGWIN" != "yes"; then
   960    984     echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
   961         -echo "configure:962: checking for Cygwin environment" >&5
          985  +echo "configure:986: checking for Cygwin environment" >&5
   962    986   if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   963    987     echo $ac_n "(cached) $ac_c" 1>&6
   964    988   else
   965    989     cat > conftest.$ac_ext <<EOF
   966         -#line 967 "configure"
          990  +#line 991 "configure"
   967    991   #include "confdefs.h"
   968    992   
   969    993   int main() {
   970    994   
   971    995   #ifndef __CYGWIN__
   972    996   #define __CYGWIN__ __CYGWIN32__
   973    997   #endif
   974    998   return __CYGWIN__;
   975    999   ; return 0; }
   976   1000   EOF
   977         -if { (eval echo configure:978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         1001  +if { (eval echo configure:1002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   978   1002     rm -rf conftest*
   979   1003     ac_cv_cygwin=yes
   980   1004   else
   981   1005     echo "configure: failed program was:" >&5
   982   1006     cat conftest.$ac_ext >&5
   983   1007     rm -rf conftest*
   984   1008     ac_cv_cygwin=no
................................................................................
  1034   1058     TARGET_TCL_LIBS="$config_TARGET_TCL_LIBS"
  1035   1059   else
  1036   1060     if test "$with_tcl" != ""; then
  1037   1061       extra=`echo $with_tcl/$tclsubdir/libtcl8*.a`
  1038   1062     fi
  1039   1063     CC=$TARGET_CC
  1040   1064     echo $ac_n "checking for sin""... $ac_c" 1>&6
  1041         -echo "configure:1042: checking for sin" >&5
         1065  +echo "configure:1066: checking for sin" >&5
  1042   1066   if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then
  1043   1067     echo $ac_n "(cached) $ac_c" 1>&6
  1044   1068   else
  1045   1069     cat > conftest.$ac_ext <<EOF
  1046         -#line 1047 "configure"
         1070  +#line 1071 "configure"
  1047   1071   #include "confdefs.h"
  1048   1072   /* System header to define __stub macros and hopefully few prototypes,
  1049   1073       which can conflict with char sin(); below.  */
  1050   1074   #include <assert.h>
  1051   1075   /* Override any gcc2 internal prototype to avoid an error.  */
  1052   1076   /* We use char because int might match the return type of a gcc2
  1053   1077       builtin and then its argument prototype would still apply.  */
................................................................................
  1062   1086   choke me
  1063   1087   #else
  1064   1088   sin();
  1065   1089   #endif
  1066   1090   
  1067   1091   ; return 0; }
  1068   1092   EOF
  1069         -if { (eval echo configure:1070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         1093  +if { (eval echo configure:1094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  1070   1094     rm -rf conftest*
  1071   1095     eval "ac_cv_func_sin=yes"
  1072   1096   else
  1073   1097     echo "configure: failed program was:" >&5
  1074   1098     cat conftest.$ac_ext >&5
  1075   1099     rm -rf conftest*
  1076   1100     eval "ac_cv_func_sin=no"
................................................................................
  1083   1107     LIBS=""
  1084   1108   else
  1085   1109     echo "$ac_t""no" 1>&6
  1086   1110   LIBS="-lm"
  1087   1111   fi
  1088   1112   
  1089   1113     echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
  1090         -echo "configure:1091: checking for dlopen in -ldl" >&5
         1114  +echo "configure:1115: checking for dlopen in -ldl" >&5
  1091   1115   ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
  1092   1116   if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  1093   1117     echo $ac_n "(cached) $ac_c" 1>&6
  1094   1118   else
  1095   1119     ac_save_LIBS="$LIBS"
  1096   1120   LIBS="-ldl  $LIBS"
  1097   1121   cat > conftest.$ac_ext <<EOF
  1098         -#line 1099 "configure"
         1122  +#line 1123 "configure"
  1099   1123   #include "confdefs.h"
  1100   1124   /* Override any gcc2 internal prototype to avoid an error.  */
  1101   1125   /* We use char because int might match the return type of a gcc2
  1102   1126       builtin and then its argument prototype would still apply.  */
  1103   1127   char dlopen();
  1104   1128   
  1105   1129   int main() {
  1106   1130   dlopen()
  1107   1131   ; return 0; }
  1108   1132   EOF
  1109         -if { (eval echo configure:1110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         1133  +if { (eval echo configure:1134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  1110   1134     rm -rf conftest*
  1111   1135     eval "ac_cv_lib_$ac_lib_var=yes"
  1112   1136   else
  1113   1137     echo "configure: failed program was:" >&5
  1114   1138     cat conftest.$ac_ext >&5
  1115   1139     rm -rf conftest*
  1116   1140     eval "ac_cv_lib_$ac_lib_var=no"
................................................................................
  1136   1160     otherlibs=$LIBS
  1137   1161     if test "$extra" != ""; then
  1138   1162       LIBS=$extra
  1139   1163     else 
  1140   1164       LIBS=""
  1141   1165       
  1142   1166   echo $ac_n "checking for library containing Tcl_Init""... $ac_c" 1>&6
  1143         -echo "configure:1144: checking for library containing Tcl_Init" >&5
         1167  +echo "configure:1168: checking for library containing Tcl_Init" >&5
  1144   1168   if eval "test \"`echo '$''{'ac_cv_search_Tcl_Init'+set}'`\" = set"; then
  1145   1169     echo $ac_n "(cached) $ac_c" 1>&6
  1146   1170   else
  1147   1171     ac_func_search_save_LIBS="$LIBS"
  1148   1172   ac_cv_search_Tcl_Init="no"
  1149   1173   cat > conftest.$ac_ext <<EOF
  1150         -#line 1151 "configure"
         1174  +#line 1175 "configure"
  1151   1175   #include "confdefs.h"
  1152   1176   /* Override any gcc2 internal prototype to avoid an error.  */
  1153   1177   /* We use char because int might match the return type of a gcc2
  1154   1178       builtin and then its argument prototype would still apply.  */
  1155   1179   char Tcl_Init();
  1156   1180   
  1157   1181   int main() {
  1158   1182   Tcl_Init()
  1159   1183   ; return 0; }
  1160   1184   EOF
  1161         -if { (eval echo configure:1162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         1185  +if { (eval echo configure:1186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  1162   1186     rm -rf conftest*
  1163   1187     ac_cv_search_Tcl_Init="none required"
  1164   1188   else
  1165   1189     echo "configure: failed program was:" >&5
  1166   1190     cat conftest.$ac_ext >&5
  1167   1191   fi
  1168   1192   rm -f conftest*
  1169   1193   test "$ac_cv_search_Tcl_Init" = "no" && for i in         tcl8.4 tcl8.3 tcl8.2 tcl8.1 tcl8.0 tcl80 tcl; do
  1170   1194   LIBS="-l$i $otherlibs $ac_func_search_save_LIBS"
  1171   1195   cat > conftest.$ac_ext <<EOF
  1172         -#line 1173 "configure"
         1196  +#line 1197 "configure"
  1173   1197   #include "confdefs.h"
  1174   1198   /* Override any gcc2 internal prototype to avoid an error.  */
  1175   1199   /* We use char because int might match the return type of a gcc2
  1176   1200       builtin and then its argument prototype would still apply.  */
  1177   1201   char Tcl_Init();
  1178   1202   
  1179   1203   int main() {
  1180   1204   Tcl_Init()
  1181   1205   ; return 0; }
  1182   1206   EOF
  1183         -if { (eval echo configure:1184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         1207  +if { (eval echo configure:1208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  1184   1208     rm -rf conftest*
  1185   1209     ac_cv_search_Tcl_Init="-l$i"
  1186   1210   break
  1187   1211   else
  1188   1212     echo "configure: failed program was:" >&5
  1189   1213     cat conftest.$ac_ext >&5
  1190   1214   fi
................................................................................
  1205   1229   fi
  1206   1230   
  1207   1231   
  1208   1232   ##########
  1209   1233   # Figure out where to get the TCL header files.
  1210   1234   #
  1211   1235   echo $ac_n "checking TCL header files""... $ac_c" 1>&6
  1212         -echo "configure:1213: checking TCL header files" >&5
         1236  +echo "configure:1237: checking TCL header files" >&5
  1213   1237   found=no
  1214   1238   if test "$config_TARGET_TCL_INC" != ""; then
  1215   1239     TARGET_TCL_INC=$config_TARGET_TCL_INC
  1216   1240     found=yes
  1217   1241   else
  1218   1242     if test "$with_tcl" != ""; then
  1219   1243       TARGET_TCL_INC="-I$with_tcl/generic -I$with_tcl/$tclsubdir"
................................................................................
  1224   1248     fi
  1225   1249   fi
  1226   1250   if test "$found" = "yes"; then
  1227   1251     echo "$ac_t""$TARGET_TCL_INC" 1>&6
  1228   1252   else
  1229   1253     echo "$ac_t""not specified: still searching..." 1>&6
  1230   1254     echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
  1231         -echo "configure:1232: checking how to run the C preprocessor" >&5
         1255  +echo "configure:1256: checking how to run the C preprocessor" >&5
  1232   1256   # On Suns, sometimes $CPP names a directory.
  1233   1257   if test -n "$CPP" && test -d "$CPP"; then
  1234   1258     CPP=
  1235   1259   fi
  1236   1260   if test -z "$CPP"; then
  1237   1261   if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
  1238   1262     echo $ac_n "(cached) $ac_c" 1>&6
................................................................................
  1239   1263   else
  1240   1264       # This must be in double quotes, not single quotes, because CPP may get
  1241   1265     # substituted into the Makefile and "${CC-cc}" will confuse make.
  1242   1266     CPP="${CC-cc} -E"
  1243   1267     # On the NeXT, cc -E runs the code through the compiler's parser,
  1244   1268     # not just through cpp.
  1245   1269     cat > conftest.$ac_ext <<EOF
  1246         -#line 1247 "configure"
         1270  +#line 1271 "configure"
  1247   1271   #include "confdefs.h"
  1248   1272   #include <assert.h>
  1249   1273   Syntax Error
  1250   1274   EOF
  1251   1275   ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  1252         -{ (eval echo configure:1253: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
         1276  +{ (eval echo configure:1277: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  1253   1277   ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  1254   1278   if test -z "$ac_err"; then
  1255   1279     :
  1256   1280   else
  1257   1281     echo "$ac_err" >&5
  1258   1282     echo "configure: failed program was:" >&5
  1259   1283     cat conftest.$ac_ext >&5
  1260   1284     rm -rf conftest*
  1261   1285     CPP="${CC-cc} -E -traditional-cpp"
  1262   1286     cat > conftest.$ac_ext <<EOF
  1263         -#line 1264 "configure"
         1287  +#line 1288 "configure"
  1264   1288   #include "confdefs.h"
  1265   1289   #include <assert.h>
  1266   1290   Syntax Error
  1267   1291   EOF
  1268   1292   ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  1269         -{ (eval echo configure:1270: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
         1293  +{ (eval echo configure:1294: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  1270   1294   ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  1271   1295   if test -z "$ac_err"; then
  1272   1296     :
  1273   1297   else
  1274   1298     echo "$ac_err" >&5
  1275   1299     echo "configure: failed program was:" >&5
  1276   1300     cat conftest.$ac_ext >&5
  1277   1301     rm -rf conftest*
  1278   1302     CPP="${CC-cc} -nologo -E"
  1279   1303     cat > conftest.$ac_ext <<EOF
  1280         -#line 1281 "configure"
         1304  +#line 1305 "configure"
  1281   1305   #include "confdefs.h"
  1282   1306   #include <assert.h>
  1283   1307   Syntax Error
  1284   1308   EOF
  1285   1309   ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  1286         -{ (eval echo configure:1287: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
         1310  +{ (eval echo configure:1311: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  1287   1311   ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  1288   1312   if test -z "$ac_err"; then
  1289   1313     :
  1290   1314   else
  1291   1315     echo "$ac_err" >&5
  1292   1316     echo "configure: failed program was:" >&5
  1293   1317     cat conftest.$ac_ext >&5
................................................................................
  1305   1329   else
  1306   1330     ac_cv_prog_CPP="$CPP"
  1307   1331   fi
  1308   1332   echo "$ac_t""$CPP" 1>&6
  1309   1333   
  1310   1334   ac_safe=`echo "tcl.h" | sed 'y%./+-%__p_%'`
  1311   1335   echo $ac_n "checking for tcl.h""... $ac_c" 1>&6
  1312         -echo "configure:1313: checking for tcl.h" >&5
         1336  +echo "configure:1337: checking for tcl.h" >&5
  1313   1337   if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  1314   1338     echo $ac_n "(cached) $ac_c" 1>&6
  1315   1339   else
  1316   1340     cat > conftest.$ac_ext <<EOF
  1317         -#line 1318 "configure"
         1341  +#line 1342 "configure"
  1318   1342   #include "confdefs.h"
  1319   1343   #include <tcl.h>
  1320   1344   EOF
  1321   1345   ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  1322         -{ (eval echo configure:1323: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
         1346  +{ (eval echo configure:1347: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  1323   1347   ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  1324   1348   if test -z "$ac_err"; then
  1325   1349     rm -rf conftest*
  1326   1350     eval "ac_cv_header_$ac_safe=yes"
  1327   1351   else
  1328   1352     echo "$ac_err" >&5
  1329   1353     echo "configure: failed program was:" >&5
................................................................................
  1342   1366   
  1343   1367   fi
  1344   1368   if test "$found" = "no"; then
  1345   1369     for dir in /usr/local /usr/X11 /usr/X11R6 /usr/pkg /usr/contrib /usr; do
  1346   1370       
  1347   1371   ac_safe=`echo "$dir/include/tcl.h" | sed 'y%./+-%__p_%'`
  1348   1372   echo $ac_n "checking for $dir/include/tcl.h""... $ac_c" 1>&6
  1349         -echo "configure:1350: checking for $dir/include/tcl.h" >&5
         1373  +echo "configure:1374: checking for $dir/include/tcl.h" >&5
  1350   1374   if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
  1351   1375     echo $ac_n "(cached) $ac_c" 1>&6
  1352   1376   else
  1353   1377     if test "$cross_compiling" = yes; then
  1354   1378       { echo "configure: error: Cannot check for file existence when cross compiling" 1>&2; exit 1; }
  1355   1379   else
  1356   1380     if test -r $dir/include/tcl.h; then
................................................................................
  1386   1410   if test "$config_TARGET_GDBM_LIBS" != ""; then
  1387   1411     TARGET_GDBM_LIBS="$config_TARGET_GDBM_LIBS"
  1388   1412   else
  1389   1413     CC=$TARGET_CC
  1390   1414     LIBS=""
  1391   1415     
  1392   1416   echo $ac_n "checking for library containing gdbm_open""... $ac_c" 1>&6
  1393         -echo "configure:1394: checking for library containing gdbm_open" >&5
         1417  +echo "configure:1418: checking for library containing gdbm_open" >&5
  1394   1418   if eval "test \"`echo '$''{'ac_cv_search_gdbm_open'+set}'`\" = set"; then
  1395   1419     echo $ac_n "(cached) $ac_c" 1>&6
  1396   1420   else
  1397   1421     ac_func_search_save_LIBS="$LIBS"
  1398   1422   ac_cv_search_gdbm_open="no"
  1399   1423   cat > conftest.$ac_ext <<EOF
  1400         -#line 1401 "configure"
         1424  +#line 1425 "configure"
  1401   1425   #include "confdefs.h"
  1402   1426   /* Override any gcc2 internal prototype to avoid an error.  */
  1403   1427   /* We use char because int might match the return type of a gcc2
  1404   1428       builtin and then its argument prototype would still apply.  */
  1405   1429   char gdbm_open();
  1406   1430   
  1407   1431   int main() {
  1408   1432   gdbm_open()
  1409   1433   ; return 0; }
  1410   1434   EOF
  1411         -if { (eval echo configure:1412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         1435  +if { (eval echo configure:1436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  1412   1436     rm -rf conftest*
  1413   1437     ac_cv_search_gdbm_open="none required"
  1414   1438   else
  1415   1439     echo "configure: failed program was:" >&5
  1416   1440     cat conftest.$ac_ext >&5
  1417   1441   fi
  1418   1442   rm -f conftest*
  1419   1443   test "$ac_cv_search_gdbm_open" = "no" && for i in gdbm; do
  1420   1444   LIBS="-l$i  $ac_func_search_save_LIBS"
  1421   1445   cat > conftest.$ac_ext <<EOF
  1422         -#line 1423 "configure"
         1446  +#line 1447 "configure"
  1423   1447   #include "confdefs.h"
  1424   1448   /* Override any gcc2 internal prototype to avoid an error.  */
  1425   1449   /* We use char because int might match the return type of a gcc2
  1426   1450       builtin and then its argument prototype would still apply.  */
  1427   1451   char gdbm_open();
  1428   1452   
  1429   1453   int main() {
  1430   1454   gdbm_open()
  1431   1455   ; return 0; }
  1432   1456   EOF
  1433         -if { (eval echo configure:1434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         1457  +if { (eval echo configure:1458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  1434   1458     rm -rf conftest*
  1435   1459     ac_cv_search_gdbm_open="-l$i"
  1436   1460   break
  1437   1461   else
  1438   1462     echo "configure: failed program was:" >&5
  1439   1463     cat conftest.$ac_ext >&5
  1440   1464   fi
................................................................................
  1454   1478   fi
  1455   1479   
  1456   1480   
  1457   1481   ##########
  1458   1482   # Figure out where to get the GDBM header files.
  1459   1483   #
  1460   1484   echo $ac_n "checking GDBM header files""... $ac_c" 1>&6
  1461         -echo "configure:1462: checking GDBM header files" >&5
         1485  +echo "configure:1486: checking GDBM header files" >&5
  1462   1486   found=no
  1463   1487   if test "$config_TARGET_GDBM_INC" != ""; then
  1464   1488     TARGET_GDBM_INC=$config_TARGET_GDBM_INC
  1465   1489     found=yes
  1466   1490   fi
  1467   1491   if test "$found" = "yes"; then
  1468   1492     echo "$ac_t""$TARGET_GDBM_INC" 1>&6
  1469   1493   else
  1470   1494     echo "$ac_t""not specified: still searching..." 1>&6
  1471   1495     ac_safe=`echo "gdbm.h" | sed 'y%./+-%__p_%'`
  1472   1496   echo $ac_n "checking for gdbm.h""... $ac_c" 1>&6
  1473         -echo "configure:1474: checking for gdbm.h" >&5
         1497  +echo "configure:1498: checking for gdbm.h" >&5
  1474   1498   if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  1475   1499     echo $ac_n "(cached) $ac_c" 1>&6
  1476   1500   else
  1477   1501     cat > conftest.$ac_ext <<EOF
  1478         -#line 1479 "configure"
         1502  +#line 1503 "configure"
  1479   1503   #include "confdefs.h"
  1480   1504   #include <gdbm.h>
  1481   1505   EOF
  1482   1506   ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  1483         -{ (eval echo configure:1484: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
         1507  +{ (eval echo configure:1508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  1484   1508   ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  1485   1509   if test -z "$ac_err"; then
  1486   1510     rm -rf conftest*
  1487   1511     eval "ac_cv_header_$ac_safe=yes"
  1488   1512   else
  1489   1513     echo "$ac_err" >&5
  1490   1514     echo "configure: failed program was:" >&5
................................................................................
  1503   1527   
  1504   1528   fi
  1505   1529   if test "$found" = "no"; then
  1506   1530     for dir in /usr/local /usr/pkg /usr/contrib; do
  1507   1531       
  1508   1532   ac_safe=`echo "$dir/include/gdbm.h" | sed 'y%./+-%__p_%'`
  1509   1533   echo $ac_n "checking for $dir/include/gdbm.h""... $ac_c" 1>&6
  1510         -echo "configure:1511: checking for $dir/include/gdbm.h" >&5
         1534  +echo "configure:1535: checking for $dir/include/gdbm.h" >&5
  1511   1535   if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
  1512   1536     echo $ac_n "(cached) $ac_c" 1>&6
  1513   1537   else
  1514   1538     if test "$cross_compiling" = yes; then
  1515   1539       { echo "configure: error: Cannot check for file existence when cross compiling" 1>&2; exit 1; }
  1516   1540   else
  1517   1541     if test -r $dir/include/gdbm.h; then
................................................................................
  1544   1568   if test "$config_TARGET_READLINE_LIBS" != ""; then
  1545   1569     TARGET_READLINE_LIBS="$config_TARGET_READLINE_LIBS"
  1546   1570   else
  1547   1571     CC=$TARGET_CC
  1548   1572     LIBS=""
  1549   1573     
  1550   1574   echo $ac_n "checking for library containing readline""... $ac_c" 1>&6
  1551         -echo "configure:1552: checking for library containing readline" >&5
         1575  +echo "configure:1576: checking for library containing readline" >&5
  1552   1576   if eval "test \"`echo '$''{'ac_cv_search_readline'+set}'`\" = set"; then
  1553   1577     echo $ac_n "(cached) $ac_c" 1>&6
  1554   1578   else
  1555   1579     ac_func_search_save_LIBS="$LIBS"
  1556   1580   ac_cv_search_readline="no"
  1557   1581   cat > conftest.$ac_ext <<EOF
  1558         -#line 1559 "configure"
         1582  +#line 1583 "configure"
  1559   1583   #include "confdefs.h"
  1560   1584   /* Override any gcc2 internal prototype to avoid an error.  */
  1561   1585   /* We use char because int might match the return type of a gcc2
  1562   1586       builtin and then its argument prototype would still apply.  */
  1563   1587   char readline();
  1564   1588   
  1565   1589   int main() {
  1566   1590   readline()
  1567   1591   ; return 0; }
  1568   1592   EOF
  1569         -if { (eval echo configure:1570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         1593  +if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  1570   1594     rm -rf conftest*
  1571   1595     ac_cv_search_readline="none required"
  1572   1596   else
  1573   1597     echo "configure: failed program was:" >&5
  1574   1598     cat conftest.$ac_ext >&5
  1575   1599   fi
  1576   1600   rm -f conftest*
  1577   1601   test "$ac_cv_search_readline" = "no" && for i in readline; do
  1578   1602   LIBS="-l$i  $ac_func_search_save_LIBS"
  1579   1603   cat > conftest.$ac_ext <<EOF
  1580         -#line 1581 "configure"
         1604  +#line 1605 "configure"
  1581   1605   #include "confdefs.h"
  1582   1606   /* Override any gcc2 internal prototype to avoid an error.  */
  1583   1607   /* We use char because int might match the return type of a gcc2
  1584   1608       builtin and then its argument prototype would still apply.  */
  1585   1609   char readline();
  1586   1610   
  1587   1611   int main() {
  1588   1612   readline()
  1589   1613   ; return 0; }
  1590   1614   EOF
  1591         -if { (eval echo configure:1592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         1615  +if { (eval echo configure:1616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  1592   1616     rm -rf conftest*
  1593   1617     ac_cv_search_readline="-l$i"
  1594   1618   break
  1595   1619   else
  1596   1620     echo "configure: failed program was:" >&5
  1597   1621     cat conftest.$ac_ext >&5
  1598   1622   fi
................................................................................
  1612   1636   fi
  1613   1637   
  1614   1638   
  1615   1639   ##########
  1616   1640   # Figure out where to get the READLINE header files.
  1617   1641   #
  1618   1642   echo $ac_n "checking readline header files""... $ac_c" 1>&6
  1619         -echo "configure:1620: checking readline header files" >&5
         1643  +echo "configure:1644: checking readline header files" >&5
  1620   1644   found=no
  1621   1645   if test "$config_TARGET_READLINE_INC" != ""; then
  1622   1646     TARGET_READLINE_INC=$config_TARGET_READLINE_INC
  1623   1647     found=yes
  1624   1648   fi
  1625   1649   if test "$found" = "yes"; then
  1626   1650     echo "$ac_t""$TARGET_READLINE_INC" 1>&6
  1627   1651   else
  1628   1652     echo "$ac_t""not specified: still searching..." 1>&6
  1629   1653     ac_safe=`echo "readline.h" | sed 'y%./+-%__p_%'`
  1630   1654   echo $ac_n "checking for readline.h""... $ac_c" 1>&6
  1631         -echo "configure:1632: checking for readline.h" >&5
         1655  +echo "configure:1656: checking for readline.h" >&5
  1632   1656   if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  1633   1657     echo $ac_n "(cached) $ac_c" 1>&6
  1634   1658   else
  1635   1659     cat > conftest.$ac_ext <<EOF
  1636         -#line 1637 "configure"
         1660  +#line 1661 "configure"
  1637   1661   #include "confdefs.h"
  1638   1662   #include <readline.h>
  1639   1663   EOF
  1640   1664   ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
  1641         -{ (eval echo configure:1642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
         1665  +{ (eval echo configure:1666: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  1642   1666   ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  1643   1667   if test -z "$ac_err"; then
  1644   1668     rm -rf conftest*
  1645   1669     eval "ac_cv_header_$ac_safe=yes"
  1646   1670   else
  1647   1671     echo "$ac_err" >&5
  1648   1672     echo "configure: failed program was:" >&5
................................................................................
  1661   1685   
  1662   1686   fi
  1663   1687   if test "$found" = "no"; then
  1664   1688     for dir in /usr /usr/local /usr/local/readline /usr/contrib; do
  1665   1689       
  1666   1690   ac_safe=`echo "$dir/include/readline.h" | sed 'y%./+-%__p_%'`
  1667   1691   echo $ac_n "checking for $dir/include/readline.h""... $ac_c" 1>&6
  1668         -echo "configure:1669: checking for $dir/include/readline.h" >&5
         1692  +echo "configure:1693: checking for $dir/include/readline.h" >&5
  1669   1693   if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
  1670   1694     echo $ac_n "(cached) $ac_c" 1>&6
  1671   1695   else
  1672   1696     if test "$cross_compiling" = yes; then
  1673   1697       { echo "configure: error: Cannot check for file existence when cross compiling" 1>&2; exit 1; }
  1674   1698   else
  1675   1699     if test -r $dir/include/readline.h; then
................................................................................
  1690   1714       if test "$found" = "yes"; then
  1691   1715         TARGET_READLINE_INC="-I$dir/include"
  1692   1716         break
  1693   1717       fi
  1694   1718       
  1695   1719   ac_safe=`echo "$dir/include/readline/readline.h" | sed 'y%./+-%__p_%'`
  1696   1720   echo $ac_n "checking for $dir/include/readline/readline.h""... $ac_c" 1>&6
  1697         -echo "configure:1698: checking for $dir/include/readline/readline.h" >&5
         1721  +echo "configure:1722: checking for $dir/include/readline/readline.h" >&5
  1698   1722   if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
  1699   1723     echo $ac_n "(cached) $ac_c" 1>&6
  1700   1724   else
  1701   1725     if test "$cross_compiling" = yes; then
  1702   1726       { echo "configure: error: Cannot check for file existence when cross compiling" 1>&2; exit 1; }
  1703   1727   else
  1704   1728     if test -r $dir/include/readline/readline.h; then
................................................................................
  1734   1758   
  1735   1759   
  1736   1760   
  1737   1761   #########
  1738   1762   # Figure out whether or not we have a "usleep()" function.
  1739   1763   #
  1740   1764   echo $ac_n "checking for usleep""... $ac_c" 1>&6
  1741         -echo "configure:1742: checking for usleep" >&5
         1765  +echo "configure:1766: checking for usleep" >&5
  1742   1766   if eval "test \"`echo '$''{'ac_cv_func_usleep'+set}'`\" = set"; then
  1743   1767     echo $ac_n "(cached) $ac_c" 1>&6
  1744   1768   else
  1745   1769     cat > conftest.$ac_ext <<EOF
  1746         -#line 1747 "configure"
         1770  +#line 1771 "configure"
  1747   1771   #include "confdefs.h"
  1748   1772   /* System header to define __stub macros and hopefully few prototypes,
  1749   1773       which can conflict with char usleep(); below.  */
  1750   1774   #include <assert.h>
  1751   1775   /* Override any gcc2 internal prototype to avoid an error.  */
  1752   1776   /* We use char because int might match the return type of a gcc2
  1753   1777       builtin and then its argument prototype would still apply.  */
................................................................................
  1762   1786   choke me
  1763   1787   #else
  1764   1788   usleep();
  1765   1789   #endif
  1766   1790   
  1767   1791   ; return 0; }
  1768   1792   EOF
  1769         -if { (eval echo configure:1770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         1793  +if { (eval echo configure:1794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  1770   1794     rm -rf conftest*
  1771   1795     eval "ac_cv_func_usleep=yes"
  1772   1796   else
  1773   1797     echo "configure: failed program was:" >&5
  1774   1798     cat conftest.$ac_ext >&5
  1775   1799     rm -rf conftest*
  1776   1800     eval "ac_cv_func_usleep=no"
................................................................................
  1941   1965   s%@RANLIB@%$RANLIB%g
  1942   1966   s%@TARGET_CC@%$TARGET_CC%g
  1943   1967   s%@TARGET_CFLAGS@%$TARGET_CFLAGS%g
  1944   1968   s%@TARGET_LINK@%$TARGET_LINK%g
  1945   1969   s%@TARGET_LFLAGS@%$TARGET_LFLAGS%g
  1946   1970   s%@TARGET_RANLIB@%$TARGET_RANLIB%g
  1947   1971   s%@TARGET_AR@%$TARGET_AR%g
         1972  +s%@ENCODING@%$ENCODING%g
  1948   1973   s%@BUILD_EXEEXT@%$BUILD_EXEEXT%g
  1949   1974   s%@OS_UNIX@%$OS_UNIX%g
  1950   1975   s%@OS_WIN@%$OS_WIN%g
  1951   1976   s%@TARGET_EXEEXT@%$TARGET_EXEEXT%g
  1952   1977   s%@TARGET_LIBS@%$TARGET_LIBS%g
  1953   1978   s%@TARGET_TCL_LIBS@%$TARGET_TCL_LIBS%g
  1954   1979   s%@CPP@%$CPP%g

Changes to configure.in.

   147    147   # the corresponding code.
   148    148   #
   149    149   AC_INIT(src/sqlite.h.in)
   150    150   
   151    151   dnl Put the RCS revision string after AC_INIT so that it will also
   152    152   dnl show in in configure.
   153    153   # The following RCS revision string applies to configure.in
   154         -# $Revision: 1.8 $
          154  +# $Revision: 1.9 $
   155    155   
   156    156   #########
   157    157   # Make sure we are not building in a subdirectory of the source tree.
   158    158   #
   159    159   changequote(<<<,>>>)
   160    160   temp=`echo $srcdir | grep '[^./]'`
   161    161   changequote([,])
................................................................................
   305    305     cross=0
   306    306     AC_MSG_RESULT(yes)
   307    307   else
   308    308     cross=1
   309    309     AC_MSG_RESULT(no)
   310    310   fi
   311    311   
          312  +##########
          313  +# Are we using UTF-8 or iso8859 encodings?
          314  +#
          315  +AC_ARG_ENABLE(utf8, 
          316  +[  --enable-utf8           Use UTF-8 encodings],,enable_utf8=no)
          317  +AC_MSG_CHECKING([character encoding])
          318  +if test "$enable_utf8" = "no"; then
          319  +  ENCODING=ISO8859
          320  +  AC_MSG_RESULT([iso8859])
          321  +else
          322  +  ENCODING=UTF8
          323  +  AC_MSG_RESULT([UTF-8])
          324  +fi
          325  +AC_SUBST(ENCODING)
          326  +
   312    327   ###########
   313    328   # Lots of things are different if we are compiling for Windows using
   314    329   # the CYGWIN environment.  So check for that special case and handle
   315    330   # things accordingly.
   316    331   #
   317    332   AC_MSG_CHECKING([if executables have the .exe suffix])
   318    333   if test "$config_BUILD_EXEEXT" = ".exe"; then

Changes to src/main.c.

    22     22   **
    23     23   *************************************************************************
    24     24   ** Main file for the SQLite library.  The routines in this file
    25     25   ** implement the programmer interface to the library.  Routines in
    26     26   ** other files are for internal use by SQLite and should not be
    27     27   ** accessed by users of the library.
    28     28   **
    29         -** $Id: main.c,v 1.25 2001/02/11 16:56:24 drh Exp $
           29  +** $Id: main.c,v 1.26 2001/04/05 15:57:13 drh Exp $
    30     30   */
    31     31   #include "sqliteInt.h"
    32     32   #include <unistd.h>
    33     33   
    34     34   /*
    35     35   ** This is the callback routine for the code that initializes the
    36     36   ** database.  Each callback contains text of a CREATE TABLE or
................................................................................
   186    186   }
   187    187   
   188    188   /*
   189    189   ** The version of the library
   190    190   */
   191    191   const char sqlite_version[] = SQLITE_VERSION;
   192    192   
          193  +/*
          194  +** Does the library expect data to be encoded as UTF-8 or iso8859?  The
          195  +** following global constant always lets us know.
          196  +*/
          197  +#ifdef SQLITE_UTF8
          198  +char sqlite_encoding[] = "UTF-8";
          199  +#else
          200  +char sqlite_encoding[] = "iso8859";
          201  +#endif
          202  +
   193    203   /*
   194    204   ** Open a new SQLite database.  Construct an "sqlite" structure to define
   195    205   ** the state of this database and return a pointer to that structure.
   196    206   **
   197    207   ** An attempt is made to initialize the in-memory data structures that
   198    208   ** hold the database schema.  But if this fails (because the schema file
   199    209   ** is locked) then that step is deferred until the first call to

Changes to src/sqlite.h.in.

    20     20   **   drh@hwaci.com
    21     21   **   http://www.hwaci.com/drh/
    22     22   **
    23     23   *************************************************************************
    24     24   ** This header file defines the interface that the sqlite library
    25     25   ** presents to client programs.
    26     26   **
    27         -** @(#) $Id: sqlite.h.in,v 1.10 2001/04/03 16:53:22 drh Exp $
           27  +** @(#) $Id: sqlite.h.in,v 1.11 2001/04/05 15:57:13 drh Exp $
    28     28   */
    29     29   #ifndef _SQLITE_H_
    30     30   #define _SQLITE_H_
    31     31   #include <stdarg.h>     /* Needed for the definition of va_list */
    32     32   
    33     33   /*
    34     34   ** The version of the SQLite library.
................................................................................
    38     38   /*
    39     39   ** The version string is also compiled into the library so that a program
    40     40   ** can check to make sure that the lib*.a file and the *.h file are from
    41     41   ** the same version.
    42     42   */
    43     43   extern const char sqlite_version[];
    44     44   
           45  +/*
           46  +** The SQLITE_UTF8 macro is defined if the library expects to see
           47  +** UTF-8 encoded data.  The SQLITE_ISO8859 macro is defined if the
           48  +** iso8859 encoded should be used.
           49  +*/
           50  +#define SQLITE_--ENCODING-- 1
           51  +
           52  +/*
           53  +** The following constant holds one of two strings, "UTF-8" or "iso8859",
           54  +** depending on which character encoding the SQLite library expects to
           55  +** see.  The character encoding makes a difference for the LIKE and GLOB
           56  +** operators and for the LENGTH() and SUBSTR() functions.
           57  +*/
           58  +extern char sqlite_encoding[];
           59  +
    45     60   /*
    46     61   ** Each open sqlite database is represented by an instance of the
    47     62   ** following opaque structure.
    48     63   */
    49     64   typedef struct sqlite sqlite;
    50     65   
    51     66   /*

Changes to src/tclsqlite.c.

    19     19   ** Author contact information:
    20     20   **   drh@hwaci.com
    21     21   **   http://www.hwaci.com/drh/
    22     22   **
    23     23   *************************************************************************
    24     24   ** A TCL Interface to SQLite
    25     25   **
    26         -** $Id: tclsqlite.c,v 1.14 2001/04/03 16:53:22 drh Exp $
           26  +** $Id: tclsqlite.c,v 1.15 2001/04/05 15:57:13 drh Exp $
    27     27   */
    28     28   #ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */
    29     29   
    30     30   #include "sqlite.h"
    31     31   #include "tcl.h"
    32     32   #include <stdlib.h>
    33     33   #include <string.h>
................................................................................
    52     52     Tcl_Interp *interp;       /* The TCL interpreter */
    53     53     char *zArray;             /* The array into which data is written */
    54     54     Tcl_Obj *pCode;           /* The code to execute for each row */
    55     55     int once;                 /* Set only for the first invocation of callback */
    56     56     int tcl_rc;               /* Return code from TCL script */
    57     57   };
    58     58   
           59  +/*
           60  +** If TCL uses UTF-8 and SQLite is configured to use iso8859, then we
           61  +** have to do a translation when going between the two.  Set the 
           62  +** UTF_TRANSLATION_NEEDED macro to indicate that we need to do
           63  +** this translation.  
           64  +*/
           65  +#if defined(TCL_UTF_MAX) && !defined(SQLITE_UTF8)
           66  +# define UTF_TRANSLATION_NEEDED 1
           67  +#endif
           68  +
    59     69   /*
    60     70   ** Called for each row of the result.
    61     71   */
    62     72   static int DbEvalCallback(
    63     73     void *clientData,      /* An instance of CallbackData */
    64     74     int nCol,              /* Number of columns in the result */
    65     75     char ** azCol,         /* Data for each column */
    66     76     char ** azN            /* Name for each column */
    67     77   ){
    68     78     CallbackData *cbData = (CallbackData*)clientData;
    69     79     int i, rc;
           80  +#ifdef UTF_TRANSLATION_NEEDED
           81  +  Tcl_DString dCol;
           82  +#endif
    70     83     if( cbData->zArray[0] ){
    71     84       if( cbData->once ){
    72     85         Tcl_SetVar2(cbData->interp, cbData->zArray, "*", "", 0);
    73     86         for(i=0; i<nCol; i++){
    74     87           Tcl_SetVar2(cbData->interp, cbData->zArray, "*", azN[i],
    75     88              TCL_LIST_ELEMENT|TCL_APPEND_VALUE);
    76     89         }
    77     90       }
    78     91       for(i=0; i<nCol; i++){
    79     92         char *z = azCol[i];
    80     93         if( z==0 ) z = "";
           94  +#ifdef UTF_TRANSLATION_NEEDED
           95  +      Tcl_DStringInit(&dCol);
           96  +      Tcl_ExternalToUtfDString(NULL, z, -1, &dCol);
           97  +      Tcl_SetVar2(cbData->interp, cbData->zArray, azN[i], 
           98  +            Tcl_DStringValue(&dCol), 0);
           99  +      Tcl_DStringFree(&dCol);
          100  +#else
    81    101         Tcl_SetVar2(cbData->interp, cbData->zArray, azN[i], z, 0);
          102  +#endif
    82    103       }
    83    104     }else{
    84    105       for(i=0; i<nCol; i++){
    85    106         char *z = azCol[i];
    86    107         if( z==0 ) z = "";
          108  +#ifdef UTF_TRANSLATION_NEEDED
          109  +      Tcl_DStringInit(&dCol);
          110  +      Tcl_ExternalToUtfDString(NULL, z, -1, &dCol);
          111  +      Tcl_SetVar(cbData->interp, azN[i], Tcl_DStringValue(&dCol), 0);
          112  +      Tcl_DStringFree(&dCol);
          113  +#else
    87    114         Tcl_SetVar(cbData->interp, azN[i], z, 0);
          115  +#endif
    88    116       }
    89    117     }
    90    118     cbData->once = 0;
    91    119     rc = Tcl_EvalObj(cbData->interp, cbData->pCode);
    92    120     if( rc==TCL_CONTINUE ) rc = TCL_OK;
    93    121     cbData->tcl_rc = rc;
    94    122     return rc!=TCL_OK;
................................................................................
   107    135     char ** azN            /* Name for each column */
   108    136   ){
   109    137     Tcl_Obj *pList = (Tcl_Obj*)clientData;
   110    138     int i;
   111    139     for(i=0; i<nCol; i++){
   112    140       Tcl_Obj *pElem;
   113    141       if( azCol[i] && *azCol[i] ){
          142  +#ifdef UTF_TRANSLATION_NEEDED
          143  +      Tcl_DString dCol;
          144  +      Tcl_DStringInit(&dCol);
          145  +      Tcl_ExternalToUtfDString(NULL, azCol[i], -1, &dCol);
          146  +      pElem = Tcl_NewStringObj(Tcl_DStringValue(&dCol), -1);
          147  +      Tcl_DStringFree(&dCol);
          148  +#else
   114    149         pElem = Tcl_NewStringObj(azCol[i], -1);
          150  +#endif
   115    151       }else{
   116    152         pElem = Tcl_NewObj();
   117    153       }
   118    154       Tcl_ListObjAppendElement(0, pList, pElem);
   119    155     }
   120    156     return 0;
   121    157   }
................................................................................
   264    300     ** that have the same name as the fields extracted by the query.
   265    301     */
   266    302     case DB_EVAL: {
   267    303       CallbackData cbData;
   268    304       char *zErrMsg;
   269    305       char *zSql;
   270    306       int rc;
          307  +#ifdef UTF_TRANSLATION_NEEDED
          308  +    Tcl_DString dSql;
          309  +#endif
   271    310   
   272    311       if( objc!=5 && objc!=3 ){
   273    312         Tcl_WrongNumArgs(interp, 2, objv, "SQL ?ARRAY-NAME CODE?");
   274    313         return TCL_ERROR;
   275    314       }
   276    315       pDb->interp = interp;
   277    316       zSql = Tcl_GetStringFromObj(objv[2], 0);
          317  +#ifdef UTF_TRANSLATION_NEEDED
          318  +    Tcl_DStringInit(&dSql);
          319  +    Tcl_UtfToExternalDString(NULL, zSql, -1, &dSql);
          320  +    zSql = Tcl_DStringValue(&dSql);
          321  +#endif
   278    322       Tcl_IncrRefCount(objv[2]);
   279    323       if( objc==5 ){
   280    324         cbData.interp = interp;
   281    325         cbData.once = 1;
   282    326         cbData.zArray = Tcl_GetStringFromObj(objv[3], 0);
   283    327         cbData.pCode = objv[4];
   284    328         cbData.tcl_rc = TCL_OK;
................................................................................
   299    343         Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE);
   300    344         free(zErrMsg);
   301    345         rc = TCL_ERROR;
   302    346       }else{
   303    347         rc = cbData.tcl_rc;
   304    348       }
   305    349       Tcl_DecrRefCount(objv[2]);
          350  +#ifdef UTF_TRANSLATION_NEEDED
          351  +    Tcl_DStringFree(&dSql);
          352  +#endif
   306    353       return rc;
   307    354     }
   308    355   
   309    356     /*
   310    357     **     $db timeout MILLESECONDS
   311    358     **
   312    359     ** Delay for the number of milliseconds specified when a file is locked.
................................................................................
   378    425   ** (Hence there is no namespace.  There is no point in using a namespace
   379    426   ** if the extension only supplies one new name!)  The "sqlite" command is
   380    427   ** used to open a new SQLite database.  See the DbMain() routine above
   381    428   ** for additional information.
   382    429   */
   383    430   int Sqlite_Init(Tcl_Interp *interp){
   384    431     Tcl_CreateCommand(interp, "sqlite", DbMain, 0, 0);
          432  +  Tcl_SetVar(interp,"sqlite_encoding",sqlite_encoding,TCL_GLOBAL_ONLY);
   385    433     Tcl_PkgProvide(interp, "sqlite", "1.0");
   386    434     return TCL_OK;
   387    435   }
   388    436   int Sqlite_SafeInit(Tcl_Interp *interp){
   389    437     return TCL_OK;
   390    438   }
   391    439   
................................................................................
   426    474       "}\n"
   427    475     "}\n"
   428    476   ;
   429    477   
   430    478   #define TCLSH_MAIN main   /* Needed to fake out mktclapp */
   431    479   int TCLSH_MAIN(int argc, char **argv){
   432    480     Tcl_Interp *interp;
          481  +  Tcl_FindExecutable(argv[0]);
   433    482     interp = Tcl_CreateInterp();
   434    483     Sqlite_Init(interp);
   435    484     if( argc>=2 ){
   436    485       int i;
   437    486       Tcl_SetVar(interp,"argv0",argv[1],TCL_GLOBAL_ONLY);
   438    487       Tcl_SetVar(interp,"argv", "", TCL_GLOBAL_ONLY);
   439    488       for(i=2; i<argc; i++){

Changes to src/util.c.

    22     22   **
    23     23   *************************************************************************
    24     24   ** Utility functions used throughout sqlite.
    25     25   **
    26     26   ** This file contains functions for allocating memory, comparing
    27     27   ** strings, and stuff like that.
    28     28   **
    29         -** $Id: util.c,v 1.19 2001/04/04 21:10:19 drh Exp $
           29  +** $Id: util.c,v 1.20 2001/04/05 15:57:13 drh Exp $
    30     30   */
    31     31   #include "sqliteInt.h"
    32     32   #include <stdarg.h>
    33     33   #include <ctype.h>
    34     34   
    35     35   /*
    36     36   ** If MEMORY_DEBUG is defined, then use versions of malloc() and
................................................................................
   721    721         b += len;
   722    722       }
   723    723     }
   724    724     if( *a=='-' ) res = -res;
   725    725     return res;
   726    726   }
   727    727   
          728  +#ifdef SQLITE_UTF8
          729  +/*
          730  +** X is a pointer to the first byte of a UTF-8 character.  Increment
          731  +** X so that it points to the next character.  This only works right
          732  +** if X points to a well-formed UTF-8 string.
          733  +*/
          734  +#define sqliteNextChar(X)  while( (0xc0&*++(X))==0x80 ){}
          735  +#define sqliteCharVal(X)   sqlite_utf8_to_int(X)
          736  +
          737  +#else /* !defined(SQLITE_UTF8) */
   728    738   /*
   729         -** When the first byte of a UTF-8 character is used as the
   730         -** index of the following array, then the value is the number
   731         -** of bytes in the whole UTF-8 character.  This matrix assumes
   732         -** a well-formed UTF-8 string.  All bets are off if the input
   733         -** is not well-formed.
          739  +** For iso8859 encoding, the next character is just the next byte.
   734    740   */
   735         -static const unsigned char utf8_width[] = {
   736         -        /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
   737         -/* 0x */   0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   738         -/* 1x */   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   739         -/* 2x */   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   740         -/* 3x */   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   741         -/* 4x */   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   742         -/* 5x */   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   743         -/* 6x */   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   744         -/* 7x */   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   745         -/* 8x */   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   746         -/* 9x */   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   747         -/* Ax */   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   748         -/* Bx */   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
   749         -/* Cx */   2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
   750         -/* Dx */   2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
   751         -/* Ex */   3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
   752         -/* Fx */   4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1,
   753         -};
          741  +#define sqliteNextChar(X)  (++(X));
          742  +#define sqliteCharVal(X)   ((int)*(X))
          743  +
          744  +#endif /* defined(SQLITE_UTF8) */
          745  +
   754    746   
          747  +#ifdef SQLITE_UTF8
   755    748   /*
   756         -** This routine computes the number of bytes to the start of the
   757         -** next UTF-8 character.  We could just do 
   758         -**
   759         -**      z += utf8_width[*z]
   760         -**
   761         -** accomplish the same thing, if we know that z was a well-formed
   762         -** UTF-8 string.  If it is not, then z might be incremented past
   763         -** its null terminator.  This function, though slower, will never
   764         -** increment z past its terminator.
          749  +** Convert the UTF-8 character to which z points into a 31-bit
          750  +** UCS character.  This only works right if z points to a well-formed
          751  +** UTF-8 string.
   765    752   */
   766         -static int utf8_char_size(const unsigned char *z){
   767         -  int i, n = utf8_width[*z];
   768         -  for(i=1; i<n && z[i]!=0; i++){}
   769         -  return i;
   770         -}
   771         -
   772         -/*
   773         -** Convert the UTF-8 character pointed to by the input parameter
   774         -** into a 31-bit UCS character and return an integer holding the
   775         -** 31-bit UCS character.
   776         -*/
   777         -static int utf8_to_int(const unsigned char *z){
   778         -  int n = utf8_width[*z];
          753  +static int sqlite_utf8_to_int(const unsigned char *z){
   779    754     int c;
   780         -  switch( n ){
   781         -    case 0: {
   782         -      return 0;
   783         -    }
   784         -    case 1: {
   785         -      return *z;
   786         -    }
   787         -    case 2: {
   788         -      c = 0x1f & *(z++);
   789         -      break;
   790         -    }
   791         -    case 3: {
   792         -      c = 0x0f & *(z++);
   793         -      break;
   794         -    }
   795         -    case 4: {
   796         -      c = 0x07 & *(z++);
   797         -      break;
   798         -    }
   799         -    case 5: {
   800         -      c = 0x03 & *(z++);
   801         -      break;
   802         -    }
   803         -    case 6: {
   804         -      c = 0x01 & *(z++);
   805         -      break;
   806         -    }
   807         -  }
   808         -  while( (--n) > 0 ){
   809         -    c = (c<<6) | (0x3f & *(z++));
          755  +  static const int initVal[] = {
          756  +      0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,
          757  +     15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
          758  +     30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,
          759  +     45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
          760  +     60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,
          761  +     75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,
          762  +     90,  91,  92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102, 103, 104,
          763  +    105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
          764  +    120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
          765  +    135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
          766  +    150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
          767  +    165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
          768  +    180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,   0,   1,   2,
          769  +      3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,
          770  +     18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,   0,
          771  +      1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
          772  +      0,   1,   2,   3,   4,   5,   6,   7,   0,   1,   2,   3,   0,   1, 254,
          773  +    255,
          774  +  };
          775  +  c = initVal[*(z++)];
          776  +  while( (0xc0&*z)==0x80 ){
          777  +    c = (c<<6) | (0x3f&*(z++));
   810    778     }
   811    779     return c;
   812    780   }
          781  +#endif
   813    782   
   814    783   /*
   815    784   ** Compare two UTF-8 strings for equality where the first string can
   816    785   ** potentially be a "glob" expression.  Return true (1) if they
   817    786   ** are the same and false (0) if they are different.
   818    787   **
   819    788   ** Globbing rules:
................................................................................
   848    817   
   849    818     while( (c = *zPattern)!=0 ){
   850    819       switch( c ){
   851    820         case '*':
   852    821           while( (c=zPattern[1]) == '*' || c == '?' ){
   853    822             if( c=='?' ){
   854    823               if( *zString==0 ) return 0;
   855         -            zString += utf8_char_size(zString);
          824  +            sqliteNextChar(zString);
   856    825             }
   857    826             zPattern++;
   858    827           }
   859    828           if( c==0 ) return 1;
   860    829           c = UpperToLower[c];
   861    830           if( c=='[' ){
   862    831             while( *zString && sqliteGlobCompare(&zPattern[1],zString)==0 ){
   863         -            zString += utf8_char_size(zString);
          832  +            sqliteNextChar(zString);
   864    833             }
   865    834             return *zString!=0;
   866    835           }else{
   867    836             while( (c2 = *zString)!=0 ){
   868    837               while( c2 != 0 && c2 != c ){ c2 = *++zString; }
   869    838               if( c2==0 ) return 0;
   870    839               if( sqliteGlobCompare(&zPattern[1],zString) ) return 1;
   871         -            zString += utf8_char_size(zString);
          840  +            sqliteNextChar(zString);
   872    841             }
   873    842             return 0;
   874    843           }
   875    844         case '?': {
   876    845           if( *zString==0 ) return 0;
   877         -        zString += utf8_char_size(zString);
          846  +        sqliteNextChar(zString);
   878    847           zPattern++;
   879    848           break;
   880    849         }
   881    850         case '[': {
   882    851           int prior_c = 0;
   883    852           seen = 0;
   884    853           invert = 0;
   885         -        c = utf8_to_int(zString);
          854  +        c = sqliteCharVal(zString);
   886    855           if( c==0 ) return 0;
   887    856           c2 = *++zPattern;
   888    857           if( c2=='^' ){ invert = 1; c2 = *++zPattern; }
   889    858           if( c2==']' ){
   890    859             if( c==']' ) seen = 1;
   891    860             c2 = *++zPattern;
   892    861           }
   893         -        while( (c2 = utf8_to_int(zPattern))!=0 && c2!=']' ){
          862  +        while( (c2 = sqliteCharVal(zPattern))!=0 && c2!=']' ){
   894    863             if( c2=='-' && zPattern[1]!=']' && zPattern[1]!=0 && prior_c>0 ){
   895    864               zPattern++;
   896         -            c2 = utf8_to_int(zPattern);
          865  +            c2 = sqliteCharVal(zPattern);
   897    866               if( c>=prior_c && c<=c2 ) seen = 1;
   898    867               prior_c = 0;
   899    868             }else if( c==c2 ){
   900    869               seen = 1;
   901    870               prior_c = c2;
   902    871             }else{
   903    872               prior_c = c2;
   904    873             }
   905         -          zPattern += utf8_char_size(zPattern);
          874  +          sqliteNextChar(zPattern);
   906    875           }
   907    876           if( c2==0 || (seen ^ invert)==0 ) return 0;
   908         -        zString += utf8_char_size(zString);
          877  +        sqliteNextChar(zString);
   909    878           zPattern++;
   910    879           break;
   911    880         }
   912    881         default: {
   913    882           if( c != *zString ) return 0;
   914    883           zPattern++;
   915    884           zString++;
................................................................................
   936    905   
   937    906     while( (c = UpperToLower[*zPattern])!=0 ){
   938    907       switch( c ){
   939    908         case '%': {
   940    909           while( (c=zPattern[1]) == '%' || c == '_' ){
   941    910             if( c=='_' ){
   942    911               if( *zString==0 ) return 0;
   943         -            zString += utf8_char_size(zString);
          912  +            sqliteNextChar(zString);
   944    913             }
   945    914             zPattern++;
   946    915           }
   947    916           if( c==0 ) return 1;
   948    917           c = UpperToLower[c];
   949    918           while( (c2=UpperToLower[*zString])!=0 ){
   950    919             while( c2 != 0 && c2 != c ){ c2 = UpperToLower[*++zString]; }
   951    920             if( c2==0 ) return 0;
   952    921             if( sqliteLikeCompare(&zPattern[1],zString) ) return 1;
   953         -          zString += utf8_char_size(zString);
          922  +          sqliteNextChar(zString);
   954    923           }
   955    924           return 0;
   956    925         }
   957    926         case '_': {
   958    927           if( *zString==0 ) return 0;
   959         -        zString += utf8_char_size(zString);
          928  +        sqliteNextChar(zString);
   960    929           zPattern++;
   961    930           break;
   962    931         }
   963    932         default: {
   964    933           if( c != UpperToLower[*zString] ) return 0;
   965    934           zPattern++;
   966    935           zString++;
   967    936           break;
   968    937         }
   969    938       }
   970    939     }
   971    940     return *zString==0;
   972    941   }

Changes to src/vdbe.c.

    37     37   ** inplicit conversion from one type to the other occurs as necessary.
    38     38   ** 
    39     39   ** Most of the code in this file is taken up by the sqliteVdbeExec()
    40     40   ** function which does the work of interpreting a VDBE program.
    41     41   ** But other routines are also provided to help in building up
    42     42   ** a program instruction by instruction.
    43     43   **
    44         -** $Id: vdbe.c,v 1.55 2001/04/04 21:22:14 drh Exp $
           44  +** $Id: vdbe.c,v 1.56 2001/04/05 15:57:13 drh Exp $
    45     45   */
    46     46   #include "sqliteInt.h"
    47     47   #include <unistd.h>
    48     48   #include <ctype.h>
    49     49   
    50     50   /*
    51     51   ** SQL is translated into a sequence of instructions to be
................................................................................
  3280   3280           if(VERIFY( i>=0 && i<p->nSet &&) !SetTest(&p->aSet[i], zStack[tos])){
  3281   3281             pc = pOp->p2 - 1;
  3282   3282           }
  3283   3283           POPSTACK;
  3284   3284           break;
  3285   3285         }
  3286   3286   
  3287         -      /* Opcode: Length * * *
         3287  +      /* Opcode: Strlen * * *
  3288   3288         **
  3289   3289         ** Interpret the top of the stack as a string.  Replace the top of
  3290   3290         ** stack with an integer which is the length of the string.
  3291   3291         */
  3292   3292         case OP_Strlen: {
  3293   3293           int tos = p->tos;
  3294   3294           int len;
  3295   3295           VERIFY( if( tos<0 ) goto not_enough_stack; )
  3296   3296           Stringify(p, tos);
         3297  +#ifdef SQLITE_UTF8
         3298  +        {
         3299  +          char *z = zStack[tos];
         3300  +          for(len=0; *z; z++){ if( (0xc0&*z)!=0x80 ) len++; }
         3301  +        }
         3302  +#else
  3297   3303           len = aStack[tos].n-1;
         3304  +#endif
  3298   3305           POPSTACK;
  3299   3306           p->tos++;
  3300   3307           aStack[tos].i = len;
  3301   3308           aStack[tos].flags = STK_Int;
  3302   3309           break;
  3303   3310         }
  3304   3311   
................................................................................
  3341   3348             start = aStack[p->tos].i - 1;
  3342   3349             POPSTACK;
  3343   3350           }else{
  3344   3351             start = pOp->p1 - 1;
  3345   3352           }
  3346   3353           VERIFY( if( p->tos<0 ) goto not_enough_stack; )
  3347   3354           Stringify(p, p->tos);
         3355  +
         3356  +        /* "n" will be the number of characters in the input string.
         3357  +        ** For iso8859, the number of characters is the number of bytes.
         3358  +        ** Buf for UTF-8, some characters can use multiple bytes and the
         3359  +        ** situation is more complex. 
         3360  +        */
         3361  +#ifdef SQLITE_UTF8
         3362  +        z = zStack[p->tos];
         3363  +        for(n=0; *z; z++){ if( (0xc0&*z)!=0x80 ) n++; }
         3364  +#else
  3348   3365           n = aStack[p->tos].n - 1;
         3366  +#endif
  3349   3367           if( start<0 ){
  3350   3368             start += n + 1;
  3351   3369             if( start<0 ){
  3352   3370               cnt += start;
  3353   3371               start = 0;
  3354   3372             }
  3355   3373           }
................................................................................
  3356   3374           if( start>n ){
  3357   3375             start = n;
  3358   3376           }
  3359   3377           if( cnt<0 ) cnt = 0;
  3360   3378           if( cnt > n ){
  3361   3379             cnt = n;
  3362   3380           }
         3381  +
         3382  +        /* At this point, "start" is the index of the first character to
         3383  +        ** extract and "cnt" is the number of characters to extract.  We
         3384  +        ** need to convert units on these variable from characters into
         3385  +        ** bytes.  For iso8859, the conversion is a no-op, but for UTF-8
         3386  +        ** we have to do a little work.
         3387  +        */
         3388  +#ifdef SQLITE_UTF8
         3389  +        {
         3390  +          int c_start = start;
         3391  +          int c_cnt = cnt;
         3392  +          int i;
         3393  +          z = zStack[p->tos];
         3394  +          for(start=i=0; i<c_start; i++){
         3395  +            while( (0xc0&z[++start])==0x80 ){}
         3396  +          }
         3397  +          for(cnt=i=0; i<c_cnt; i++){
         3398  +            while( (0xc0&z[(++cnt)+start])==0x80 ){}
         3399  +          }
         3400  +        }
         3401  +#endif
  3363   3402           z = sqliteMalloc( cnt+1 );
  3364   3403           if( z==0 ) goto no_mem;
  3365   3404           strncpy(z, &zStack[p->tos][start], cnt);
  3366   3405           z[cnt] = 0;
  3367   3406           POPSTACK;
  3368   3407           p->tos++;
  3369   3408           zStack[p->tos] = z;

Changes to test/expr.test.

    19     19   #   drh@hwaci.com
    20     20   #   http://www.hwaci.com/drh/
    21     21   #
    22     22   #***********************************************************************
    23     23   # This file implements regression tests for SQLite library.  The
    24     24   # focus of this file is testing expressions.
    25     25   #
    26         -# $Id: expr.test,v 1.11 2001/04/04 21:10:19 drh Exp $
           26  +# $Id: expr.test,v 1.12 2001/04/05 15:57:14 drh Exp $
    27     27   
    28     28   set testdir [file dirname $argv0]
    29     29   source $testdir/tester.tcl
    30     30   
    31     31   # Create a table to work with.
    32     32   #
    33     33   execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)}
................................................................................
   156    156   test_expr expr-5.9 {t1='abc', t2='A%_C'} {t1 LIKE t2} 1
   157    157   test_expr expr-5.9b {t1='ac', t2='A%_C'} {t1 LIKE t2} 0
   158    158   test_expr expr-5.10 {t1='abxyzzyc', t2='A%_C'} {t1 LIKE t2} 1
   159    159   test_expr expr-5.11 {t1='abc', t2='xyz'} {t1 NOT LIKE t2} 1
   160    160   test_expr expr-5.12 {t1='abc', t2='ABC'} {t1 NOT LIKE t2} 0
   161    161   
   162    162   # The following tests only work on versions of TCL that support
   163         -# Unicode.
          163  +# Unicode and SQLite configured for UTF-8 support.
          164  +#
          165  +if {"\u1234"!="u1234" && $::sqlite_encoding=="UTF-8"} {
          166  +  test_expr expr-5.13 "t1='a\u0080c', t2='A_C'" {t1 LIKE t2} 1
          167  +  test_expr expr-5.14 "t1='a\u07FFc', t2='A_C'" {t1 LIKE t2} 1
          168  +  test_expr expr-5.15 "t1='a\u0800c', t2='A_C'" {t1 LIKE t2} 1
          169  +  test_expr expr-5.16 "t1='a\uFFFFc', t2='A_C'" {t1 LIKE t2} 1
          170  +  test_expr expr-5.17 "t1='a\u0080', t2='A__'" {t1 LIKE t2} 0
          171  +  test_expr expr-5.18 "t1='a\u07FF', t2='A__'" {t1 LIKE t2} 0
          172  +  test_expr expr-5.19 "t1='a\u0800', t2='A__'" {t1 LIKE t2} 0
          173  +  test_expr expr-5.20 "t1='a\uFFFF', t2='A__'" {t1 LIKE t2} 0
          174  +  test_expr expr-5.21 "t1='ax\uABCD', t2='A_\uABCD'" {t1 LIKE t2} 1
          175  +  test_expr expr-5.22 "t1='ax\u1234', t2='A%\u1234'" {t1 LIKE t2} 1
          176  +  test_expr expr-5.23 "t1='ax\uFEDC', t2='A_%'" {t1 LIKE t2} 1
          177  +  test_expr expr-5.24 "t1='ax\uFEDCy\uFEDC', t2='A%\uFEDC'" {t1 LIKE t2} 1
          178  +}
          179  +
          180  +# Theses tests are for when SQLite assumes iso8859 characters.
   164    181   #
   165         -test_expr expr-5.13 "t1='a\u0080c', t2='A_C'" {t1 LIKE t2} 1
   166         -test_expr expr-5.14 "t1='a\u07FFc', t2='A_C'" {t1 LIKE t2} 1
   167         -test_expr expr-5.15 "t1='a\u0800c', t2='A_C'" {t1 LIKE t2} 1
   168         -test_expr expr-5.16 "t1='a\uFFFFc', t2='A_C'" {t1 LIKE t2} 1
   169         -test_expr expr-5.17 "t1='a\u0080', t2='A__'" {t1 LIKE t2} 0
   170         -test_expr expr-5.18 "t1='a\u07FF', t2='A__'" {t1 LIKE t2} 0
   171         -test_expr expr-5.19 "t1='a\u0800', t2='A__'" {t1 LIKE t2} 0
   172         -test_expr expr-5.20 "t1='a\uFFFF', t2='A__'" {t1 LIKE t2} 0
   173         -test_expr expr-5.21 "t1='ax\uABCD', t2='A_\uABCD'" {t1 LIKE t2} 1
   174         -test_expr expr-5.22 "t1='ax\u1234', t2='A%\u1234'" {t1 LIKE t2} 1
   175         -test_expr expr-5.23 "t1='ax\uFEDC', t2='A_%'" {t1 LIKE t2} 1
   176         -test_expr expr-5.24 "t1='ax\uFEDCy\uFEDC', t2='A%\uFEDC'" {t1 LIKE t2} 1
          182  +if {$::sqlite_encoding=="iso8859"} {
          183  +  catch {encoding system iso8859-1}
          184  +  test_expr expr-5.50 "t1='a\266c', t2='A_C'"  {t1 LIKE t2} 1
          185  +  test_expr expr-5.51 "t1='a\347', t2='A_'"  {t1 LIKE t2} 1
          186  +  test_expr expr-5.52 "t1='ax\351', t2='A_\351'"  {t1 LIKE t2} 1
          187  +  test_expr expr-5.53 "t1='ax\241', t2='A_%'"  {t1 LIKE t2} 1
          188  +}
   177    189   
   178    190   test_expr expr-6.1 {t1='abc', t2='xyz'} {t1 GLOB t2} 0
   179    191   test_expr expr-6.2 {t1='abc', t2='ABC'} {t1 GLOB t2} 0
   180    192   test_expr expr-6.3 {t1='abc', t2='A?C'} {t1 GLOB t2} 0
   181    193   test_expr expr-6.4 {t1='abc', t2='a?c'} {t1 GLOB t2} 1
   182    194   test_expr expr-6.5 {t1='abc', t2='abc?'} {t1 GLOB t2} 0
   183    195   test_expr expr-6.6 {t1='abc', t2='A*C'} {t1 GLOB t2} 0
................................................................................
   199    211   test_expr expr-6.22 {t1='abcdefg', t2='a*[^de]g'} {t1 GLOB t2} 1
   200    212   test_expr expr-6.23 {t1='abcdefg', t2='a*?g'} {t1 GLOB t2} 1
   201    213   test_expr expr-6.24 {t1='ac', t2='a*c'} {t1 GLOB t2} 1
   202    214   test_expr expr-6.25 {t1='ac', t2='a*?c'} {t1 GLOB t2} 0
   203    215   
   204    216   # These tests only work on versions of TCL that support Unicode
   205    217   #
   206         -test_expr expr-6.26 "t1='a\u0080c', t2='a?c'" {t1 GLOB t2} 1
   207         -test_expr expr-6.27 "t1='a\u07ffc', t2='a?c'" {t1 GLOB t2} 1
   208         -test_expr expr-6.28 "t1='a\u0800c', t2='a?c'" {t1 GLOB t2} 1
   209         -test_expr expr-6.29 "t1='a\uffffc', t2='a?c'" {t1 GLOB t2} 1
   210         -test_expr expr-6.30 "t1='a\u1234', t2='a?'" {t1 GLOB t2} 1
   211         -test_expr expr-6.31 "t1='a\u1234', t2='a??'" {t1 GLOB t2} 0
   212         -test_expr expr-6.32 "t1='ax\u1234', t2='a?\u1234'" {t1 GLOB t2} 1
   213         -test_expr expr-6.33 "t1='ax\u1234', t2='a*\u1234'" {t1 GLOB t2} 1
   214         -test_expr expr-6.34 "t1='ax\u1234y\u1234', t2='a*\u1234'" {t1 GLOB t2} 1
   215         -test_expr expr-6.35 "t1='a\u1234b', t2='a\[x\u1234y\]b'" {t1 GLOB t2} 1
   216         -test_expr expr-6.36 "t1='a\u1234b', t2='a\[\u1233-\u1235\]b'" {t1 GLOB t2} 1
   217         -test_expr expr-6.37 "t1='a\u1234b', t2='a\[\u1234-\u124f\]b'" {t1 GLOB t2} 1
   218         -test_expr expr-6.38 "t1='a\u1234b', t2='a\[\u1235-\u124f\]b'" {t1 GLOB t2} 0
   219         -test_expr expr-6.39 "t1='a\u1234b', t2='a\[a-\u1235\]b'" {t1 GLOB t2} 1
   220         -test_expr expr-6.40 "t1='a\u1234b', t2='a\[a-\u1234\]b'" {t1 GLOB t2} 1
   221         -test_expr expr-6.41 "t1='a\u1234b', t2='a\[a-\u1233\]b'" {t1 GLOB t2} 0
          218  +if {"\u1234"!="u1234" && $::sqlite_encoding=="UTF-8"} {
          219  +  test_expr expr-6.26 "t1='a\u0080c', t2='a?c'" {t1 GLOB t2} 1
          220  +  test_expr expr-6.27 "t1='a\u07ffc', t2='a?c'" {t1 GLOB t2} 1
          221  +  test_expr expr-6.28 "t1='a\u0800c', t2='a?c'" {t1 GLOB t2} 1
          222  +  test_expr expr-6.29 "t1='a\uffffc', t2='a?c'" {t1 GLOB t2} 1
          223  +  test_expr expr-6.30 "t1='a\u1234', t2='a?'" {t1 GLOB t2} 1
          224  +  test_expr expr-6.31 "t1='a\u1234', t2='a??'" {t1 GLOB t2} 0
          225  +  test_expr expr-6.32 "t1='ax\u1234', t2='a?\u1234'" {t1 GLOB t2} 1
          226  +  test_expr expr-6.33 "t1='ax\u1234', t2='a*\u1234'" {t1 GLOB t2} 1
          227  +  test_expr expr-6.34 "t1='ax\u1234y\u1234', t2='a*\u1234'" {t1 GLOB t2} 1
          228  +  test_expr expr-6.35 "t1='a\u1234b', t2='a\[x\u1234y\]b'" {t1 GLOB t2} 1
          229  +  test_expr expr-6.36 "t1='a\u1234b', t2='a\[\u1233-\u1235\]b'" {t1 GLOB t2} 1
          230  +  test_expr expr-6.37 "t1='a\u1234b', t2='a\[\u1234-\u124f\]b'" {t1 GLOB t2} 1
          231  +  test_expr expr-6.38 "t1='a\u1234b', t2='a\[\u1235-\u124f\]b'" {t1 GLOB t2} 0
          232  +  test_expr expr-6.39 "t1='a\u1234b', t2='a\[a-\u1235\]b'" {t1 GLOB t2} 1
          233  +  test_expr expr-6.40 "t1='a\u1234b', t2='a\[a-\u1234\]b'" {t1 GLOB t2} 1
          234  +  test_expr expr-6.41 "t1='a\u1234b', t2='a\[a-\u1233\]b'" {t1 GLOB t2} 0
          235  +}
   222    236   
          237  +# Theses tests are for when SQLite assumes iso8859 characters.
          238  +#
          239  +if {$::sqlite_encoding=="iso8859"} {
          240  +  catch {encoding system iso8859-1}
          241  +  test_expr expr-6.50 "t1='a\266c', t2='a?c'" {t1 GLOB t2} 1
          242  +  test_expr expr-6.51 "t1='a\266', t2='a?'" {t1 GLOB t2} 1
          243  +  test_expr expr-6.52 "t1='a\266', t2='a??'" {t1 GLOB t2} 0
          244  +  test_expr expr-6.53 "t1='ax\266', t2='a??'" {t1 GLOB t2} 1
          245  +  test_expr expr-6.54 "t1='ax\266', t2='a?\266'" {t1 GLOB t2} 1
          246  +  test_expr expr-6.55 "t1='ax\266y\266', t2='a*\266'" {t1 GLOB t2} 1
          247  +  test_expr expr-6.56 "t1='a\266b', t2='a\[x\266y\]b'" {t1 GLOB t2} 1
          248  +  test_expr expr-6.57 "t1='a\266b', t2='a\[\260-\270\]b'" {t1 GLOB t2} 1
          249  +  test_expr expr-6.58 "t1='a\266b', t2='a\[\266-\270\]b'" {t1 GLOB t2} 1
          250  +  test_expr expr-6.59 "t1='a\266b', t2='a\[\267-\270\]b'" {t1 GLOB t2} 0
          251  +  test_expr expr-6.60 "t1='a\266b', t2='a\[x-\267\]b'" {t1 GLOB t2} 1
          252  +  test_expr expr-6.61 "t1='a\266b', t2='a\[x-\266\]b'" {t1 GLOB t2} 1
          253  +  test_expr expr-6.62 "t1='a\266b', t2='a\[x-\265\]b'" {t1 GLOB t2} 0
          254  +}
   223    255   
   224    256   # The sqliteExprIfFalse and sqliteExprIfTrue routines are only
   225    257   # executed as part of a WHERE clause.  Create a table suitable
   226    258   # for testing these functions.
   227    259   #
   228    260   execsql {DROP TABLE test1}
   229    261   execsql {CREATE TABLE test1(a int, b int);}

Changes to test/func.test.

    19     19   #   drh@hwaci.com
    20     20   #   http://www.hwaci.com/drh/
    21     21   #
    22     22   #***********************************************************************
    23     23   # This file implements regression tests for SQLite library.  The
    24     24   # focus of this file is testing built-in functions.
    25     25   #
    26         -# $Id: func.test,v 1.1 2000/08/28 16:22:00 drh Exp $
           26  +# $Id: func.test,v 1.2 2001/04/05 15:57:14 drh Exp $
    27     27   
    28     28   set testdir [file dirname $argv0]
    29     29   source $testdir/tester.tcl
    30     30   
    31     31   # Create a table to work with.
    32     32   #
    33         -execsql {CREATE TABLE tbl1(t1 text)}
    34         -foreach word {this program is free software} {
    35         -  execsql "INSERT INTO tbl1 VALUES('$word')"
    36         -}
    37         -
    38         -# Make sure the table was created properly.
    39         -#
    40     33   do_test func-0.0 {
           34  +  execsql {CREATE TABLE tbl1(t1 text)}
           35  +  foreach word {this program is free software} {
           36  +    execsql "INSERT INTO tbl1 VALUES('$word')"
           37  +  }
    41     38     execsql {SELECT t1 FROM tbl1 ORDER BY t1}
    42     39   } {free is program software this}
    43     40   
    44     41   # Check out the length() function
    45     42   #
    46     43   do_test func-1.0 {
    47     44     execsql {SELECT length(t1) FROM tbl1 ORDER BY t1}
................................................................................
    84     81   } {ee is am re is}
    85     82   do_test func-2.7 {
    86     83     execsql {SELECT substr(t1,-4,2) FROM tbl1 ORDER BY t1}
    87     84   } {fr {} gr wa th}
    88     85   do_test func-2.8 {
    89     86     execsql {SELECT t1 FROM tbl1 ORDER BY substr(t1,2,20)}
    90     87   } {this software free program is}
           88  +
           89  +# Only do the following tests if TCL has UTF-8 capabilities and
           90  +# the UTF-8 encoding is turned on in the SQLite library.
           91  +#
           92  +if {$::sqlite_encoding=="UTF-8" && "\u1234"!="u1234"} {
           93  +
           94  +# Put some UTF-8 characters in the database
           95  +#
           96  +do_test func-3.0 {
           97  +  execsql {DELETE FROM tbl1}
           98  +  foreach word "contains UTF-8 characters hi\u1234ho" {
           99  +    execsql "INSERT INTO tbl1 VALUES('$word')"
          100  +  }
          101  +  execsql {SELECT t1 FROM tbl1 ORDER BY t1}
          102  +} "characters contains hi\u1234ho UTF-8"
          103  +do_test func-3.1 {
          104  +  execsql {SELECT length(t1) FROM tbl1 ORDER BY t1}
          105  +} {10 8 5 5}
          106  +do_test func-3.2 {
          107  +  execsql {SELECT substr(t1,1,2) FROM tbl1 ORDER BY t1}
          108  +} {ch co hi UT}
          109  +do_test func-3.3 {
          110  +  execsql {SELECT substr(t1,1,3) FROM tbl1 ORDER BY t1}
          111  +} "cha con hi\u1234 UTF"
          112  +do_test func-3.4 {
          113  +  execsql {SELECT substr(t1,2,2) FROM tbl1 ORDER BY t1}
          114  +} "ha on i\u1234 TF"
          115  +do_test func-3.5 {
          116  +  execsql {SELECT substr(t1,2,3) FROM tbl1 ORDER BY t1}
          117  +} "har ont i\u1234h TF-"
          118  +do_test func-3.6 {
          119  +  execsql {SELECT substr(t1,3,2) FROM tbl1 ORDER BY t1}
          120  +} "ar nt \u1234h F-"
          121  +do_test func-3.7 {
          122  +  execsql {SELECT substr(t1,4,2) FROM tbl1 ORDER BY t1}
          123  +} "ra ta ho -8"
          124  +do_test func-3.8 {
          125  +  execsql {SELECT substr(t1,-1,1) FROM tbl1 ORDER BY t1}
          126  +} "s s o 8"
          127  +do_test func-3.9 {
          128  +  execsql {SELECT substr(t1,-3,2) FROM tbl1 ORDER BY t1}
          129  +} "er in \u1234h F-"
          130  +do_test func-3.10 {
          131  +  execsql {SELECT substr(t1,-4,3) FROM tbl1 ORDER BY t1}
          132  +} "ter ain i\u1234h TF-"
          133  +
          134  +} ;# End sqlite_encoding==UTF-8 and \u1234!=u1234
    91    135   
    92    136   finish_test

Changes to www/changes.tcl.

    15     15   proc chng {date desc} {
    16     16     puts "<DT><B>$date</B></DT>"
    17     17     puts "<DD><P><UL>$desc</UL></P></DD>"
    18     18   }
    19     19   
    20     20   chng {2001 Apr 5 (1.0.29)} {
    21     21   <li>The LIKE and GLOB operators now assume both operands are
    22         -    UTF-8 strings.
    23         -    <font color="red">** This change could potentially
    24         -    break existing code **</font></li>
           22  +    UTF-8 strings if the library is configured with the "--enable-utf8"
           23  +    option.  If not configured for UTF-8 but using a version of TCL
           24  +    that supports UTF-8, then a conversion from UTF-8 to iso8859 and
           25  +    back again is done inside the TCL interface.</li>
    25     26   }
    26     27   
    27     28   chng {2001 Apr 4 (1.0.28)} {
    28     29   <li>Added limited support for transactions.  At this point, transactions
    29     30       will do table locking on the GDBM backend.  There is no support (yet)
    30     31       for rollback or atomic commit.</li>
    31     32   <li>Added special column names ROWID, OID, and _ROWID_ that refer to the

Changes to www/index.tcl.

     1      1   #
     2      2   # Run this TCL script to generate HTML for the index.html file.
     3      3   #
     4         -set rcsid {$Id: index.tcl,v 1.34 2001/04/04 21:10:19 drh Exp $}
            4  +set rcsid {$Id: index.tcl,v 1.35 2001/04/05 15:57:14 drh Exp $}
     5      5   
     6      6   puts {<html>
     7      7   <head><title>SQLite: An SQL Database Library Built Atop GDBM</title></head>
     8      8   <body bgcolor=white>
     9      9   <h1 align=center>SQLite: An SQL Database Library Built Atop
    10     10   <a href="http://www.gnu.org/software/gdbm/gdbm.html">GDBM</a></h1>
    11     11   <p align=center>}
................................................................................
    58     58   There are currently no <em>known</em> bugs or memory leaks
    59     59   in the library.  <a href="http://gcc.gnu.org/onlinedocs/gcov_1.html">Gcov</a>
    60     60   is used to verify test coverage.  The test suite currently exercises
    61     61   all code except for a few areas which are unreachable or which are
    62     62   only reached when <tt>malloc()</tt> fails.  The code has been tested
    63     63   for memory leaks and is found to be clean.</p>
    64     64   
    65         -<p><b>Important Note:</b>  Beginning with version 1.0.29, the LIKE and
    66         -GLOB operators assume both operands are UTF-8 strings.  Prior to that,
    67         -both operators assumed plain ASCII strings.  Users of earlier versions
    68         -of SQLite that invoke LIKE or GLOB to compare strings containing
    69         -characters greater than 127 may have problems when they upgrade to
    70         -version 1.0.29 or later.</p>
    71         -
    72     65   <p><b>Important Note:</b>  Serious bugs have been found in versions
    73     66   1.0.22 on Unix and 1.0.26 on Windows.  Users of these or earlier
    74     67   versions of SQLite should upgrade.</p>
    75     68   
    76     69   <h2>Documentation</h2>
    77     70   
    78     71   <p>The following documentation is currently available:</p>