]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Experimental branch for more flexible selection of extensions and localization of...
authorlarrybr <larrybr@noemail.net>
Fri, 2 Dec 2022 03:35:28 +0000 (03:35 +0000)
committerlarrybr <larrybr@noemail.net>
Fri, 2 Dec 2022 03:35:28 +0000 (03:35 +0000)
FossilOrigin-Name: 98be19ba839779e6d5a22850fe82fb3d5d7ed156baf8074a4d4b74f4e49f3f61

manifest
manifest.uuid
src/cli_extend.c [new file with mode: 0644]
src/shell.c.in
tool/mkshellc.tcl

index 687edef5340350cb6896256f1e42d87322b60e20..37fac3b8f2cce4db895a4c6f340ba7fa9831896d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C sqlite3_js_create_file()\snow\saccepts\san\sArrayBuffer\sdata\ssource.\sAdd\stest\sfor\sOPFS-based\sexport/re-import.\sThe\s(sqlite3*)\sargument\sconverter\snow\soptionally\saccepts\ssqlite3.oo1.DB\sinstances.
-D 2022-12-01T15:22:03.961
+C Experimental\sbranch\sfor\smore\sflexible\sselection\sof\sextensions\sand\slocalization\sof\sdetails\sof\sincorporation\sby\shost.\sA\sWIP\sfor\snow.
+D 2022-12-02T03:35:28.370
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -589,6 +589,7 @@ F src/btree.h 49da925329574798be3cbb745a49d069a9e67c99900d8a0d04b1e934d60394ea
 F src/btreeInt.h 88ad499c92b489afedbfefc3f067c4d15023ec021afe622db240dc9d2277cfa5
 F src/build.c d3e43e950e4e377c1d451a4862556792acdef1faba14a03f899d30d09731c48b
 F src/callback.c 4cd7225b26a97f7de5fee5ae10464bed5a78f2adefe19534cc2095b3a8ca484a
+F src/cli_extend.c fbfe60880fbde5b0c2806d2e983d86db1d6fa7fcc2f2e3f350a290a71540507e
 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
 F src/ctime.c 20507cc0b0a6c19cd882fcd0eaeda32ae6a4229fb4b024cfdf3183043d9b703d
 F src/date.c 94ce83b4cd848a387680a5f920c9018c16655db778c4d36525af0a0f34679ac5
@@ -646,7 +647,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
 F src/resolve.c efea4e5fbecfd6d0a9071b0be0d952620991673391b6ffaaf4c277b0bb674633
 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
 F src/select.c 6983de0e6b8b68c97f82f9fca27ffb8f17161cff4d0d48fdf9eb40b213da0cc6
-F src/shell.c.in 9fda74d40b206a707aaa69fc5dc38e2c6a9137a3f4a1dcd7af581d59d92c063c
+F src/shell.c.in c6be18e6a6c420070ff36c1d238aeba21c6ef3ad4d51e49646cec0b8d5c90bd3
 F src/sqlite.h.in 3439711b72cf1a541716da3671ac40f8d5957cdecfc192d47d32f7aed94207c2
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h c4b9fa7a7e2bcdf850cfeb4b8a91d5ec47b7a00033bc996fd2ee96cbf2741f5f
@@ -1997,7 +1998,7 @@ F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61
 F tool/mkopcodeh.tcl bcb2bd5affb545fd219ef0304c7978e2a356407ab723f45ec8569235892c1c3f
 F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa
 F tool/mkpragmatab.tcl bd07bd59d45d0f3448e123d6937e9811195f9908a51e09d774609883055bfd3d
-F tool/mkshellc.tcl 02d0de8349ef830c0fb20d29680320bde2466e2ec422e5bd94c4317a7a7e8cc9
+F tool/mkshellc.tcl 79f47c7903bcb7d32fd0f0b3b589302fa55cff649eed1b6ac353f06f9593d6d5
 F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
 F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f
@@ -2065,8 +2066,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 9ea2d3dcf798393a7fd231e199c0e2c6302949fe2a7f2573178fb0e50c78a2f4
-R 03a40b38b5a233d1d5761f06f6f34dbb
-U stephan
-Z 343e90b1bb6c198c8661d1f234560b23
+P 14a84b67fb17e16a5691ea4bf7f374123ac73a361a5d3d0efca53788d2001e3a
+R 9f43e273f35904337d993bcd41e54bfb
+T *branch * extension_opts
+T *sym-extension_opts *
+T -sym-trunk *
+U larrybr
+Z 177a05c2fff7614fb99cda37f3a71700
 # Remove this line to create a well-formed Fossil manifest.
index 411cc90ecc184e50ffacc27c0a42f24afd7c6ae6..1e63f19093c5b9449c7f7b8b3c89fba6f561a6df 100644 (file)
@@ -1 +1 @@
-14a84b67fb17e16a5691ea4bf7f374123ac73a361a5d3d0efca53788d2001e3a
\ No newline at end of file
+98be19ba839779e6d5a22850fe82fb3d5d7ed156baf8074a4d4b74f4e49f3f61
\ No newline at end of file
diff --git a/src/cli_extend.c b/src/cli_extend.c
new file mode 100644 (file)
index 0000000..a33f054
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+** 2022-12-01
+**
+** The author disclaims copyright to this source code.  In place of
+** a legal notice, here is a blessing:
+**
+**    May you do good and not evil.
+**    May you find forgiveness for yourself and forgive others.
+**    May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This source allows multiple SQLite extensions to be either: (a) combined
+** into a single runtime-loadable library; (b) built into the SQLite shell
+** using a preprocessing convention set by src/shell.c.in (and shell.c), or
+** built into and statically linked with a customized SQLite3 library build.
+**
+** The customized library build may be effected by appending this source
+** to the sqlite3.c amalgamation to form a modified translation unit. How
+** this concatenation is accomplished is immaterial.
+*/
+
+INCLUDE cli_extend.c
+#include "cli_extend.c"
index a829fa2387a1942e4b0ebaa663b181789a4b2467..d0a1a6db61eb6bc887ce93ec24041b1ba537ae1c 100644 (file)
@@ -1072,6 +1072,11 @@ INCLUDE ../ext/recover/dbdata.c
 INCLUDE ../ext/recover/sqlite3recover.c
 # endif
 #endif
