tool/mkshellc.tcl ext/misc/tclshext.c.in > tclshext.c
gcc -shared -fPIC -O2 -I. -Isrc -I/usr/include/tcl8.6 \
tclshext.c -o tclshext.so -ltcl8.6
-** Or, use the provided Makefile and build target tcl_shell_extension .
- If the Tk library is available, it can be linked and used thusly:
+** Or, (after ./configure ...), use the provided Makefile thusly:
+ make tcl_shell_extension
+** If the Tk library is available, it can be linked and used thusly:
gcc -shared -fPIC -O2 -I. -Isrc -I/usr/include/tcl8.6 \
-DSHELL_ENABLE_TK tclshext.c -o tclshext.so -ltcl8.6 -ltk8.6
-** Or, make the same target, with 'TCLEXT_OPTS=-DSHELL_ENABLE_TK'.
-** Later TCL versions can be used if desired.
- "TCL scripting support is added with a registerScripting() call in the\n"
- "ShellExtensionAPI, per ScriptingSupport interface requirements. This\n"
- "support lasts until the scripting object destructor is called.\n"
+** Or, make the same target with Tk thusly:
+ make tcl_shell_extension WITH_TK=1
+** Later TCL versions can be used if desired (and installed.)
+**
+** TCL scripting support is added with a registerScripting() call (in the
+** ShellExtensionAPI), meeting ScriptingSupport interface requirements.
*/
static const char * const zTclHelp =
"This extension adds these features to the host shell:\n"
" 1. TCL scripting support is added.\n"
" 2. TCL commands are added: udb shdb now_interactive get_tcl_group ..\n"
" 3. The .tcl and .unknown dot commands are added.\n"
- " 4. If built with Tk capability, the gui TCL command will be added if\n"
- " this extension was loaded using the shell via: .load ... -shext -tk .\n"
- " Any other arguments beyond -shext are in TCL's argv variable.\n"
+ " 4. If built with Tk capability, the gui TCL command will be added if this\n"
+ " extension was loaded using shell command: .load tclshext -shext -tk .\n"
+ " Any other arguments beyond -shext are copied into TCL's argv variable.\n"
"Operation:\n"
" Shell input groups beginning with \"..\" are treated as TCL input, in\n"
" these ways: (1) When a bare \"..\" is entered, a TCL REPL loop is run\n"
" is entered, (where \"T\" is a TCL command name), that TCL command and its\n"
" arguments will be collected and expanded according to TCL parsing rules,\n"
" then run in the TCL execution environment (in its global namespace), but\n"
- " the shell execution environment remains in effect afterward.\n"
+ " the shell REPL and execution environment remains in effect afterward.\n"
"\n"
" Note that cases 2 and 3 differ in having space after the leading \"..\".\n"
"\n"
};
#elif TCL_REPL==3
/* using shell's input collection with line editing (if configured) */
-static const char * const zREPL = "sqlite_shell_REPL";
+static const char * const zREPL = "uplevel #0 sqlite_shell_REPL";
TCL_CSTR_LITERAL(static const char * const zDefineREPL = ){
proc sqlite_shell_REPL {} {
- set interactive [now_interactive]
+ if {[info exists ::tcl_interactive]} {
+ set save_interactive $::tcl_interactive
+ }
+ set ::tcl_interactive [now_interactive]
while {1} {
foreach {group ready} [get_tcl_group] {}
set trimmed [string trim $group]
}
if {$interactive && $trimmed ne "."} {puts {}}
read stdin 0
+ if {[info exists save_interactive]} {
+ set ::tcl_interactive $save_interactive
+ } else { unset ::tcl_interactive }
}
};
#else
return 0;
}
-#if TCL_REPL==2
+#if TCL_REPL==1 || TCL_REPL==2
#define GETLINE_MAXLEN 1000
/* C implementation of TCL proc, get_input_line */
}
#endif /* defined(SHELL_ENABLE_TK) */
-#define UNKNOWN_RENAME "::_original_unknown"
+#define UNKNOWN_RENAME "_original_unknown"
/* C implementation of TCL ::register_adhoc_command name ?help? */
static int registerAdHocCommand(/* ShellExState */ void *pv,
return TCL_ERROR;
}
-/* C implementation of TCL ::unknown to (maybe) delegate to dot commands */
+/* C implementation of TCL unknown to (maybe) delegate to dot commands */
static int unknownDotDelegate(void *pvSS, Tcl_Interp *interp,
int nArgs, const char *azArgs[]){
const char *name = (nArgs>1 && *azArgs[1]=='.')? azArgs[1]+1 : 0;
return TCL_ERROR;
}
}else{
- /* Defer to the TCL-default ::unknown command, or fail here. */
+ /* Defer to the TCL-default unknown command, or fail here. */
if( 0!=Tcl_FindCommand(interp, UNKNOWN_RENAME, 0, TCL_GLOBAL_ONLY) ){
Tcl_Obj **ppo = sqlite3_malloc((nArgs+1)*sizeof(Tcl_Obj*));
if( ppo==0 ) return TCL_ERROR;
ppo[ia] = Tcl_NewStringObj(azArgs[ia], -1);
Tcl_IncrRefCount(ppo[ia]);
}
+ ppo[ia] = 0;
rc = Tcl_EvalObjv(interp, nArgs, ppo, TCL_EVAL_GLOBAL);
for( ia=0; ia<nArgs; ++ia ) Tcl_DecrRefCount(ppo[ia]);
sqlite3_free(ppo);
#ifdef SHELL_ENABLE_TK
ldTk = 1;
#else
- *pzErrMsg = sqlite3_mprintf("Option -tk not supported by this"
+ *pzErrMsg = sqlite3_mprintf("Option -tk not supported by this "
"tclshext extension as built.\n");
return SQLITE_ERROR;
#endif
-C Fix\sTCL\sextension\sbuild\sissue.
-D 2022-04-09T03:12:40.948
+C Get\stclshext\smade\swith\sTk,\soptionally,\sand\smake\sunknown\swork\sas\sin\stclsh.
+D 2022-04-09T14:57:17.905
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
-F Makefile.in 45a1174d1eb69015620b82a87f598e7558137e5ff0276ca622e976649cf7c30f
+F Makefile.in f96bf52d014571fe3bbabd575a2824a7ea9d7ef2f40bf23315efacda81d59ee1
F Makefile.linux-gcc f609543700659711fbd230eced1f01353117621dccae7b9fb70daa64236c5241
F Makefile.msc 689726a2785027e0eb34ea9ce8e67ac94bc4aebbaa6def20ddb6fa9f7b0c43b5
F README.md 2dd87a5c1d108b224921f3dd47dea567973f706e1f6959386282a626f459a70c
F ext/misc/spellfix.c 94df9bbfa514a563c1484f684a2df3d128a2f7209a84ca3ca100c68a0163e29f
F ext/misc/sqlar.c 0ace5d3c10fe736dc584bf1159a36b8e2e60fab309d310cd8a0eecd9036621b6
F ext/misc/stmt.c 35063044a388ead95557e4b84b89c1b93accc2f1c6ddea3f9710e8486a7af94a
-F ext/misc/tclshext.c.in 419d8dde92b5be9ef289056e6d661d5aeccb48bb93deb4e6cb7986b8bc1cd4dc
+F ext/misc/tclshext.c.in 026416fd5c1e84eb8c8e98edc9dcd826e3c0d32fd0883ab306829642867128e8
F ext/misc/templatevtab.c 8a16a91a5ceaccfcbd6aaaa56d46828806e460dd194965b3f77bf38f14b942c4
F ext/misc/totype.c fa4aedeb07f66169005dffa8de3b0a2b621779fd44f85c103228a42afa71853b
F ext/misc/uint.c 053fed3bce2e89583afcd4bf804d75d659879bbcedac74d0fa9ed548839a030b
F src/resolve.c 18d99e7146852d6064559561769fcca0743eb32b14a97da6dbed373a30ee0e76
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c d6c04eb93395024af80f61a8c278a33c2a0333aeb7d57bb6aa737a6f1c4af4b8
-F src/shell.c.in a32d50c687fc79e4d19992810dfa358d0342f4b9e464f791e6db011cc6c5f0ec
+F src/shell.c.in 8e2ad2912ae381786653ce9db04522f8058873d690f434016ecda5a419c0cdc5
F src/shext_linkage.h 88a3f215fdb090fcc3b3577a05bafd234f1a556bad3f2f4ac990a177aebf4b2c
F src/sqlite.h.in 2a35f62185eb5e7ecc64a2f68442b538ce9be74f80f28a00abc24837edcf1c17
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 2cd49df502a7cd250c453cbbd6a2651e588d69dd755bbdf5a55b58715e548760
-R 9e007e781c4f098c2fd1d0e6fa36b03e
+P 0b3bb0e793f8c7fd79042322b7748a75d17a3c3d0752cfb0f2c544af49b1d6d6
+R fd77dc9b9d6010cf74b598e30b2c6a7a
U larrybr
-Z 0a2834b5db7d2e730016c4d403bccffd
+Z 41d0aa7cc99a4d24d4e075af36bc0e99
# Remove this line to create a well-formed Fossil manifest.