]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Change the way the sqlite3_analyzer executable is built.
authordan <dan@noemail.net>
Wed, 21 Sep 2011 16:43:07 +0000 (16:43 +0000)
committerdan <dan@noemail.net>
Wed, 21 Sep 2011 16:43:07 +0000 (16:43 +0000)
FossilOrigin-Name: 05e3cced8a884e8bca6f208d2f09e335d3929eac

main.mk
manifest
manifest.uuid
src/tclsqlite.c
src/test_stat.c

diff --git a/main.mk b/main.mk
index aab370627231e31d05141d2d70a464e70d7d87e7..a1f723314084846166e7c204b8c7e99693ed30d2 100644 (file)
--- a/main.mk
+++ b/main.mk
@@ -518,6 +518,16 @@ tclsqlite3:        $(TOP)/src/tclsqlite.c libsqlite3.a
        $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
                $(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
 
+sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
+       echo "#define TCLSH 2" > $@
+       cat sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c >> $@
+       echo "static const char *tclsh_main_loop(void){" >> $@
+       echo "static const char *zMainloop = " >> $@
+       $(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl >> $@
+       echo "; return zMainloop; }" >> $@
+
+sqlite3_analyzer$(EXE): sqlite3_analyzer.c spaceanal_tcl.h
+       $(TCCX) $(TCL_FLAGS) sqlite3_analyzer.c -o $@ $(LIBTCL) $(THREADLIB) 
 
 # Rules to build the 'testfixture' application.
 #
@@ -560,16 +570,6 @@ threadtest3$(EXE): sqlite3.o $(TOP)/test/threadtest3.c $(TOP)/test/tt3_checkpoin
 threadtest: threadtest3$(EXE)
        ./threadtest3$(EXE)
 
-sqlite3_analyzer$(EXE):        $(TOP)/src/tclsqlite.c sqlite3.c $(TESTSRC) \
-                       $(TOP)/tool/spaceanal.tcl
-       $(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl \
-                >spaceanal_tcl.h
-       $(TCCX) $(TCL_FLAGS) -DTCLSH=2 $(TESTFIXTURE_FLAGS)                    \
-               -DSQLITE_TEST=1 -DSQLITE_PRIVATE=""                            \
-               $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c                    \
-               -o sqlite3_analyzer$(EXE)                                      \
-               $(LIBTCL) $(THREADLIB)
-
 TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
 $(TEST_EXTENSION): $(TOP)/src/test_loadext.c
        $(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION)
index 95538b272e1888dff0455b535023358ea1b6911d..7c20228ef4a3e8726b1a7213066a44eda6938e29 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Minor\scomment\schange\sin\sthe\sdescription\sof\sthe\sdifferent\smemory\sallocator\noptions.\s\sNo\schanges\sto\scode.
-D 2011-09-19T20:56:59.410
+C Change\sthe\sway\sthe\ssqlite3_analyzer\sexecutable\sis\sbuilt.
+D 2011-09-21T16:43:07.588
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -104,7 +104,7 @@ F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de
 F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
 F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
-F main.mk 8744cb76517817170f7fd2c78fbf0006fabb93c1
+F main.mk e8b1c8b8eac849d90d3ffce9c2365f657446971c
 F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
 F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
 F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac
@@ -187,7 +187,7 @@ F src/sqliteInt.h 76d81cd9da0618b231398bfcf90556e971972fca
 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
 F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf
 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
-F src/tclsqlite.c 3ef1dda2f1dc207c792eaadebf9d8adc44648581
+F src/tclsqlite.c 20578e66dda94b4d4db3d4478644a4dd9c6084a6
 F src/test1.c 0f41b7c67719207a5de24b009e172c4dcf189827
 F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31
 F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432
@@ -223,7 +223,7 @@ F src/test_quota.c a391c866217e92986c6f523f05b08aa6956c8419
 F src/test_rtree.c 6d06306e29946dc36f528a3a2cdc3add794656f1
 F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
 F src/test_server.c 2f99eb2837dfa06a4aacf24af24c6affdf66a84f
-F src/test_stat.c f682704b5d1ba8e1d4e7e882a6d7922e2dcf066c
+F src/test_stat.c 5bf0dcd0ffa469b2326d90f4a6e52d83e3f2df07
 F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
 F src/test_syscall.c a992d8c80ea91fbf21fb2dd570db40e77dd7e6ae
 F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
@@ -963,7 +963,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5
 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2
-P 3e0da808d2f5b4d12046e05980ca04578f581177
-R 8185767b36f8ee5089cf1856ba34ec13
-U drh
-Z dd5a6c14bafead231702b31c9079bdda
+P 36be31ff0af7f811fe2c6f7e26f058cffb7257e1
+R 8a6deb50b0588867fc20acf473ca1a9e
+U dan
+Z 506e969eac3211328e94965db47501bb
index f3b3da0f669c999eb25b1503f5cb819526a17d72..53acc37cad329c0044ffbb08b7c30cabf05e28e6 100644 (file)
@@ -1 +1 @@
-36be31ff0af7f811fe2c6f7e26f058cffb7257e1
\ No newline at end of file
+05e3cced8a884e8bca6f208d2f09e335d3929eac
\ No newline at end of file
index d2a0582e475b5a59c81aefcf360f55f9e8391317..35dd0ad8aed2b9e745c959afc9034cbd8185ebdf 100644 (file)
@@ -3539,33 +3539,34 @@ int Md5_Register(sqlite3 *db){
 ** the TCL interpreter reads and evaluates that file.
 */
 #if TCLSH==1
-static char zMainloop[] =
-  "set line {}\n"
-  "while {![eof stdin]} {\n"
-    "if {$line!=\"\"} {\n"
-      "puts -nonewline \"> \"\n"
-    "} else {\n"
-      "puts -nonewline \"% \"\n"
-    "}\n"
-    "flush stdout\n"
-    "append line [gets stdin]\n"
-    "if {[info complete $line]} {\n"
-      "if {[catch {uplevel #0 $line} result]} {\n"
-        "puts stderr \"Error: $result\"\n"
-      "} elseif {$result!=\"\"} {\n"
-        "puts $result\n"
+static const char *tclsh_main_loop(void){
+  static const char zMainloop[] =
+    "set line {}\n"
+    "while {![eof stdin]} {\n"
+      "if {$line!=\"\"} {\n"
+        "puts -nonewline \"> \"\n"
+      "} else {\n"
+        "puts -nonewline \"% \"\n"
+      "}\n"
+      "flush stdout\n"
+      "append line [gets stdin]\n"
+      "if {[info complete $line]} {\n"
+        "if {[catch {uplevel #0 $line} result]} {\n"
+          "puts stderr \"Error: $result\"\n"
+        "} elseif {$result!=\"\"} {\n"
+          "puts $result\n"
+        "}\n"
+        "set line {}\n"
+      "} else {\n"
+        "append line \\n\n"
       "}\n"
-      "set line {}\n"
-    "} else {\n"
-      "append line \\n\n"
     "}\n"
-  "}\n"
-;
+  ;
+  return zMainloop;
+}
 #endif
 #if TCLSH==2
-static char zMainloop[] = 
-#include "spaceanal_tcl.h"
-;
+static const char *tclsh_main_loop(void);
 #endif
 
 #ifdef SQLITE_TEST
@@ -3649,6 +3650,17 @@ static void init_all(Tcl_Interp *interp){
   Md5_Init(interp);
 #endif
 
+  /* Install the [register_dbstat_vtab] command to access the implementation
+  ** of virtual table dbstat (source file test_stat.c). This command is
+  ** required for testfixture and sqlite3_analyzer, but not by the production
+  ** Tcl extension.  */
+#if defined(SQLITE_TEST) || TCLSH==2
+  {
+    extern int SqlitetestStat_Init(Tcl_Interp*);
+    SqlitetestStat_Init(interp);
+  }
+#endif
+
 #ifdef SQLITE_TEST
   {
     extern int Sqliteconfig_Init(Tcl_Interp*);
@@ -3678,7 +3690,6 @@ static void init_all(Tcl_Interp *interp){
     extern int Sqlitetestbackup_Init(Tcl_Interp*);
     extern int Sqlitetestintarray_Init(Tcl_Interp*);
     extern int Sqlitetestvfs_Init(Tcl_Interp *);
-    extern int SqlitetestStat_Init(Tcl_Interp*);
     extern int Sqlitetestrtree_Init(Tcl_Interp*);
     extern int Sqlitequota_Init(Tcl_Interp*);
     extern int Sqlitemultiplex_Init(Tcl_Interp*);
@@ -3722,7 +3733,6 @@ static void init_all(Tcl_Interp *interp){
     Sqlitetestbackup_Init(interp);
     Sqlitetestintarray_Init(interp);
     Sqlitetestvfs_Init(interp);
-    SqlitetestStat_Init(interp);
     Sqlitetestrtree_Init(interp);
     Sqlitequota_Init(interp);
     Sqlitemultiplex_Init(interp);
@@ -3758,12 +3768,13 @@ int TCLSH_MAIN(int argc, char **argv){
   ** sqlite3_initialize() is. */
   sqlite3_shutdown();
 
+  Tcl_FindExecutable(argv[0]);
+  interp = Tcl_CreateInterp();
+
 #if TCLSH==2
   sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
 #endif
-  Tcl_FindExecutable(argv[0]);
 
-  interp = Tcl_CreateInterp();
   init_all(interp);
   if( argc>=2 ){
     int i;
@@ -3784,7 +3795,7 @@ int TCLSH_MAIN(int argc, char **argv){
     }
   }
   if( TCLSH==2 || argc<=1 ){
-    Tcl_GlobalEval(interp, zMainloop);
+    Tcl_GlobalEval(interp, tclsh_main_loop());
   }
   return 0;
 }
index c85463e52657d712d07684c72b64406972a9b250..6e6accf6dad62318675c86372436af1bb68ed844 100644 (file)
@@ -18,7 +18,9 @@
 ** for an example implementation.
 */
 
-#include "sqliteInt.h"
+#ifndef SQLITE_AMALGAMATION
+# include "sqliteInt.h"
+#endif
 
 #ifndef SQLITE_OMIT_VIRTUALTABLE
 
@@ -568,7 +570,7 @@ int sqlite3_dbstat_register(sqlite3 *db){
 
 #endif
 
-#ifdef SQLITE_TEST
+#if defined(SQLITE_TEST) || TCLSH==2
 #include <tcl.h>
 
 static int test_dbstat(
@@ -604,4 +606,5 @@ int SqlitetestStat_Init(Tcl_Interp *interp){
   Tcl_CreateObjCommand(interp, "register_dbstat_vtab", test_dbstat, 0, 0);
   return TCL_OK;
 }
-#endif
+#endif /* if defined(SQLITE_TEST) || TCLSH==2 */
+