+
+/*
+** Provide for incorporating more or fewer extensions in custom builds.
+*/
+INCLUDE cli_extend.c
 #ifdef SQLITE_SHELL_EXTSRC
 # include SHELL_STRINGIFY(SQLITE_SHELL_EXTSRC)
 #endif
index 35b48007197fc728684cf391207a1fef90e03fc1..034028d122737e132e927c829b86e24a59d6526c 100644 (file)
@@ -9,10 +9,10 @@
 # the script is $DIR, then the component parts are located in $DIR/../src
 # and $DIR/../ext/misc.
 #
-set topdir [file dir [file dir [file normal $argv0]]]
-set out stdout
+set ::topdir [file dir [file dir [file normal $argv0]]]
+set ::out stdout
 fconfigure stdout -translation binary
-puts $out {/* DO NOT EDIT!
+puts $::out {/* DO NOT EDIT!
 ** This file is automatically generated by the script in the canonical
 ** SQLite source tree at tool/mkshellc.tcl.  That script combines source
 ** code from various constituent source files of SQLite into this single
@@ -27,11 +27,12 @@ puts $out {/* DO NOT EDIT!
 ** source file to help make the command-line program easier to compile.
 **
 ** To modify this program, get a copy of the canonical SQLite source tree,
-** edit the src/shell.c.in" and/or some of the other files that are included
+** edit "src/shell.c.in" and/or some of the other files that are included
 ** by "src/shell.c.in", then rerun the tool/mkshellc.tcl script.
 */}
-set in [open $topdir/src/shell.c.in]
-fconfigure $in -translation binary
+
+array set ::filesInput {}
+
 proc omit_redundant_typedefs {line} {
   global typedef_seen
   if {[regexp {^typedef .*\y([a-zA-Z0-9_]+);} $line all typename]} {
@@ -42,34 +43,53 @@ proc omit_redundant_typedefs {line} {
   }
   return $line
 }
-set iLine 0
-while {1} {
-  set lx [omit_redundant_typedefs [gets $in]]
-  if {[eof $in]} break;
-  incr iLine
-  if {[regexp {^INCLUDE } $lx]} {
-    set cfile [lindex $lx 1]
-    puts $out "/************************* Begin $cfile ******************/"
-#   puts $out "#line 1 \"$cfile\""
-    set in2 [open $topdir/src/$cfile]
-    fconfigure $in2 -translation binary
-    while {![eof $in2]} {
-      set lx [omit_redundant_typedefs [gets $in2]]
-      if {[regexp {^#include "sqlite} $lx]} {
-        set lx "/* $lx */"
-      }
-      if {[regexp {^# *include "test_windirent.h"} $lx]} {
-        set lx "/* $lx */"
+
+# For INCLUDED files, suppress redundant #include directives and
+# eliminate a Windows-specific attribute not needed for the shell.
+proc misc_sieve {line} {
+  if {[regexp {^# *include "([^"]+)"} $line _ finc]} {
+    set finc [regsub {".*$} $finc ""]
+    # Project headers #include'd at top level (by shell.c.in), or
+    # files already the object of INCLUDE, need not be #include'd.
+    if {[regexp {^sqlite} $finc] || [info exists ::filesInput($finc)]} {
+      return "/* $line */"
+    }
+  }
+  return [string map [list __declspec(dllexport) {}] $line]
+}
+
+# Read, process and emit the named file, and track recursion level.
+proc include_file {fname rlevel} {
+  if {[info exists ::filesInput($fname)]} return ;# Block revisits.
+  set in [open $::topdir/src/$fname]
+  fconfigure $in -translation binary
+  set ::filesInput($fname) 1
+  if {$rlevel > 0} {
+    puts $::out "/************************* Begin $fname ******************/"
+  }
+  set iLine 0
+  # puts $::out "#line 1 \"$fname\""
+  while {![eof $in]} {
+    set lx [omit_redundant_typedefs [gets $in]]
+    incr iLine
+    if {[regexp {^INCLUDE } $lx]} {
+      set cfile [lindex $lx 1]
+      include_file $cfile [expr $rlevel + 1]
+      # puts $::out "#line [expr $iLine+1] \"$fname\""
+    } else {
+      if {$rlevel > 0} {
+        puts $::out [misc_sieve $lx]
+      } elseif {$lx ne "" || ![eof $in]} {
+        puts $::out $lx
       }
-      set lx [string map [list __declspec(dllexport) {}] $lx]
-      puts $out $lx
     }
-    close $in2
-    puts $out "/************************* End $cfile ********************/"
-#   puts $out "#line [expr $iLine+1] \"shell.c.in\""
-    continue
   }
-  puts $out $lx
+  close $in
+  if {$rlevel > 0} {
+    puts $::out "/************************* End $fname ********************/"
+  }
 }
-close $in
-close $out
+
+include_file shell.c.in 0
+
+close $::out