Tk Source Code

Check-in [c955f857]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge trunk, and take over selected changes from androwish
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | androwish
Files: files | file ages | folders
SHA1: c955f85746c383aa2d910bb4a01afbaae137ebe5
User & Date: jan.nijtmans 2015-09-02 08:30:45
Context
2015-09-08
15:04
Merge trunk, and take over tkImgPhoto.h from androwish check-in: 122a9ab6 user: jan.nijtmans tags: androwish
2015-09-02
08:30
Merge trunk, and take over selected changes from androwish check-in: c955f857 user: jan.nijtmans tags: androwish
2015-08-28
11:47
Completing 00189c4afc: Allow semi-static UCRT build on Windows with VC 14.0. Now for the configure/makefile build. check-in: 44b24118 user: jan.nijtmans tags: trunk
2015-08-24
13:24
Merge trunk. Take over selected changes from androwish check-in: 1ebe378f user: jan.nijtmans tags: androwish
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Android.mk.

8
9
10
11
12
13
14


15
16
17


18
19
20
21
22
23
24

include $(CLEAR_VARS)

tcl_path := $(LOCAL_PATH)/../tcl

include $(tcl_path)/tcl-config.mk



tk_path := $(LOCAL_PATH)

include $(tk_path)/tk-config.mk



LOCAL_MODULE := tk

LOCAL_ARM_MODE := arm

LOCAL_C_INCLUDES := $(tk_includes) \
	$(LOCAL_PATH)/xlib \







>
>



>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

include $(CLEAR_VARS)

tcl_path := $(LOCAL_PATH)/../tcl

include $(tcl_path)/tcl-config.mk

LOCAL_ADDITIONAL_DEPENDENCIES += $(tcl_path)/tcl-config.mk

tk_path := $(LOCAL_PATH)

include $(tk_path)/tk-config.mk

LOCAL_ADDITIONAL_DEPENDENCIES += $(tk_path)/tk-config.mk

LOCAL_MODULE := tk

LOCAL_ARM_MODE := arm

LOCAL_C_INCLUDES := $(tk_includes) \
	$(LOCAL_PATH)/xlib \

Changes to generic/tkFont.c.

254
255
256
257
258
259
260
261



262
263
264
265
266
267
268
    "\344\270\270\343\202\264\343\202\267\343\203\203\343\202\257\342\210\222\357\274\255",
				/* Mac (goshikku-M). */
    NULL
};

static const char *const dingbatsAliases[] = {
#ifdef PLATFORM_SDL
    "opensymbol",



#endif
    "dingbats", "zapfdingbats", "itc zapfdingbats",
				/* Unix. */
				/* Windows. */
    "zapf dingbats",		/* Mac. */
    NULL
};







|
>
>
>







254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
    "\344\270\270\343\202\264\343\202\267\343\203\203\343\202\257\342\210\222\357\274\255",
				/* Mac (goshikku-M). */
    NULL
};

static const char *const dingbatsAliases[] = {
#ifdef PLATFORM_SDL
    "opensymbol", "symbola",
#ifdef ANDROID
    "android emoji",
#endif
#endif
    "dingbats", "zapfdingbats", "itc zapfdingbats",
				/* Unix. */
				/* Windows. */
    "zapf dingbats",		/* Mac. */
    NULL
};
339
340
341
342
343
344
345
346



347
348
349
350
351
352
353
    "simplified arabic fixed",	/* Windows. */
    "monaco", "pryamoy",	/* Mac. */
    NULL
};

static const char *const symbolClass[] = {
#ifdef PLATFORM_SDL
    "opensymbol",



#endif
    "symbol", "dingbats", "wingdings", NULL
};

static const char *const *const fontFallbacks[] = {
    systemClass,
    serifClass,







|
>
>
>







342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
    "simplified arabic fixed",	/* Windows. */
    "monaco", "pryamoy",	/* Mac. */
    NULL
};

static const char *const symbolClass[] = {
#ifdef PLATFORM_SDL
    "opensymbol", "symbola",
#ifdef ANDROID
    "android emoji",
#endif
#endif
    "symbol", "dingbats", "wingdings", NULL
};

