]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Modularize all use of the calling convention macros based on the USE_STDCALL nmake...
authormistachkin <mistachkin@noemail.net>
Wed, 24 Aug 2016 19:58:46 +0000 (19:58 +0000)
committermistachkin <mistachkin@noemail.net>
Wed, 24 Aug 2016 19:58:46 +0000 (19:58 +0000)
FossilOrigin-Name: e4a56197b08546601bd6a623f667b43f50d603be

Makefile.msc
manifest
manifest.uuid
tool/mksqlite3c-noext.tcl
tool/mksqlite3c.tcl
tool/mksqlite3h.tcl

index 527efd8f7d18d9d545ec2843392f8aae147fddaa..1569487aa32db54f30ea3645f8bd851d8b5c295f 100644 (file)
@@ -31,6 +31,13 @@ USE_FULLWARN = 0
 USE_RUNTIME_CHECKS = 0
 !ENDIF
 
+# Set this non-0 to create a SQLite amalgamation file that excludes the
+# various built-in extensions.
+#
+!IFNDEF MINIMAL_AMALGAMATION
+MINIMAL_AMALGAMATION = 0
+!ENDIF
+
 # Set this non-0 to use "stdcall" calling convention for the core library
 # and shell executable.
 #
@@ -270,12 +277,37 @@ SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
 !ENDIF
 !ENDIF
 
+# These are the names of the customized Tcl header files used by various parts
+# of this makefile when the stdcall calling convention is in use.  It is not
+# used for any other purpose.
+#
+!IFNDEF SQLITETCLH
+SQLITETCLH = sqlite_tcl.h
+!ENDIF
+
+!IFNDEF SQLITETCLDECLSH
+SQLITETCLDECLSH = sqlite_tclDecls.h
+!ENDIF
+
+# These are the additional targets that the targets that integrate with the
+# Tcl library should depend on when compiling, etc.
+#
+!IFNDEF SQLITE_TCL_DEP
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
+SQLITE_TCL_DEP = $(SQLITETCLDECLSH) $(SQLITETCLH)
+!ELSE
+SQLITE_TCL_DEP =
+!ENDIF
+!ENDIF
+
 # These are the "standard" SQLite compilation options used when compiling for
 # the Windows platform.
 #
 !IFNDEF OPT_FEATURE_FLAGS
+!IF $(MINIMAL_AMALGAMATION)==0
 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
+!ENDIF
 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
 !ENDIF
 
@@ -649,12 +681,35 @@ RCC = $(RCC) -I$(TOP)\ext\session
 # options are necessary in order to allow debugging symbols to
 # work correctly with Visual Studio when using the amalgamation.
 #
+!IFNDEF MKSQLITE3C_TOOL
+!IF $(MINIMAL_AMALGAMATION)!=0
+MKSQLITE3C_TOOL = $(TOP)\tool\mksqlite3c-noext.tcl
+!ELSE
+MKSQLITE3C_TOOL = $(TOP)\tool\mksqlite3c.tcl
+!ENDIF
+!ENDIF
+
 !IFNDEF MKSQLITE3C_ARGS
 !IF $(DEBUG)>1
 MKSQLITE3C_ARGS = --linemacros
 !ELSE
 MKSQLITE3C_ARGS =
 !ENDIF
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
+MKSQLITE3C_ARGS = $(MKSQLITE3C_ARGS) --useapicall
+!ENDIF
+!ENDIF
+
+# The mksqlite3h.tcl script accepts some options on the command line.
+# When compiling with stdcall support, some of these options are
+# necessary.
+#
+!IFNDEF MKSQLITE3H_ARGS
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
+MKSQLITE3H_ARGS = --useapicall
+!ELSE
+MKSQLITE3H_ARGS =
+!ENDIF
 !ENDIF
 # <</mark>>
 
@@ -1260,9 +1315,13 @@ SRC11 = \
 
 # Generated Tcl header files
 #
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
 SRC12 = \
-  sqlite_tcl.h \
-  sqlite_tclDecls.h
+  $(SQLITETCLH) \
+  $(SQLITETCLDECLSH)
+!ELSE
+SRC12 =
+!ENDIF
 
 # All source code files.
 #
@@ -1528,7 +1587,7 @@ mptest:   mptester.exe
 # files are automatically generated.  This target takes care of
 # all that automatic generation.
 #
