diff options
author | nijtmans <nijtmans> | 2010-11-16 14:03:34 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-11-16 14:03:34 (GMT) |
commit | e02c453ac1080eb369646528c2fa0eee8510ba83 (patch) | |
tree | 55736a49d6e36c10e72b9b7a57db9b3d31d34406 | |
parent | a4c47fe21756aaa1d76d7e820521184abbe07178 (diff) | |
download | tcl-e02c453ac1080eb369646528c2fa0eee8510ba83.zip tcl-e02c453ac1080eb369646528c2fa0eee8510ba83.tar.gz tcl-e02c453ac1080eb369646528c2fa0eee8510ba83.tar.bz2 |
Bring compilation under mingw-w64 a bit closer to reality
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | win/cat.c | 11 | ||||
-rwxr-xr-x | win/configure | 2 | ||||
-rw-r--r-- | win/tcl.m4 | 2 | ||||
-rw-r--r-- | win/tclAppInit.c | 56 |
5 files changed, 46 insertions, 32 deletions
@@ -1,3 +1,10 @@ +2010-11-16 Jan Nijtmans <nijtmans@users.sf.net> + + * win/tclAppInit.c Bring compilation under mingw-w64 a bit closer + * win/cat.c to reality. See for what's missing: + * win/tcl.m4 <https://sourceforge.net/apps/trac/mingw-w64/wiki/Unicode%20apps> + * win/configure (re-generated) + 2010-11-15 Andreas Kupries <andreask@activestate.com> * doc/interp.n: [3081184] TIP #378. @@ -8,9 +8,15 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: cat.c,v 1.5 2010/01/13 06:46:56 nijtmans Exp $ + * RCS: @(#) $Id: cat.c,v 1.6 2010/11/16 14:03:34 nijtmans Exp $ */ +#ifdef TCL_BROKEN_MAINARGS +/* On mingw32 and cygwin this doesn't work */ +# undef UNICODE +# undef _UNICODE +#endif + #include <stdio.h> #ifdef __CYGWIN__ # include <unistd.h> @@ -18,9 +24,10 @@ # include <io.h> #endif #include <string.h> +#include <tchar.h> int -main(void) +_tmain(void) { char buf[1024]; int n; diff --git a/win/configure b/win/configure index f6f8b81..46e66af 100755 --- a/win/configure +++ b/win/configure @@ -4029,7 +4029,7 @@ echo "$as_me: WARNING: 64bit mode not supported with GCC on Windows" >&2;} MAKE_EXE="\${CC} -o \$@" LIBPREFIX="lib" - extra_cflags="-pipe" + extra_cflags="-pipe -DTCL_BROKEN_MAINARGS" extra_ldflags="-pipe" if test "$ac_cv_cygwin" = "yes"; then @@ -477,7 +477,7 @@ file for information about building with Mingw.]) MAKE_EXE="\${CC} -o \[$]@" LIBPREFIX="lib" - extra_cflags="-pipe" + extra_cflags="-pipe -DTCL_BROKEN_MAINARGS" extra_ldflags="-pipe" if test "$ac_cv_cygwin" = "yes"; then diff --git a/win/tclAppInit.c b/win/tclAppInit.c index d92109c..2189238 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -12,11 +12,11 @@ * 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.34 2010/11/04 21:48:23 nijtmans Exp $ + * RCS: @(#) $Id: tclAppInit.c,v 1.35 2010/11/16 14:03:34 nijtmans Exp $ */ -#ifndef _MSC_VER -/* On mingw and cygwin this doesn't work yet */ +#ifdef TCL_BROKEN_MAINARGS +/* On mingw32 and cygwin this doesn't work */ # undef UNICODE # undef _UNICODE #endif @@ -34,9 +34,9 @@ extern Tcl_PackageInitProc Tcltest_Init; extern Tcl_PackageInitProc Tcltest_SafeInit; #endif /* TCL_TEST */ -#if defined(__GNUC__) -static void setargv(int *argcPtr, TCHAR ***argvPtr); -#endif /* __GNUC__ */ +#ifdef TCL_BROKEN_MAINARGS +static void setargv(int *argcPtr, char ***argvPtr); +#endif /* * The following #if block allows you to change the AppInit function by using @@ -94,7 +94,7 @@ _tmain( * Get our args from the c-runtime. Ignore lpszCmdLine. */ -#if defined(__GNUC__) +#ifdef TCL_BROKEN_MAINARGS setargv(&argc, &argv); #endif @@ -223,14 +223,14 @@ Tcl_AppInit( *-------------------------------------------------------------------------- */ -#if defined(__GNUC__) +#ifdef TCL_BROKEN_MAINARGS static void setargv( int *argcPtr, /* Filled with number of argument strings. */ - TCHAR ***argvPtr) /* Filled with argument strings (malloc'd). */ + char ***argvPtr) /* Filled with argument strings (malloc'd). */ { - TCHAR *cmdLine, *p, *arg, *argSpace; - TCHAR **argv; + char *cmdLine, *p, *arg, *argSpace; + char **argv; int argc, size, inquote, copy, slashes; cmdLine = GetCommandLine(); @@ -241,30 +241,30 @@ setargv( */ size = 2; - for (p = cmdLine; *p != TEXT('\0'); p++) { - if ((*p == TEXT(' ')) || (*p == TEXT('\t'))) { /* INTL: ISO space. */ + for (p = cmdLine; *p != '\0'; p++) { + if ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ size++; - while ((*p == TEXT(' ')) || (*p == TEXT('\t'))) { /* INTL: ISO space. */ + while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ p++; } - if (*p == TEXT('\0')) { + if (*p == '\0') { break; } } } - argSpace = (TCHAR *) ckalloc( - (unsigned) (size * sizeof(TCHAR *) + (_tcslen(cmdLine) * sizeof(TCHAR)) + 1)); - argv = (TCHAR **) argSpace; - argSpace += size * sizeof(TCHAR *); + argSpace = (char *) ckalloc( + (unsigned) (size * sizeof(char *) + (strlen(cmdLine)) + 1)); + argv = (char **) argSpace; + argSpace += size; size--; p = cmdLine; for (argc = 0; argc < size; argc++) { argv[argc] = arg = argSpace; - while ((*p == TEXT(' ')) || (*p == TEXT('\t'))) { /* INTL: ISO space. */ + while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ p++; } - if (*p == TEXT('\0')) { + if (*p == '\0') { break; } @@ -272,14 +272,14 @@ setargv( slashes = 0; while (1) { copy = 1; - while (*p == TEXT('\\')) { + while (*p == '\\') { slashes++; p++; } - if (*p == TEXT('"')) { + if (*p == '"') { if ((slashes & 1) == 0) { copy = 0; - if ((inquote) && (p[1] == TEXT('"'))) { + if ((inquote) && (p[1] == '"')) { p++; copy = 1; } else { @@ -290,13 +290,13 @@ setargv( } while (slashes) { - *arg = TEXT('\\'); + *arg = '\\'; arg++; slashes--; } - if ((*p == TEXT('\0')) || (!inquote && - ((*p == TEXT(' ')) || (*p == TEXT('\t'))))) { /* INTL: ISO space. */ + if ((*p == '\0') || (!inquote && + ((*p == ' ') || (*p == '\t')))) { /* INTL: ISO space. */ break; } if (copy != 0) { @@ -305,7 +305,7 @@ setargv( } p++; } - *arg = TEXT('\0'); + *arg = '\0'; argSpace = arg + 1; } argv[argc] = NULL; |