static const char *const *const fontFallbacks[] = {
    systemClass,
    serifClass,

Changes to sdl/tkSDLFont.c.

37
38
39
40
41
42
43

44
45


46

47
48
49
50
51
52
53
 * character existence metrics, used to determine if a screen font can display
 * a given Unicode character.
 *
 * Under Unix, there are three attributes that uniquely identify a "font
 * family": the foundry, face name, and charset.
 */


#define FONTMAP_SHIFT		10



#define FONTMAP_PAGES		(1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))

#define FONTMAP_BITSPERPAGE	(1 << FONTMAP_SHIFT)

typedef struct FontFamily {
    struct FontFamily *nextPtr;	/* Next in list of all known font families. */
    int refCount;		/* How many SubFonts are referring to this
				 * FontFamily. When the refCount drops to
				 * zero, this FontFamily may be freed. */







>
|
|
>
>

>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 * character existence metrics, used to determine if a screen font can display
 * a given Unicode character.
 *
 * Under Unix, there are three attributes that uniquely identify a "font
 * family": the foundry, face name, and charset.
 */

#if TCL_UTF_MAX > 3
#define FONTMAP_SHIFT		12
#define FONTMAP_PAGES		(1 << (21 - FONTMAP_SHIFT))
#else
#define FONTMAP_SHIFT		10
#define FONTMAP_PAGES		(1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))
#endif
#define FONTMAP_BITSPERPAGE	(1 << FONTMAP_SHIFT)

typedef struct FontFamily {
    struct FontFamily *nextPtr;	/* Next in list of all known font families. */
    int refCount;		/* How many SubFonts are referring to this
				 * FontFamily. When the refCount drops to
				 * zero, this FontFamily may be freed. */
92
93
94
95
96
97
98



99

100
101
102
103
104
105
106
} SubFont;

/*
 * The following structure represents Unix's implementation of a font object.
 */

#define SUBFONT_SPACE		3



#define BASE_CHARS		2048


typedef struct UnixFont {
    TkFont font;		/* Stuff used by generic font package. Must be
				 * first in structure. */
    SubFont staticSubFonts[SUBFONT_SPACE];
				/* Builtin space for a limited number of
				 * SubFonts. */







>
>
>

>







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
} SubFont;

/*
 * The following structure represents Unix's implementation of a font object.
 */

#define SUBFONT_SPACE		3
#if TCL_UTF_MAX > 3
#define BASE_CHARS		4096
#else
#define BASE_CHARS		2048
#endif

typedef struct UnixFont {
    TkFont font;		/* Stuff used by generic font package. Must be
				 * first in structure. */
    SubFont staticSubFonts[SUBFONT_SPACE];
				/* Builtin space for a limited number of
				 * SubFonts. */
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
    result = TCL_OK;

    srcStart = src;
    srcEnd = src + srcLen;

    dstStart = dst;
#if TCL_UTF_MAX > 3
    dstEnd = dst + dstLen - 8 * sizeof(unsigned int);
#else
    dstEnd = dst + dstLen - 6 * sizeof(unsigned int);
#endif
    wDst = (unsigned int *) dst;

    for ( ; src < srcEnd; ) {
	if ((char *) wDst > dstEnd) {







|







434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
    result = TCL_OK;

    srcStart = src;
    srcEnd = src + srcLen;

    dstStart = dst;
#if TCL_UTF_MAX > 3
    dstEnd = dst + dstLen - 10 * sizeof(unsigned int);
#else
    dstEnd = dst + dstLen - 6 * sizeof(unsigned int);
#endif
    wDst = (unsigned int *) dst;

    for ( ; src < srcEnd; ) {
	if ((char *) wDst > dstEnd) {
457
458
459
460
461
462
463
464
465
466
467
468
469


470
471
472
473
474
475
476
477
478
479
480
481

482
483
484
485
486
487
488
	    wDst[2] = hexChars[(ch >> 12) & 0xf];
	    wDst[3] = hexChars[(ch >> 8) & 0xf];
	    wDst[4] = hexChars[(ch >> 4) & 0xf];
	    wDst[5] = hexChars[ch & 0xf];
	    wDst += 6;
	} else {
	    wDst[1] = 'U';
	    wDst[2] = hexChars[(ch >> 20) & 0xf];
	    wDst[3] = hexChars[(ch >> 16) & 0xf];
	    wDst[4] = hexChars[(ch >> 12) & 0xf];
	    wDst[5] = hexChars[(ch >> 8) & 0xf];
	    wDst[6] = hexChars[(ch >> 4) & 0xf];
	    wDst[7] = hexChars[ch & 0xf];


	    wDst += 8;
	}
#else
	} else {
	    wDst[1] = 'u';
	    wDst[2] = hexChars[(ch >> 12) & 0xf];
	    wDst[3] = hexChars[(ch >> 8) & 0xf];
	    wDst[4] = hexChars[(ch >> 4) & 0xf];
	    wDst[5] = hexChars[ch & 0xf];
	    wDst += 6;
	}
#endif

    }
    *srcReadPtr = src - srcStart;
    *dstWrotePtr = (char *) wDst - dstStart;
    *dstCharsPtr = *dstWrotePtr / sizeof(unsigned int);
    return result;
}








|
|
|
|
|
|
>
>
|
<








<

>







465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480

481
482
483
484
485
486
487
488

489
490
491
492
493
494
495
496
497
	    wDst[2] = hexChars[(ch >> 12) & 0xf];
	    wDst[3] = hexChars[(ch >> 8) & 0xf];
	    wDst[4] = hexChars[(ch >> 4) & 0xf];
	    wDst[5] = hexChars[ch & 0xf];
	    wDst += 6;
	} else {
	    wDst[1] = 'U';
	    wDst[2] = hexChars[(ch >> 28) & 0xf];
	    wDst[3] = hexChars[(ch >> 24) & 0xf];
	    wDst[4] = hexChars[(ch >> 20) & 0xf];
	    wDst[5] = hexChars[(ch >> 16) & 0xf];
	    wDst[6] = hexChars[(ch >> 12) & 0xf];
	    wDst[7] = hexChars[(ch >> 8) & 0xf];
	    wDst[8] = hexChars[(ch >> 4) & 0xf];
	    wDst[9] = hexChars[ch & 0xf];
	    wDst += 10;

#else
	} else {
	    wDst[1] = 'u';
	    wDst[2] = hexChars[(ch >> 12) & 0xf];
	    wDst[3] = hexChars[(ch >> 8) & 0xf];
	    wDst[4] = hexChars[(ch >> 4) & 0xf];
	    wDst[5] = hexChars[ch & 0xf];
	    wDst += 6;

#endif
	}
    }
    *srcReadPtr = src - srcStart;
    *dstWrotePtr = (char *) wDst - dstStart;
    *dstCharsPtr = *dstWrotePtr / sizeof(unsigned int);
    return result;
}

