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 | |
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++
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | doc/Tcl_Main.3 | 5 | ||||
-rw-r--r-- | generic/tclDecls.h | 8 | ||||
-rw-r--r-- | generic/tclMain.c | 36 | ||||
-rw-r--r-- | win/.cvsignore | 1 | ||||
-rw-r--r-- | win/Makefile.in | 6 | ||||
-rw-r--r-- | win/makefile.vc | 7 | ||||
-rw-r--r-- | win/tclAppInit.c | 12 | ||||
-rw-r--r-- | win/tclWin32Dll.c | 6 |
9 files changed, 67 insertions, 24 deletions
@@ -1,3 +1,13 @@ +2010-11-04 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclDecls.h [FRQ 491789]: "setargv() doesn't support a unicode + * generic/tclMain.c: cmdline" implemented for Tcl on MSVC++ + * doc/Tcl_Main.3 + * win/tclAppInit.c + * win/makefile.vc + * win/Makefile.in + * win/tclWin32Dll.c Eliminate minor MSVC warning TCHAR -> char conversion + 2010-11-04 Reinhard Max <max@suse.de> * tests/socket.test: Run the socket tests three times with the diff --git a/doc/Tcl_Main.3 b/doc/Tcl_Main.3 index e37ffe4..5bae645 100644 --- a/doc/Tcl_Main.3 +++ b/doc/Tcl_Main.3 @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: Tcl_Main.3,v 1.20 2008/12/19 18:23:04 dgp Exp $ +'\" RCS: @(#) $Id: Tcl_Main.3,v 1.21 2010/11/04 21:48:23 nijtmans Exp $ '\" .so man.macros .TH Tcl_Main 3 8.4 Tcl "Tcl Library Procedures" @@ -30,7 +30,8 @@ Tcl_Obj * .AP int argc in Number of elements in \fIargv\fR. .AP char *argv[] in -Array of strings containing command-line arguments. +Array of strings containing command-line arguments. On Windows, when +using -DUNICODE, the parameter type changes to wchar_t *. .AP Tcl_AppInitProc *appInitProc in Address of an application-specific initialization procedure. The value for this argument is usually \fBTcl_AppInit\fR. 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()); +} + /* *--------------------------------------------------------------- * diff --git a/win/.cvsignore b/win/.cvsignore index c3044c9..90b96de 100644 --- a/win/.cvsignore +++ b/win/.cvsignore @@ -29,3 +29,4 @@ tcl.suo *.pch versions.vc vercl.x +Release_VC* diff --git a/win/Makefile.in b/win/Makefile.in index 0c0c0bb..3097849 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.184 2010/08/30 09:19:38 nijtmans Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.185 2010/11/04 21:48:23 nijtmans Exp $ VERSION = @TCL_VERSION@ @@ -251,6 +251,7 @@ GENERIC_OBJS = \ tclListObj.$(OBJEXT) \ tclLoad.$(OBJEXT) \ tclMain.$(OBJEXT) \ + tclMain2.$(OBJEXT) \ tclNamesp.$(OBJEXT) \ tclNotify.$(OBJEXT) \ tclOO.$(OBJEXT) \ @@ -499,6 +500,9 @@ tclWinPipe.${OBJEXT}: tclWinPipe.c testMain.${OBJEXT}: tclAppInit.c $(CC) -c $(CC_SWITCHES) -DTCL_TEST @DEPARG@ $(CC_OBJNAME) +tclMain2.${OBJEXT}: tclMain.c + $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) + # TIP #59, embedding of configuration information into the binary library. # # Part of Tcl's configuration information are the paths where it was installed diff --git a/win/makefile.vc b/win/makefile.vc index dc8bce5..9cc1a71 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -13,7 +13,7 @@ # Copyright (c) 2003-2008 Pat Thoyts. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.215 2010/10/11 12:11:53 nijtmans Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.216 2010/11/04 21:48:23 nijtmans Exp $ #------------------------------------------------------------------------------ # Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR) @@ -289,6 +289,7 @@ COREOBJS = \ $(TMP_DIR)\tclLiteral.obj \ $(TMP_DIR)\tclLoad.obj \ $(TMP_DIR)\tclMain.obj \ + $(TMP_DIR)\tclMain2.obj \ $(TMP_DIR)\tclNamesp.obj \ $(TMP_DIR)\tclNotify.obj \ $(TMP_DIR)\tclOO.obj \ @@ -896,6 +897,10 @@ $(TMP_DIR)\testMain.obj: $(WINDIR)\tclAppInit.c -DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \ -Fo$@ $? +$(TMP_DIR)\tclMain2.obj: $(GENERICDIR)\tclMain.c + $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -DTCL_ASCII_MAIN \ + -Fo$@ $? + $(TMP_DIR)\tclTest.obj: $(GENERICDIR)\tclTest.c $(cc32) $(TCL_CFLAGS) -Fo$@ $? diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 48962c0..d92109c 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -12,14 +12,14 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclAppInit.c,v 1.33 2010/09/23 21:40:45 nijtmans Exp $ + * RCS: @(#) $Id: tclAppInit.c,v 1.34 2010/11/04 21:48:23 nijtmans Exp $ */ -/* TODO: This file does not compile in UNICODE mode. - * See [Freq 2965056]: Windows build with -DUNICODE - */ -#undef UNICODE -#undef _UNICODE +#ifndef _MSC_VER +/* On mingw and cygwin this doesn't work yet */ +# undef UNICODE +# undef _UNICODE +#endif #include "tcl.h" #define WIN32_LEAN_AND_MEAN diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 9b8ec13..98cfa85 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.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: tclWin32Dll.c,v 1.69 2010/10/12 10:21:55 nijtmans Exp $ + * RCS: @(#) $Id: tclWin32Dll.c,v 1.70 2010/11/04 21:48:23 nijtmans Exp $ */ #include "tclWinInt.h" @@ -522,7 +522,7 @@ TclWinDriveLetterForVolMountPoint( */ Tcl_MutexUnlock(&mountPointMap); - return dlIter->driveLetter; + return (char) dlIter->driveLetter; } } @@ -602,7 +602,7 @@ TclWinDriveLetterForVolMountPoint( dlIter = dlIter->nextPtr) { if (_tcscmp(dlIter->volumeName, mountPoint) == 0) { Tcl_MutexUnlock(&mountPointMap); - return dlIter->driveLetter; + return (char) dlIter->driveLetter; } } |