diff options
author | nijtmans <nijtmans> | 2010-11-04 21:48:23 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-11-04 21:48:23 (GMT) |
commit | 259ada8fb281493b125e0b1560f2747fa91209bf (patch) | |
tree | eca4cf58389348cf58a44d588d60ff77e45cbcba /generic | |
parent | ebb0221fdd2b89c2af2d5ee05d235debb5f0bb72 (diff) | |
download | tcl-259ada8fb281493b125e0b1560f2747fa91209bf.zip tcl-259ada8fb281493b125e0b1560f2747fa91209bf.tar.gz tcl-259ada8fb281493b125e0b1560f2747fa91209bf.tar.bz2 |
[FRQ 491789]: "setargv() doesn't support a unicode cmdline" implemented for Tcl on MSVC++
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclDecls.h | 8 | ||||
-rw-r--r-- | generic/tclMain.c | 36 |
2 files changed, 33 insertions, 11 deletions
diff --git a/generic/tclDecls.h b/generic/tclDecls.h index fc9e082..a0453f3 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDecls.h,v 1.187 2010/09/23 21:40:46 nijtmans Exp $ + * RCS: @(#) $Id: tclDecls.h,v 1.188 2010/11/04 21:48:23 nijtmans Exp $ */ #ifndef _TCLDECLS @@ -3787,8 +3787,14 @@ extern const TclStubs *tclStubsPtr; # define Tcl_SetVar(interp, varName, newValue, flags) \ (tclStubsPtr->tcl_SetVar(interp, varName, newValue, flags)) #endif + #if defined(_WIN32) && defined(UNICODE) # define Tcl_FindExecutable(arg) ((Tcl_FindExecutable)((const char *)(arg))) +# define Tcl_MainEx Tcl_MainExW + EXTERN void Tcl_MainExW(int argc, wchar_t **argv, + Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); +# define Tcl_Main(argc, argv, proc) Tcl_MainExW(argc, argv, proc, \ + (Tcl_FindExecutable(argv[0]), (Tcl_CreateInterp)())) #endif #undef TCL_STORAGE_CLASS diff --git a/generic/tclMain.c b/generic/tclMain.c index 6fb67ac..93db15b 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMain.c,v 1.52 2010/09/29 20:04:09 nijtmans Exp $ + * RCS: @(#) $Id: tclMain.c,v 1.53 2010/11/04 21:48:23 nijtmans Exp $ */ /** @@ -19,8 +19,13 @@ * can be implemented, sharing the same source code. */ #ifndef TCL_ASCII_MAIN -# undef UNICODE -# undef _UNICODE +# ifdef UNICODE +# undef UNICODE +# undef _UNICODE +# else +# define UNICODE +# define _UNICODE +# endif #endif #include "tclInt.h" @@ -265,7 +270,7 @@ Tcl_SourceRCFile( /*---------------------------------------------------------------------- * - * Tcl_Main -- + * Tcl_Main, Tcl_MainEx -- * * Main program for tclsh and most other Tcl-based applications. * @@ -282,13 +287,14 @@ Tcl_SourceRCFile( */ void -Tcl_Main( +Tcl_MainEx( int argc, /* Number of arguments. */ TCHAR **argv, /* Array of argument strings. */ - Tcl_AppInitProc *appInitProc) + Tcl_AppInitProc *appInitProc, /* Application-specific initialization * function to call after most initialization * but before starting to execute commands. */ + Tcl_Interp *interp) { Tcl_Obj *path, *resultPtr, *argvPtr, *commandPtr = NULL; const char *encodingName = NULL; @@ -296,12 +302,8 @@ Tcl_Main( int code, length, tty, exitCode = 0; Tcl_MainLoopProc *mainLoopProc; Tcl_Channel inChannel, outChannel, errChannel; - Tcl_Interp *interp; Tcl_DString appName; - Tcl_FindExecutable(argv[0]); - - interp = Tcl_CreateInterp(); Tcl_InitMemory(interp); /* @@ -652,6 +654,20 @@ Tcl_Main( } #ifndef TCL_ASCII_MAIN +#undef Tcl_Main +void +Tcl_Main( + int argc, /* Number of arguments. */ + TCHAR **argv, /* Array of argument strings. */ + Tcl_AppInitProc *appInitProc) + /* Application-specific initialization + * function to call after most initialization + * but before starting to execute commands. */ +{ + Tcl_FindExecutable(argv[0]); + Tcl_MainEx(argc, argv, appInitProc, Tcl_CreateInterp()); +} + /* *--------------------------------------------------------------- * |