2267
2268
2269
2270
2271
2272
2273



2274
2275
2276
2277
2278
2279
2280

    if (subFontPtr->familyPtr == &tsdPtr->controlFamily) {
	return;
    }

    end = (row + 1) << FONTMAP_SHIFT;
    for (i = row << FONTMAP_SHIFT; i < end; i++) {



	if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i, src),
		TCL_ENCODING_STOPONERROR, NULL, buf, sizeof(buf), NULL,
		NULL, NULL) != TCL_OK) {
	    continue;
	}
	if (SdlTkFontHasChar(subFontPtr->fontStructPtr, buf)) {
	    bitOffset = i & (FONTMAP_BITSPERPAGE - 1);







>
>
>







2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292

    if (subFontPtr->familyPtr == &tsdPtr->controlFamily) {
	return;
    }

    end = (row + 1) << FONTMAP_SHIFT;
    for (i = row << FONTMAP_SHIFT; i < end; i++) {
	if ((i >= 0xD800) && (i <= 0xDFFF)) {
	    continue;
	}
	if (Tcl_UtfToExternal(NULL, encoding, src, Tcl_UniCharToUtf(i, src),
		TCL_ENCODING_STOPONERROR, NULL, buf, sizeof(buf), NULL,
		NULL, NULL) != TCL_OK) {
	    continue;
	}
	if (SdlTkFontHasChar(subFontPtr->fontStructPtr, buf)) {
	    bitOffset = i & (FONTMAP_BITSPERPAGE - 1);

Changes to win/configure.

3902
3903
3904
3905
3906
3907
3908







3909
3910
3911
3912
3913
3914
3915
	    # dynamic
            echo "$as_me:$LINENO: result: using shared flags" >&5
echo "${ECHO_T}using shared flags" >&6
	    runtime=-MD
	    # Add SHLIB_LD_LIBS to the Make rule, not here.
	    LIBRARIES="\${SHARED_LIBRARIES}"
	    EXESUFFIX="\${DBGX}.exe"







	fi
	MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\$@"
	# DLLSUFFIX is separate because it is the building block for
	# users of tclConfig.sh that may build shared or static.
	DLLSUFFIX="\${DBGX}.dll"
	LIBSUFFIX="\${DBGX}.lib"
	LIBFLAGSUFFIX="\${DBGX}"







>
>
>
>
>
>
>







3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
	    # dynamic
            echo "$as_me:$LINENO: result: using shared flags" >&5
echo "${ECHO_T}using shared flags" >&6
	    runtime=-MD
	    # Add SHLIB_LD_LIBS to the Make rule, not here.
	    LIBRARIES="\${SHARED_LIBRARIES}"
	    EXESUFFIX="\${DBGX}.exe"
	    case "x`echo \${VisualStudioVersion}`" in
		x14*)
		    lflags="${lflags} -nodefaultlib:libucrt.lib"
		    ;;
		*)
		    ;;
	    esac
	fi
	MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\$@"
	# DLLSUFFIX is separate because it is the building block for
	# users of tclConfig.sh that may build shared or static.
	DLLSUFFIX="\${DBGX}.dll"
	LIBSUFFIX="\${DBGX}.lib"
	LIBFLAGSUFFIX="\${DBGX}"
3942
3943
3944
3945
3946
3947
3948









3949
3950
3951
3952
3953
3954
3955
	    else
		echo "$as_me:$LINENO: result:    Using 64-bit $MACHINE mode" >&5
echo "${ECHO_T}   Using 64-bit $MACHINE mode" >&6
	    fi
	fi

	LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib ws2_32.lib"









	if test "$do64bit" != "no" ; then
	    # The space-based-path will work for the Makefile, but will
	    # not work if AC_TRY_COMPILE is called.  TEA has the
	    # TEA_PATH_NOSPACE to avoid this issue.
	    # Check if _WIN64 is already recognized, and if so we don't
	    # need to modify CC.
	    echo "$as_me:$LINENO: checking whether _WIN64 is declared" >&5







>
>
>
>
>
>
>
>
>







3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
	    else
		echo "$as_me:$LINENO: result:    Using 64-bit $MACHINE mode" >&5
echo "${ECHO_T}   Using 64-bit $MACHINE mode" >&6
	    fi
	fi

	LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib ws2_32.lib"

	case "x`echo \${VisualStudioVersion}`" in
		x14*)
		    LIBS="$LIBS ucrt.lib"
		    ;;
		*)
		    ;;
	esac

	if test "$do64bit" != "no" ; then
	    # The space-based-path will work for the Makefile, but will
	    # not work if AC_TRY_COMPILE is called.  TEA has the
	    # TEA_PATH_NOSPACE to avoid this issue.
	    # Check if _WIN64 is already recognized, and if so we don't
	    # need to modify CC.
	    echo "$as_me:$LINENO: checking whether _WIN64 is declared" >&5
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
			 -I\"${MSSDK}/Include/crt/sys\""