-.target_source:        $(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c sqlite_tcl.h
+.target_source:        $(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c $(SQLITE_TCL_DEP)
        -rmdir /Q/S tsrc 2>NUL
        -mkdir tsrc
        for %i in ($(SRC00)) do copy /Y %i tsrc
@@ -1551,8 +1610,8 @@ mptest:   mptester.exe
        move vdbe.new tsrc\vdbe.c
        echo > .target_source
 
-sqlite3.c:     .target_source sqlite3ext.h $(TOP)\tool\mksqlite3c.tcl
-       $(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl $(MKSQLITE3C_ARGS)
+sqlite3.c:     .target_source sqlite3ext.h $(MKSQLITE3C_TOOL)
+       $(TCLSH_CMD) $(MKSQLITE3C_TOOL) $(MKSQLITE3C_ARGS)
        copy tsrc\shell.c .
        copy $(TOP)\ext\session\sqlite3session.h .
 
@@ -1825,10 +1884,10 @@ wherecode.lo:   $(TOP)\src\wherecode.c $(HDR)
 whereexpr.lo:  $(TOP)\src\whereexpr.c $(HDR)
        $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\whereexpr.c
 
-tclsqlite.lo:  $(TOP)\src\tclsqlite.c $(HDR) sqlite_tcl.h
+tclsqlite.lo:  $(TOP)\src\tclsqlite.c $(HDR) $(SQLITE_TCL_DEP)
        $(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
 
-tclsqlite-shell.lo:    $(TOP)\src\tclsqlite.c $(HDR) sqlite_tcl.h
+tclsqlite-shell.lo:    $(TOP)\src\tclsqlite.c $(HDR) $(SQLITE_TCL_DEP)
        $(LTCOMPILE) $(NO_WARN) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
 
 tclsqlite3.exe:        tclsqlite-shell.lo $(SQLITE3C) $(SQLITE3H) $(LIBRESOBJS)
@@ -1854,12 +1913,16 @@ parse.c:        $(TOP)\src\parse.y lemon.exe $(TOP)\tool\addopcodes.tcl
        $(TCLSH_CMD) $(TOP)\tool\addopcodes.tcl parse.h.temp > parse.h
 
 $(SQLITE3H):   $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
-       $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > $(SQLITE3H)
+       $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > $(SQLITE3H) $(MKSQLITE3H_ARGS)
 
 sqlite3ext.h:  .target_source
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
        type tsrc\sqlite3ext.h | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*\)" "(SQLITE_CALLBACK *)" \
                | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*" "(SQLITE_APICALL *" > sqlite3ext.h
        copy /Y sqlite3ext.h tsrc\sqlite3ext.h
+!ELSE
+       copy /Y tsrc\sqlite3ext.h sqlite3ext.h
+!ENDIF
 
 mkkeywordhash.exe:     $(TOP)\tool\mkkeywordhash.c
        $(BCC) $(NO_WARN) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) \
@@ -2002,25 +2065,27 @@ TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
 TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
 !ENDIF
 
+!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
 sqlite_tclDecls.h:
-       echo #ifndef SQLITE_TCLAPI > sqlite_tclDecls.h
-       echo #  define SQLITE_TCLAPI >> sqlite_tclDecls.h
-       echo #endif >> sqlite_tclDecls.h
+       echo #ifndef SQLITE_TCLAPI > $(SQLITETCLDECLSH)
+       echo #  define SQLITE_TCLAPI >> $(SQLITETCLDECLSH)
+       echo #endif >> $(SQLITETCLDECLSH)
        type "$(TCLINCDIR)\tclDecls.h" \
                | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN(?: CONST\d+?)?\s+?[^\(]*?\s+?)Tcl_" "\1 SQLITE_TCLAPI Tcl_" \
                | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "^(EXTERN\s+?(?:void|VOID)\s+?)TclFreeObj" "\1 SQLITE_TCLAPI TclFreeObj" \
                | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*tcl_" "(SQLITE_TCLAPI *tcl_" \
                | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*tclFreeObj" "(SQLITE_TCLAPI *tclFreeObj" \
-               | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*" "(SQLITE_TCLAPI *" >> sqlite_tclDecls.h
+               | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "\(\*" "(SQLITE_TCLAPI *" >> $(SQLITETCLDECLSH)
 
-sqlite_tcl.h:  sqlite_tclDecls.h
+sqlite_tcl.h:
        type "$(TCLINCDIR)\tcl.h" | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact tclDecls.h sqlite_tclDecls.h \
                | $(TCLSH_CMD) $(TOP)\tool\replace.tcl regsub "typedef (.*?)\(Tcl_" "typedef \1 (SQLITE_TCLAPI Tcl_" \
                | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "void (*freeProc)" "void (SQLITE_TCLAPI *freeProc)" \
                | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "Tcl_HashEntry *(*findProc)" "Tcl_HashEntry *(SQLITE_TCLAPI *findProc)" \
-               | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "Tcl_HashEntry *(*createProc)" "Tcl_HashEntry *(SQLITE_TCLAPI *createProc)" >> sqlite_tcl.h
+               | $(TCLSH_CMD) $(TOP)\tool\replace.tcl exact "Tcl_HashEntry *(*createProc)" "Tcl_HashEntry *(SQLITE_TCLAPI *createProc)" >> $(SQLITETCLH)
+!ENDIF
 
-testfixture.exe:       $(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR) sqlite_tcl.h
+testfixture.exe:       $(TESTFIXTURE_SRC) $(SQLITE3H) $(LIBRESOBJS) $(HDR) $(SQLITE_TCL_DEP)
        $(LTLINK) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
                -DBUILD_sqlite -I$(TCLINCDIR) \
                $(TESTFIXTURE_SRC) \
@@ -2069,7 +2134,7 @@ smoketest:        $(TESTPROGS)
        @set PATH=$(LIBTCLPATH);$(PATH)
        .\testfixture.exe $(TOP)\test\main.test $(TESTOPTS)
 
-sqlite3_analyzer.c:    $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl sqlite_tcl.h
+sqlite3_analyzer.c:    $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl $(SQLITE_TCL_DEP)
        echo #define TCLSH 2 > $@
        echo #define SQLITE_ENABLE_DBSTAT_VTAB 1 >> $@
        copy $@ + $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@
@@ -2149,7 +2214,7 @@ clean:
        -rmdir /Q/S .libs 2>NUL
        -rmdir /Q/S tsrc 2>NUL
        del /Q .target_source 2>NUL
-       del /Q tclsqlite3.exe sqlite_tcl.h sqlite_tclDecls.h 2>NUL
+       del /Q tclsqlite3.exe $(SQLITETCLH) $(SQLITETCLDECLSH) 2>NUL
        del /Q testloadext.dll 2>NUL
        del /Q testfixture.exe test.db 2>NUL
        del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe 2>NUL
index 31ab0fb601d45aa51572a7dbd9921b338c3f4c82..e72fee200161899cbc5e13b0000bfc85565cd370 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
-C Merge\supdates\sfrom\strunk.
-D 2016-08-24T18:49:20.476
+C Modularize\sall\suse\sof\sthe\scalling\sconvention\smacros\sbased\son\sthe\sUSE_STDCALL\snmake\smacro.
+D 2016-08-24T19:58:46.902
 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
-F Makefile.msc 3340e479e5221f06c3d61726f8f7efff885e4233
+F Makefile.msc 2a8f135e10f383a31f1106cf42edabf3a18a3d08
 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
 F VERSION 25e2e333adeff5965520bc8db999c658898c972d
 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
@@ -1451,9 +1451,9 @@ F tool/mkopcodeh.tcl a01d2c1d8a6205b03fc635adf3735b4c523befd3
 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
 F tool/mkpragmatab.tcl f0d5bb266d1d388cf86fce5ba01a891e95d72d41
 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
-F tool/mksqlite3c-noext.tcl aa58ea3be311c81821c2cd3209f55e46b07ab656
-F tool/mksqlite3c.tcl a52ead27e2ac5d4b616e945a0601f628f4328329
-F tool/mksqlite3h.tcl cf5cd68028e69a51ed5c76042672664201f0f756
+F tool/mksqlite3c-noext.tcl e241889b12b7f857bc7c361776ef113d826e0c28
+F tool/mksqlite3c.tcl b076d24348a84dffd41aab01bc4e19a1ba17581a
+F tool/mksqlite3h.tcl 22fa51b3dc04bef7cc55546c94b8b05478e081f8
 F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
 F tool/mkvsix.tcl 4abcaf3267171b2faadaf9b82a0dfbaa6e98f8b7
 F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091
@@ -1511,7 +1511,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 71ffa195f5a48280ee522d80ab82e8cdea636961 77f7c31a3aa44798cfa5f557242caffb593ce7af
-R 6639d7ca813b34dc442dce0c70a8d49a
+P 428fc38d95dd88b90655a97133d0ad1214c9f176
+R 8fcf2f6bc8929252e1f73eaeed6c2ff1
 U mistachkin
-Z fc90dd7d8c306741e4a70346c0bad323
+Z 8acb335e007f8a860d6f64c92d2219b8
index bce9ac3fde536ae13c129375d02b3e8135d77351..60aed0f8b193f33759a53eb1a0f726be7de8ef66 100644 (file)
@@ -1 +1 @@
-428fc38d95dd88b90655a97133d0ad1214c9f176
\ No newline at end of file
+e4a56197b08546601bd6a623f667b43f50d603be
\ No newline at end of file
index fad6c9e5842044d4082ab1e26b8f2812579aa8de..a55e93ff165049ae5659358ab96b6b097a92abf2 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/tclsh
 #
 # To build a single huge source file holding all of SQLite (or at
-# least the core components - the test harness, shell, and TCL 
+# least the core components - the test harness, shell, and TCL
 # interface are omitted.) first do
 #
 #      make target_source
@@ -11,7 +11,7 @@
 # there and will not work if they are not found.)  There are a few
 # generated C code files that are also added to the tsrc directory.
 # For example, the "parse.c" and "parse.h" files to implement the
-# the parser are derived from "parse.y" using lemon.  And the 
+# the parser are derived from "parse.y" using lemon.  And the
 # "keywordhash.h" files is generated by a program named "mkkeywordhash".
 #
 # After the "tsrc" directory has been created and populated, run
 # from in this file.  The version number is needed to generate the header
 # comment of the amalgamation.
 #
-if {[lsearch $argv --nostatic]>=0} {
-  set addstatic 0
-} else {
-  set addstatic 1
-}
-if {[lsearch $argv --linemacros]>=0} {
-  set linemacros 1
-} else {
-  set linemacros 0
+set addstatic 1
+set linemacros 0
+set useapicall 0
+for {set i 0} {$i<[llength $argv]} {incr i} {
+  set x [lindex $argv $i]
+  if {[regexp {^-+nostatic$} $x]} {
+    set addstatic 0
+  } elseif {[regexp {^-+linemacros} $x]} {
+    set linemacros 1
+  } elseif {[regexp {^-+useapicall} $x]} {
+    set useapicall 1
+  } else {
+    error "unknown command-line option: $x"
+  }
 }
 set in [open tsrc/sqlite3.h]
 set cnt 0
@@ -57,7 +62,7 @@ set today [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S UTC" -gmt 1]
 puts $out [subst \
 {/******************************************************************************
 ** This file is an amalgamation of many separate C source files from SQLite
-** version $VERSION.  By combining all the individual C code files into this 
+** version $VERSION.  By combining all the individual C code files into this
 ** single large file, the entire code can be compiled as a single translation
 ** unit.  This allows many compilers to do optimizations that would not be
 ** possible if the files were compiled separately.  Performance improvements
@@ -66,7 +71,7 @@ puts $out [subst \
 **
 ** This file is all you need to compile SQLite.  To use SQLite in other
 ** programs, you need this file and the "sqlite3.h" header file that defines
-** the programming interface to the SQLite library.  (If you do not have 
+** the programming interface to the SQLite library.  (If you do not have
 ** the "sqlite3.h" header file at hand, you will find a copy embedded within
 ** the text of this file.  Search for "Begin file sqlite3.h" to find the start
 ** of the embedded sqlite3.h header file.) Additional code files may be needed
@@ -83,7 +88,7 @@ if {$addstatic} {
 #endif}
 }
 
-# These are the header files used by SQLite.  The first time any of these 
+# These are the header files used by SQLite.  The first time any of these
 # files are seen in a #include statement in the C code, include the complete
 # text of the file in-line.  The file only needs to be included once.
 #
@@ -104,8 +109,8 @@ foreach hdr {
    parse.h
    pcache.h
    pragma.h
-   sqlite3ext.h
    sqlite3.h
+   sqlite3ext.h
    sqliteicu.h
    sqliteInt.h
    sqliteLimit.h
@@ -155,7 +160,8 @@ proc section_comment {text} {
 # process them appropriately.
 #
 proc copy_file {filename} {
-  global seen_hdr available_hdr varonly_hdr cdecllist out addstatic linemacros
+  global seen_hdr available_hdr varonly_hdr cdecllist out
+  global addstatic linemacros useapicall
   set ln 0
   set tail [file tail $filename]
   section_comment "Begin file $tail"
@@ -203,7 +209,8 @@ proc copy_file {filename} {
       puts $out "#if 0"
     } elseif {!$linemacros && [regexp {^#line} $line]} {
       # Skip #line directives.
-    } elseif {$addstatic && ![regexp {^(static|typedef)} $line]} {
+    } elseif {$addstatic
+               && ![regexp {^(static|typedef|SQLITE_PRIVATE)} $line]} {
       # 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)]
@@ -211,16 +218,18 @@ proc copy_file {filename} {
         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]} {
+        if {[regexp {^sqlite3[a-z]*_} $funcname]} {
           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_APICALL
+          if {$useapicall} {
+            if {[lsearch -exact $cdecllist $funcname] >= 0} {
+              append line SQLITE_CDECL
+            } else {
+              append line SQLITE_APICALL
+            }
           }
           append line " " $funcname $rest
           puts $out $line
@@ -285,6 +294,7 @@ foreach file {
    mutex_w32.c
    malloc.c
    printf.c
+   treeview.c
    random.c
    threads.c
    utf.c
@@ -313,7 +323,6 @@ foreach file {
    vdbe.c
    vdbeblob.c
    vdbesort.c
-   journal.c
    memjournal.c
 
    walker.c
@@ -339,6 +348,8 @@ foreach file {
    update.c
    vacuum.c
    vtab.c
+   wherecode.c
+   whereexpr.c
    where.c
 
    parse.c
index b7561cfa5b7fff8c53db54f41e020f48cedf801d..9938ed14e46c22c19557f2388ba774da38cb49ae 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/tclsh
 #
 # To build a single huge source file holding all of SQLite (or at
-# least the core components - the test harness, shell, and TCL 
+# least the core components - the test harness, shell, and TCL
 # interface are omitted.) first do
 #
 #      make target_source
@@ -11,7 +11,7 @@
 # there and will not work if they are not found.)  There are a few
 # generated C code files that are also added to the tsrc directory.
 # For example, the "parse.c" and "parse.h" files to implement the
-# the parser are derived from "parse.y" using lemon.  And the 
+# the parser are derived from "parse.y" using lemon.  And the
 # "keywordhash.h" files is generated by a program named "mkkeywordhash".
 #
 # After the "tsrc" directory has been created and populated, run
 #
 set addstatic 1
 set linemacros 0
+set useapicall 0
 for {set i 0} {$i<[llength $argv]} {incr i} {
   set x [lindex $argv $i]
   if {[regexp {^-+nostatic$} $x]} {
     set addstatic 0
   } elseif {[regexp {^-+linemacros} $x]} {
     set linemacros 1
+  } elseif {[regexp {^-+useapicall} $x]} {
+    set useapicall 1
   } else {
     error "unknown command-line option: $x"
   }
@@ -59,7 +62,7 @@ set today [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S UTC" -gmt 1]
 puts $out [subst \
 {/******************************************************************************
 ** This file is an amalgamation of many separate C source files from SQLite
-** version $VERSION.  By combining all the individual C code files into this 
+** version $VERSION.  By combining all the individual C code files into this
 ** single large file, the entire code can be compiled as a single translation
 ** unit.  This allows many compilers to do optimizations that would not be
 ** possible if the files were compiled separately.  Performance improvements
@@ -68,7 +71,7 @@ puts $out [subst \
 **
 ** This file is all you need to compile SQLite.  To use SQLite in other
 ** programs, you need this file and the "sqlite3.h" header file that defines
-** the programming interface to the SQLite library.  (If you do not have 
+** the programming interface to the SQLite library.  (If you do not have
 ** the "sqlite3.h" header file at hand, you will find a copy embedded within
 ** the text of this file.  Search for "Begin file sqlite3.h" to find the start
 ** of the embedded sqlite3.h header file.) Additional code files may be needed
@@ -85,7 +88,7 @@ if {$addstatic} {
 #endif}
 }
 
-# These are the header files used by SQLite.  The first time any of these 
+# These are the header files used by SQLite.  The first time any of these
 # files are seen in a #include statement in the C code, include the complete
 # text of the file in-line.  The file only needs to be included once.
 #
@@ -112,7 +115,6 @@ foreach hdr {
    pragma.h
    rtree.h
    sqlite3session.h
-   sqlite3ext.h
    sqlite3.h
    sqlite3ext.h
    sqlite3rbu.h
@@ -166,7 +168,8 @@ proc section_comment {text} {
 # process them appropriately.
 #
 proc copy_file {filename} {
-  global seen_hdr available_hdr varonly_hdr cdecllist out addstatic linemacros
+  global seen_hdr available_hdr varonly_hdr cdecllist out
+  global addstatic linemacros useapicall
   set ln 0
   set tail [file tail $filename]
   section_comment "Begin file $tail"
@@ -229,10 +232,12 @@ proc copy_file {filename} {
           if {[string index $rettype end] ne "*"} {
             append line " "
           }
-          if {[lsearch -exact $cdecllist $funcname] >= 0} {
-            append line SQLITE_CDECL
-          } else {
-            append line SQLITE_APICALL
+          if {$useapicall} {
+            if {[lsearch -exact $cdecllist $funcname] >= 0} {
+              append line SQLITE_CDECL
+            } else {
+              append line SQLITE_APICALL
+            }
           }
           append line " " $funcname $rest
           puts $out $line
index 9a4e7d298577c3e4ec9f627e458386fe6189c44d..c620eb630da72b6c412cc6ec78a1d99b4bf64eef 100644 (file)
 #
 # Run this script by specifying the root directory of the source tree
 # on the command-line.
-# 
+#
 # This script performs processing on src/sqlite.h.in. It:
 #
 #   1) Adds SQLITE_EXTERN in front of the declaration of global variables,
 #   2) Adds SQLITE_API in front of the declaration of API functions,
-#   3) Replaces the string --VERS-- with the current library version, 
+#   3) Replaces the string --VERS-- with the current library version,
 #      formatted as a string (e.g. "3.6.17"), and
 #   4) Replaces the string --VERSION-NUMBER-- with current library version,
 #      formatted as an integer (e.g. "3006017").
-#   5) Replaces the string --SOURCE-ID-- with the date and time and sha1 
+#   5) Replaces the string --SOURCE-ID-- with the date and time and sha1
 #      hash of the fossil-scm manifest for the source tree.
 #   6) Adds the SQLITE_CALLBACK calling convention macro in front of all
 #      callback declarations.
 #
 set TOP [lindex $argv 0]
 
+# Enable use of SQLITE_APICALL macros at the right points?
+#
+set useapicall 0
+
+if {[lsearch -regexp [lrange $argv 1 end] {^-+useapicall}] != -1} {
+  set useapicall 1
+}
+
 # Get the SQLite version number (ex: 3.6.18) from the $TOP/VERSION file.
 #
 set in [open $TOP/VERSION]
@@ -98,14 +106,14 @@ foreach file $filelist {
     puts "/******** Begin file [file tail $file] *********/"
   }
   while {![eof $in]} {
-  
+
     set line [gets $in]
 
     # File sqlite3rtree.h contains a line "#include <sqlite3.h>". Omit this
     # line when copying sqlite3rtree.h into sqlite3.h.
     #
     if {[string match {*#include*[<"]sqlite3.h[>"]*} $line]} continue
-  
+
     regsub -- --VERS--           $line $zVersion line
     regsub -- --VERSION-NUMBER-- $line $nVersion line
     regsub -- --SOURCE-ID--      $line "$zDate $zUuid" line
@@ -119,17 +127,21 @@ foreach file $filelist {
         if {[string index $rettype end] ne "*"} {
           append line " "
         }
-        if {[lsearch -exact $cdecllist $funcname] >= 0} {
-          append line SQLITE_CDECL
-        } else {
-          append line SQLITE_APICALL
+        if {$useapicall} {
+          if {[lsearch -exact $cdecllist $funcname] >= 0} {
+            append line SQLITE_CDECL
+          } else {
+            append line SQLITE_APICALL
+          }
         }
         append line " " $funcname $rest
       }
     }
-    set line [string map [list (*sqlite3_syscall_ptr) \
-        "(SQLITE_SYSAPI *sqlite3_syscall_ptr)"] $line]
-    regsub {\(\*} $line {(SQLITE_CALLBACK *} line
+    if {$useapicall} {
+      set line [string map [list (*sqlite3_syscall_ptr) \
+          "(SQLITE_SYSAPI *sqlite3_syscall_ptr)"] $line]
+      regsub {\(\*} $line {(SQLITE_CALLBACK *} line
+    }
     puts $line
   }
   close $in