]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove FILE* from shell extension interface.
authorlarrybr <larrybr@noemail.net>
Sun, 1 May 2022 14:26:49 +0000 (14:26 +0000)
committerlarrybr <larrybr@noemail.net>
Sun, 1 May 2022 14:26:49 +0000 (14:26 +0000)
FossilOrigin-Name: 27ff5ce5170ef5902f15ca8fe4133e41b139e0ef5214f8f5a58d12e852a2b782

ext/misc/tclshext.c.in
manifest
manifest.uuid
src/shell.c.in
src/shext_linkage.h
src/test_shellext_c.c
src/test_shellext_cpp.cpp

index 86293d6ad1ae8841e370f4a3bcfe8bd933763a9e..6b7cb5b1bcf389621a7709a7ed78530732dcac57 100644 (file)
@@ -118,6 +118,7 @@ SQLITE_EXTENSION_INIT1;
 SHELL_EXTENSION_INIT1(pShExtApi, pExtHelpers, shextLinkFetcher);
 #define SHX_API(entry) pShExtApi->entry
 #define SHX_HELPER(entry) pExtHelpers->entry
+#define oprintf pExtHelpers->utf8CurrentOutPrintf
 
 /* This is not found in the API pointer table published for extensions: */
 #define sqlite3_enable_load_extension SHX_HELPER(enable_load_extension)