fi

	    RC="\"${MSSDK}/bin/rc.exe\""
	    CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
	    # Do not use -O2 for Win64 - this has proved buggy in code gen.
	    CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}"
	    lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
	    LINKBIN="\"${PATH64}/link.exe\""
	    # Avoid 'unresolved external symbol __security_cookie' errors.
	    # c.f. http://support.microsoft.com/?id=894573
	    LIBS="$LIBS bufferoverflowU.lib"
	else
	    RC="rc"
	    # -Od - no optimization
	    # -WX - warnings as errors
	    CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
	    # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy)
	    CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}"
	    lflags="-nologo"
	    LINKBIN="link"
	fi

	if test "$doWince" != "no" ; then
	    # Set defaults for common evc4/PPC2003 setup
	    # Currently Tcl requires 300+, possibly 420+ for sockets
	    CEVERSION=420; 		# could be 211 300 301 400 420 ...







|











|







4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
			 -I\"${MSSDK}/Include/crt/sys\""
fi

	    RC="\"${MSSDK}/bin/rc.exe\""
	    CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
	    # Do not use -O2 for Win64 - this has proved buggy in code gen.
	    CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}"
	    lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
	    LINKBIN="\"${PATH64}/link.exe\""
	    # Avoid 'unresolved external symbol __security_cookie' errors.
	    # c.f. http://support.microsoft.com/?id=894573
	    LIBS="$LIBS bufferoverflowU.lib"
	else
	    RC="rc"
	    # -Od - no optimization
	    # -WX - warnings as errors
	    CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
	    # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy)
	    CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}"
	    lflags="${lflags} -nologo"
	    LINKBIN="link"
	fi

	if test "$doWince" != "no" ; then
	    # Set defaults for common evc4/PPC2003 setup
	    # Currently Tcl requires 300+, possibly 420+ for sockets
	    CEVERSION=420; 		# could be 211 300 301 400 420 ...

