Fossil SCM

Cherrypick [252aff3e62] and related clean-ups: Use built-in Tcl for "diff --tk" implementation if possible. Fallback is to spawn an external "tclsh" as before. This makes "fossil diff --tk" work with ActiveState Tcl on Win32 out-of-the-box.

jan.nijtmans 2014-02-14 13:37 branch-1.28
Commit f325b2343e6a18f85a955683c568cd51c31cae11
+20 -3
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774774
@ grid remove $sb
775775
@ }
776776
@ }
777777
@ enableSync x
778778
@ }
779
-@
779
+@
780780
@ proc sync-y {first last} {
781781
@ disableSync y
782782
@ foreach c [cols] {
783783
@ $c yview moveto $first
784784
@ }
@@ -793,10 +793,11 @@
793793
@
794794
@ wm withdraw .
795795
@ wm title . $CFG(TITLE)
796796
@ wm iconname . $CFG(TITLE)
797797
@ bind . <q> exit
798
+@ bind . <Destroy> {after 0 exit}
798799
@ bind . <Tab> {cycleDiffs; break}
799800
@ bind . <<PrevWindow>> {cycleDiffs 1; break}
800801
@ bind . <Return> {
801802
@ event generate .files <1>
802803
@ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907908
908909
/*
909910
** Show diff output in a Tcl/Tk window, in response to the --tk option
910911
** to the diff command.
911912
**
912
-** Steps:
913
+** If fossil has direct access to a Tcl interpreter (either loaded
914
+** dynamically through stubs or linked in statically), we can use it
915
+** directly. Otherwise:
913916
** (1) Write the Tcl/Tk script used for rendering into a temp file.
914
-** (2) Invoke "wish" on the temp file using fossil_system().
917
+** (2) Invoke "tclsh" on the temp file using fossil_system().
915918
** (3) Delete the temp file.
916919
*/
917920
void diff_tk(const char *zSubCmd, int firstArg){
918921
int i;
919922
Blob script;
@@ -943,10 +946,24 @@
943946
blob_appendf(&script, "}\n%s", zDiffScript);
944947
if( zTempFile ){
945948
blob_write_to_file(&script, zTempFile);
946949
fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947950
}else{
951
+#if defined(FOSSIL_ENABLE_TCL)
952
+ Th_FossilInit(TH_INIT_DEFAULT);
953
+ if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954
+ blob_size(&script), 1)==TCL_OK ){
955
+ blob_reset(&script);
956
+ return;
957
+ }
958
+ /*
959
+ * If evaluation of the Tcl script fails, the reason may be that Tk
960
+ * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961
+ * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962
+ * to using the external "tclsh", if available.
963
+ */
964
+#endif
948965
zTempFile = write_blob_to_temp_file(&script);
949966
zCmd = mprintf("tclsh \"%s\"", zTempFile);
950967
fossil_system(zCmd);
951968
file_delete(zTempFile);
952969
fossil_free(zCmd);
953970
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
 
798 @ bind . <Tab> {cycleDiffs; break}
799 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
800 @ bind . <Return> {
801 @ event generate .files <1>
802 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907
908 /*
909 ** Show diff output in a Tcl/Tk window, in response to the --tk option
910 ** to the diff command.
911 **
912 ** Steps:
 
 
913 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
914 ** (2) Invoke "wish" on the temp file using fossil_system().
915 ** (3) Delete the temp file.
916 */
917 void diff_tk(const char *zSubCmd, int firstArg){
918 int i;
919 Blob script;
@@ -943,10 +946,24 @@
943 blob_appendf(&script, "}\n%s", zDiffScript);
944 if( zTempFile ){
945 blob_write_to_file(&script, zTempFile);
946 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947 }else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
948 zTempFile = write_blob_to_temp_file(&script);
949 zCmd = mprintf("tclsh \"%s\"", zTempFile);
950 fossil_system(zCmd);
951 file_delete(zTempFile);
952 fossil_free(zCmd);
953
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
798 @ bind . <Destroy> {after 0 exit}
799 @ bind . <Tab> {cycleDiffs; break}
800 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
801 @ bind . <Return> {
802 @ event generate .files <1>
803 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
908
909 /*
910 ** Show diff output in a Tcl/Tk window, in response to the --tk option
911 ** to the diff command.
912 **
913 ** If fossil has direct access to a Tcl interpreter (either loaded
914 ** dynamically through stubs or linked in statically), we can use it
915 ** directly. Otherwise:
916 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
917 ** (2) Invoke "tclsh" on the temp file using fossil_system().
918 ** (3) Delete the temp file.
919 */
920 void diff_tk(const char *zSubCmd, int firstArg){
921 int i;
922 Blob script;
@@ -943,10 +946,24 @@
946 blob_appendf(&script, "}\n%s", zDiffScript);
947 if( zTempFile ){
948 blob_write_to_file(&script, zTempFile);
949 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
950 }else{
951 #if defined(FOSSIL_ENABLE_TCL)
952 Th_FossilInit(TH_INIT_DEFAULT);
953 if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954 blob_size(&script), 1)==TCL_OK ){
955 blob_reset(&script);
956 return;
957 }
958 /*
959 * If evaluation of the Tcl script fails, the reason may be that Tk
960 * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961 * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962 * to using the external "tclsh", if available.
963 */
964 #endif
965 zTempFile = write_blob_to_temp_file(&script);
966 zCmd = mprintf("tclsh \"%s\"", zTempFile);
967 fossil_system(zCmd);
968 file_delete(zTempFile);
969 fossil_free(zCmd);
970
+20 -3
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774774
@ grid remove $sb
775775
@ }
776776
@ }
777777
@ enableSync x
778778
@ }
779
-@
779
+@
780780
@ proc sync-y {first last} {
781781
@ disableSync y
782782
@ foreach c [cols] {
783783
@ $c yview moveto $first
784784
@ }
@@ -793,10 +793,11 @@
793793
@
794794
@ wm withdraw .
795795
@ wm title . $CFG(TITLE)
796796
@ wm iconname . $CFG(TITLE)
797797
@ bind . <q> exit
798
+@ bind . <Destroy> {after 0 exit}
798799
@ bind . <Tab> {cycleDiffs; break}
799800
@ bind . <<PrevWindow>> {cycleDiffs 1; break}
800801
@ bind . <Return> {
801802
@ event generate .files <1>
802803
@ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907908
908909
/*
909910
** Show diff output in a Tcl/Tk window, in response to the --tk option
910911
** to the diff command.
911912
**
912
-** Steps:
913
+** If fossil has direct access to a Tcl interpreter (either loaded
914
+** dynamically through stubs or linked in statically), we can use it
915
+** directly. Otherwise:
913916
** (1) Write the Tcl/Tk script used for rendering into a temp file.
914
-** (2) Invoke "wish" on the temp file using fossil_system().
917
+** (2) Invoke "tclsh" on the temp file using fossil_system().
915918
** (3) Delete the temp file.
916919
*/
917920
void diff_tk(const char *zSubCmd, int firstArg){
918921
int i;
919922
Blob script;
@@ -943,10 +946,24 @@
943946
blob_appendf(&script, "}\n%s", zDiffScript);
944947
if( zTempFile ){
945948
blob_write_to_file(&script, zTempFile);
946949
fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947950
}else{
951
+#if defined(FOSSIL_ENABLE_TCL)
952
+ Th_FossilInit(TH_INIT_DEFAULT);
953
+ if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954
+ blob_size(&script), 1)==TCL_OK ){
955
+ blob_reset(&script);
956
+ return;
957
+ }
958
+ /*
959
+ * If evaluation of the Tcl script fails, the reason may be that Tk
960
+ * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961
+ * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962
+ * to using the external "tclsh", if available.
963
+ */
964
+#endif
948965
zTempFile = write_blob_to_temp_file(&script);
949966
zCmd = mprintf("tclsh \"%s\"", zTempFile);
950967
fossil_system(zCmd);
951968
file_delete(zTempFile);
952969
fossil_free(zCmd);
953970
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
 
798 @ bind . <Tab> {cycleDiffs; break}
799 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
800 @ bind . <Return> {
801 @ event generate .files <1>
802 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907
908 /*
909 ** Show diff output in a Tcl/Tk window, in response to the --tk option
910 ** to the diff command.
911 **
912 ** Steps:
 
 
913 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
914 ** (2) Invoke "wish" on the temp file using fossil_system().
915 ** (3) Delete the temp file.
916 */
917 void diff_tk(const char *zSubCmd, int firstArg){
918 int i;
919 Blob script;
@@ -943,10 +946,24 @@
943 blob_appendf(&script, "}\n%s", zDiffScript);
944 if( zTempFile ){
945 blob_write_to_file(&script, zTempFile);
946 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947 }else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
948 zTempFile = write_blob_to_temp_file(&script);
949 zCmd = mprintf("tclsh \"%s\"", zTempFile);
950 fossil_system(zCmd);
951 file_delete(zTempFile);
952 fossil_free(zCmd);
953
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
798 @ bind . <Destroy> {after 0 exit}
799 @ bind . <Tab> {cycleDiffs; break}
800 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
801 @ bind . <Return> {
802 @ event generate .files <1>
803 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
908
909 /*
910 ** Show diff output in a Tcl/Tk window, in response to the --tk option
911 ** to the diff command.
912 **
913 ** If fossil has direct access to a Tcl interpreter (either loaded
914 ** dynamically through stubs or linked in statically), we can use it
915 ** directly. Otherwise:
916 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
917 ** (2) Invoke "tclsh" on the temp file using fossil_system().
918 ** (3) Delete the temp file.
919 */
920 void diff_tk(const char *zSubCmd, int firstArg){
921 int i;
922 Blob script;
@@ -943,10 +946,24 @@
946 blob_appendf(&script, "}\n%s", zDiffScript);
947 if( zTempFile ){
948 blob_write_to_file(&script, zTempFile);
949 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
950 }else{
951 #if defined(FOSSIL_ENABLE_TCL)
952 Th_FossilInit(TH_INIT_DEFAULT);
953 if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954 blob_size(&script), 1)==TCL_OK ){
955 blob_reset(&script);
956 return;
957 }
958 /*
959 * If evaluation of the Tcl script fails, the reason may be that Tk
960 * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961 * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962 * to using the external "tclsh", if available.
963 */
964 #endif
965 zTempFile = write_blob_to_temp_file(&script);
966 zCmd = mprintf("tclsh \"%s\"", zTempFile);
967 fossil_system(zCmd);
968 file_delete(zTempFile);
969 fossil_free(zCmd);
970
+20 -3
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774774
@ grid remove $sb
775775
@ }
776776
@ }
777777
@ enableSync x
778778
@ }
779
-@
779
+@
780780
@ proc sync-y {first last} {
781781
@ disableSync y
782782
@ foreach c [cols] {
783783
@ $c yview moveto $first
784784
@ }
@@ -793,10 +793,11 @@
793793
@
794794
@ wm withdraw .
795795
@ wm title . $CFG(TITLE)
796796
@ wm iconname . $CFG(TITLE)
797797
@ bind . <q> exit
798
+@ bind . <Destroy> {after 0 exit}
798799
@ bind . <Tab> {cycleDiffs; break}
799800
@ bind . <<PrevWindow>> {cycleDiffs 1; break}
800801
@ bind . <Return> {
801802
@ event generate .files <1>
802803
@ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907908
908909
/*
909910
** Show diff output in a Tcl/Tk window, in response to the --tk option
910911
** to the diff command.
911912
**
912
-** Steps:
913
+** If fossil has direct access to a Tcl interpreter (either loaded
914
+** dynamically through stubs or linked in statically), we can use it
915
+** directly. Otherwise:
913916
** (1) Write the Tcl/Tk script used for rendering into a temp file.
914
-** (2) Invoke "wish" on the temp file using fossil_system().
917
+** (2) Invoke "tclsh" on the temp file using fossil_system().
915918
** (3) Delete the temp file.
916919
*/
917920
void diff_tk(const char *zSubCmd, int firstArg){
918921
int i;
919922
Blob script;
@@ -943,10 +946,24 @@
943946
blob_appendf(&script, "}\n%s", zDiffScript);
944947
if( zTempFile ){
945948
blob_write_to_file(&script, zTempFile);
946949
fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947950
}else{
951
+#if defined(FOSSIL_ENABLE_TCL)
952
+ Th_FossilInit(TH_INIT_DEFAULT);
953
+ if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954
+ blob_size(&script), 1)==TCL_OK ){
955
+ blob_reset(&script);
956
+ return;
957
+ }
958
+ /*
959
+ * If evaluation of the Tcl script fails, the reason may be that Tk
960
+ * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961
+ * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962
+ * to using the external "tclsh", if available.
963
+ */
964
+#endif
948965
zTempFile = write_blob_to_temp_file(&script);
949966
zCmd = mprintf("tclsh \"%s\"", zTempFile);
950967
fossil_system(zCmd);
951968
file_delete(zTempFile);
952969
fossil_free(zCmd);
953970
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
 
798 @ bind . <Tab> {cycleDiffs; break}
799 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
800 @ bind . <Return> {
801 @ event generate .files <1>
802 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907
908 /*
909 ** Show diff output in a Tcl/Tk window, in response to the --tk option
910 ** to the diff command.
911 **
912 ** Steps:
 
 
913 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
914 ** (2) Invoke "wish" on the temp file using fossil_system().
915 ** (3) Delete the temp file.
916 */
917 void diff_tk(const char *zSubCmd, int firstArg){
918 int i;
919 Blob script;
@@ -943,10 +946,24 @@
943 blob_appendf(&script, "}\n%s", zDiffScript);
944 if( zTempFile ){
945 blob_write_to_file(&script, zTempFile);
946 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947 }else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
948 zTempFile = write_blob_to_temp_file(&script);
949 zCmd = mprintf("tclsh \"%s\"", zTempFile);
950 fossil_system(zCmd);
951 file_delete(zTempFile);
952 fossil_free(zCmd);
953
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
798 @ bind . <Destroy> {after 0 exit}
799 @ bind . <Tab> {cycleDiffs; break}
800 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
801 @ bind . <Return> {
802 @ event generate .files <1>
803 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
908
909 /*
910 ** Show diff output in a Tcl/Tk window, in response to the --tk option
911 ** to the diff command.
912 **
913 ** If fossil has direct access to a Tcl interpreter (either loaded
914 ** dynamically through stubs or linked in statically), we can use it
915 ** directly. Otherwise:
916 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
917 ** (2) Invoke "tclsh" on the temp file using fossil_system().
918 ** (3) Delete the temp file.
919 */
920 void diff_tk(const char *zSubCmd, int firstArg){
921 int i;
922 Blob script;
@@ -943,10 +946,24 @@
946 blob_appendf(&script, "}\n%s", zDiffScript);
947 if( zTempFile ){
948 blob_write_to_file(&script, zTempFile);
949 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
950 }else{
951 #if defined(FOSSIL_ENABLE_TCL)
952 Th_FossilInit(TH_INIT_DEFAULT);
953 if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954 blob_size(&script), 1)==TCL_OK ){
955 blob_reset(&script);
956 return;
957 }
958 /*
959 * If evaluation of the Tcl script fails, the reason may be that Tk
960 * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961 * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962 * to using the external "tclsh", if available.
963 */
964 #endif
965 zTempFile = write_blob_to_temp_file(&script);
966 zCmd = mprintf("tclsh \"%s\"", zTempFile);
967 fossil_system(zCmd);
968 file_delete(zTempFile);
969 fossil_free(zCmd);
970
+20 -3
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774774
@ grid remove $sb
775775
@ }
776776
@ }
777777
@ enableSync x
778778
@ }
779
-@
779
+@
780780
@ proc sync-y {first last} {
781781
@ disableSync y
782782
@ foreach c [cols] {
783783
@ $c yview moveto $first
784784
@ }
@@ -793,10 +793,11 @@
793793
@
794794
@ wm withdraw .
795795
@ wm title . $CFG(TITLE)
796796
@ wm iconname . $CFG(TITLE)
797797
@ bind . <q> exit
798
+@ bind . <Destroy> {after 0 exit}
798799
@ bind . <Tab> {cycleDiffs; break}
799800
@ bind . <<PrevWindow>> {cycleDiffs 1; break}
800801
@ bind . <Return> {
801802
@ event generate .files <1>
802803
@ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907908
908909
/*
909910
** Show diff output in a Tcl/Tk window, in response to the --tk option
910911
** to the diff command.
911912
**
912
-** Steps:
913
+** If fossil has direct access to a Tcl interpreter (either loaded
914
+** dynamically through stubs or linked in statically), we can use it
915
+** directly. Otherwise:
913916
** (1) Write the Tcl/Tk script used for rendering into a temp file.
914
-** (2) Invoke "wish" on the temp file using fossil_system().
917
+** (2) Invoke "tclsh" on the temp file using fossil_system().
915918
** (3) Delete the temp file.
916919
*/
917920
void diff_tk(const char *zSubCmd, int firstArg){
918921
int i;
919922
Blob script;
@@ -943,10 +946,24 @@
943946
blob_appendf(&script, "}\n%s", zDiffScript);
944947
if( zTempFile ){
945948
blob_write_to_file(&script, zTempFile);
946949
fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947950
}else{
951
+#if defined(FOSSIL_ENABLE_TCL)
952
+ Th_FossilInit(TH_INIT_DEFAULT);
953
+ if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954
+ blob_size(&script), 1)==TCL_OK ){
955
+ blob_reset(&script);
956
+ return;
957
+ }
958
+ /*
959
+ * If evaluation of the Tcl script fails, the reason may be that Tk
960
+ * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961
+ * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962
+ * to using the external "tclsh", if available.
963
+ */
964
+#endif
948965
zTempFile = write_blob_to_temp_file(&script);
949966
zCmd = mprintf("tclsh \"%s\"", zTempFile);
950967
fossil_system(zCmd);
951968
file_delete(zTempFile);
952969
fossil_free(zCmd);
953970
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
 
798 @ bind . <Tab> {cycleDiffs; break}
799 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
800 @ bind . <Return> {
801 @ event generate .files <1>
802 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907
908 /*
909 ** Show diff output in a Tcl/Tk window, in response to the --tk option
910 ** to the diff command.
911 **
912 ** Steps:
 
 
913 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
914 ** (2) Invoke "wish" on the temp file using fossil_system().
915 ** (3) Delete the temp file.
916 */
917 void diff_tk(const char *zSubCmd, int firstArg){
918 int i;
919 Blob script;
@@ -943,10 +946,24 @@
943 blob_appendf(&script, "}\n%s", zDiffScript);
944 if( zTempFile ){
945 blob_write_to_file(&script, zTempFile);
946 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947 }else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
948 zTempFile = write_blob_to_temp_file(&script);
949 zCmd = mprintf("tclsh \"%s\"", zTempFile);
950 fossil_system(zCmd);
951 file_delete(zTempFile);
952 fossil_free(zCmd);
953
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
798 @ bind . <Destroy> {after 0 exit}
799 @ bind . <Tab> {cycleDiffs; break}
800 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
801 @ bind . <Return> {
802 @ event generate .files <1>
803 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
908
909 /*
910 ** Show diff output in a Tcl/Tk window, in response to the --tk option
911 ** to the diff command.
912 **
913 ** If fossil has direct access to a Tcl interpreter (either loaded
914 ** dynamically through stubs or linked in statically), we can use it
915 ** directly. Otherwise:
916 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
917 ** (2) Invoke "tclsh" on the temp file using fossil_system().
918 ** (3) Delete the temp file.
919 */
920 void diff_tk(const char *zSubCmd, int firstArg){
921 int i;
922 Blob script;
@@ -943,10 +946,24 @@
946 blob_appendf(&script, "}\n%s", zDiffScript);
947 if( zTempFile ){
948 blob_write_to_file(&script, zTempFile);
949 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
950 }else{
951 #if defined(FOSSIL_ENABLE_TCL)
952 Th_FossilInit(TH_INIT_DEFAULT);
953 if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954 blob_size(&script), 1)==TCL_OK ){
955 blob_reset(&script);
956 return;
957 }
958 /*
959 * If evaluation of the Tcl script fails, the reason may be that Tk
960 * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961 * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962 * to using the external "tclsh", if available.
963 */
964 #endif
965 zTempFile = write_blob_to_temp_file(&script);
966 zCmd = mprintf("tclsh \"%s\"", zTempFile);
967 fossil_system(zCmd);
968 file_delete(zTempFile);
969 fossil_free(zCmd);
970
+20 -3
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774774
@ grid remove $sb
775775
@ }
776776
@ }
777777
@ enableSync x
778778
@ }
779
-@
779
+@
780780
@ proc sync-y {first last} {
781781
@ disableSync y
782782
@ foreach c [cols] {
783783
@ $c yview moveto $first
784784
@ }
@@ -793,10 +793,11 @@
793793
@
794794
@ wm withdraw .
795795
@ wm title . $CFG(TITLE)
796796
@ wm iconname . $CFG(TITLE)
797797
@ bind . <q> exit
798
+@ bind . <Destroy> {after 0 exit}
798799
@ bind . <Tab> {cycleDiffs; break}
799800
@ bind . <<PrevWindow>> {cycleDiffs 1; break}
800801
@ bind . <Return> {
801802
@ event generate .files <1>
802803
@ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907908
908909
/*
909910
** Show diff output in a Tcl/Tk window, in response to the --tk option
910911
** to the diff command.
911912
**
912
-** Steps:
913
+** If fossil has direct access to a Tcl interpreter (either loaded
914
+** dynamically through stubs or linked in statically), we can use it
915
+** directly. Otherwise:
913916
** (1) Write the Tcl/Tk script used for rendering into a temp file.
914
-** (2) Invoke "wish" on the temp file using fossil_system().
917
+** (2) Invoke "tclsh" on the temp file using fossil_system().
915918
** (3) Delete the temp file.
916919
*/
917920
void diff_tk(const char *zSubCmd, int firstArg){
918921
int i;
919922
Blob script;
@@ -943,10 +946,24 @@
943946
blob_appendf(&script, "}\n%s", zDiffScript);
944947
if( zTempFile ){
945948
blob_write_to_file(&script, zTempFile);
946949
fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947950
}else{
951
+#if defined(FOSSIL_ENABLE_TCL)
952
+ Th_FossilInit(TH_INIT_DEFAULT);
953
+ if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954
+ blob_size(&script), 1)==TCL_OK ){
955
+ blob_reset(&script);
956
+ return;
957
+ }
958
+ /*
959
+ * If evaluation of the Tcl script fails, the reason may be that Tk
960
+ * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961
+ * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962
+ * to using the external "tclsh", if available.
963
+ */
964
+#endif
948965
zTempFile = write_blob_to_temp_file(&script);
949966
zCmd = mprintf("tclsh \"%s\"", zTempFile);
950967
fossil_system(zCmd);
951968
file_delete(zTempFile);
952969
fossil_free(zCmd);
953970
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
 
798 @ bind . <Tab> {cycleDiffs; break}
799 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
800 @ bind . <Return> {
801 @ event generate .files <1>
802 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907
908 /*
909 ** Show diff output in a Tcl/Tk window, in response to the --tk option
910 ** to the diff command.
911 **
912 ** Steps:
 
 
913 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
914 ** (2) Invoke "wish" on the temp file using fossil_system().
915 ** (3) Delete the temp file.
916 */
917 void diff_tk(const char *zSubCmd, int firstArg){
918 int i;
919 Blob script;
@@ -943,10 +946,24 @@
943 blob_appendf(&script, "}\n%s", zDiffScript);
944 if( zTempFile ){
945 blob_write_to_file(&script, zTempFile);
946 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947 }else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
948 zTempFile = write_blob_to_temp_file(&script);
949 zCmd = mprintf("tclsh \"%s\"", zTempFile);
950 fossil_system(zCmd);
951 file_delete(zTempFile);
952 fossil_free(zCmd);
953
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
798 @ bind . <Destroy> {after 0 exit}
799 @ bind . <Tab> {cycleDiffs; break}
800 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
801 @ bind . <Return> {
802 @ event generate .files <1>
803 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
908
909 /*
910 ** Show diff output in a Tcl/Tk window, in response to the --tk option
911 ** to the diff command.
912 **
913 ** If fossil has direct access to a Tcl interpreter (either loaded
914 ** dynamically through stubs or linked in statically), we can use it
915 ** directly. Otherwise:
916 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
917 ** (2) Invoke "tclsh" on the temp file using fossil_system().
918 ** (3) Delete the temp file.
919 */
920 void diff_tk(const char *zSubCmd, int firstArg){
921 int i;
922 Blob script;
@@ -943,10 +946,24 @@
946 blob_appendf(&script, "}\n%s", zDiffScript);
947 if( zTempFile ){
948 blob_write_to_file(&script, zTempFile);
949 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
950 }else{
951 #if defined(FOSSIL_ENABLE_TCL)
952 Th_FossilInit(TH_INIT_DEFAULT);
953 if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954 blob_size(&script), 1)==TCL_OK ){
955 blob_reset(&script);
956 return;
957 }
958 /*
959 * If evaluation of the Tcl script fails, the reason may be that Tk
960 * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961 * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962 * to using the external "tclsh", if available.
963 */
964 #endif
965 zTempFile = write_blob_to_temp_file(&script);
966 zCmd = mprintf("tclsh \"%s\"", zTempFile);
967 fossil_system(zCmd);
968 file_delete(zTempFile);
969 fossil_free(zCmd);
970
+20 -3
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774774
@ grid remove $sb
775775
@ }
776776
@ }
777777
@ enableSync x
778778
@ }
779
-@
779
+@
780780
@ proc sync-y {first last} {
781781
@ disableSync y
782782
@ foreach c [cols] {
783783
@ $c yview moveto $first
784784
@ }
@@ -793,10 +793,11 @@
793793
@
794794
@ wm withdraw .
795795
@ wm title . $CFG(TITLE)
796796
@ wm iconname . $CFG(TITLE)
797797
@ bind . <q> exit
798
+@ bind . <Destroy> {after 0 exit}
798799
@ bind . <Tab> {cycleDiffs; break}
799800
@ bind . <<PrevWindow>> {cycleDiffs 1; break}
800801
@ bind . <Return> {
801802
@ event generate .files <1>
802803
@ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907908
908909
/*
909910
** Show diff output in a Tcl/Tk window, in response to the --tk option
910911
** to the diff command.
911912
**
912
-** Steps:
913
+** If fossil has direct access to a Tcl interpreter (either loaded
914
+** dynamically through stubs or linked in statically), we can use it
915
+** directly. Otherwise:
913916
** (1) Write the Tcl/Tk script used for rendering into a temp file.
914
-** (2) Invoke "wish" on the temp file using fossil_system().
917
+** (2) Invoke "tclsh" on the temp file using fossil_system().
915918
** (3) Delete the temp file.
916919
*/
917920
void diff_tk(const char *zSubCmd, int firstArg){
918921
int i;
919922
Blob script;
@@ -943,10 +946,24 @@
943946
blob_appendf(&script, "}\n%s", zDiffScript);
944947
if( zTempFile ){
945948
blob_write_to_file(&script, zTempFile);
946949
fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947950
}else{
951
+#if defined(FOSSIL_ENABLE_TCL)
952
+ Th_FossilInit(TH_INIT_DEFAULT);
953
+ if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954
+ blob_size(&script), 1)==TCL_OK ){
955
+ blob_reset(&script);
956
+ return;
957
+ }
958
+ /*
959
+ * If evaluation of the Tcl script fails, the reason may be that Tk
960
+ * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961
+ * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962
+ * to using the external "tclsh", if available.
963
+ */
964
+#endif
948965
zTempFile = write_blob_to_temp_file(&script);
949966
zCmd = mprintf("tclsh \"%s\"", zTempFile);
950967
fossil_system(zCmd);
951968
file_delete(zTempFile);
952969
fossil_free(zCmd);
953970
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
 
798 @ bind . <Tab> {cycleDiffs; break}
799 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
800 @ bind . <Return> {
801 @ event generate .files <1>
802 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
907
908 /*
909 ** Show diff output in a Tcl/Tk window, in response to the --tk option
910 ** to the diff command.
911 **
912 ** Steps:
 
 
913 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
914 ** (2) Invoke "wish" on the temp file using fossil_system().
915 ** (3) Delete the temp file.
916 */
917 void diff_tk(const char *zSubCmd, int firstArg){
918 int i;
919 Blob script;
@@ -943,10 +946,24 @@
943 blob_appendf(&script, "}\n%s", zDiffScript);
944 if( zTempFile ){
945 blob_write_to_file(&script, zTempFile);
946 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
947 }else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
948 zTempFile = write_blob_to_temp_file(&script);
949 zCmd = mprintf("tclsh \"%s\"", zTempFile);
950 fossil_system(zCmd);
951 file_delete(zTempFile);
952 fossil_free(zCmd);
953
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -774,11 +774,11 @@
774 @ grid remove $sb
775 @ }
776 @ }
777 @ enableSync x
778 @ }
779 @
780 @ proc sync-y {first last} {
781 @ disableSync y
782 @ foreach c [cols] {
783 @ $c yview moveto $first
784 @ }
@@ -793,10 +793,11 @@
793 @
794 @ wm withdraw .
795 @ wm title . $CFG(TITLE)
796 @ wm iconname . $CFG(TITLE)
797 @ bind . <q> exit
798 @ bind . <Destroy> {after 0 exit}
799 @ bind . <Tab> {cycleDiffs; break}
800 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
801 @ bind . <Return> {
802 @ event generate .files <1>
803 @ event generate .files <ButtonRelease-1>
@@ -907,13 +908,15 @@
908
909 /*
910 ** Show diff output in a Tcl/Tk window, in response to the --tk option
911 ** to the diff command.
912 **
913 ** If fossil has direct access to a Tcl interpreter (either loaded
914 ** dynamically through stubs or linked in statically), we can use it
915 ** directly. Otherwise:
916 ** (1) Write the Tcl/Tk script used for rendering into a temp file.
917 ** (2) Invoke "tclsh" on the temp file using fossil_system().
918 ** (3) Delete the temp file.
919 */
920 void diff_tk(const char *zSubCmd, int firstArg){
921 int i;
922 Blob script;
@@ -943,10 +946,24 @@
946 blob_appendf(&script, "}\n%s", zDiffScript);
947 if( zTempFile ){
948 blob_write_to_file(&script, zTempFile);
949 fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile);
950 }else{
951 #if defined(FOSSIL_ENABLE_TCL)
952 Th_FossilInit(TH_INIT_DEFAULT);
953 if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script),
954 blob_size(&script), 1)==TCL_OK ){
955 blob_reset(&script);
956 return;
957 }
958 /*
959 * If evaluation of the Tcl script fails, the reason may be that Tk
960 * could not be found by the loaded Tcl, or that Tcl cannot be loaded
961 * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback
962 * to using the external "tclsh", if available.
963 */
964 #endif
965 zTempFile = write_blob_to_temp_file(&script);
966 zCmd = mprintf("tclsh \"%s\"", zTempFile);
967 fossil_system(zCmd);
968 file_delete(zTempFile);
969 fossil_free(zCmd);
970
+6 -2
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157157
int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158158
int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159159
int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160160
161161
#ifdef FOSSIL_ENABLE_TCL
162
-int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163
-int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
162
+/*
163
+** Interfaces to the full Tcl core library from "th_tcl.c".
164
+*/
165
+int th_register_tcl(Th_Interp *, void *);
166
+int unloadTcl(Th_Interp *, void *);
167
+int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
164168
#endif
165169
166170
/*
167171
** General purpose hash table from th_lang.c.
168172
*/
169173
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163 int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
 
 
 
 
164 #endif
165
166 /*
167 ** General purpose hash table from th_lang.c.
168 */
169
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 /*
163 ** Interfaces to the full Tcl core library from "th_tcl.c".
164 */
165 int th_register_tcl(Th_Interp *, void *);
166 int unloadTcl(Th_Interp *, void *);
167 int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
168 #endif
169
170 /*
171 ** General purpose hash table from th_lang.c.
172 */
173
+6 -2
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157157
int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158158
int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159159
int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160160
161161
#ifdef FOSSIL_ENABLE_TCL
162
-int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163
-int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
162
+/*
163
+** Interfaces to the full Tcl core library from "th_tcl.c".
164
+*/
165
+int th_register_tcl(Th_Interp *, void *);
166
+int unloadTcl(Th_Interp *, void *);
167
+int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
164168
#endif
165169
166170
/*
167171
** General purpose hash table from th_lang.c.
168172
*/
169173
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163 int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
 
 
 
 
164 #endif
165
166 /*
167 ** General purpose hash table from th_lang.c.
168 */
169
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 /*
163 ** Interfaces to the full Tcl core library from "th_tcl.c".
164 */
165 int th_register_tcl(Th_Interp *, void *);
166 int unloadTcl(Th_Interp *, void *);
167 int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
168 #endif
169
170 /*
171 ** General purpose hash table from th_lang.c.
172 */
173
+6 -2
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157157
int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158158
int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159159
int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160160
161161
#ifdef FOSSIL_ENABLE_TCL
162
-int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163
-int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
162
+/*
163
+** Interfaces to the full Tcl core library from "th_tcl.c".
164
+*/
165
+int th_register_tcl(Th_Interp *, void *);
166
+int unloadTcl(Th_Interp *, void *);
167
+int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
164168
#endif
165169
166170
/*
167171
** General purpose hash table from th_lang.c.
168172
*/
169173
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163 int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
 
 
 
 
164 #endif
165
166 /*
167 ** General purpose hash table from th_lang.c.
168 */
169
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 /*
163 ** Interfaces to the full Tcl core library from "th_tcl.c".
164 */
165 int th_register_tcl(Th_Interp *, void *);
166 int unloadTcl(Th_Interp *, void *);
167 int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
168 #endif
169
170 /*
171 ** General purpose hash table from th_lang.c.
172 */
173
+6 -2
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157157
int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158158
int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159159
int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160160
161161
#ifdef FOSSIL_ENABLE_TCL
162
-int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163
-int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
162
+/*
163
+** Interfaces to the full Tcl core library from "th_tcl.c".
164
+*/
165
+int th_register_tcl(Th_Interp *, void *);
166
+int unloadTcl(Th_Interp *, void *);
167
+int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
164168
#endif
165169
166170
/*
167171
** General purpose hash table from th_lang.c.
168172
*/
169173
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163 int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
 
 
 
 
164 #endif
165
166 /*
167 ** General purpose hash table from th_lang.c.
168 */
169
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 /*
163 ** Interfaces to the full Tcl core library from "th_tcl.c".
164 */
165 int th_register_tcl(Th_Interp *, void *);
166 int unloadTcl(Th_Interp *, void *);
167 int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
168 #endif
169
170 /*
171 ** General purpose hash table from th_lang.c.
172 */
173
+6 -2
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157157
int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158158
int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159159
int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160160
161161
#ifdef FOSSIL_ENABLE_TCL
162
-int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163
-int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
162
+/*
163
+** Interfaces to the full Tcl core library from "th_tcl.c".
164
+*/
165
+int th_register_tcl(Th_Interp *, void *);
166
+int unloadTcl(Th_Interp *, void *);
167
+int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
164168
#endif
165169
166170
/*
167171
** General purpose hash table from th_lang.c.
168172
*/
169173
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163 int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
 
 
 
 
164 #endif
165
166 /*
167 ** General purpose hash table from th_lang.c.
168 */
169
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 /*
163 ** Interfaces to the full Tcl core library from "th_tcl.c".
164 */
165 int th_register_tcl(Th_Interp *, void *);
166 int unloadTcl(Th_Interp *, void *);
167 int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
168 #endif
169
170 /*
171 ** General purpose hash table from th_lang.c.
172 */
173
+6 -2
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157157
int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158158
int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159159
int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160160
161161
#ifdef FOSSIL_ENABLE_TCL
162
-int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163
-int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
162
+/*
163
+** Interfaces to the full Tcl core library from "th_tcl.c".
164
+*/
165
+int th_register_tcl(Th_Interp *, void *);
166
+int unloadTcl(Th_Interp *, void *);
167
+int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
164168
#endif
165169
166170
/*
167171
** General purpose hash table from th_lang.c.
168172
*/
169173
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 int th_register_tcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
163 int unloadTcl(Th_Interp *interp, void *pContext); /* th_tcl.c */
 
 
 
 
164 #endif
165
166 /*
167 ** General purpose hash table from th_lang.c.
168 */
169
--- src/th.h
+++ src/th.h
@@ -157,12 +157,16 @@
157 int th_register_sqlite(Th_Interp *interp); /* th_sqlite.c */
158 int th_register_vfs(Th_Interp *interp); /* th_vfs.c */
159 int th_register_testvfs(Th_Interp *interp); /* th_testvfs.c */
160
161 #ifdef FOSSIL_ENABLE_TCL
162 /*
163 ** Interfaces to the full Tcl core library from "th_tcl.c".
164 */
165 int th_register_tcl(Th_Interp *, void *);
166 int unloadTcl(Th_Interp *, void *);
167 int evaluateTclWithEvents(Th_Interp *, void *, const char *, int, int);
168 #endif
169
170 /*
171 ** General purpose hash table from th_lang.c.
172 */
173
+32
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -766,10 +766,42 @@
766766
}
767767
}
768768
Tcl_DecrRefCount(listPtr);
769769
return rc;
770770
}
771
+
772
+/*
773
+** Evaluate a Tcl script, creating the Tcl interpreter if necessary. If the
774
+** Tcl script succeeds, start a Tcl event loop until there are no more events
775
+** remaining to process -OR- the script calls [exit]. If the bWait argument
776
+** is zero, only process events that are already in the queue; otherwise,
777
+** process events until the script terminates the Tcl event loop.
778
+*/
779
+int evaluateTclWithEvents(
780
+ Th_Interp *interp,
781
+ void *pContext,
782
+ const char *zScript,
783
+ int nScript,
784
+ int bWait
785
+){
786
+ struct TclContext *tclContext = (struct TclContext *)pContext;
787
+ Tcl_Interp *tclInterp;
788
+ int rc;
789
+ int flags = TCL_ALL_EVENTS;
790
+
791
+ if( createTclInterp(interp, pContext)!=TH_OK ){
792
+ return TH_ERROR;
793
+ }
794
+ tclInterp = tclContext->interp;
795
+ rc = Tcl_EvalEx(tclInterp, zScript, nScript, TCL_EVAL_GLOBAL);
796
+ if( rc!=TCL_OK ) return rc;
797
+ if( !bWait ) flags |= TCL_DONT_WAIT;
798
+ while( Tcl_DoOneEvent(flags) ){
799
+ /* do nothing */
800
+ }
801
+ return rc;
802
+}
771803
772804
/*
773805
** Creates and initializes a Tcl interpreter for use with the specified TH1
774806
** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
775807
** by the caller.
776808
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -766,10 +766,42 @@
766 }
767 }
768 Tcl_DecrRefCount(listPtr);
769 return rc;
770 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
771
772 /*
773 ** Creates and initializes a Tcl interpreter for use with the specified TH1
774 ** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
775 ** by the caller.
776
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -766,10 +766,42 @@
766 }
767 }
768 Tcl_DecrRefCount(listPtr);
769 return rc;
770 }
771
772 /*
773 ** Evaluate a Tcl script, creating the Tcl interpreter if necessary. If the
774 ** Tcl script succeeds, start a Tcl event loop until there are no more events
775 ** remaining to process -OR- the script calls [exit]. If the bWait argument
776 ** is zero, only process events that are already in the queue; otherwise,
777 ** process events until the script terminates the Tcl event loop.
778 */
779 int evaluateTclWithEvents(
780 Th_Interp *interp,
781 void *pContext,
782 const char *zScript,
783 int nScript,
784 int bWait
785 ){
786 struct TclContext *tclContext = (struct TclContext *)pContext;
787 Tcl_Interp *tclInterp;
788 int rc;
789 int flags = TCL_ALL_EVENTS;
790
791 if( createTclInterp(interp, pContext)!=TH_OK ){
792 return TH_ERROR;
793 }
794 tclInterp = tclContext->interp;
795 rc = Tcl_EvalEx(tclInterp, zScript, nScript, TCL_EVAL_GLOBAL);
796 if( rc!=TCL_OK ) return rc;
797 if( !bWait ) flags |= TCL_DONT_WAIT;
798 while( Tcl_DoOneEvent(flags) ){
799 /* do nothing */
800 }
801 return rc;
802 }
803
804 /*
805 ** Creates and initializes a Tcl interpreter for use with the specified TH1
806 ** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
807 ** by the caller.
808
+32
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -766,10 +766,42 @@
766766
}
767767
}
768768
Tcl_DecrRefCount(listPtr);
769769
return rc;
770770
}
771
+
772
+/*
773
+** Evaluate a Tcl script, creating the Tcl interpreter if necessary. If the
774
+** Tcl script succeeds, start a Tcl event loop until there are no more events
775
+** remaining to process -OR- the script calls [exit]. If the bWait argument
776
+** is zero, only process events that are already in the queue; otherwise,
777
+** process events until the script terminates the Tcl event loop.
778
+*/
779
+int evaluateTclWithEvents(
780
+ Th_Interp *interp,
781
+ void *pContext,
782
+ const char *zScript,
783
+ int nScript,
784
+ int bWait
785
+){
786
+ struct TclContext *tclContext = (struct TclContext *)pContext;
787
+ Tcl_Interp *tclInterp;
788
+ int rc;
789
+ int flags = TCL_ALL_EVENTS;
790
+
791
+ if( createTclInterp(interp, pContext)!=TH_OK ){
792
+ return TH_ERROR;
793
+ }
794
+ tclInterp = tclContext->interp;
795
+ rc = Tcl_EvalEx(tclInterp, zScript, nScript, TCL_EVAL_GLOBAL);
796
+ if( rc!=TCL_OK ) return rc;
797
+ if( !bWait ) flags |= TCL_DONT_WAIT;
798
+ while( Tcl_DoOneEvent(flags) ){
799
+ /* do nothing */
800
+ }
801
+ return rc;
802
+}
771803
772804
/*
773805
** Creates and initializes a Tcl interpreter for use with the specified TH1
774806
** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
775807
** by the caller.
776808
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -766,10 +766,42 @@
766 }
767 }
768 Tcl_DecrRefCount(listPtr);
769 return rc;
770 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
771
772 /*
773 ** Creates and initializes a Tcl interpreter for use with the specified TH1
774 ** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
775 ** by the caller.
776
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -766,10 +766,42 @@
766 }
767 }
768 Tcl_DecrRefCount(listPtr);
769 return rc;
770 }
771
772 /*
773 ** Evaluate a Tcl script, creating the Tcl interpreter if necessary. If the
774 ** Tcl script succeeds, start a Tcl event loop until there are no more events
775 ** remaining to process -OR- the script calls [exit]. If the bWait argument
776 ** is zero, only process events that are already in the queue; otherwise,
777 ** process events until the script terminates the Tcl event loop.
778 */
779 int evaluateTclWithEvents(
780 Th_Interp *interp,
781 void *pContext,
782 const char *zScript,
783 int nScript,
784 int bWait
785 ){
786 struct TclContext *tclContext = (struct TclContext *)pContext;
787 Tcl_Interp *tclInterp;
788 int rc;
789 int flags = TCL_ALL_EVENTS;
790
791 if( createTclInterp(interp, pContext)!=TH_OK ){
792 return TH_ERROR;
793 }
794 tclInterp = tclContext->interp;
795 rc = Tcl_EvalEx(tclInterp, zScript, nScript, TCL_EVAL_GLOBAL);
796 if( rc!=TCL_OK ) return rc;
797 if( !bWait ) flags |= TCL_DONT_WAIT;
798 while( Tcl_DoOneEvent(flags) ){
799 /* do nothing */
800 }
801 return rc;
802 }
803
804 /*
805 ** Creates and initializes a Tcl interpreter for use with the specified TH1
806 ** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
807 ** by the caller.
808
+32
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -766,10 +766,42 @@
766766
}
767767
}
768768
Tcl_DecrRefCount(listPtr);
769769
return rc;
770770
}
771
+
772
+/*
773
+** Evaluate a Tcl script, creating the Tcl interpreter if necessary. If the
774
+** Tcl script succeeds, start a Tcl event loop until there are no more events
775
+** remaining to process -OR- the script calls [exit]. If the bWait argument
776
+** is zero, only process events that are already in the queue; otherwise,
777
+** process events until the script terminates the Tcl event loop.
778
+*/
779
+int evaluateTclWithEvents(
780
+ Th_Interp *interp,
781
+ void *pContext,
782
+ const char *zScript,
783
+ int nScript,
784
+ int bWait
785
+){
786
+ struct TclContext *tclContext = (struct TclContext *)pContext;
787
+ Tcl_Interp *tclInterp;
788
+ int rc;
789
+ int flags = TCL_ALL_EVENTS;
790
+
791
+ if( createTclInterp(interp, pContext)!=TH_OK ){
792
+ return TH_ERROR;
793
+ }
794
+ tclInterp = tclContext->interp;
795
+ rc = Tcl_EvalEx(tclInterp, zScript, nScript, TCL_EVAL_GLOBAL);
796
+ if( rc!=TCL_OK ) return rc;
797
+ if( !bWait ) flags |= TCL_DONT_WAIT;
798
+ while( Tcl_DoOneEvent(flags) ){
799
+ /* do nothing */
800
+ }
801
+ return rc;
802
+}
771803
772804
/*
773805
** Creates and initializes a Tcl interpreter for use with the specified TH1
774806
** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
775807
** by the caller.
776808
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -766,10 +766,42 @@
766 }
767 }
768 Tcl_DecrRefCount(listPtr);
769 return rc;
770 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
771
772 /*
773 ** Creates and initializes a Tcl interpreter for use with the specified TH1
774 ** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
775 ** by the caller.
776
--- src/th_tcl.c
+++ src/th_tcl.c
@@ -766,10 +766,42 @@
766 }
767 }
768 Tcl_DecrRefCount(listPtr);
769 return rc;
770 }
771
772 /*
773 ** Evaluate a Tcl script, creating the Tcl interpreter if necessary. If the
774 ** Tcl script succeeds, start a Tcl event loop until there are no more events
775 ** remaining to process -OR- the script calls [exit]. If the bWait argument
776 ** is zero, only process events that are already in the queue; otherwise,
777 ** process events until the script terminates the Tcl event loop.
778 */
779 int evaluateTclWithEvents(
780 Th_Interp *interp,
781 void *pContext,
782 const char *zScript,
783 int nScript,
784 int bWait
785 ){
786 struct TclContext *tclContext = (struct TclContext *)pContext;
787 Tcl_Interp *tclInterp;
788 int rc;
789 int flags = TCL_ALL_EVENTS;
790
791 if( createTclInterp(interp, pContext)!=TH_OK ){
792 return TH_ERROR;
793 }
794 tclInterp = tclContext->interp;
795 rc = Tcl_EvalEx(tclInterp, zScript, nScript, TCL_EVAL_GLOBAL);
796 if( rc!=TCL_OK ) return rc;
797 if( !bWait ) flags |= TCL_DONT_WAIT;
798 while( Tcl_DoOneEvent(flags) ){
799 /* do nothing */
800 }
801 return rc;
802 }
803
804 /*
805 ** Creates and initializes a Tcl interpreter for use with the specified TH1
806 ** interpreter. Stores the created Tcl interpreter in the Tcl context supplied
807 ** by the caller.
808

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button