| Index: third_party/sqlite/sqlite-src-3100200/tool/mksqlite3c-noext.tcl
|
| diff --git a/third_party/sqlite/src/tool/mksqlite3c.tcl b/third_party/sqlite/sqlite-src-3100200/tool/mksqlite3c-noext.tcl
|
| similarity index 76%
|
| copy from third_party/sqlite/src/tool/mksqlite3c.tcl
|
| copy to third_party/sqlite/sqlite-src-3100200/tool/mksqlite3c-noext.tcl
|
| index 9e2b0fe517353dc00614fc012797a02e79413118..601b8cce8c3e6d85d88c285c39909fb787c56e2d 100644
|
| --- a/third_party/sqlite/src/tool/mksqlite3c.tcl
|
| +++ b/third_party/sqlite/sqlite-src-3100200/tool/mksqlite3c-noext.tcl
|
| @@ -17,7 +17,7 @@
|
| # After the "tsrc" directory has been created and populated, run
|
| # this script:
|
| #
|
| -# tclsh mksqlite3c.tcl
|
| +# tclsh mksqlite3c-noext.tcl
|
| #
|
| # The amalgamated SQLite code will be written into sqlite3.c
|
| #
|
| @@ -80,9 +80,6 @@ if {$addstatic} {
|
| puts $out \
|
| {#ifndef SQLITE_PRIVATE
|
| # define SQLITE_PRIVATE static
|
| -#endif
|
| -#ifndef SQLITE_API
|
| -# define SQLITE_API
|
| #endif}
|
| }
|
|
|
| @@ -93,13 +90,10 @@ if {$addstatic} {
|
| foreach hdr {
|
| btree.h
|
| btreeInt.h
|
| - fts3.h
|
| - fts3Int.h
|
| - fts3_hash.h
|
| - fts3_tokenizer.h
|
| hash.h
|
| hwtime.h
|
| keywordhash.h
|
| + msvc.h
|
| mutex.h
|
| opcodes.h
|
| os_common.h
|
| @@ -109,7 +103,7 @@ foreach hdr {
|
| pager.h
|
| parse.h
|
| pcache.h
|
| - rtree.h
|
| + pragma.h
|
| sqlite3ext.h
|
| sqlite3.h
|
| sqliteicu.h
|
| @@ -117,6 +111,7 @@ foreach hdr {
|
| sqliteLimit.h
|
| vdbe.h
|
| vdbeInt.h
|
| + vxworks.h
|
| wal.h
|
| whereInt.h
|
| } {
|
| @@ -124,6 +119,23 @@ foreach hdr {
|
| }
|
| set available_hdr(sqliteInt.h) 0
|
|
|
| +# These headers should be copied into the amalgamation without modifying any
|
| +# of their function declarations or definitions.
|
| +set varonly_hdr(sqlite3.h) 1
|
| +
|
| +# These are the functions that accept a variable number of arguments. They
|
| +# always need to use the "cdecl" calling convention even when another calling
|
| +# convention (e.g. "stcall") is being used for the rest of the library.
|
| +set cdecllist {
|
| + sqlite3_config
|
| + sqlite3_db_config
|
| + sqlite3_log
|
| + sqlite3_mprintf
|
| + sqlite3_snprintf
|
| + sqlite3_test_control
|
| + sqlite3_vtab_config
|
| +}
|
| +
|
| # 78 stars used for comment formatting.
|
| set s78 \
|
| {*****************************************************************************}
|
| @@ -143,18 +155,18 @@ proc section_comment {text} {
|
| # process them appropriately.
|
| #
|
| proc copy_file {filename} {
|
| - global seen_hdr available_hdr out addstatic linemacros
|
| + global seen_hdr available_hdr varonly_hdr cdecllist out addstatic linemacros
|
| set ln 0
|
| set tail [file tail $filename]
|
| section_comment "Begin file $tail"
|
| if {$linemacros} {puts $out "#line 1 \"$filename\""}
|
| set in [open $filename r]
|
| set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+(sqlite3[_a-zA-Z0-9]+)(\[|;| =)}
|
| - set declpattern {[a-zA-Z][a-zA-Z_0-9 ]+ \**(sqlite3[_a-zA-Z0-9]+)\(}
|
| + set declpattern {([a-zA-Z][a-zA-Z_0-9 ]+ \**)(sqlite3[_a-zA-Z0-9]+)(\(.*)}
|
| if {[file extension $filename]==".h"} {
|
| set declpattern " *$declpattern"
|
| }
|
| - set declpattern ^$declpattern
|
| + set declpattern ^$declpattern\$
|
| while {![eof $in]} {
|
| set line [gets $in]
|
| incr ln
|
| @@ -168,6 +180,10 @@ proc copy_file {filename} {
|
| copy_file tsrc/$hdr
|
| section_comment "Continuing where we left off in $tail"
|
| if {$linemacros} {puts $out "#line [expr {$ln+1}] \"$filename\""}
|
| + } else {
|
| + # Comment out the entire line, replacing any nested comment
|
| + # begin/end markers with the harmless substring "**".
|
| + puts $out "/* [string map [list /* ** */ **] $line] */"
|
| }
|
| } elseif {![info exists seen_hdr($hdr)]} {
|
| if {![regexp {/\*\s+amalgamator:\s+dontcache\s+\*/} $line]} {
|
| @@ -188,32 +204,49 @@ proc copy_file {filename} {
|
| } elseif {!$linemacros && [regexp {^#line} $line]} {
|
| # Skip #line directives.
|
| } elseif {$addstatic && ![regexp {^(static|typedef)} $line]} {
|
| - regsub {^SQLITE_API } $line {} line
|
| - if {[regexp $declpattern $line all funcname]} {
|
| + # Skip adding the SQLITE_PRIVATE or SQLITE_API keyword before
|
| + # functions if this header file does not need it.
|
| + if {![info exists varonly_hdr($tail)]
|
| + && [regexp $declpattern $line all rettype funcname rest]} {
|
| + regsub {^SQLITE_API } $line {} line
|
| # Add the SQLITE_PRIVATE or SQLITE_API keyword before functions.
|
| # so that linkage can be modified at compile-time.
|
| if {[regexp {^sqlite3_} $funcname]} {
|
| - puts $out "SQLITE_API $line"
|
| + set line SQLITE_API
|
| + append line " " [string trim $rettype]
|
| + if {[string index $rettype end] ne "*"} {
|
| + append line " "
|
| + }
|
| + if {[lsearch -exact $cdecllist $funcname] >= 0} {
|
| + append line SQLITE_CDECL
|
| + } else {
|
| + append line SQLITE_STDCALL
|
| + }
|
| + append line " " $funcname $rest
|
| + puts $out $line
|
| } else {
|
| puts $out "SQLITE_PRIVATE $line"
|
| }
|
| } elseif {[regexp $varpattern $line all varname]} {
|
| - # Add the SQLITE_PRIVATE before variable declarations or
|
| - # definitions for internal use
|
| - if {![regexp {^sqlite3_} $varname]} {
|
| - regsub {^extern } $line {} line
|
| - puts $out "SQLITE_PRIVATE $line"
|
| - } else {
|
| - if {[regexp {const char sqlite3_version\[\];} $line]} {
|
| - set line {const char sqlite3_version[] = SQLITE_VERSION;}
|
| + # Add the SQLITE_PRIVATE before variable declarations or
|
| + # definitions for internal use
|
| + regsub {^SQLITE_API } $line {} line
|
| + if {![regexp {^sqlite3_} $varname]} {
|
| + regsub {^extern } $line {} line
|
| + puts $out "SQLITE_PRIVATE $line"
|
| + } else {
|
| + if {[regexp {const char sqlite3_version\[\];} $line]} {
|
| + set line {const char sqlite3_version[] = SQLITE_VERSION;}
|
| + }
|
| + regsub {^SQLITE_EXTERN } $line {} line
|
| + puts $out "SQLITE_API $line"
|
| }
|
| - regsub {^SQLITE_EXTERN } $line {} line
|
| - puts $out "SQLITE_API $line"
|
| - }
|
| } elseif {[regexp {^(SQLITE_EXTERN )?void \(\*sqlite3IoTrace\)} $line]} {
|
| + regsub {^SQLITE_API } $line {} line
|
| regsub {^SQLITE_EXTERN } $line {} line
|
| - puts $out "SQLITE_PRIVATE $line"
|
| + puts $out $line
|
| } elseif {[regexp {^void \(\*sqlite3Os} $line]} {
|
| + regsub {^SQLITE_API } $line {} line
|
| puts $out "SQLITE_PRIVATE $line"
|
| } else {
|
| puts $out $line
|
| @@ -315,25 +348,6 @@ foreach file {
|
|
|
| main.c
|
| notify.c
|
| -
|
| - recover.c
|
| -
|
| - fts3.c
|
| - fts3_aux.c
|
| - fts3_expr.c
|
| - fts3_hash.c
|
| - fts3_porter.c
|
| - fts3_tokenizer.c
|
| - fts3_tokenizer1.c
|
| - fts3_tokenize_vtab.c
|
| - fts3_write.c
|
| - fts3_snippet.c
|
| - fts3_unicode.c
|
| - fts3_unicode2.c
|
| -
|
| - rtree.c
|
| - icu.c
|
| - fts3_icu.c
|
| } {
|
| copy_file tsrc/$file
|
| }
|
|
|