Changes to win/makefile.vc.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#     swapping of different environments to be easier.
#
# 2)  To use the Platform SDK (not expressly needed), run setenv.bat after
#     vcvars32.bat according to the instructions for it.  This can also
#     turn on the 64-bit compiler, if your SDK has it.
#
# 3)  Targets are:
#	release  -- Builds the core, the shell. (default)
#	dlls     -- Just builds the windows extensions.
#	shell    -- Just builds the shell and the core.
#	core     -- Only builds the core [tkXX.(dll|lib)].
#	all      -- Builds everything.
#	test     -- Builds and runs the test suite.
#	tktest   -- Just builds the binaries for the test suite.
#	install  -- Installs the built binaries and libraries to $(INSTALLDIR)







|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#     swapping of different environments to be easier.
#
# 2)  To use the Platform SDK (not expressly needed), run setenv.bat after
#     vcvars32.bat according to the instructions for it.  This can also
#     turn on the 64-bit compiler, if your SDK has it.
#
# 3)  Targets are:
#	release  -- Builds the core, the shell and the dlls. (default)
#	dlls     -- Just builds the windows extensions.
#	shell    -- Just builds the shell and the core.
#	core     -- Only builds the core [tkXX.(dll|lib)].
#	all      -- Builds everything.
#	test     -- Builds and runs the test suite.
#	tktest   -- Just builds the binaries for the test suite.
#	install  -- Installs the built binaries and libraries to $(INSTALLDIR)
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#		Tk does need the source directory, though.  Tk comes very close
#		to not needing the sources, but does, in fact, require them.
#
#	INSTALLDIR=<path>
#		Sets where to install Tcl from the built binaries.
#		C:\Progra~1\Tcl is assumed when not specified.
#
#	OPTS=loimpact,msvcrt,nothreads,noxp,pdbs,profile,square,static,staticpkg,symbols,unchecked,ucrt,none
#		Sets special options for the core.  The default is for none.
#		Any combination of the above may be used (comma separated).
#		'none' will over-ride everything to nothing.
#
#		loimpact = Adds a flag for how NT treats the heap to keep memory
#			   in use, low.  This is said to impact alloc performance.
#		msvcrt   = Affects the static option only to switch it from







|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#		Tk does need the source directory, though.  Tk comes very close
#		to not needing the sources, but does, in fact, require them.
#
#	INSTALLDIR=<path>
#		Sets where to install Tcl from the built binaries.
#		C:\Progra~1\Tcl is assumed when not specified.
#
#	OPTS=loimpact,msvcrt,nothreads,noxp,pdbs,profile,square,static,staticpkg,symbols,unchecked,none
#		Sets special options for the core.  The default is for none.
#		Any combination of the above may be used (comma separated).
#		'none' will over-ride everything to nothing.
#
#		loimpact = Adds a flag for how NT treats the heap to keep memory
#			   in use, low.  This is said to impact alloc performance.
#		msvcrt   = Affects the static option only to switch it from
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#			   This is the default on threaded builds.
#		tclalloc = Use the old non-thread allocator
#		symbols  = Debug build. Links to the debug C runtime, disables
#			   optimizations and creates pdb symbols files.
#		unchecked = Allows a symbols build to not use the debug
#			   enabled runtime (msvcrt.dll not msvcrtd.dll
#			   or libcmt.lib not libcmtd.lib).
#		ucrt= Uses ucrt.lib and libvcruntime.lib, which
#			   ensures Tcl will run on machines with only the subset
#			   of the C runtime that is part of the operating system.
#			   If omitted, builds with VC 14.0 or later will require
#			   the full C runtime redistributable.
#
#	STATS=compdbg,memdbg,none
#		Sets optional memory and bytecode compiler debugging code added
#		to the core.  The default is for none.  Any combination of the
#		above may be used (comma separated).  'none' will over-ride
#		everything to nothing.
#







<
<
<
<
<







101
102
103
104
105
106
107





