summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-11-16 14:05:36 (GMT)
committernijtmans <nijtmans>2010-11-16 14:05:36 (GMT)
commitf1c7fea84dca36312c54c8513abc7253d10838a2 (patch)
tree8b4ecc571b58e16e547a6af6fc777ab264b0ecbf /win
parent68d0160d54c6bd5b4b77778284a30f944d5123ac (diff)
downloadtk-f1c7fea84dca36312c54c8513abc7253d10838a2.zip
tk-f1c7fea84dca36312c54c8513abc7253d10838a2.tar.gz
tk-f1c7fea84dca36312c54c8513abc7253d10838a2.tar.bz2
Bring compilation under mingw-w64 a bit closer to reality
Diffstat (limited to 'win')
-rwxr-xr-xwin/configure2
-rw-r--r--win/tcl.m42
-rw-r--r--win/winMain.c54
3 files changed, 29 insertions, 29 deletions
diff --git a/win/configure b/win/configure
index 5ef96d9..2b69036 100755
--- a/win/configure
+++ b/win/configure
@@ -3301,7 +3301,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
diff --git a/win/tcl.m4 b/win/tcl.m4
index ff07c34..ff61263 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -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/winMain.c b/win/winMain.c
index 8e98168..1be6561 100644
--- a/win/winMain.c
+++ b/win/winMain.c
@@ -11,11 +11,11 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: winMain.c,v 1.34 2010/10/11 21:50:46 nijtmans Exp $
+ * RCS: @(#) $Id: winMain.c,v 1.35 2010/11/16 14:05:36 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
@@ -33,8 +33,8 @@ extern Tcl_PackageInitProc Tktest_Init;
#endif /* TK_TEST */
#if defined(__CYGWIN__)
-static void setargv(int *argcPtr, TCHAR ***argvPtr);
-#endif /* __CYGWIN__ */
+static void setargv(int *argcPtr, char ***argvPtr);
+#endif
/*
* Forward declarations for procedures defined later in this file:
@@ -85,7 +85,7 @@ int APIENTRY
_tWinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
- LPTSTR lpszCmdLine,
+ LPWSTR lpszCmdLine,
int nCmdShow)
{
TCHAR **argv;
@@ -279,7 +279,7 @@ WishPanic(
ExitProcess(1);
}
-#if !defined(__GNUC__) || defined(TK_TEST)
+#if !defined(TCL_BROKEN_MAINARGS) || defined(TK_TEST)
/*
*----------------------------------------------------------------------
*
@@ -359,10 +359,10 @@ _tmain(
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();
@@ -373,30 +373,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;
}
@@ -404,14 +404,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 {
@@ -422,13 +422,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) {
@@ -437,7 +437,7 @@ setargv(
}
p++;
}
- *arg = TEXT('\0');
+ *arg = '\0';
argSpace = arg + 1;
}
argv[argc] = NULL;