Attachment "MainEx.patch" to
ticket [1711975fff]
added by
fridolin
2007-05-03 20:54:41.
*** old/tcl8.5a6/generic/tcl.h Wed Jan 31 00:42:50 2007
--- tcl8.5a6/generic/tcl.h Thu May 3 15:31:15 2007
***************
*** 2254,2259 ****
--- 2254,2262 ----
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));
+
/*
* Include the public function declarations that are accessible via the stubs
* table.
Only in tcl8.5a6/generic: tcl.h~
diff -wrc old/tcl8.5a6/generic/tclMain.c tcl8.5a6/generic/tclMain.c
*** old/tcl8.5a6/generic/tclMain.c Tue Apr 24 21:13:09 2007
--- tcl8.5a6/generic/tclMain.c Thu May 3 15:32:42 2007
***************
*** 311,319 ****
/*----------------------------------------------------------------------
*
! * 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
--- 311,320 ----
/*----------------------------------------------------------------------
*
! * 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,337 ****
*/
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. */
--- 329,339 ----
*/
void
! Tcl_MainEx(
int argc, /* Number of arguments. */
char **argv, /* Array of argument strings. */
! Tcl_AppInitProc *appInitProc,
! Tcl_Interp * interp)
/* Application-specific initialization
* function to call after most initialization
* but before starting to execute commands. */
***************
*** 341,353 ****
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
--- 343,352 ----
***************
*** 680,685 ****
--- 679,719 ----
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);
+
+ }
+
+
/*
*---------------------------------------------------------------
*