108
109
110
111
112
113
114
#			   This is the default on threaded builds.
#		tclalloc = Use the old non-thread allocator
#		symbols  = Debug build. Links to the debug C runtime, disables
#			   optimizations and creates pdb symbols files.
#		unchecked = Allows a symbols build to not use the debug
#			   enabled runtime (msvcrt.dll not msvcrtd.dll
#			   or libcmt.lib not libcmtd.lib).





#
#	STATS=compdbg,memdbg,none
#		Sets optional memory and bytecode compiler debugging code added
#		to the core.  The default is for none.  Any combination of the
#		above may be used (comma separated).  'none' will over-ride
#		everything to nothing.
#
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492

493
494
495
496
497
498
499
### This cranks the optimization level to maximize speed
###  We can't use -O2 because sometimes it causes problems.
cdebug	= $(OPTIMIZATIONS)
!else
cdebug	=
!endif
!if $(SYMBOLS)
cdebug = $(cdebug) -Zi
!endif
!else if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
### Warnings are too many, can't support warnings into errors.
cdebug	= -Zi -Od $(DEBUGFLAGS)
!else
cdebug	= -Zi -WX $(DEBUGFLAGS)
!endif

### Declarations common to all compiler options
cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\

!if $(UCRT)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
!else
crt = -MT
!endif
!elseif $(MSVCRT)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
!else
crt = -MD
!endif
!else
!if $(DEBUG) && !$(UNCHECKED)
crt = -MTd
!else
crt = -MT
!endif
!endif

BASE_CFLAGS	= $(cdebug) $(cflags) $(crt) $(TK_INCLUDES)
TK_CFLAGS	= $(BASE_CFLAGS) $(TK_DEFINES) -DUSE_TCL_STUBS
CON_CFLAGS	= $(cdebug) $(cflags) $(crt) -DCONSOLE
WISH_CFLAGS	= $(BASE_CFLAGS) $(TK_DEFINES)
STUB_CFLAGS     = $(cflags) $(cdebug) $(TK_DEFINES)


#---------------------------------------------------------------------
# Link flags
#---------------------------------------------------------------------

!if $(DEBUG)
ldebug	= -debug -debugtype:cv







|












<
<
<
<
<
<
|


















>







443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462






463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
### This cranks the optimization level to maximize speed
###  We can't use -O2 because sometimes it causes problems.
cdebug	= $(OPTIMIZATIONS)
!else
cdebug	=
!endif
!if $(SYMBOLS)
cdebug	= $(cdebug) -Zi
!endif
!else if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
### Warnings are too many, can't support warnings into errors.
cdebug	= -Zi -Od $(DEBUGFLAGS)
!else
cdebug	= -Zi -WX $(DEBUGFLAGS)
!endif

### Declarations common to all compiler options
cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\







!if $(MSVCRT)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
!else
crt = -MD
!endif
!else
!if $(DEBUG) && !$(UNCHECKED)
crt = -MTd
!else
crt = -MT
!endif
!endif

BASE_CFLAGS	= $(cdebug) $(cflags) $(crt) $(TK_INCLUDES)
TK_CFLAGS	= $(BASE_CFLAGS) $(TK_DEFINES) -DUSE_TCL_STUBS
CON_CFLAGS	= $(cdebug) $(cflags) $(crt) -DCONSOLE
WISH_CFLAGS	= $(BASE_CFLAGS) $(TK_DEFINES)
STUB_CFLAGS     = $(cflags) $(cdebug) $(TK_DEFINES)


#---------------------------------------------------------------------
# Link flags
#---------------------------------------------------------------------

!if $(DEBUG)
ldebug	= -debug -debugtype:cv
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
### Declarations common to all linker options
lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)

!if $(PROFILE)
lflags	= $(lflags) -profile
!endif

!if $(UCRT) && !($(DEBUG) && !$(UNCHECKED))
lflags	= $(lflags) -nodefaultlib:libucrt.lib
!endif

!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
### Align sections for PE size savings.
lflags	= $(lflags) -opt:nowin98
!else if !$(ALIGN98_HACK) && $(STATIC_BUILD)







|







497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
### Declarations common to all linker options
lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)

!if $(PROFILE)
lflags	= $(lflags) -profile
!endif

!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
lflags	= $(lflags) -nodefaultlib:libucrt.lib
!endif

!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
### Align sections for PE size savings.
lflags	= $(lflags) -opt:nowin98
!else if !$(ALIGN98_HACK) && $(STATIC_BUILD)
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
# Avoid 'unresolved external symbol __security_cookie' errors.
# c.f. http://support.microsoft.com/?id=894573
!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
baselibs   = $(baselibs) bufferoverflowU.lib
!endif
!endif

