Attachment "MainEx-8.5.5.patch" to
ticket [1711975fff]
added by
fridolin
2008-11-06 20:20:06.
diff -rBNu tcl8.5.5/generic/tcl.h tcl8.5.5.new/generic/tcl.h
--- tcl8.5.5/generic/tcl.h 2008-10-10 20:16:47.000000000 +0200
+++ tcl8.5.5.new/generic/tcl.h 2008-11-06 10:08:13.000000000 +0100
@@ -145,7 +145,7 @@
*
* The following TCL_VARARGS* macros are to support old extensions
* written for older versions of Tcl where the macros permitted
- * support for the varargs.h system as well as stdarg.h .
+ * support for the varargs.h system as well as stdarg.h .
*
* New code should just directly be written to use stdarg.h conventions.
*/
@@ -167,7 +167,7 @@
* Note: when building static but linking dynamically to MSVCRT we must still
* correctly decorate the C library imported function. Use CRTIMPORT
* for this purpose. _DLL is defined by the compiler when linking to
- * MSVCRT.
+ * MSVCRT.
*/
#if (defined(__WIN32__) && (defined(_MSC_VER) || (__BORLANDC__ >= 0x0550) || defined(__LCC__) || defined(__WATCOMC__) || (defined(__GNUC__) && defined(__declspec))))
@@ -2234,6 +2234,8 @@
EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv,
Tcl_AppInitProc *appInitProc));
+EXTERN void Tcl_MainEx _ANSI_ARGS_((int argc, char **argv,
+ Tcl_AppInitProc *appInitProc, Tcl_Interp * interp));
EXTERN CONST char * Tcl_PkgInitStubsCheck _ANSI_ARGS_((Tcl_Interp *interp,
CONST char *version, int exact));
#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
diff -rBNu tcl8.5.5/generic/tclMain.c tcl8.5.5.new/generic/tclMain.c
--- tcl8.5.5/generic/tclMain.c 2007-12-13 16:23:19.000000000 +0100
+++ tcl8.5.5.new/generic/tclMain.c 2008-11-06 10:08:06.000000000 +0100
@@ -311,9 +311,10 @@
/*----------------------------------------------------------------------
*
- * Tcl_Main --
+ * Tcl_MainEx --
*
* Main program for tclsh and most other Tcl-based applications.
+ * It gets the main interp as an argument.
*
* Results:
* None. This function never returns (it exits the process when it's
@@ -328,10 +329,11 @@
*/
void
-Tcl_Main(
+Tcl_MainEx(
int argc, /* Number of arguments. */
char **argv, /* Array of argument strings. */
- Tcl_AppInitProc *appInitProc)
+ Tcl_AppInitProc *appInitProc,
+ Tcl_Interp * interp)
/* Application-specific initialization
* function to call after most initialization
* but before starting to execute commands. */
@@ -341,13 +343,10 @@
PromptType prompt = PROMPT_START;
int code, length, tty, exitCode = 0;
Tcl_Channel inChannel, outChannel, errChannel;
- Tcl_Interp *interp;
Tcl_DString appName;
Tcl_FindExecutable(argv[0]);
- interp = Tcl_CreateInterp();
- Tcl_InitMemory(interp);
/*
* If the application has not already set a startup script, parse the
@@ -688,6 +687,41 @@
Tcl_Exit(exitCode);
}
+/*----------------------------------------------------------------------
+ *
+ * Tcl_Main --
+ *
+ * Main program for tclsh and most other Tcl-based applications.
+ *
+ * Results:
+ * None. This function never returns (it exits the process when it's
+ * done).
+ *
+ * Side effects:
+ * This function initializes the Tcl world and then starts interpreting
+ * commands; almost anything could happen, depending on the script being
+ * interpreted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tcl_Main(
+ int argc, /* Number of arguments. */
+ char **argv, /* Array of argument strings. */
+ Tcl_AppInitProc *appInitProc)
+ /* Application-specific initialization
+ * function to call after most initialization
+ * but before starting to execute commands. */
+{
+
+ Tcl_Interp * interp = Tcl_CreateInterp();
+ Tcl_InitMemory(interp);
+ Tcl_MainEx(argc, argv, appInitProc, interp);
+
+}
+
+
/*
*---------------------------------------------------------------
*