@@ -527,7 +528,6 @@ static DotCmdRC runTclREPL(Tcl_Interp *interp, char **pzErrMsg){
 
 DERIVED_METHOD(DotCmdRC, execute, DotCommand,TclCmd, 4,
              (ShellExState *psx, char **pzErrMsg, int nArgs, char *azArgs[])){
-  FILE *out = SHX_HELPER(currentOutputFile)(psx);
   TclCmd *ptc = (TclCmd *)pThis;
   if( nArgs>1 ){
     /* Read named files into the interpreter. */
@@ -562,9 +562,8 @@ DERIVED_METHOD(DotCmdRC, execute, DotCommand,UnkCmd, 4,
       *pzErrMsg = sqlite3_mprintf("Command %s not found.\n", zName);
       return DCR_Unknown;
     }else{
-      FILE *out = SHX_HELPER(currentOutputFile)(psx);
       fprintf(stderr, "The %s command does not yet exist.\n", zName);
-      fprintf(out, "Run .help to see existent dot commands,"
+      oprintf(psx, "Run .help to see existent dot commands,"
               " or create %s as a TCL proc.\n", zName);
       return DCR_CmdErred;
     }
index 53463ec09f151b1604a6f1a6f294bdb026b4a429..19fad4e4ca4b595f0dbe3b4060a566fe4bcd5af1 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Get\ssqlite3x.exe\sand\sextensions\stested\swith\sMSVC\sbuild.
-D 2022-05-01T04:55:59.982
+C Remove\sFILE*\sfrom\sshell\sextension\sinterface.
+D 2022-05-01T14:26:49.216
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -330,7 +330,7 @@ F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
 F ext/misc/spellfix.c 94df9bbfa514a563c1484f684a2df3d128a2f7209a84ca3ca100c68a0163e29f
 F ext/misc/sqlar.c 0ace5d3c10fe736dc584bf1159a36b8e2e60fab309d310cd8a0eecd9036621b6
 F ext/misc/stmt.c 35063044a388ead95557e4b84b89c1b93accc2f1c6ddea3f9710e8486a7af94a
-F ext/misc/tclshext.c.in 8c939f7048630f73608133e6873e2c963eb8bb4bdfdf65144a3c6f2ca3d62510
+F ext/misc/tclshext.c.in d288a729637bf8d55497b72f0cefeec09c3a3ab9c5826f75ab7597b04ba6e523
 F ext/misc/templatevtab.c 8a16a91a5ceaccfcbd6aaaa56d46828806e460dd194965b3f77bf38f14b942c4
 F ext/misc/totype.c fa4aedeb07f66169005dffa8de3b0a2b621779fd44f85c103228a42afa71853b
 F ext/misc/uint.c 053fed3bce2e89583afcd4bf804d75d659879bbcedac74d0fa9ed548839a030b
@@ -558,8 +558,8 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
 F src/resolve.c f72bb13359dd5a74d440df25f320dc2c1baff5cde4fc9f0d1bc3feba90b8932a
 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
 F src/select.c cc1a7581403fc074eee85283ba8d81de50a831ae175cb65a5751be00f621c0d5
-F src/shell.c.in a298520dcb54d9d900e850b92c41e8fab461f2a536b0353c3da63b9aa9cfe1b0
-F src/shext_linkage.h 1d3567d5f141b84c4d895f015481abd1340ffc24206de81bd5512a4967d87c9f
+F src/shell.c.in 2609f4dfa2d4340350cb1a51da79f2c359cc0535b5b6c4ee49ffbf05b7675790
+F src/shext_linkage.h b1af148b4f0ab92d73ad08a4f25365c60db497d18461a5b8a51b3c70977e0ac4
 F src/sqlite.h.in 2a35f62185eb5e7ecc64a2f68442b538ce9be74f80f28a00abc24837edcf1c17
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h f49e28c25bd941e79794db5415fdf7b202deb3bc072ed6f1ed273d578703684e
@@ -608,8 +608,8 @@ F src/test_quota.h 2a8ad1952d1d2ca9af0ce0465e56e6c023b5e15d
 F src/test_rtree.c 671f3fae50ff116ef2e32a3bf1fe21b5615b4b7b
 F src/test_schema.c f5d6067dfc2f2845c4dd56df63e66ee826fb23877855c785f75cc2ca83fd0c1b
 F src/test_server.c a2615049954cbb9cfb4a62e18e2f0616e4dc38fe
-F src/test_shellext_c.c 4e858a0f0618ccd62d845c16a3bb460c236177df3881555b6db3acebfcc5301b
-F src/test_shellext_cpp.cpp 791509064f6e3c08ecc101beed4cdab940c2ea89bdbffd7408790f751e417886
+F src/test_shellext_c.c aee192ee9ed63c1a6bde180a74ace1243a235f6fbd583aad67094c1ed6e1ec26
+F src/test_shellext_cpp.cpp 2525913692646e06e9f68206abce155fbcfd92a0c069ebf3937f58f752b871ad
 F src/test_sqllog.c 540feaea7280cd5f926168aee9deb1065ae136d0bbbe7361e2ef3541783e187a
 F src/test_superlock.c 4839644b9201da822f181c5bc406c0b2385f672e
 F src/test_syscall.c 1073306ba2e9bfc886771871a13d3de281ed3939
@@ -1960,8 +1960,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P c3494fa75772077d3ef51bc4d9e7cd673050e6d60c78f1543bcaf9f1a2534915
-R 022d02304f18e854a14c2132bbc30385
+P d2b16c29fcbd73c2579aefcfb7042b22a2676e84e815c8ba4bf4b5570eca0d97
+R 01c7577fc5e77a5b3ed875d297e8d677
 U larrybr
-Z 240e46def679b8cc9b945d4803ee9ff6
+Z 82444d8b81ca9a647979eae39ec42355
 # Remove this line to create a well-formed Fossil manifest.
index 2457752db309f885a82b65842f834869a69cf229..c3199cc4bf65759fb40e666172eaeadf1753a144 100644 (file)
@@ -1 +1 @@
-d2b16c29fcbd73c2579aefcfb7042b22a2676e84e815c8ba4bf4b5570eca0d97
\ No newline at end of file
+27ff5ce5170ef5902f15ca8fe4133e41b139e0ef5214f8f5a58d12e852a2b782
\ No newline at end of file
index 551470b724fc7378e567b59f92d4389f19660eb8..7c6139648af7a941d06371b0d225ded7331f2254 100644 (file)
@@ -8204,10 +8204,10 @@ static DotCommand * findDotCommand(const char *, ShellExState *, int *);
 static DotCmdRC runDotCommand(DotCommand*, char *[], int na, ShellExState*);
 
 static ExtensionHelpers extHelpers = {
-  14,
+  13,
   {
     failIfSafeMode,
-    currentOutputFile,
+    utf8_out_printf,
     currentInputSource,
     strLineGet,
     findDotCommand,
@@ -8219,7 +8219,6 @@ static ExtensionHelpers extHelpers = {
     one_input_line,
     free_input_line,
     sqlite3_enable_load_extension,
-    utf8_out_printf,
     0
   }
 };
@@ -15276,7 +15275,6 @@ static void verify_uninitialized(void){
   pDatax->zRecordSeparator = &pData->rowSeparator[0];
   pDatax->zNullValue = &pData->nullValue[0];
   pData->out = STD_OUT;
-  pDatax->ppCurrentOutput = &pData->out;
   pData->normalMode = pData->cMode = pData->mode = MODE_List;
   pData->autoExplain = 1;
   pData->pAuxDb = &pData->aAuxDb[0];
index 5769fd4dccca988833d8d42753051b924cd1b824..788ea9d92d9610b9d589dff8847d690933c34035 100644 (file)
@@ -88,9 +88,6 @@ typedef struct ShellExState {
    * or "shext_" are reserved for the shell's use. */
   sqlite3 *dbShell;
 
-  /* Output stream to which shell's text output to be written (reference) */
-  FILE **ppCurrentOutput;
-
   /* Shell abrupt exit indicator with return code in LS-byte
    * 0 => no exit
    * 0x100 => a non-error (0) exit
@@ -300,7 +297,7 @@ AGGTYPE_BEGIN(ExtensionHelpers) {
   int helperCount; /* Helper count, not including sentinel */
   struct ExtHelpers {
     int (*failIfSafeMode)(ShellExState *p, const char *zErrMsg, ...);
-    FILE * (*currentOutputFile)(ShellExState *p);
+    void (*utf8CurrentOutPrintf)(ShellExState *p, const char *zFmt, ...);
     struct InSource * (*currentInputSource)(ShellExState *p);
     char * (*strLineGet)(char *zBuf, int ncMax, struct InSource *pInSrc);
     DotCommand * (*findDotCommand)(const char *cmdName, ShellExState *p,
@@ -315,7 +312,6 @@ AGGTYPE_BEGIN(ExtensionHelpers) {
                            int isContinuation, Prompts *pCue);
     void (*freeInputLine)(char *zLine);
     int (*enable_load_extension)(sqlite3 *db, int onoff);
-    void (*utf8CurrentOutPrintf)(ShellExState *p, const char *zFmt, ...);
     void *pSentinel; /* Always set to 0, above never are. */
   } helpers;
 } AGGTYPE_END(ExtensionHelpers);
index 8f8c99f89c1a7e091790cad12d5b9193e224bd9c..b9ac59a8f6194cec3c732b1344da2294a28c2d6e 100644 (file)
@@ -168,7 +168,7 @@ int sqlite3_testshellextc_init(
   SHELL_EXTENSION_INIT2(pShExtLink, shextLinkFetcher, db);
 
   SHELL_EXTENSION_INIT3(pShExtApi, pExtHelpers, pShExtLink);
-  iLdErr = SHELL_EXTENSION_LOADFAIL_WHY(pShExtLink, 5, 14);
+  iLdErr = SHELL_EXTENSION_LOADFAIL_WHY(pShExtLink, 5, 13);
   if( iLdErr!=EXLD_Ok ){
     *pzErrMsg = sqlite3_mprintf("Load failed, cause %d\n", iLdErr);
     return SQLITE_ERROR;
@@ -183,7 +183,7 @@ int sqlite3_testshellextc_init(
       zLoadArgs = sqlite3_mprintf("%z %s", zLoadArgs,
                                   pShExtLink->azLoadArgs[ila]);
     }
-    if( ila ) fprintf(SHX_HELPER(currentOutputFile)(psx), "%s\n", zLoadArgs);
+    if( ila ) oprintf(psx, "%s\n", zLoadArgs);
     sqlite3_free(zLoadArgs);
     SHX_API(subscribeEvents)(psx, sqlite3_testshellextc_init, &batty,
                              NK_CountOf, shellEventHandle);
index 01ec594702e7fe5773a07f53247110edaf1221a8..ae18b1fd8ccc13f009d1ea551283286d00ef0bca 100644 (file)
@@ -158,7 +158,7 @@ int sqlite3_testshellextcpp_init(
   SHELL_EXTENSION_INIT2(pShExtLink, shextLinkFetcher, db);
 
   SHELL_EXTENSION_INIT3(pShExtApi, pExtHelpers, pShExtLink);
-  iLdErr = SHELL_EXTENSION_LOADFAIL_WHY(pShExtLink, 5, 14);
+  iLdErr = SHELL_EXTENSION_LOADFAIL_WHY(pShExtLink, 5, 13);
   if( iLdErr!=EXLD_Ok ){
     *pzErrMsg = sqlite3_mprintf("Load failed, cause %d\n", iLdErr);
     return SQLITE_ERROR;
@@ -172,7 +172,7 @@ int sqlite3_testshellextcpp_init(
       zLoadArgs = sqlite3_mprintf("%z %s", zLoadArgs,
                                   pShExtLink->azLoadArgs[ila]);
     }
-    if( ila ) fprintf(SHX_HELPER(currentOutputFile)(psx), "%s\n", zLoadArgs);
+    if( ila ) oprintf(psx, "%s\n", zLoadArgs);
     sqlite3_free(zLoadArgs);
     SHX_API(subscribeEvents)(psx, sqlite3_testshellextcpp_init, &batty,
                              NK_CountOf, shellEventHandle);