!if $(UCRT) && !($(DEBUG) && !$(UNCHECKED))
baselibs   = $(baselibs) ucrt.lib
!endif

guilibs	  = $(baselibs) gdi32.lib


#---------------------------------------------------------------------







<
|







527
528
529
530
531
532
533

534
535
536
537
538
539
540
541
# Avoid 'unresolved external symbol __security_cookie' errors.
# c.f. http://support.microsoft.com/?id=894573
!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
baselibs   = $(baselibs) bufferoverflowU.lib
!endif
!endif

!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
baselibs   = $(baselibs) ucrt.lib
!endif

guilibs	  = $(baselibs) gdi32.lib


#---------------------------------------------------------------------

Changes to win/rules.vc.

219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
PROFILE		= 0
PGO		= 0
MSVCRT		= 1
LOIMPACT	= 0
TCL_USE_STATIC_PACKAGES	= 0
USE_THREAD_ALLOC = 1
UNCHECKED	= 0
UCRT	= 0
!else
!if [nmakehlp -f $(OPTS) "static"]
!message *** Doing static
STATIC_BUILD	= 1
!else
STATIC_BUILD	= 0
!endif







<







219
220
221
222
223
224
225

226
227
228
229
230
231
232
PROFILE		= 0
PGO		= 0
MSVCRT		= 1
LOIMPACT	= 0
TCL_USE_STATIC_PACKAGES	= 0
USE_THREAD_ALLOC = 1
UNCHECKED	= 0

!else
!if [nmakehlp -f $(OPTS) "static"]
!message *** Doing static
STATIC_BUILD	= 1
!else
STATIC_BUILD	= 0
!endif
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
!if [nmakehlp -f $(OPTS) "unchecked"]
!message *** Doing unchecked
UNCHECKED = 1
!else
UNCHECKED = 0
!endif
!endif
!if [nmakehlp -f $(OPTS) "ucrt"] && $(VCVERSION) >= 1900
!message *** Doing UCRT
UCRT = 1
!else
UCRT = 0
!endif

#----------------------------------------------------------
# Figure-out how to name our intermediate and output directories.
# We wouldn't want different builds to use the same .obj files
# by accident.
#----------------------------------------------------------








<
<
<
<
<
<







298
299
300
301
302
303
304






305
306
307
308
309
310
311
!if [nmakehlp -f $(OPTS) "unchecked"]
!message *** Doing unchecked
UNCHECKED = 1
!else
UNCHECKED = 0
!endif
!endif







#----------------------------------------------------------
# Figure-out how to name our intermediate and output directories.
# We wouldn't want different builds to use the same .obj files
# by accident.
#----------------------------------------------------------

Changes to win/tcl.m4.

787
788
789
790
791
792
793







794
795
796
797
798
799
800
	else
	    # dynamic
            AC_MSG_RESULT([using shared flags])
	    runtime=-MD
	    # Add SHLIB_LD_LIBS to the Make rule, not here.
	    LIBRARIES="\${SHARED_LIBRARIES}"
	    EXESUFFIX="\${DBGX}.exe"







	fi
	MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\[$]@"
	# DLLSUFFIX is separate because it is the building block for
	# users of tclConfig.sh that may build shared or static.
	DLLSUFFIX="\${DBGX}.dll"
	LIBSUFFIX="\${DBGX}.lib"
	LIBFLAGSUFFIX="\${DBGX}"







>
>
>
>
>
>
>







787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
	else
	    # dynamic
            AC_MSG_RESULT([using shared flags])
	    runtime=-MD
	    # Add SHLIB_LD_LIBS to the Make rule, not here.
	    LIBRARIES="\${SHARED_LIBRARIES}"
	    EXESUFFIX="\${DBGX}.exe"
	    case "x`echo \${VisualStudioVersion}`" in
		x14*)
		    lflags="${lflags} -nodefaultlib:libucrt.lib"
		    ;;
		*)
		    ;;
	    esac
	fi
	MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -out:\[$]@"
	# DLLSUFFIX is separate because it is the building block for
	# users of tclConfig.sh that may build shared or static.
	DLLSUFFIX="\${DBGX}.dll"
	LIBSUFFIX="\${DBGX}.lib"
	LIBFLAGSUFFIX="\${DBGX}"
824
825
826
827
828
829
830









831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
		do64bit="no"
	    else
		AC_MSG_RESULT([   Using 64-bit $MACHINE mode])
	    fi
	fi

	LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib ws2_32.lib"









	if test "$do64bit" != "no" ; then
	    # The space-based-path will work for the Makefile, but will
	    # not work if AC_TRY_COMPILE is called.  TEA has the
	    # TEA_PATH_NOSPACE to avoid this issue.
	    # Check if _WIN64 is already recognized, and if so we don't
	    # need to modify CC.
	    AC_CHECK_DECL([_WIN64], [],
			  [CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \
			 -I\"${MSSDK}/Include/crt\" \
			 -I\"${MSSDK}/Include/crt/sys\""])
	    RC="\"${MSSDK}/bin/rc.exe\""
	    CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
	    # Do not use -O2 for Win64 - this has proved buggy in code gen.
	    CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}"
	    lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
	    LINKBIN="\"${PATH64}/link.exe\""
	    # Avoid 'unresolved external symbol __security_cookie' errors.
	    # c.f. http://support.microsoft.com/?id=894573
	    LIBS="$LIBS bufferoverflowU.lib"
	else
	    RC="rc"
	    # -Od - no optimization
	    # -WX - warnings as errors
	    CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
	    # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy)
	    CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}"
	    lflags="-nologo"
	    LINKBIN="link"
	fi

	if test "$doWince" != "no" ; then
	    # Set defaults for common evc4/PPC2003 setup
	    # Currently Tcl requires 300+, possibly 420+ for sockets
	    CEVERSION=420; 		# could be 211 300 301 400 420 ...







>
>
>
>
>
>
>
>
>














|











|







831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
		do64bit="no"
	    else
		AC_MSG_RESULT([   Using 64-bit $MACHINE mode])
	    fi
	fi

	LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib ws2_32.lib"

	case "x`echo \${VisualStudioVersion}`" in
		x14*)
		    LIBS="$LIBS ucrt.lib"
		    ;;
		*)
		    ;;
	esac

	if test "$do64bit" != "no" ; then
	    # The space-based-path will work for the Makefile, but will
	    # not work if AC_TRY_COMPILE is called.  TEA has the
	    # TEA_PATH_NOSPACE to avoid this issue.
	    # Check if _WIN64 is already recognized, and if so we don't
	    # need to modify CC.
	    AC_CHECK_DECL([_WIN64], [],
			  [CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \
			 -I\"${MSSDK}/Include/crt\" \
			 -I\"${MSSDK}/Include/crt/sys\""])
	    RC="\"${MSSDK}/bin/rc.exe\""
	    CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
	    # Do not use -O2 for Win64 - this has proved buggy in code gen.
	    CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}"
	    lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
	    LINKBIN="\"${PATH64}/link.exe\""
	    # Avoid 'unresolved external symbol __security_cookie' errors.
	    # c.f. http://support.microsoft.com/?id=894573
	    LIBS="$LIBS bufferoverflowU.lib"
	else
	    RC="rc"
	    # -Od - no optimization
	    # -WX - warnings as errors
	    CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
	    # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy)
	    CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}"
	    lflags="${lflags} -nologo"
	    LINKBIN="link"
	fi

	if test "$doWince" != "no" ; then
	    # Set defaults for common evc4/PPC2003 setup
	    # Currently Tcl requires 300+, possibly 420+ for sockets
	    CEVERSION=420; 		# could be 211 300 301 400 420 ...

Changes to xlib/X11/Xlib.h.

540
541
542
543
544
545
546



547

548
549
550
551
552
553
554
} Display;

#if NeedFunctionPrototypes	/* prototypes require event type definitions */
#undef _XEVENT_
#endif
#ifndef _XEVENT_




#define XMaxTransChars 4


/*
 * Definitions of specific events.
 */
typedef struct {
	int type;		/* of event */
	unsigned long serial;	/* # of last request processed by server */







>
>
>

>







540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
} Display;

#if NeedFunctionPrototypes	/* prototypes require event type definitions */
#undef _XEVENT_
#endif
#ifndef _XEVENT_

#ifdef PLATFORM_SDL
#define XMaxTransChars 12
#else
#define XMaxTransChars 4
#endif

/*
 * Definitions of specific events.
 */
typedef struct {
	int type;		/* of event */
	unsigned long serial;	/* # of last request processed by server */