summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/Makefile.in143
-rw-r--r--win/README2
-rwxr-xr-xwin/configure8523
-rw-r--r--win/configure.ac (renamed from win/configure.in)138
-rw-r--r--win/makefile.vc147
-rw-r--r--win/mkd.bat12
-rw-r--r--win/rc/buttons.bmpbin846 -> 0 bytes
-rw-r--r--win/rc/lamp.bmpbin2102 -> 0 bytes
-rw-r--r--win/rc/tk.rc8
-rw-r--r--win/rc/tk_base.rc6
-rw-r--r--win/rc/wish.rc8
-rw-r--r--win/rmd.bat20
-rw-r--r--win/rules.vc44
-rw-r--r--win/stubs.c451
-rw-r--r--win/tcl.m4347
-rw-r--r--win/tkConfig.sh.in5
-rw-r--r--win/tkWin.h12
-rw-r--r--win/tkWin32Dll.c3
-rw-r--r--win/tkWin3d.c4
-rw-r--r--win/tkWinButton.c495
-rw-r--r--win/tkWinClipboard.c52
-rw-r--r--win/tkWinColor.c13
-rw-r--r--win/tkWinConfig.c6
-rw-r--r--win/tkWinCursor.c21
-rw-r--r--win/tkWinDefault.h74
-rw-r--r--win/tkWinDialog.c872
-rw-r--r--win/tkWinDraw.c110
-rw-r--r--win/tkWinEmbed.c76
-rw-r--r--win/tkWinFont.c79
-rw-r--r--win/tkWinGDI.c3886
-rw-r--r--win/tkWinIco.c227
-rw-r--r--win/tkWinIco.h101
-rw-r--r--win/tkWinImage.c31
-rw-r--r--win/tkWinInit.c18
-rw-r--r--win/tkWinInt.h37
-rw-r--r--win/tkWinKey.c38
-rw-r--r--win/tkWinMenu.c189
-rw-r--r--win/tkWinPixmap.c2
-rw-r--r--win/tkWinPointer.c52
-rw-r--r--win/tkWinPort.h3
-rw-r--r--win/tkWinRegion.c9
-rw-r--r--win/tkWinScrlbr.c20
-rw-r--r--win/tkWinSend.c97
-rw-r--r--win/tkWinSendCom.c10
-rw-r--r--win/tkWinSendCom.h8
-rw-r--r--win/tkWinSysTray.c1177
-rw-r--r--win/tkWinTest.c104
-rw-r--r--win/tkWinWindow.c36
-rw-r--r--win/tkWinWm.c882
-rw-r--r--win/tkWinX.c358
-rw-r--r--win/tktest.exe.manifest.in53
-rw-r--r--win/ttkWinMonitor.c21
-rw-r--r--win/ttkWinTheme.c97
-rw-r--r--win/ttkWinXPTheme.c138
-rw-r--r--win/winMain.c12
-rw-r--r--win/wish.exe.manifest.in6
-rwxr-xr-xwin/x86_64-w64-mingw32-nmakehlp.exebin25600 -> 25088 bytes
57 files changed, 12663 insertions, 6620 deletions
diff --git a/win/Makefile.in b/win/Makefile.in
index 2b7c2f1..2d3c3ea 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -71,11 +71,8 @@ MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3
# Directory in which to install manual entries for the built-in Tk commands:
MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann
-# Libraries built with optimization switches have this additional extension
-TK_DBGX = @TK_DBGX@
-
# Directory in which to install the pkgIndex.tcl file for loadable Tk
-PKG_INSTALL_DIR = $(LIB_INSTALL_DIR)/tk$(VERSION)$(TK_DBGX)
+PKG_INSTALL_DIR = $(LIB_INSTALL_DIR)/tk$(VERSION)
# Package index file for loadable Tk
PKG_INDEX = $(PKG_INSTALL_DIR)/pkgIndex.tcl
@@ -129,14 +126,21 @@ TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)')
DLLSUFFIX = @DLLSUFFIX@
LIBSUFFIX = @LIBSUFFIX@
EXESUFFIX = @EXESUFFIX@
+TCLVER = @TCL_MAJOR_VERSION@@TCL_MINOR_VERSION@
VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@
DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@
+TK_ZIP_FILE = @TK_ZIP_FILE@
+TK_VFS_PATH = libtk.vfs/tk_library
+TK_VFS_ROOT = libtk.vfs
+
TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
TK_LIB_FILE = @TK_LIB_FILE@
TK_DLL_FILE = @TK_DLL_FILE@
+TK_DLL_FILE_TCL8 = @TK_DLL_FILE_TCL8@
+TK_DLL_FILE_TCL9 = @TK_DLL_FILE_TCL9@
TEST_DLL_FILE = tktest$(VER)${DLLSUFFIX}
-TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${DLLSUFFIX}.a
+TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${DLLSUFFIX}${LIBSUFFIX}
SHARED_LIBRARIES = $(TK_DLL_FILE) $(TK_STUB_LIB_FILE)
STATIC_LIBRARIES = $(TK_LIB_FILE)
@@ -198,14 +202,13 @@ MKDIR = mkdir -p
SHELL = @SHELL@
RM = rm -f
COPY = cp
-
-BUILD_TCLSH = @BUILD_TCLSH@
+LN = ln
# Tk does not used deprecated Tcl constructs so it should
# compile fine with -DTCL_NO_DEPRECATED. To remove its own
# set of deprecated code uncomment the second line.
NO_DEPRECATED_FLAGS =
-#NO_DEPRECATED_FLAGS = -DTK_NO_DEPRECATED
+#NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED
# TCL_EXE is the name of a tclsh executable that is available *BEFORE*
# running make for the first time. Certain build targets (make genstubs)
@@ -213,12 +216,52 @@ NO_DEPRECATED_FLAGS =
# required just to do a normal build although it can be required to run
# make dist.
TCL_EXE = @TCLSH_PROG@
+WINE = @WINE@
+
+###
+# Tip 430 - ZipFS Modifications
+###
+
+TK_ZIP_FILE = @TK_ZIP_FILE@
+TK_VFS_PATH = libtk.vfs/tk_library
+TK_VFS_ROOT = libtk.vfs
+
+HOST_CC = @CC_FOR_BUILD@
+HOST_EXEEXT = @EXEEXT_FOR_BUILD@
+HOST_OBJEXT = @OBJEXT_FOR_BUILD@
+ZIPFS_BUILD = @ZIPFS_BUILD@
+NATIVE_ZIP = @ZIP_PROG@
+ZIP_PROG_OPTIONS = @ZIP_PROG_OPTIONS@
+ZIP_PROG_VFSSEARCH = @ZIP_PROG_VFSSEARCH@
+SHARED_BUILD = @SHARED_BUILD@
+INSTALL_MSGS = @INSTALL_MSGS@
+INSTALL_LIBRARIES = @INSTALL_LIBRARIES@
+
+# Minizip
+MINIZIP_OBJS = \
+ adler32.$(HOST_OBJEXT) \
+ compress.$(HOST_OBJEXT) \
+ crc32.$(HOST_OBJEXT) \
+ deflate.$(HOST_OBJEXT) \
+ infback.$(HOST_OBJEXT) \
+ inffast.$(HOST_OBJEXT) \
+ inflate.$(HOST_OBJEXT) \
+ inftrees.$(HOST_OBJEXT) \
+ ioapi.$(HOST_OBJEXT) \
+ iowin32.$(HOST_OBJEXT) \
+ trees.$(HOST_OBJEXT) \
+ uncompr.$(HOST_OBJEXT) \
+ zip.$(HOST_OBJEXT) \
+ zutil.$(HOST_OBJEXT) \
+ minizip.$(HOST_OBJEXT)
+
+ZIP_INSTALL_OBJS = @ZIP_INSTALL_OBJS@
CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
-I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \
-I"${XLIB_DIR_NATIVE}" -I"${BITMAP_DIR_NATIVE}" \
-I"${TCL_GENERIC_NATIVE}" -I"${TCL_PLATFORM_NATIVE}" \
-${AC_FLAGS} $(NO_DEPRECATED_FLAGS) -DUSE_TCL_STUBS
+${AC_FLAGS} $(NO_DEPRECATED_FLAGS) -DTCL_UTF_MAX=3 -DUSE_TCL_STUBS
CC_OBJNAME = @CC_OBJNAME@
CC_EXENAME = @CC_EXENAME@
@@ -264,6 +307,8 @@ TK_OBJS = \
tkWinDraw.$(OBJEXT) \
tkWinEmbed.$(OBJEXT) \
tkWinFont.$(OBJEXT) \
+ tkWinGDI.$(OBJEXT) \
+ tkWinIco.$(OBJEXT) \
tkWinImage.$(OBJEXT) \
tkWinInit.$(OBJEXT) \
tkWinKey.$(OBJEXT) \
@@ -274,6 +319,7 @@ TK_OBJS = \
tkWinScrlbr.$(OBJEXT) \
tkWinSend.$(OBJEXT) \
tkWinSendCom.$(OBJEXT) \
+ tkWinSysTray.$(OBJEXT) \
tkWinWindow.$(OBJEXT) \
tkWinWm.$(OBJEXT) \
tkWinX.$(OBJEXT) \
@@ -312,11 +358,14 @@ TK_OBJS = \
tkGet.$(OBJEXT) \
tkGrab.$(OBJEXT) \
tkGrid.$(OBJEXT) \
+ tkIcu.$(OBJEXT) \
tkImage.$(OBJEXT) \
tkImgBmap.$(OBJEXT) \
+ tkImgListFormat.$(OBJEXT) \
tkImgGIF.$(OBJEXT) \
tkImgPNG.$(OBJEXT) \
tkImgPPM.$(OBJEXT) \
+ tkImgSVGnano.$(OBJEXT) \
tkImgPhoto.$(OBJEXT) \
tkImgPhInstance.$(OBJEXT) \
tkImgUtil.$(OBJEXT) \
@@ -333,6 +382,7 @@ TK_OBJS = \
tkOldConfig.$(OBJEXT) \
tkOption.$(OBJEXT) \
tkPack.$(OBJEXT) \
+ tkPkgConfig.$(OBJEXT) \
tkPlace.$(OBJEXT) \
tkPointer.$(OBJEXT) \
tkRectOval.$(OBJEXT) \
@@ -436,23 +486,23 @@ $(MAN2TCL): $(TCL_SRC_DIR)/tools/man2tcl.c
test: test-classic test-ttk
test-classic: binaries $(TKTEST) $(TEST_DLL_FILE) $(CAT32)
- $(SHELL_ENV) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" \
- $(TESTFLAGS) | ./$(CAT32)
+ $(SHELL_ENV) $(WINE) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" \
+ $(TESTFLAGS) | $(WINE) ./$(CAT32)
test-ttk: binaries $(TKTEST) $(TEST_DLL_FILE) $(CAT32)
- $(SHELL_ENV) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/ttk/all.tcl" \
- $(TESTFLAGS) | ./$(CAT32)
+ $(SHELL_ENV) $(WINE) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/ttk/all.tcl" \
+ $(TESTFLAGS) | $(WINE) ./$(CAT32)
runtest: binaries $(TKTEST) $(TEST_DLL_FILE)
- $(SHELL_ENV) ./$(TKTEST) $(TESTFLAGS) $(SCRIPT)
+ $(SHELL_ENV) $(WINE) ./$(TKTEST) $(TESTFLAGS) $(SCRIPT)
# This target can be used to run wish from the build directory
# via `make shell` or `make shell SCRIPT=foo.tcl`
shell: binaries
- $(SHELL_ENV) ./$(WISH) $(SCRIPT)
+ $(SHELL_ENV) $(WINE) ./$(WISH) $(SCRIPT)
demo: $(WISH)
- $(SHELL_ENV) ./$(WISH) $(ROOT_DIR)/library/demos/widget
+ $(SHELL_ENV) $(WINE) ./$(WISH) $(ROOT_DIR)/library/demos/widget
# This target can be used to run wish inside either gdb or insight
gdb: binaries
@@ -484,13 +534,22 @@ install-binaries: binaries
@echo "Creating package index $(PKG_INDEX)";
@$(RM) $(PKG_INDEX);
@(\
- echo "if {![package vsatisfies [package provide Tcl] 8.6.0]} return";\
+ echo "if {![package vsatisfies [package provide Tcl] 8.7-]} return";\
echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\
echo " || ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\
- echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]]]";\
+ echo " if {[package vsatisfies [package provide Tcl] 9.0]} {";\
+ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtcl9tk$(VERSION).dll]]]";\
+ echo " } else {";\
+ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]]]";\
+ echo " }";\
echo "} else {";\
- echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE)]]]";\
+ echo " if {[package vsatisfies [package provide Tcl] 9.0]} {";\
+ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE_TCL9)]]]";\
+ echo " } else {";\
+ echo " package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE_TCL8)]]]";\
+ echo " }";\
echo "}";\
+ echo "package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list package require -exact tk $(VERSION)$(PATCH_LEVEL)]";\
) > $(PKG_INDEX);
@for i in tkConfig.sh $(TK_LIB_FILE) $(TK_STUB_LIB_FILE); \
do \
@@ -608,11 +667,16 @@ install-private-headers: libraries
$(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \
done;
-$(WISH): $(WISH_OBJS) @LIBRARIES@ $(TK_STUB_LIB_FILE) wish.$(RES)
+$(WISH): $(WISH_OBJS) @LIBRARIES@ $(TK_STUB_LIB_FILE) wish.$(RES) ${TK_ZIP_FILE}
$(CC) $(CFLAGS) $(WISH_OBJS) $(TK_LIB_FILE) \
$(TK_STUB_LIB_FILE) $(TCL_LIB_FILE) $(LIBS) \
wish.$(RES) $(CC_EXENAME) $(LDFLAGS_WINDOW)
@VC_MANIFEST_EMBED_EXE@
+ @if test "${ZIPFS_BUILD}" = "2" ; then \
+ cat ${TK_ZIP_FILE} >> ${WISH}; \
+ ${NATIVE_ZIP} -A ${WISH} \
+ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \
+ fi
tktest: $(TKTEST)
@@ -643,6 +707,30 @@ cat32.${OBJEXT}: $(TCL_SRC_DIR)/win/cat.c
$(CAT32): cat32.${OBJEXT}
$(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE)
+tkzipfile: ${TK_ZIP_FILE}
+
+${TK_ZIP_FILE}: ${ZIP_INSTALL_OBJS}
+ @$(RMDIR) ${TK_VFS_ROOT}
+ @mkdir -p ${TK_VFS_PATH}
+ @echo "creating ${TK_VFS_PATH} (prepare compression)"
+ @( \
+ $(COPY) -a $(TOP_DIR)/library/* ${TK_VFS_PATH}; \
+ )
+ @$(RMDIR) $(TK_VFS_PATH)/demos
+ -@if test "${ZIPFS_BUILD}" = "2" ; then \
+ cp ${TCL_BIN_DIR}/tclsh${TCLVER}s.exe ${TK_VFS_ROOT}/../${TK_ZIP_FILE} || cp ${TCL_BIN_DIR}/../bin/tclsh${TCLVER}s.exe ${TK_VFS_ROOT}/../${TK_ZIP_FILE}; \
+ (zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \
+ (echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \
+ cd ${TK_VFS_ROOT} && $$zip -J ../${TK_ZIP_FILE}) \
+ fi
+ (zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \
+ (echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \
+ cd ${TK_VFS_ROOT} && \
+ $$zip ${ZIP_PROG_OPTIONS} ../${TK_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} >/dev/null && \
+ echo "${TK_ZIP_FILE} successful created with $$zip" && \
+ cd ..)
+
+
# The following targets are configured by autoconf to generate either
# a shared library or static library
@@ -651,10 +739,15 @@ ${TK_STUB_LIB_FILE}: ${STUB_OBJS}
@MAKE_STUB_LIB@ ${STUB_OBJS}
@POST_MAKE_LIB@
-${TK_DLL_FILE}: ${TK_OBJS} $(TK_RES)
+${TK_DLL_FILE}: ${TK_OBJS} $(TK_RES) ${TK_ZIP_FILE}
@$(RM) ${TK_DLL_FILE}
@MAKE_DLL@ ${TK_OBJS} $(TK_RES) $(SHLIB_LD_LIBS)
@VC_MANIFEST_EMBED_DLL@
+ @if test "${ZIPFS_BUILD}" = "1" ; then \
+ cat ${TK_ZIP_FILE} >> ${TK_DLL_FILE}; \
+ ${NATIVE_ZIP} -A ${TK_DLL_FILE} \
+ || echo 'ignore zip-error by adjust sfx process (not executable?)'; \
+ fi
${TK_LIB_FILE}: ${TK_OBJS}
@$(RM) ${TK_LIB_FILE}
@@ -696,6 +789,12 @@ tkUnixMenubu.$(OBJEXT): ${UNIX_DIR}/tkUnixMenubu.c
tkUnixScale.$(OBJEXT): ${UNIX_DIR}/tkUnixScale.c
$(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME)
+tkPkgConfig.$(OBJEXT): $(GENERIC_DIR)/tkPkgConfig.c
+ $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk \
+ -DCFG_RUNTIME_DLLFILE="\"$(TK_DLL_FILE)\"" \
+ @DEPARG@ $(CC_OBJNAME)
+
+
tkWindow.$(OBJEXT): ${GENERIC_DIR}/tkWindow.c configure Makefile tkUuid.h
$(CC) -c $(CC_SWITCHES) -I. -DBUILD_tk @DEPARG@ $(CC_OBJNAME)
@@ -752,7 +851,7 @@ genstubs:
"$(GENERIC_DIR_NATIVE)" \
"$(GENERIC_DIR_NATIVE)/tk.decls" \
"$(GENERIC_DIR_NATIVE)/tkInt.decls"
- $(TCL_EXE) "$(TTK_DIR)/ttkGenStubs.tcl" \
+ $(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \
"$(TTK_DIR)" \
"$(TTK_DIR)/ttk.decls"
diff --git a/win/README b/win/README
index 950854e..e371a2c 100644
--- a/win/README
+++ b/win/README
@@ -1,4 +1,4 @@
-Tk 8.6 for Windows
+Tk 8.7 for Windows
Originally by Scott Stanton while at Sun Microsystems Labs
diff --git a/win/configure b/win/configure
index 607e3ed..9a92e86 100755
--- a/win/configure
+++ b/win/configure
@@ -1,81 +1,469 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for tk 8.6.
+# Generated by GNU Autoconf 2.72 for tk 8.7.
+#
+#
+# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation,
+# Inc.
+#
#
-# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
emulate sh
NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
+ setopt NO_GLOB_SUBST
+else case e in #(
+ e) case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac ;;
+esac
fi
-DUALCASE=1; export DUALCASE # for MKS sh
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+# Reset variables that may have inherited troublesome values from
+# the environment.
+
+# IFS needs to be set, to space, tab, and newline, in precisely that order.
+# (If _AS_PATH_WALK were called with IFS unset, it would have the
+# side effect of setting IFS to empty, thus disabling word splitting.)
+# Quoting is to prevent editors from complaining about space-tab.
+as_nl='
+'
+export as_nl
+IFS=" "" $as_nl"
+
PS1='$ '
PS2='> '
PS4='+ '
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
+# Ensure predictable behavior from utilities with locale-dependent output.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# We cannot yet rely on "unset" to work, but we need these variables
+# to be unset--not just set to an empty or harmless value--now, to
+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct
+# also avoids known problems related to "unset" and subshell syntax
+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
+do eval test \${$as_var+y} \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+
+# Ensure that fds 0, 1, and 2 are open.
+if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
+if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
+if (exec 3>&2) ; then :; else exec 2>/dev/null; fi
+
+# The user is always right.
+if ${PATH_SEPARATOR+false} :; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ test -r "$as_dir$0" && as_myself=$as_dir$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as 'sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed 'exec'.
+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else case e in #(
+ e) case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" )
+then :
+
+else case e in #(
+ e) exitcode=1; echo positional parameters were not saved. ;;
+esac
+fi
+test x\$exitcode = x0 || exit 1
+blah=\$(echo \$(echo blah))
+test x\"\$blah\" = xblah || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null
+then :
+ as_have_required=yes
+else case e in #(
+ e) as_have_required=no ;;
+esac
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null
+then :
+
+else case e in #(
+ e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null
+then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null
+then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
done
+IFS=$as_save_IFS
+if $as_found
+then :
+
+else case e in #(
+ e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null
+then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi ;;
+esac
+fi
+
+
+ if test "x$CONFIG_SHELL" != x
+then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed 'exec'.
+printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno
+then :
+ printf "%s\n" "$0: This script requires a shell more modern than all"
+ printf "%s\n" "$0: the shells that I found on your system."
+ if test ${ZSH_VERSION+y} ; then
+ printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi ;;
+esac
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
+then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else case e in #(
+ e) as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ } ;;
+esac
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
+then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else case e in #(
+ e) as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ } ;;
+esac
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ printf "%s\n" "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
-# Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
-
-# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@@ -83,238 +471,349 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
sed '
+ t clear
+ :clear
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
+ s/-\n.*//
' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
+ chmod +x "$as_me.lineno" ||
+ { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+# Determine whether it's possible to make 'echo' print without a newline.
+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
+# for compatibility with existing Makefiles.
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
+# For backward compatibility with old third-party macros, we provide
+# the shell variables $as_echo and $as_echo_n. New code should use
+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
+as_echo='printf %s\n'
+as_echo_n='printf %s'
rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable.
+ # In both cases, we have to default to 'cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-as_executable_p="test -f"
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated
# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed '$as_sed_sh'" # deprecated
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-exec 6>&1
-
#
# Initializations.
#
ac_default_prefix=/usr/local
+ac_clean_files=
ac_config_libobj_dir=.
+LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete. It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
# Identity of this package.
PACKAGE_NAME='tk'
PACKAGE_TARNAME='tk'
-PACKAGE_VERSION='8.6'
-PACKAGE_STRING='tk 8.6'
+PACKAGE_VERSION='8.7'
+PACKAGE_STRING='tk 8.7'
PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
ac_unique_file="../generic/tk.h"
# Factoring default headers for most tests.
ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
+#include <stddef.h>
+#ifdef HAVE_STDIO_H
+# include <stdio.h>
#endif
-#if STDC_HEADERS
+#ifdef HAVE_STDLIB_H
# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-# endif
+#ifdef HAVE_STRING_H
# include <string.h>
#endif
-#if HAVE_STRINGS_H
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
#endif
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AR ac_ct_AR RANLIB ac_ct_RANLIB RC ac_ct_RC SET_MAKE TCL_THREADS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_DEFS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING CFLAGS_NOLTO MAN2TCLFLAGS CFLAGS_DEFAULT LDFLAGS_DEFAULT VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE BUILD_TCLSH TCLSH_PROG TK_WIN_VERSION MACHINE TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_DBGX TK_LIB_FILE TK_DLL_FILE TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_BUILD_STUB_LIB_SPEC TK_SRC_DIR TK_BIN_DIR TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL TCL_DBGX CFG_TK_SHARED_LIB_SUFFIX CFG_TK_UNSHARED_LIB_SUFFIX EXTRA_CFLAGS DEPARG CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW TK_RES STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX TK_SHARED_BUILD LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB MAKE_STUB_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TK_LIB_FLAG TK_LIB_SPEC TK_BUILD_LIB_SPEC TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_BUILD_STUB_LIB_PATH TK_CC_SEARCH_FLAGS TK_LD_SEARCH_FLAGS RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES RES LIBOBJS LTLIBOBJS'
+ac_header_c_list=
+ac_subst_vars='LTLIBOBJS
+LIBOBJS
+RES
+RC_DEFINES
+RC_DEFINE
+RC_INCLUDE
+RC_TYPE
+RC_OUT
+TK_LD_SEARCH_FLAGS
+TK_CC_SEARCH_FLAGS
+TK_BUILD_STUB_LIB_PATH
+TK_STUB_LIB_PATH
+TK_STUB_LIB_SPEC
+TK_BUILD_LIB_SPEC
+TK_LIB_SPEC
+TK_LIB_FLAG
+MAKE_EXE
+MAKE_DLL
+POST_MAKE_LIB
+MAKE_STUB_LIB
+MAKE_LIB
+LIBRARIES
+EXESUFFIX
+LIBSUFFIX
+LIBPREFIX
+DLLSUFFIX
+LIBS_GUI
+TK_SHARED_BUILD
+SHLIB_SUFFIX
+SHLIB_CFLAGS
+SHLIB_LD_LIBS
+SHLIB_LD
+STLIB_LD
+TK_RES
+LDFLAGS_WINDOW
+LDFLAGS_CONSOLE
+LDFLAGS_OPTIMIZE
+LDFLAGS_DEBUG
+CC_EXENAME
+CC_OBJNAME
+DEPARG
+EXTRA_CFLAGS
+CFG_TK_UNSHARED_LIB_SUFFIX
+CFG_TK_SHARED_LIB_SUFFIX
+TCL_PATCH_LEVEL
+TCL_MINOR_VERSION
+TCL_MAJOR_VERSION
+TK_BIN_DIR
+TK_SRC_DIR
+TK_BUILD_STUB_LIB_SPEC
+TK_STUB_LIB_FLAG
+TK_STUB_LIB_FILE
+TK_DLL_FILE_TCL9
+TK_DLL_FILE_TCL8
+TK_DLL_FILE
+TK_LIB_FILE
+TK_PATCH_LEVEL
+TK_MINOR_VERSION
+TK_MAJOR_VERSION
+TK_VERSION
+MACHINE
+TK_WIN_VERSION
+INSTALL_MSGS
+INSTALL_LIBRARIES
+TK_ZIP_FILE
+ZIPFS_BUILD
+ZIP_INSTALL_OBJS
+ZIP_PROG_VFSSEARCH
+ZIP_PROG_OPTIONS
+ZIP_PROG
+EXEEXT_FOR_BUILD
+CC_FOR_BUILD
+TCLSH_PROG
+BUILD_TCLSH
+VC_MANIFEST_EMBED_EXE
+VC_MANIFEST_EMBED_DLL
+CPP
+LDFLAGS_DEFAULT
+CFLAGS_DEFAULT
+MAN2TCLFLAGS
+CFLAGS_NOLTO
+CFLAGS_WARNING
+CFLAGS_OPTIMIZE
+CFLAGS_DEBUG
+DL_LIBS
+WINE
+CYGPATH
+TCL_DEFS
+TCL_STUB_LIB_SPEC
+TCL_STUB_LIB_FLAG
+TCL_STUB_LIB_FILE
+TCL_LIB_SPEC
+TCL_LIB_FLAG
+TCL_LIB_FILE
+TCL_SRC_DIR
+TCL_BIN_DIR
+TCL_VERSION
+SHARED_BUILD
+SET_MAKE
+RC
+RANLIB
+AR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+runstatedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL
+OBJEXT_FOR_BUILD'
ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_shared
+with_tcl
+enable_64bit
+enable_symbols
+enable_embedded_manifest
+enable_zipfs
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
@@ -337,34 +836,48 @@ x_libraries=NONE
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
ac_prev=
+ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
+ eval $ac_prev=\$ac_option
ac_prev=
continue
fi
- ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
@@ -386,33 +899,59 @@ do
--config-cache | -C)
cache_file=config.cache ;;
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ -datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
-disable-* | --disable-*)
- ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- eval "enable_$ac_feature=no" ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: '$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
-enable-* | --enable-*)
- ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid feature name: $ac_feature" >&2
- { (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: '$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
esac
- eval "enable_$ac_feature='$ac_optarg'" ;;
+ eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -439,6 +978,12 @@ do
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
@@ -463,13 +1008,16 @@ do
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
-localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
+ | --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
@@ -534,10 +1082,29 @@ do
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -584,26 +1151,36 @@ do
ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: '$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
esac
- eval "with_$ac_package='$ac_optarg'" ;;
+ eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
- ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid package name: $ac_package" >&2
- { (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/-/_/g'`
- eval "with_$ac_package=no" ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: '$ac_useropt'"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
@@ -623,27 +1200,26 @@ do
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
- -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
+ -*) as_fn_error $? "unrecognized option: '$ac_option'
+Try '$0 --help' for more information"
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
- eval "$ac_envvar='$ac_optarg'"
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: '$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
- echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
@@ -651,34 +1227,39 @@ done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "missing argument to $ac_option"
fi
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
-done
+fi
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir runstatedir
do
- eval ac_val=$`echo $ac_var`
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
case $ac_val in
- [\\/$]* | ?:[\\/]* ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
-# There might be people who depend on the old broken behavior: `$host'
+# There might be people who depend on the old broken behavior: '$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
@@ -689,8 +1270,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -702,74 +1281,72 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_confdir=`(dirname "$0") 2>/dev/null ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
+ if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
- { (exit 1); exit 1; }; }
- else
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
- fi
-fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
- { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
- { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
#
# Report the --help message.
@@ -778,7 +1355,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures tk 8.6 to adapt to many kinds of systems.
+'configure' configures tk 8.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -792,41 +1369,46 @@ Configuration:
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
+ -q, --quiet, --silent do not print 'checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
- -C, --config-cache alias for \`--cache-file=config.cache'
+ -C, --config-cache alias for '--cache-file=config.cache'
-n, --no-create do not create output files
- --srcdir=DIR find the sources in DIR [configure dir or \`..']
+ --srcdir=DIR find the sources in DIR [configure dir or '..']
-_ACEOF
-
- cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
+ [$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
+ [PREFIX]
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
+By default, 'make install' will install all the files in
+'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than '$ac_default_prefix' using '--prefix',
+for instance '--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/tk]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
@@ -835,155 +1417,321 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of tk 8.6:";;
+ short | recursive ) echo "Configuration of tk 8.7:";;
esac
cat <<\_ACEOF
Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-threads build with threads (default: on)
--enable-shared build and link with shared libraries (default: on)
--enable-64bit enable 64bit support (where applicable)
- --enable-wince enable Win/CE support (where applicable)
--enable-symbols build with debugging symbols (default: off)
--enable-embedded-manifest
embed manifest if possible (default: yes)
+ --enable-zipfs build with Zipfs support (default: on)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-tcl directory containing tcl configuration
(tclConfig.sh)
- --with-celib=DIR use Windows/CE support library from DIR
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
- CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
- headers in a nonstandard directory <include dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
CPP C preprocessor
-Use these variables to override the choices made by `configure' or to help
+Use these variables to override the choices made by 'configure' or to help
it to find libraries and programs with nonstandard names/locations.
+Report bugs to the package provider.
_ACEOF
+ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
ac_builddir=.
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
case $srcdir in
- .) # No --srcdir option. We are building in place.
+ .) # We are building in place.
ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
-
- cd $ac_dir
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- echo
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
- echo
- $SHELL $ac_srcdir/configure --help=recursive
- elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
- echo
- $ac_configure --help
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for configure.gnu first; this name is used for a wrapper for
+ # Metaconfig's "Configure" on case-insensitive file systems.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
else
- echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi
- cd $ac_popdir
+ printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
-test -n "$ac_init_help" && exit 0
+test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-tk configure 8.6
-generated by GNU Autoconf 2.59
+tk configure 8.7
+generated by GNU Autoconf 2.72
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 2023 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
- exit 0
+ exit
fi
-exec 5>config.log
-cat >&5 <<_ACEOF
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest.beam
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext
+then :
+ ac_retval=0
+else case e in #(
+ e) printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1 ;;
+esac
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ eval "$3=yes"
+else case e in #(
+ e) eval "$3=no" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+esac
+fi
+eval ac_res=\$$3
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+printf %s "checking for $2... " >&6; }
+if eval test \${$3+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main (void)
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main (void)
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+
+else case e in #(
+ e) eval "$3=yes" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+esac
+fi
+eval ac_res=\$$3
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+printf "%s\n" "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }
+then :
+ ac_retval=0
+else case e in #(
+ e) printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1 ;;
+esac
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+ac_configure_args_raw=
+for ac_arg
+do
+ case $ac_arg in
+ *\'*)
+ ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append ac_configure_args_raw " '$ac_arg'"
+done
+
+case $ac_configure_args_raw in
+ *$as_nl*)
+ ac_safe_unquote= ;;
+ *)
+ ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab.
+ ac_unsafe_a="$ac_unsafe_z#~"
+ ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g"
+ ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;;
+esac
+
+cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by tk $as_me 8.6, which was
-generated by GNU Autoconf 2.59. Invocation command line was
+It was created by tk $as_me 8.7, which was
+generated by GNU Autoconf 2.72. Invocation command line was
- $ $0 $@
+ $ $0$ac_configure_args_raw
_ACEOF
+exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
@@ -1002,7 +1750,7 @@ uname -v = `(uname -v) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
@@ -1013,9 +1761,14 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- echo "PATH: $as_dir"
-done
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ printf "%s\n" "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
} >&5
@@ -1037,7 +1790,6 @@ _ACEOF
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
-ac_sep=
ac_must_keep_next=false
for ac_pass in 1 2
do
@@ -1048,13 +1800,13 @@ do
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *\'*)
+ ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
@@ -1070,217 +1822,575 @@ do
-* ) ac_must_keep_next=true ;;
esac
fi
- ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- # Get rid of the leading space.
- ac_sep=" "
+ as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
+ # Sanitize IFS.
+ IFS=" "" $as_nl"
# Save into config.log some information that might help in debugging.
{
echo
- cat <<\_ASBOX
-## ---------------- ##
+ printf "%s\n" "## ---------------- ##
## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
-{
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
(set) 2>&1 |
- case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
- ;;
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
*)
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
- esac;
-}
+ esac |
+ sort
+)
echo
- cat <<\_ASBOX
-## ----------------- ##
+ printf "%s\n" "## ----------------- ##
## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ printf "%s\n" "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
-_ASBOX
+ printf "%s\n" "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ printf "%s\n" "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
+ printf "%s\n" "## ----------- ##
## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
echo
- sed "/^$/d" confdefs.h | sort
+ cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
- echo "$as_me: caught signal $ac_signal"
- echo "$as_me: exit $exit_status"
+ printf "%s\n" "$as_me: caught signal $ac_signal"
+ printf "%s\n" "$as_me: exit $exit_status"
} >&5
- rm -f core *.core &&
- rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
- ' 0
+' 0
for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
+rm -f -r conftest* confdefs.h
-# Predefined preprocessor variables.
+printf "%s\n" "/* confdefs.h */" > confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
+# Predefined preprocessor variables.
+printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
+printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h
+printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
+printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h
+printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
+printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h
# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
+# Prefer an explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+ ac_site_files="$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ ac_site_files="$prefix/share/config.site $prefix/etc/config.site"
+else
+ ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
+
+for ac_site_file in $ac_site_files
+do
+ case $ac_site_file in #(
+ */*) :
+ ;; #(
+ *) :
+ ac_site_file=./$ac_site_file ;;
+esac
+ if test -f "$ac_site_file" && test -r "$ac_site_file"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
+ . "$ac_site_file" \
+ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See 'config.log' for more details" "$LINENO" 5; }
fi
done
if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+printf "%s\n" "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
esac
fi
else
- { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+printf "%s\n" "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
+# Test code for whether the C compiler supports C89 (global declarations)
+ac_c_conftest_c89_globals='
+/* Does the compiler advertise C89 conformance?
+ Do not test the value of __STDC__, because some compilers set it to 0
+ while being otherwise adequately conformant. */
+#if !defined __STDC__
+# error "Compiler does not advertise C89 conformance"
+#endif
+
+#include <stddef.h>
+#include <stdarg.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */
+struct buf { int x; };
+struct buf * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (char **p, int i)
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* C89 style stringification. */
+#define noexpand_stringify(a) #a
+const char *stringified = noexpand_stringify(arbitrary+token=sequence);
+
+/* C89 style token pasting. Exercises some of the corner cases that
+ e.g. old MSVC gets wrong, but not very hard. */
+#define noexpand_concat(a,b) a##b
+#define expand_concat(a,b) noexpand_concat(a,b)
+extern int vA;
+extern int vbee;
+#define aye A
+#define bee B
+int *pvA = &expand_concat(v,aye);
+int *pvbee = &noexpand_concat(v,bee);
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not \xHH hex character constants.
+ These do not provoke an error unfortunately, instead are silently treated
+ as an "x". The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously \x00 != x always comes out true, for an
+ array size at least. It is necessary to write \x00 == 0 to get something
+ that is true only with -std. */
+int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) '\''x'\''
+int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int),
+ int, int);'
+
+# Test code for whether the C compiler supports C89 (body of main).
+ac_c_conftest_c89_main='
+ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]);
+'
+
+# Test code for whether the C compiler supports C99 (global declarations)
+ac_c_conftest_c99_globals='
+/* Does the compiler advertise C99 conformance? */
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
+# error "Compiler does not advertise C99 conformance"
+#endif
+
+// See if C++-style comments work.
+
+#include <stdbool.h>
+extern int puts (const char *);
+extern int printf (const char *, ...);
+extern int dprintf (int, const char *, ...);
+extern void *malloc (size_t);
+extern void free (void *);
+
+// Check varargs macros. These examples are taken from C99 6.10.3.5.
+// dprintf is used instead of fprintf to avoid needing to declare
+// FILE and stderr.
+#define debug(...) dprintf (2, __VA_ARGS__)
+#define showlist(...) puts (#__VA_ARGS__)
+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
+static void
+test_varargs_macros (void)
+{
+ int x = 1234;
+ int y = 5678;
+ debug ("Flag");
+ debug ("X = %d\n", x);
+ showlist (The first, second, and third items.);
+ report (x>y, "x is %d but y is %d", x, y);
+}
+
+// Check long long types.
+#define BIG64 18446744073709551615ull
+#define BIG32 4294967295ul
+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
+#if !BIG_OK
+ #error "your preprocessor is broken"
+#endif
+#if BIG_OK
+#else
+ #error "your preprocessor is broken"
+#endif
+static long long int bignum = -9223372036854775807LL;
+static unsigned long long int ubignum = BIG64;
+
+struct incomplete_array
+{
+ int datasize;
+ double data[];
+};
+
+struct named_init {
+ int number;
+ const wchar_t *name;
+ double average;
+};
+
+typedef const char *ccp;
+
+static inline int
+test_restrict (ccp restrict text)
+{
+ // Iterate through items via the restricted pointer.
+ // Also check for declarations in for loops.
+ for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i)
+ continue;
+ return 0;
+}
+
+// Check varargs and va_copy.
+static bool
+test_varargs (const char *format, ...)
+{
+ va_list args;
+ va_start (args, format);
+ va_list args_copy;
+ va_copy (args_copy, args);
+
+ const char *str = "";
+ int number = 0;
+ float fnumber = 0;
+
+ while (*format)
+ {
+ switch (*format++)
+ {
+ case '\''s'\'': // string
+ str = va_arg (args_copy, const char *);
+ break;
+ case '\''d'\'': // int
+ number = va_arg (args_copy, int);
+ break;
+ case '\''f'\'': // float
+ fnumber = va_arg (args_copy, double);
+ break;
+ default:
+ break;
+ }
+ }
+ va_end (args_copy);
+ va_end (args);
+
+ return *str && number && fnumber;
+}
+'
+
+# Test code for whether the C compiler supports C99 (body of main).
+ac_c_conftest_c99_main='
+ // Check bool.
+ _Bool success = false;
+ success |= (argc != 0);
+
+ // Check restrict.
+ if (test_restrict ("String literal") == 0)
+ success = true;
+ char *restrict newvar = "Another string";
+
+ // Check varargs.
+ success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234);
+ test_varargs_macros ();
+
+ // Check flexible array members.
+ struct incomplete_array *ia =
+ malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+ ia->datasize = 10;
+ for (int i = 0; i < ia->datasize; ++i)
+ ia->data[i] = i * 1.234;
+ // Work around memory leak warnings.
+ free (ia);
+
+ // Check named initializers.
+ struct named_init ni = {
+ .number = 34,
+ .name = L"Test wide string",
+ .average = 543.34343,
+ };
+
+ ni.number = 58;
+
+ int dynamic_array[ni.number];
+ dynamic_array[0] = argv[0][0];
+ dynamic_array[ni.number - 1] = 543;
+
+ // work around unused variable warnings
+ ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''
+ || dynamic_array[ni.number - 1] != 543);
+'
+
+# Test code for whether the C compiler supports C11 (global declarations)
+ac_c_conftest_c11_globals='
+/* Does the compiler advertise C11 conformance? */
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
+# error "Compiler does not advertise C11 conformance"
+#endif
+
+// Check _Alignas.
+char _Alignas (double) aligned_as_double;
+char _Alignas (0) no_special_alignment;
+extern char aligned_as_int;
+char _Alignas (0) _Alignas (int) aligned_as_int;
+
+// Check _Alignof.
+enum
+{
+ int_alignment = _Alignof (int),
+ int_array_alignment = _Alignof (int[100]),
+ char_alignment = _Alignof (char)
+};
+_Static_assert (0 < -_Alignof (int), "_Alignof is signed");
+
+// Check _Noreturn.
+int _Noreturn does_not_return (void) { for (;;) continue; }
+
+// Check _Static_assert.
+struct test_static_assert
+{
+ int x;
+ _Static_assert (sizeof (int) <= sizeof (long int),
+ "_Static_assert does not work in struct");
+ long int y;
+};
+
+// Check UTF-8 literals.
+#define u8 syntax error!
+char const utf8_literal[] = u8"happens to be ASCII" "another string";
+
+// Check duplicate typedefs.
+typedef long *long_ptr;
+typedef long int *long_ptr;
+typedef long_ptr long_ptr;
+
+// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
+struct anonymous
+{
+ union {
+ struct { int i; int j; };
+ struct { int k; long int l; } w;
+ };
+ int m;
+} v1;
+'
+
+# Test code for whether the C compiler supports C11 (body of main).
+ac_c_conftest_c11_main='
+ _Static_assert ((offsetof (struct anonymous, i)
+ == offsetof (struct anonymous, w.k)),
+ "Anonymous union alignment botch");
+ v1.i = 2;
+ v1.w.k = 5;
+ ok |= v1.i != 5;
+'
+
+# Test code for whether the C compiler supports C11 (complete).
+ac_c_conftest_c11_program="${ac_c_conftest_c89_globals}
+${ac_c_conftest_c99_globals}
+${ac_c_conftest_c11_globals}
+
+int
+main (int argc, char **argv)
+{
+ int ok = 0;
+ ${ac_c_conftest_c89_main}
+ ${ac_c_conftest_c99_main}
+ ${ac_c_conftest_c11_main}
+ return ok;
+}
+"
+
+# Test code for whether the C compiler supports C99 (complete).
+ac_c_conftest_c99_program="${ac_c_conftest_c89_globals}
+${ac_c_conftest_c99_globals}
+
+int
+main (int argc, char **argv)
+{
+ int ok = 0;
+ ${ac_c_conftest_c89_main}
+ ${ac_c_conftest_c99_main}
+ return ok;
+}
+"
+
+# Test code for whether the C compiler supports C89 (complete).
+ac_c_conftest_c89_program="${ac_c_conftest_c89_globals}
+
+int
+main (int argc, char **argv)
+{
+ int ok = 0;
+ ${ac_c_conftest_c89_main}
+ return ok;
+}
+"
+
+as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H"
+as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H"
+as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H"
+as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H"
+as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H"
+as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H"
+as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H"
+as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H"
+as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H"
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
- { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5
+printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
- { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5
+printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
-echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
-echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5
+printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5
+printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5
+printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5
+printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;}
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
- { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file'
+ and start over" "$LINENO" 5
fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -1292,40 +2402,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# The following define is needed when building with Cygwin since newer
# versions of autoconf incorrectly set SHELL to /bin/bash instead of
# /bin/sh. The bash shell seems to suffer from some strange failures.
SHELL=/bin/sh
-TK_VERSION=8.6
+TK_VERSION=8.7
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=6
-TK_PATCH_LEVEL=".14"
+TK_MINOR_VERSION=7
+TK_PATCH_LEVEL="b1"
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
#------------------------------------------------------------------------
@@ -1351,6 +2436,15 @@ if test "${CFLAGS+set}" != "set" ; then
CFLAGS=""
fi
+
+
+
+
+
+
+
+
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -1359,172 +2453,164 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
-fi
+fi ;;
+esac
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
-fi
+fi ;;
+esac
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- CC=$ac_ct_CC
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
-fi
+fi ;;
+esac
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
+ fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
ac_prog_rejected=no
@@ -1532,19 +2618,24 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
@@ -1555,146 +2646,280 @@ if test $ac_prog_rejected = yes; then
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@"
fi
fi
-fi
+fi ;;
+esac
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
- for ac_prog in cl
+ for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
-fi
+fi ;;
+esac
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
- for ac_prog in cl
+ for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
-fi
+fi ;;
+esac
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
test -n "$ac_ct_CC" && break
done
- CC=$ac_ct_CC
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args.
+set dummy ${ac_tool_prefix}clang; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CC+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}clang"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi ;;
+esac
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+printf "%s\n" "$CC" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "clang", so it can be a program name with args.
+set dummy clang; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_CC+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="clang"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi ;;
+esac
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+printf "%s\n" "$ac_ct_CC" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
fi
+fi
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+
+test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See 'config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
+printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion -version; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
@@ -1702,155 +2927,213 @@ main ()
}
_ACEOF
ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+printf %s "checking whether the C compiler works... " >&6; }
+ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'.
+# So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
- ;;
- conftest.$ac_ext )
- # This is the source file.
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool,
- # but it would be cool to find out if it's true. Does anybody
- # maintain Libtool? --akim.
- export ac_cv_exeext
+ if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an '-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
break;;
* )
break;;
esac
done
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+test "$ac_cv_exeext" = no && ac_cv_exeext=
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
+else case e in #(
+ e) ac_file='' ;;
+esac
fi
+if test -z "$ac_file"
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
-
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
+{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See 'config.log' for more details" "$LINENO" 5; }
+else case e in #(
+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; } ;;
+esac
fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+printf %s "checking for C compiler default output file name... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+printf "%s\n" "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+printf %s "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+then :
+ # If both 'conftest.exe' and 'conftest' are 'present' (well, observable)
+# catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will
+# work properly (i.e., refer to 'conftest.exe'), while it won't with
+# 'rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
break;;
* ) break;;
esac
done
-else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+else case e in #(
+ e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See 'config.log' for more details" "$LINENO" 5; } ;;
+esac
fi
-
-rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
+rm -f conftest conftest$ac_cv_exeext
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+printf "%s\n" "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
-if test "${ac_cv_objext+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main (void)
+{
+FILE *f = fopen ("conftest.out", "w");
+ if (!f)
+ return 1;
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+printf %s "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
+as_fn_error 77 "cannot run C compiled programs.
+If you meant to cross compile, use '--host'.
+See 'config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+printf "%s\n" "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext \
+ conftest.o conftest.obj conftest.out
+ac_clean_files=$ac_clean_files_save
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+printf %s "checking for suffix of object files... " >&6; }
+if test ${ac_cv_objext+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
@@ -1858,49 +3141,54 @@ main ()
}
_ACEOF
rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
-else
- echo "$as_me: failed program was:" >&5
+else case e in #(
+ e) printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
+{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See 'config.log' for more details" "$LINENO" 5; } ;;
+esac
fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
+rm -f conftest.$ac_cv_objext conftest.$ac_ext ;;
+esac
fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+printf "%s\n" "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5
+printf %s "checking whether the compiler supports GNU C... " >&6; }
+if test ${ac_cv_c_compiler_gnu+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
#ifndef __GNUC__
choke me
@@ -1910,99 +3198,100 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_compiler_gnu=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_compiler_gnu=no
+else case e in #(
+ e) ac_compiler_gnu=no ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
+ ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; }
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
+ac_test_CFLAGS=${CFLAGS+y}
ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_g+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+printf %s "checking whether $CC accepts -g... " >&6; }
+if test ${ac_cv_prog_cc_g+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+else case e in #(
+ e) CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+
+else case e in #(
+ e) ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main (void)
+{
-ac_cv_prog_cc_g=no
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag ;;
+esac
fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
-if test "$ac_test_CFLAGS" = set; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+printf "%s\n" "$ac_cv_prog_cc_g" >&6; }
+if test $ac_test_CFLAGS; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
@@ -2017,264 +3306,155 @@ else
CFLAGS=
fi
fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_prog_cc_stdc=no
+ac_prog_cc_stdc=no
+if test x$ac_prog_cc_stdc = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5
+printf %s "checking for $CC option to enable C11 features... " >&6; }
+if test ${ac_cv_prog_cc_c11+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) ac_cv_prog_cc_c11=no
ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std1 is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std1. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
+$ac_c_conftest_c11_program
_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in '' -std=gnu11
do
CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+ if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_c11=$ac_arg
fi
-rm -f conftest.err conftest.$ac_objext
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+ test "x$ac_cv_prog_cc_c11" != "xno" && break
done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
-
+rm -f conftest.$ac_ext
+CC=$ac_save_CC ;;
+esac
fi
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
- *)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
+if test "x$ac_cv_prog_cc_c11" = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else case e in #(
+ e) if test "x$ac_cv_prog_cc_c11" = x
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else case e in #(
+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5
+printf "%s\n" "$ac_cv_prog_cc_c11" >&6; }
+ CC="$CC $ac_cv_prog_cc_c11" ;;
esac
-
-# Some people use a C++ compiler to compile C. Since we use `exit',
-# in C++ we need to declare it. In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
- choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- for ac_declaration in \
- '' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+fi
+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11
+ ac_prog_cc_stdc=c11 ;;
+esac
+fi
+fi
+if test x$ac_prog_cc_stdc = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5
+printf %s "checking for $CC option to enable C99 features... " >&6; }
+if test ${ac_cv_prog_cc_c99+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) ac_cv_prog_cc_c99=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
+$ac_c_conftest_c99_program
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99=
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_c99=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+ test "x$ac_cv_prog_cc_c99" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC ;;
+esac
+fi
-continue
+if test "x$ac_cv_prog_cc_c99" = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else case e in #(
+ e) if test "x$ac_cv_prog_cc_c99" = x
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else case e in #(
+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
+printf "%s\n" "$ac_cv_prog_cc_c99" >&6; }
+ CC="$CC $ac_cv_prog_cc_c99" ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
+ ac_prog_cc_stdc=c99 ;;
+esac
+fi
+fi
+if test x$ac_prog_cc_stdc = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5
+printf %s "checking for $CC option to enable C89 features... " >&6; }
+if test ${ac_cv_prog_cc_c89+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
+$ac_c_conftest_c89_program
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_prog_cc_c89=$ac_arg
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
+rm -f conftest.$ac_ext
+CC=$ac_save_CC ;;
+esac
fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+if test "x$ac_cv_prog_cc_c89" = xno
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+printf "%s\n" "unsupported" >&6; }
+else case e in #(
+ e) if test "x$ac_cv_prog_cc_c89" = x
+then :
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+printf "%s\n" "none needed" >&6; }
+else case e in #(
+ e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+printf "%s\n" "$ac_cv_prog_cc_c89" >&6; }
+ CC="$CC $ac_cv_prog_cc_c89" ;;
+esac
+fi
+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
+ ac_prog_cc_stdc=c89 ;;
+esac
+fi
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2282,61 +3462,35 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking for inline" >&5
-echo $ECHO_N "checking for inline... $ECHO_C" >&6
-if test "${ac_cv_c_inline+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_c_inline=no
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+printf %s "checking for inline... " >&6; }
+if test ${ac_cv_c_inline+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef __cplusplus
typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
+static $ac_kw foo_t static_foo (void) {return 0; }
+$ac_kw foo_t foo (void) {return 0; }
#endif
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_c_inline=$ac_kw; break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+if ac_fn_c_try_compile "$LINENO"
+then :
+ ac_cv_c_inline=$ac_kw
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
done
-
+ ;;
+esac
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-echo "${ECHO_T}$ac_cv_c_inline" >&6
-
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+printf "%s\n" "$ac_cv_c_inline" >&6; }
case $ac_cv_c_inline in
inline | yes) ;;
@@ -2353,499 +3507,136 @@ _ACEOF
;;
esac
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
+ac_header= ac_cache=
+for ac_item in $ac_header_c_list
do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ if test $ac_cache; then
+ ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"
+ if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then
+ printf "%s\n" "#define $ac_item 1" >> confdefs.h
+ fi
+ ac_header= ac_cache=
+ elif test $ac_header; then
+ ac_cache=$ac_item
else
- ac_cpp_err=
+ ac_header=$ac_item
fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-int
-main ()
-{
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_stdc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_header_stdc=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes
+then :
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
+printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
- :
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_AR+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$AR"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_AR+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
-fi
+fi ;;
+esac
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
- echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+printf "%s\n" "$AR" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_AR"; then
ac_ct_AR=$AR
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_AR"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_AR+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$ac_ct_AR"; then
ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
-fi
+fi ;;
+esac
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
- echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+printf "%s\n" "$ac_ct_AR" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- AR=$ac_ct_AR
+ if test "x$ac_ct_AR" = x; then
+ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
else
AR="$ac_cv_prog_AR"
fi
@@ -2853,78 +3644,103 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$RANLIB"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_RANLIB+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
-fi
+fi ;;
+esac
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+printf "%s\n" "$RANLIB" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_RANLIB"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_RANLIB+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$ac_ct_RANLIB"; then
ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
-fi
+fi ;;
+esac
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+printf "%s\n" "$ac_ct_RANLIB" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- RANLIB=$ac_ct_RANLIB
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
else
RANLIB="$ac_cv_prog_RANLIB"
fi
@@ -2932,78 +3748,103 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
set dummy ${ac_tool_prefix}windres; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_RC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$RC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_RC+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$RC"; then
ac_cv_prog_RC="$RC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_RC="${ac_tool_prefix}windres"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
-fi
+fi ;;
+esac
fi
RC=$ac_cv_prog_RC
if test -n "$RC"; then
- echo "$as_me:$LINENO: result: $RC" >&5
-echo "${ECHO_T}$RC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RC" >&5
+printf "%s\n" "$RC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_RC"; then
ac_ct_RC=$RC
# Extract the first word of "windres", so it can be a program name with args.
set dummy windres; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_RC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_RC"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_RC+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$ac_ct_RC"; then
ac_cv_prog_ac_ct_RC="$ac_ct_RC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RC="windres"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
-fi
+fi ;;
+esac
fi
ac_ct_RC=$ac_cv_prog_ac_ct_RC
if test -n "$ac_ct_RC"; then
- echo "$as_me:$LINENO: result: $ac_ct_RC" >&5
-echo "${ECHO_T}$ac_ct_RC" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RC" >&5
+printf "%s\n" "$ac_ct_RC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
- RC=$ac_ct_RC
+ if test "x$ac_ct_RC" = x; then
+ RC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RC=$ac_ct_RC
+ fi
else
RC="$ac_cv_prog_RC"
fi
@@ -3013,14 +3854,15 @@ fi
# Checks to see if the make program sets the $MAKE variable.
#--------------------------------------------------------------------
-echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
set x ${MAKE-make}
-ac_make=`echo "" | sed 'y,:./+-,___p_,'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.make <<\_ACEOF
+ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval test \${ac_cv_prog_make_${ac_make}_set+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) cat >conftest.make <<\_ACEOF
SHELL = /bin/sh
all:
@echo '@@@%%%=$(MAKE)=@@@%%%'
@@ -3032,15 +3874,16 @@ case `${MAKE-make} -f conftest.make 2>/dev/null` in
*)
eval ac_cv_prog_make_${ac_make}_set=no;;
esac
-rm -f conftest.make
+rm -f conftest.make ;;
+esac
fi
if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
SET_MAKE=
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
@@ -3053,73 +3896,37 @@ fi
#--------------------------------------------------------------------
-# Check whether --enable-threads or --disable-threads was given.
-#--------------------------------------------------------------------
-
-
- echo "$as_me:$LINENO: checking for building with threads" >&5
-echo $ECHO_N "checking for building with threads... $ECHO_C" >&6
- # Check whether --enable-threads or --disable-threads was given.
-if test "${enable_threads+set}" = set; then
- enableval="$enable_threads"
- tcl_ok=$enableval
-else
- tcl_ok=yes
-fi;
-
- if test "$tcl_ok" = "yes"; then
- echo "$as_me:$LINENO: result: yes (default)" >&5
-echo "${ECHO_T}yes (default)" >&6
- TCL_THREADS=1
- cat >>confdefs.h <<\_ACEOF
-#define TCL_THREADS 1
-_ACEOF
-
- # USE_THREAD_ALLOC tells us to try the special thread-based
- # allocator that significantly reduces lock contention
- cat >>confdefs.h <<\_ACEOF
-#define USE_THREAD_ALLOC 1
-_ACEOF
-
- else
- TCL_THREADS=0
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
- fi
-
-
-
-#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtk as a shared library instead of a static library.
#--------------------------------------------------------------------
- echo "$as_me:$LINENO: checking how to build libraries" >&5
-echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6
- # Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- tcl_ok=$enableval
-else
- tcl_ok=yes
-fi;
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5
+printf %s "checking how to build libraries... " >&6; }
+ # Check whether --enable-shared was given.
+if test ${enable_shared+y}
+then :
+ enableval=$enable_shared; tcl_ok=$enableval
+else case e in #(
+ e) tcl_ok=yes ;;
+esac
+fi
+
if test "$tcl_ok" = "yes" ; then
- echo "$as_me:$LINENO: result: shared" >&5
-echo "${ECHO_T}shared" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: shared" >&5
+printf "%s\n" "shared" >&6; }
SHARED_BUILD=1
else
- echo "$as_me:$LINENO: result: static" >&5
-echo "${ECHO_T}static" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: static" >&5
+printf "%s\n" "static" >&6; }
SHARED_BUILD=0
-cat >>confdefs.h <<\_ACEOF
-#define STATIC_BUILD 1
-_ACEOF
+printf "%s\n" "#define STATIC_BUILD 1" >>confdefs.h
fi
+
#--------------------------------------------------------------------
# Locate and source the tclConfig.sh file.
#--------------------------------------------------------------------
@@ -3135,34 +3942,34 @@ _ACEOF
# we reset no_tcl in case something fails here
no_tcl=true
-# Check whether --with-tcl or --without-tcl was given.
-if test "${with_tcl+set}" = set; then
- withval="$with_tcl"
- with_tclconfig="${withval}"
-fi;
- echo "$as_me:$LINENO: checking for Tcl configuration" >&5
-echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6
- if test "${ac_cv_c_tclconfig+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+# Check whether --with-tcl was given.
+if test ${with_tcl+y}
+then :
+ withval=$with_tcl; with_tclconfig="${withval}"
+fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5
+printf %s "checking for Tcl configuration... " >&6; }
+ if test ${ac_cv_c_tclconfig+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e)
# First check to see if --with-tcl was specified.
if test x"${with_tclconfig}" != x ; then
case "${with_tclconfig}" in
*/tclConfig.sh )
if test -f "${with_tclconfig}"; then
- { echo "$as_me:$LINENO: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5
-echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;}
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5
+printf "%s\n" "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;}
with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
fi ;;
esac
if test -f "${with_tclconfig}/tclConfig.sh" ; then
ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
else
- { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5
-echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5
fi
fi
@@ -3220,34 +4027,33 @@ echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >
fi
done
fi
-
+ ;;
+esac
fi
if test x"${ac_cv_c_tclconfig}" = x ; then
TCL_BIN_DIR="# no Tcl configs found"
- { { echo "$as_me:$LINENO: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" >&5
-echo "$as_me: error: Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" "$LINENO" 5
else
no_tcl=
TCL_BIN_DIR="${ac_cv_c_tclconfig}"
- echo "$as_me:$LINENO: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5
-echo "${ECHO_T}found ${TCL_BIN_DIR}/tclConfig.sh" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5
+printf "%s\n" "found ${TCL_BIN_DIR}/tclConfig.sh" >&6; }
fi
fi
- echo "$as_me:$LINENO: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
-echo $ECHO_N "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
+printf %s "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... " >&6; }
if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
- echo "$as_me:$LINENO: result: loading" >&5
-echo "${ECHO_T}loading" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: loading" >&5
+printf "%s\n" "loading" >&6; }
. "${TCL_BIN_DIR}/tclConfig.sh"
else
- echo "$as_me:$LINENO: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5
-echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5
+printf "%s\n" "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; }
fi
#
@@ -3265,14 +4071,6 @@ echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6
TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
fi
- #
- # eval is required to do the TCL_DBGX substitution
- #
-
- eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
- eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
- eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
-
eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
@@ -3292,23 +4090,17 @@ echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6
+if test "${TCL_MAJOR_VERSION}" -lt 9 ; then
if test "${TCL_MAJOR_VERSION}" != "${TK_MAJOR_VERSION}"; then
- { { echo "$as_me:$LINENO: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&5
-echo "$as_me: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test "${TCL_MINOR_VERSION}" -lt "${TK_MINOR_VERSION}"; then
- { { echo "$as_me:$LINENO: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&5
-echo "$as_me: error: ${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
+Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+.
+Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better." "$LINENO" 5
+fi
+if test "${TCL_MINOR_VERSION}" -lt 6; then
+ as_fn_error $? "${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
+Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+.
+Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better." "$LINENO" 5
+fi
fi
#--------------------------------------------------------------------
@@ -3321,90 +4113,114 @@ fi
# Step 0: Enable 64 bit support?
- echo "$as_me:$LINENO: checking if 64bit support is requested" >&5
-echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6
- # Check whether --enable-64bit or --disable-64bit was given.
-if test "${enable_64bit+set}" = set; then
- enableval="$enable_64bit"
- do64bit=$enableval
-else
- do64bit=no
-fi;
- echo "$as_me:$LINENO: result: $do64bit" >&5
-echo "${ECHO_T}$do64bit" >&6
-
- # Cross-compiling options for Windows/CE builds
-
- echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5
-echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6
- # Check whether --enable-wince or --disable-wince was given.
-if test "${enable_wince+set}" = set; then
- enableval="$enable_wince"
- doWince=$enableval
-else
- doWince=no
-fi;
- echo "$as_me:$LINENO: result: $doWince" >&5
-echo "${ECHO_T}$doWince" >&6
-
- echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5
-echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6
-
-# Check whether --with-celib or --without-celib was given.
-if test "${with_celib+set}" = set; then
- withval="$with_celib"
- CELIB_DIR=$withval
-else
- CELIB_DIR=NO_CELIB
-fi;
- echo "$as_me:$LINENO: result: $CELIB_DIR" >&5
-echo "${ECHO_T}$CELIB_DIR" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if 64bit support is requested" >&5
+printf %s "checking if 64bit support is requested... " >&6; }
+ # Check whether --enable-64bit was given.
+if test ${enable_64bit+y}
+then :
+ enableval=$enable_64bit; do64bit=$enableval
+else case e in #(
+ e) do64bit=no ;;
+esac
+fi
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $do64bit" >&5
+printf "%s\n" "$do64bit" >&6; }
# Set some defaults (may get changed below)
EXTRA_CFLAGS=""
-cat >>confdefs.h <<\_ACEOF
-#define MODULE_SCOPE extern
-_ACEOF
+printf "%s\n" "#define MODULE_SCOPE extern" >>confdefs.h
# Extract the first word of "cygpath", so it can be a program name with args.
set dummy cygpath; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CYGPATH+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$CYGPATH"; then
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_CYGPATH+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$CYGPATH"; then
ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_prog_CYGPATH="cygpath -m"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
+IFS=$as_save_IFS
test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo"
-fi
+fi ;;
+esac
fi
CYGPATH=$ac_cv_prog_CYGPATH
if test -n "$CYGPATH"; then
- echo "$as_me:$LINENO: result: $CYGPATH" >&5
-echo "${ECHO_T}$CYGPATH" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5
+printf "%s\n" "$CYGPATH" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
fi
+ # Extract the first word of "wine", so it can be a program name with args.
+set dummy wine; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_WINE+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -n "$WINE"; then
+ ac_cv_prog_WINE="$WINE" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_prog_WINE="wine"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi ;;
+esac
+fi
+WINE=$ac_cv_prog_WINE
+if test -n "$WINE"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $WINE" >&5
+printf "%s\n" "$WINE" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+
SHLIB_SUFFIX=".dll"
# MACHINE is IX86 for LINK, but this is used by the manifest,
@@ -3413,16 +4229,13 @@ fi
if test "$GCC" = "yes"; then
- echo "$as_me:$LINENO: checking for cross-compile version of gcc" >&5
-echo $ECHO_N "checking for cross-compile version of gcc... $ECHO_C" >&6
-if test "${ac_cv_cross+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cross-compile version of gcc" >&5
+printf %s "checking for cross-compile version of gcc... " >&6; }
+if test ${ac_cv_cross+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef _WIN32
@@ -3430,47 +4243,26 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_cross=no
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_cross=yes
+else case e in #(
+ e) ac_cv_cross=yes ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ ;;
+esac
fi
-echo "$as_me:$LINENO: result: $ac_cv_cross" >&5
-echo "${ECHO_T}$ac_cv_cross" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cross" >&5
+printf "%s\n" "$ac_cv_cross" >&6; }
if test "$ac_cv_cross" = "yes"; then
case "$do64bit" in
@@ -3512,20 +4304,20 @@ echo "${ECHO_T}$ac_cv_cross" >&6
echo "101 \"name\"" >> $conftest
echo "END" >> $conftest
- echo "$as_me:$LINENO: checking for Windows native path bug in windres" >&5
-echo $ECHO_N "checking for Windows native path bug in windres... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Windows native path bug in windres" >&5
+printf %s "checking for Windows native path bug in windres... " >&6; }
cyg_conftest=`$CYGPATH $conftest`
if { ac_try='$RC -o conftest.res.o $cyg_conftest'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } ; then
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; } ; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
else
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
CYGPATH=echo
fi
conftest=
@@ -3543,16 +4335,13 @@ echo "${ECHO_T}yes" >&6
if test "${GCC}" = "yes" ; then
extra_cflags="-pipe"
extra_ldflags="-pipe -static-libgcc"
- echo "$as_me:$LINENO: checking for mingw32 version of gcc" >&5
-echo $ECHO_N "checking for mingw32 version of gcc... $ECHO_C" >&6
-if test "${ac_cv_win32+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mingw32 version of gcc" >&5
+printf %s "checking for mingw32 version of gcc... " >&6; }
+if test ${ac_cv_win32+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef _WIN32
@@ -3560,115 +4349,116 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_win32=no
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_win32=yes
+else case e in #(
+ e) ac_cv_win32=yes ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ ;;
+esac
fi
-echo "$as_me:$LINENO: result: $ac_cv_win32" >&5
-echo "${ECHO_T}$ac_cv_win32" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_win32" >&5
+printf "%s\n" "$ac_cv_win32" >&6; }
if test "$ac_cv_win32" != "yes"; then
- { { echo "$as_me:$LINENO: error: ${CC} cannot produce win32 executables." >&5
-echo "$as_me: error: ${CC} cannot produce win32 executables." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${CC} cannot produce win32 executables." "$LINENO" 5
fi
if test "$do64bit" != "arm64"; then
extra_cflags="$extra_cflags -DHAVE_CPUID=1"
fi
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -mwindows -municode -Dmain=xxmain"
- echo "$as_me:$LINENO: checking for working -municode linker flag" >&5
-echo $ECHO_N "checking for working -municode linker flag... $ECHO_C" >&6
-if test "${ac_cv_municode+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -municode linker flag" >&5
+printf %s "checking for working -municode linker flag... " >&6; }
+if test ${ac_cv_municode+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e)
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }
+then :
+ ac_retval=0
+else case e in #(
+ e) printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1 ;;
+esac
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <windows.h>
int APIENTRY wWinMain(HINSTANCE a, HINSTANCE b, LPWSTR c, int d) {return 0;}
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
ac_cv_municode=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_municode=no
+else case e in #(
+ e) ac_cv_municode=no ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext
+ ;;
+esac
fi
-echo "$as_me:$LINENO: result: $ac_cv_municode" >&5
-echo "${ECHO_T}$ac_cv_municode" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_municode" >&5
+printf "%s\n" "$ac_cv_municode" >&6; }
CFLAGS=$hold_cflags
if test "$ac_cv_municode" = "yes" ; then
extra_ldflags="$extra_ldflags -municode"
@@ -3676,136 +4466,123 @@ echo "${ECHO_T}$ac_cv_municode" >&6
extra_cflags="$extra_cflags -DTCL_BROKEN_MAINARGS"
fi
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto"
- echo "$as_me:$LINENO: checking for working -fno-lto" >&5
-echo $ECHO_N "checking for working -fno-lto... $ECHO_C" >&6
-if test "${ac_cv_nolto+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -fno-lto" >&5
+printf %s "checking for working -fno-lto... " >&6; }
+if test ${ac_cv_nolto+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_nolto=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_nolto=no
+else case e in #(
+ e) ac_cv_nolto=no ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ ;;
+esac
fi
-echo "$as_me:$LINENO: result: $ac_cv_nolto" >&5
-echo "${ECHO_T}$ac_cv_nolto" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_nolto" >&5
+printf "%s\n" "$ac_cv_nolto" >&6; }
CFLAGS=$hold_cflags
if test "$ac_cv_nolto" = "yes" ; then
CFLAGS_NOLTO="-fno-lto"
else
CFLAGS_NOLTO=""
fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -finput-charset" >&5
+printf %s "checking if the compiler understands -finput-charset... " >&6; }
+if test ${tcl_cv_cc_input_charset+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e)
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ tcl_cv_cc_input_charset=yes
+else case e in #(
+ e) tcl_cv_cc_input_charset=no ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ CFLAGS=$hold_cflags ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_input_charset" >&5
+printf "%s\n" "$tcl_cv_cc_input_charset" >&6; }
+ if test $tcl_cv_cc_input_charset = yes; then
+ extra_cflags="$extra_cflags -finput-charset=UTF-8"
+ fi
fi
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Wl,--enable-auto-image-base"
- echo "$as_me:$LINENO: checking for working --enable-auto-image-base" >&5
-echo $ECHO_N "checking for working --enable-auto-image-base... $ECHO_C" >&6
-if test "${ac_cv_enable_auto_image_base+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working --enable-auto-image-base" >&5
+printf %s "checking for working --enable-auto-image-base... " >&6; }
+if test ${ac_cv_enable_auto_image_base+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
ac_cv_enable_auto_image_base=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_enable_auto_image_base=no
+else case e in #(
+ e) ac_cv_enable_auto_image_base=no ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ ;;
+esac
fi
-echo "$as_me:$LINENO: result: $ac_cv_enable_auto_image_base" >&5
-echo "${ECHO_T}$ac_cv_enable_auto_image_base" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_auto_image_base" >&5
+printf "%s\n" "$ac_cv_enable_auto_image_base" >&6; }
CFLAGS=$hold_cflags
if test "$ac_cv_enable_auto_image_base" == "yes" ; then
extra_ldflags="$extra_ldflags -Wl,--enable-auto-image-base"
fi
- echo "$as_me:$LINENO: checking compiler flags" >&5
-echo $ECHO_N "checking compiler flags... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking compiler flags" >&5
+printf %s "checking compiler flags... " >&6; }
if test "${GCC}" = "yes" ; then
SHLIB_LD=""
SHLIB_LD_LIBS='${LIBS}'
LIBS="-lnetapi32 -lkernel32 -luser32 -ladvapi32 -luserenv -lws2_32"
# mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't
- LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32"
+ LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32 -lwinspool"
STLIB_LD='${AR} cr'
RC_OUT=-o
RC_TYPE=
@@ -3820,29 +4597,26 @@ echo $ECHO_N "checking compiler flags... $ECHO_C" >&6
if test "${SHARED_BUILD}" = "0" ; then
# static
- echo "$as_me:$LINENO: result: using static flags" >&5
-echo "${ECHO_T}using static flags" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using static flags" >&5
+printf "%s\n" "using static flags" >&6; }
runtime=
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
else
# dynamic
- echo "$as_me:$LINENO: result: using shared flags" >&5
-echo "${ECHO_T}using shared flags" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5
+printf "%s\n" "using shared flags" >&6; }
# ad-hoc check to see if CC supports -shared.
if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then
- { { echo "$as_me:$LINENO: error: ${CC} does not support the -shared option.
- You will need to upgrade to a newer version of the toolchain." >&5
-echo "$as_me: error: ${CC} does not support the -shared option.
- You will need to upgrade to a newer version of the toolchain." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "${CC} does not support the -shared option.
+ You will need to upgrade to a newer version of the toolchain." "$LINENO" 5
fi
runtime=
# Add SHLIB_LD_LIBS to the Make rule, not here.
- EXESUFFIX="\${DBGX}.exe"
+ EXESUFFIX=".exe"
LIBRARIES="\${SHARED_LIBRARIES}"
fi
# Link with gcc since ld does not link to default libs like
@@ -3853,16 +4627,16 @@ echo "$as_me: error: ${CC} does not support the -shared option.
-Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\$@)"
# 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}.a"
- LIBFLAGSUFFIX="\${DBGX}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".a"
+ LIBFLAGSUFFIX=""
SHLIB_SUFFIX=.dll
EXTRA_CFLAGS="${extra_cflags}"
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
@@ -3871,7 +4645,7 @@ echo "$as_me: error: ${CC} does not support the -shared option.
CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format"
;;
*)
- CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement"
+ CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers"
;;
esac
@@ -3899,25 +4673,21 @@ echo "$as_me: error: ${CC} does not support the -shared option.
case "$do64bit" in
amd64|x64|yes)
MACHINE="AMD64" ; # assume AMD64 as default 64-bit build
- echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
-echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5
+printf "%s\n" " Using 64-bit $MACHINE mode" >&6; }
;;
arm64|aarch64)
MACHINE="ARM64"
- echo "$as_me:$LINENO: result: Using ARM64 $MACHINE mode" >&5
-echo "${ECHO_T} Using ARM64 $MACHINE mode" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using ARM64 $MACHINE mode" >&5
+printf "%s\n" " Using ARM64 $MACHINE mode" >&6; }
;;
ia64)
MACHINE="IA64"
- echo "$as_me:$LINENO: result: Using IA64 $MACHINE mode" >&5
-echo "${ECHO_T} Using IA64 $MACHINE mode" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using IA64 $MACHINE mode" >&5
+printf "%s\n" " Using IA64 $MACHINE mode" >&6; }
;;
*)
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef _WIN64
@@ -3925,68 +4695,46 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
int
-main ()
+main (void)
{
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_win_64bit=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_win_64bit=no
-
+else case e in #(
+ e) tcl_win_64bit=no
+ ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
if test "$tcl_win_64bit" = "yes" ; then
do64bit=amd64
MACHINE="AMD64"
- echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
-echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5
+printf "%s\n" " Using 64-bit $MACHINE mode" >&6; }
fi
;;
esac
else
if test "${SHARED_BUILD}" = "0" ; then
# static
- echo "$as_me:$LINENO: result: using static flags" >&5
-echo "${ECHO_T}using static flags" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using static flags" >&5
+printf "%s\n" "using static flags" >&6; }
runtime=-MT
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
else
# dynamic
- echo "$as_me:$LINENO: result: using shared flags" >&5
-echo "${ECHO_T}using shared flags" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5
+printf "%s\n" "using shared flags" >&6; }
runtime=-MD
# Add SHLIB_LD_LIBS to the Make rule, not here.
LIBRARIES="\${SHARED_LIBRARIES}"
- EXESUFFIX="\${DBGX}.exe"
+ EXESUFFIX=".exe"
case "x`echo \${VisualStudioVersion}`" in
x1[4-9]*)
lflags="${lflags} -nodefaultlib:libucrt.lib"
@@ -3998,9 +4746,9 @@ echo "${ECHO_T}using shared flags" >&6
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}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".lib"
+ LIBFLAGSUFFIX=""
if test "$do64bit" != "no" ; then
case "$do64bit" in
@@ -4014,8 +4762,8 @@ echo "${ECHO_T}using shared flags" >&6
MACHINE="IA64"
;;
esac
- echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
-echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5
+printf "%s\n" " Using 64-bit $MACHINE mode" >&6; }
fi
LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib userenv.lib ws2_32.lib"
@@ -4048,111 +4796,7 @@ echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
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 ...
- TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
- ARCH=ARM; # could be ARM MIPS X86EM ...
- PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
- if test "$doWince" != "yes"; then
- # If !yes then the user specified something
- # Reset ARCH to allow user to skip specifying it
- ARCH=
- eval `echo $doWince | awk -F "," '{ \
- if (length($1)) { printf "CEVERSION=\"%s\"\n", $1; \
- if ($1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
- if (length($2)) { printf "TARGETCPU=\"%s\"\n", toupper($2) }; \
- if (length($3)) { printf "ARCH=\"%s\"\n", toupper($3) }; \
- if (length($4)) { printf "PLATFORM=\"%s\"\n", $4 }; \
- }'`
- if test "x${ARCH}" = "x" ; then
- ARCH=$TARGETCPU;
- fi
- fi
- OSVERSION=WCE$CEVERSION;
- if test "x${WCEROOT}" = "x" ; then
- WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
- if test ! -d "${WCEROOT}" ; then
- WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
- fi
- fi
- if test "x${SDKROOT}" = "x" ; then
- SDKROOT="C:/Program Files/Windows CE Tools"
- if test ! -d "${SDKROOT}" ; then
- SDKROOT="C:/Windows CE Tools"
- fi
- fi
- # The space-based-path will work for the Makefile, but will
- # not work if AC_TRY_COMPILE is called.
- WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
- SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
- CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
- if test ! -d "${CELIB_DIR}/inc"; then
- { { echo "$as_me:$LINENO: error: Invalid celib directory \"${CELIB_DIR}\"" >&5
-echo "$as_me: error: Invalid celib directory \"${CELIB_DIR}\"" >&2;}
- { (exit 1); exit 1; }; }
- fi
- if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"\
- -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
- { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5
-echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;}
- { (exit 1); exit 1; }; }
- else
- CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
- if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
- CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
- fi
- CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
- fi
- fi
-
- if test "$doWince" != "no" ; then
- CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
- if test "${TARGETCPU}" = "X86"; then
- CC="${CEBINROOT}/cl.exe"
- else
- CC="${CEBINROOT}/cl${ARCH}.exe"
- fi
- CC="\"${CC}\" -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
- RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
- arch=`echo ${ARCH} | awk '{print tolower($0)}'`
- defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS"
- for i in $defs ; do
- cat >>confdefs.h <<_ACEOF
-#define $i 1
-_ACEOF
-
- done
-# if test "${ARCH}" = "X86EM"; then
-# AC_DEFINE_UNQUOTED(_WIN32_WCE_EMULATION)
-# fi
- cat >>confdefs.h <<_ACEOF
-#define _WIN32_WCE $CEVERSION
-_ACEOF
-
- cat >>confdefs.h <<_ACEOF
-#define UNDER_CE $CEVERSION
-_ACEOF
-
- CFLAGS_DEBUG="-nologo -Zi -Od"
- CFLAGS_OPTIMIZE="-nologo -O2"
- lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
- lflags="-nodefaultlib -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
- LINKBIN="\"${CEBINROOT}/link.exe\""
-
- if test "${CEVERSION}" -lt 400 ; then
- LIBS="coredll.lib corelibc.lib winsock.lib"
- else
- LIBS="coredll.lib corelibc.lib ws2.lib"
- fi
- # celib currently stuck at wce300 status
- #LIBS="$LIBS \${CELIB_DIR}/wince-${ARCH}-pocket-${OSVERSION}-release/celib.lib"
- LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\""
- LIBS_GUI="commctrl.lib commdlg.lib"
- else
- LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib"
- fi
+ LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib winspool.lib"
SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}"
SHLIB_LD_LIBS='${LIBS}'
@@ -4183,7 +4827,7 @@ _ACEOF
# Specify linker flags depending on the type of app being
# built -- Console vs. Window.
- if test "$doWince" != "no" -a "${TARGETCPU}" != "X86"; then
+ if test "${TARGETCPU}" != "X86"; then
LDFLAGS_CONSOLE="-link ${lflags}"
LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
else
@@ -4193,26 +4837,66 @@ _ACEOF
fi
if test "$do64bit" != "no" ; then
- cat >>confdefs.h <<\_ACEOF
-#define TCL_CFG_DO64BIT 1
-_ACEOF
+ printf "%s\n" "#define TCL_CFG_DO64BIT 1" >>confdefs.h
fi
if test "${GCC}" = "yes" ; then
- echo "$as_me:$LINENO: checking for SEH support in compiler" >&5
-echo $ECHO_N "checking for SEH support in compiler... $ECHO_C" >&6
-if test "${tcl_cv_seh+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test "$cross_compiling" = yes; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5
+printf %s "checking for SEH support in compiler... " >&6; }
+if test ${tcl_cv_seh+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test "$cross_compiling" = yes
+then :
tcl_cv_seh=no
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+else case e in #(
+ e)
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that
+# executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+printf "%s\n" "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+then :
+ ac_retval=0
+else case e in #(
+ e) printf "%s\n" "$as_me: program exited with status $ac_status" >&5
+ printf "%s\n" "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status ;;
+esac
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define WIN32_LEAN_AND_MEAN
@@ -4231,37 +4915,26 @@ cat >>conftest.$ac_ext <<_ACEOF
}
_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"
+then :
tcl_cv_seh=yes
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-tcl_cv_seh=no
+else case e in #(
+ e) tcl_cv_seh=no ;;
+esac
fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
+esac
fi
+ ;;
+esac
fi
-echo "$as_me:$LINENO: result: $tcl_cv_seh" >&5
-echo "${ECHO_T}$tcl_cv_seh" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_seh" >&5
+printf "%s\n" "$tcl_cv_seh" >&6; }
if test "$tcl_cv_seh" = "no" ; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NO_SEH 1
-_ACEOF
+printf "%s\n" "#define HAVE_NO_SEH 1" >>confdefs.h
fi
@@ -4271,16 +4944,13 @@ _ACEOF
# with Cygwin's version as of 2002-04-10, define it to be int,
# sufficient for getting the current code to work.
#
- echo "$as_me:$LINENO: checking for EXCEPTION_DISPOSITION support in include files" >&5
-echo $ECHO_N "checking for EXCEPTION_DISPOSITION support in include files... $ECHO_C" >&6
-if test "${tcl_cv_eh_disposition+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EXCEPTION_DISPOSITION support in include files" >&5
+printf %s "checking for EXCEPTION_DISPOSITION support in include files... " >&6; }
+if test ${tcl_cv_eh_disposition+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
# define WIN32_LEAN_AND_MEAN
@@ -4288,7 +4958,7 @@ cat >>conftest.$ac_ext <<_ACEOF
# undef WIN32_LEAN_AND_MEAN
int
-main ()
+main (void)
{
EXCEPTION_DISPOSITION x;
@@ -4297,141 +4967,49 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_eh_disposition=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_eh_disposition=no
+else case e in #(
+ e) tcl_cv_eh_disposition=no ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ ;;
+esac
fi
-echo "$as_me:$LINENO: result: $tcl_cv_eh_disposition" >&5
-echo "${ECHO_T}$tcl_cv_eh_disposition" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_eh_disposition" >&5
+printf "%s\n" "$tcl_cv_eh_disposition" >&6; }
if test "$tcl_cv_eh_disposition" = "no" ; then
-cat >>confdefs.h <<\_ACEOF
-#define EXCEPTION_DISPOSITION int
-_ACEOF
+printf "%s\n" "#define EXCEPTION_DISPOSITION int" >>confdefs.h
fi
- # Check to see if winnt.h defines CHAR, SHORT, and LONG
- # even if VOID has already been #defined. The win32api
- # used by mingw and cygwin is known to do this.
-
- echo "$as_me:$LINENO: checking for winnt.h that ignores VOID define" >&5
-echo $ECHO_N "checking for winnt.h that ignores VOID define... $ECHO_C" >&6
-if test "${tcl_cv_winnt_ignore_void+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #define VOID void
- #define WIN32_LEAN_AND_MEAN
- #include <windows.h>
- #undef WIN32_LEAN_AND_MEAN
-
-int
-main ()
-{
+ ac_fn_c_check_header_compile "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdbool_h" = xyes
+then :
- CHAR c;
- SHORT s;
- LONG l;
+printf "%s\n" "#define HAVE_STDBOOL_H 1" >>confdefs.h
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- tcl_cv_winnt_ignore_void=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_winnt_ignore_void=no
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-echo "$as_me:$LINENO: result: $tcl_cv_winnt_ignore_void" >&5
-echo "${ECHO_T}$tcl_cv_winnt_ignore_void" >&6
- if test "$tcl_cv_winnt_ignore_void" = "yes" ; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_WINNT_IGNORE_VOID 1
-_ACEOF
- fi
# See if the compiler supports casting to a union type.
# This is used to stop gcc from printing a compiler
# warning when initializing a union member.
- echo "$as_me:$LINENO: checking for cast to union support" >&5
-echo $ECHO_N "checking for cast to union support... $ECHO_C" >&6
-if test "${tcl_cv_cast_to_union+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5
+printf %s "checking for cast to union support... " >&6; }
+if test ${tcl_cv_cast_to_union+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
-main ()
+main (void)
{
union foo { int i; double d; };
@@ -4441,45 +5019,22 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_cv_cast_to_union=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_cast_to_union=no
+else case e in #(
+ e) tcl_cv_cast_to_union=no ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ ;;
+esac
fi
-echo "$as_me:$LINENO: result: $tcl_cv_cast_to_union" >&5
-echo "${ECHO_T}$tcl_cv_cast_to_union" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5
+printf "%s\n" "$tcl_cv_cast_to_union" >&6; }
if test "$tcl_cv_cast_to_union" = "yes"; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CAST_TO_UNION 1
-_ACEOF
+printf "%s\n" "#define HAVE_CAST_TO_UNION 1" >>confdefs.h
fi
fi
@@ -4492,688 +5047,198 @@ _ACEOF
-#--------------------------------------------------------------------
-# man2tcl needs this so that it can use errno.h
-#--------------------------------------------------------------------
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
+ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "
+#include <stdint.h>
+"
+if test "x$ac_cv_type_intptr_t" = xyes
+then :
+printf "%s\n" "#define HAVE_INTPTR_T 1" >>confdefs.h
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "
+#include <stdint.h>
-fi
+"
+if test "x$ac_cv_type_uintptr_t" = xyes
+then :
-done
+printf "%s\n" "#define HAVE_UINTPTR_T 1" >>confdefs.h
-if test "${ac_cv_header_errno_h+set}" = set; then
- echo "$as_me:$LINENO: checking for errno.h" >&5
-echo $ECHO_N "checking for errno.h... $ECHO_C" >&6
-if test "${ac_cv_header_errno_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
-echo "${ECHO_T}$ac_cv_header_errno_h" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking errno.h usability" >&5
-echo $ECHO_N "checking errno.h usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <errno.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-# Is the header present?
-echo "$as_me:$LINENO: checking errno.h presence" >&5
-echo $ECHO_N "checking errno.h presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <errno.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+#--------------------------------------------------------------------
+# man2tcl needs this so that it can use errno.h
+#--------------------------------------------------------------------
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+ac_fn_c_check_header_compile "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default"
+if test "x$ac_cv_header_errno_h" = xyes
+then :
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: errno.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: errno.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: errno.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: errno.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: errno.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: errno.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: errno.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: errno.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: errno.h: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ----------------------------- ##
-## Report this to the tk lists. ##
-## ----------------------------- ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
+else case e in #(
+ e) MAN2TCLFLAGS="-DNO_ERRNO_H" ;;
esac
-echo "$as_me:$LINENO: checking for errno.h" >&5
-echo $ECHO_N "checking for errno.h... $ECHO_C" >&6
-if test "${ac_cv_header_errno_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_header_errno_h=$ac_header_preproc
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
-echo "${ECHO_T}$ac_cv_header_errno_h" >&6
-
-fi
-if test $ac_cv_header_errno_h = yes; then
- :
-else
- MAN2TCLFLAGS="-DNO_ERRNO_H"
fi
-
#-------------------------------------------
# Check for _strtoi64
#-------------------------------------------
-echo "$as_me:$LINENO: checking availability of _strtoi64" >&5
-echo $ECHO_N "checking availability of _strtoi64... $ECHO_C" >&6
-if test "${tcl_cv_strtoi64+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking availability of _strtoi64" >&5
+printf %s "checking availability of _strtoi64... " >&6; }
+if test ${tcl_cv_strtoi64+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e)
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
int
-main ()
+main (void)
{
_strtoi64(0,0,0)
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"
+then :
tcl_cv_strtoi64=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_cv_strtoi64=no
+else case e in #(
+ e) tcl_cv_strtoi64=no ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+ conftest$ac_exeext conftest.$ac_ext ;;
+esac
fi
-echo "$as_me:$LINENO: result: $tcl_cv_strtoi64" >&5
-echo "${ECHO_T}$tcl_cv_strtoi64" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strtoi64" >&5
+printf "%s\n" "$tcl_cv_strtoi64" >&6; }
if test $tcl_cv_strtoi64 = no; then
-cat >>confdefs.h <<\_ACEOF
-#define NO_STRTOI64 1
-_ACEOF
+printf "%s\n" "#define NO_STRTOI64 1" >>confdefs.h
fi
-echo "$as_me:$LINENO: checking for intptr_t" >&5
-echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6
-if test "${ac_cv_type_intptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if ((intptr_t *) 0)
- return 0;
-if (sizeof (intptr_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_intptr_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
+if test "x$ac_cv_type_intptr_t" = xyes
+then :
-ac_cv_type_intptr_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5
-echo "${ECHO_T}$ac_cv_type_intptr_t" >&6
-if test $ac_cv_type_intptr_t = yes; then
+printf "%s\n" "#define HAVE_INTPTR_T 1" >>confdefs.h
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_INTPTR_T 1
-_ACEOF
-
-else
-
- echo "$as_me:$LINENO: checking for pointer-size signed integer type" >&5
-echo $ECHO_N "checking for pointer-size signed integer type... $ECHO_C" >&6
-if test "${tcl_cv_intptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
+else case e in #(
+ e)
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pointer-size signed integer type" >&5
+printf %s "checking for pointer-size signed integer type... " >&6; }
+if test ${tcl_cv_intptr_t+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e)
for tcl_cv_intptr_t in "int" "long" "__int64" none; do
if test "$tcl_cv_intptr_t" != none; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
-main ()
+main (void)
{
static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_ok=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_ok=no
+else case e in #(
+ e) tcl_ok=no ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
test "$tcl_ok" = yes && break; fi
- done
+ done ;;
+esac
fi
-echo "$as_me:$LINENO: result: $tcl_cv_intptr_t" >&5
-echo "${ECHO_T}$tcl_cv_intptr_t" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_intptr_t" >&5
+printf "%s\n" "$tcl_cv_intptr_t" >&6; }
if test "$tcl_cv_intptr_t" != none; then
-cat >>confdefs.h <<_ACEOF
-#define intptr_t $tcl_cv_intptr_t
-_ACEOF
+printf "%s\n" "#define intptr_t $tcl_cv_intptr_t" >>confdefs.h
fi
-
-fi
-
-echo "$as_me:$LINENO: checking for uintptr_t" >&5
-echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
-if test "${ac_cv_type_uintptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-if ((uintptr_t *) 0)
- return 0;
-if (sizeof (uintptr_t))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_type_uintptr_t=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_type_uintptr_t=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ ;;
+esac
fi
-echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
-echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
-if test $ac_cv_type_uintptr_t = yes; then
+ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default"
+if test "x$ac_cv_type_uintptr_t" = xyes
+then :
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_UINTPTR_T 1
-_ACEOF
-
-else
- echo "$as_me:$LINENO: checking for pointer-size unsigned integer type" >&5
-echo $ECHO_N "checking for pointer-size unsigned integer type... $ECHO_C" >&6
-if test "${tcl_cv_uintptr_t+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+printf "%s\n" "#define HAVE_UINTPTR_T 1" >>confdefs.h
+else case e in #(
+ e)
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pointer-size unsigned integer type" >&5
+printf %s "checking for pointer-size unsigned integer type... " >&6; }
+if test ${tcl_cv_uintptr_t+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e)
for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned __int64" \
none; do
if test "$tcl_cv_uintptr_t" != none; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
-main ()
+main (void)
{
static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_compile "$LINENO"
+then :
tcl_ok=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-tcl_ok=no
+else case e in #(
+ e) tcl_ok=no ;;
+esac
fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
test "$tcl_ok" = yes && break; fi
- done
+ done ;;
+esac
fi
-echo "$as_me:$LINENO: result: $tcl_cv_uintptr_t" >&5
-echo "${ECHO_T}$tcl_cv_uintptr_t" >&6
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_uintptr_t" >&5
+printf "%s\n" "$tcl_cv_uintptr_t" >&6; }
if test "$tcl_cv_uintptr_t" != none; then
-cat >>confdefs.h <<_ACEOF
-#define uintptr_t $tcl_cv_uintptr_t
-_ACEOF
+printf "%s\n" "#define uintptr_t $tcl_cv_uintptr_t" >>confdefs.h
fi
-
-fi
-
-
-#--------------------------------------------------------------------
-# Windows XP theme engine header for Ttk
-#--------------------------------------------------------------------
-
-echo "$as_me:$LINENO: checking for uxtheme.h" >&5
-echo $ECHO_N "checking for uxtheme.h... $ECHO_C" >&6
-if test "${ac_cv_header_uxtheme_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <windows.h>
-
-#include <uxtheme.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_uxtheme_h=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_uxtheme_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_uxtheme_h" >&5
-echo "${ECHO_T}$ac_cv_header_uxtheme_h" >&6
-if test $ac_cv_header_uxtheme_h = yes; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_UXTHEME_H 1
-_ACEOF
-
-else
- { echo "$as_me:$LINENO: xpnative theme will be unavailable" >&5
-echo "$as_me: xpnative theme will be unavailable" >&6;}
-fi
-
-
-echo "$as_me:$LINENO: checking for vssym32.h" >&5
-echo $ECHO_N "checking for vssym32.h... $ECHO_C" >&6
-if test "${ac_cv_header_vssym32_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <windows.h>
-#include <uxtheme.h>
-
-#include <vssym32.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_header_vssym32_h=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_vssym32_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_vssym32_h" >&5
-echo "${ECHO_T}$ac_cv_header_vssym32_h" >&6
-if test $ac_cv_header_vssym32_h = yes; then
- cat >>confdefs.h <<\_ACEOF
-#define HAVE_VSSYM32_H 1
-_ACEOF
-
+ ;;
+esac
fi
-
#--------------------------------------------------------------------
# Set the default compiler switches based on the --enable-symbols
# option. This macro depends on C flags, and should be called
@@ -5181,39 +5246,35 @@ fi
#--------------------------------------------------------------------
- echo "$as_me:$LINENO: checking for build with symbols" >&5
-echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6
- # Check whether --enable-symbols or --disable-symbols was given.
-if test "${enable_symbols+set}" = set; then
- enableval="$enable_symbols"
- tcl_ok=$enableval
-else
- tcl_ok=no
-fi;
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build with symbols" >&5
+printf %s "checking for build with symbols... " >&6; }
+ # Check whether --enable-symbols was given.
+if test ${enable_symbols+y}
+then :
+ enableval=$enable_symbols; tcl_ok=$enableval
+else case e in #(
+ e) tcl_ok=no ;;
+esac
+fi
+
# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
-cat >>confdefs.h <<\_ACEOF
-#define NDEBUG 1
-_ACEOF
+printf "%s\n" "#define NDEBUG 1" >>confdefs.h
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
- cat >>confdefs.h <<\_ACEOF
-#define TCL_CFG_OPTIMIZED 1
-_ACEOF
+ printf "%s\n" "#define TCL_CFG_OPTIMIZED 1" >>confdefs.h
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
if test "$tcl_ok" = "yes"; then
- echo "$as_me:$LINENO: result: yes (standard debugging)" >&5
-echo "${ECHO_T}yes (standard debugging)" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes (standard debugging)" >&5
+printf "%s\n" "yes (standard debugging)" >&6; }
fi
fi
@@ -5221,52 +5282,319 @@ echo "${ECHO_T}yes (standard debugging)" >&6
if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
-cat >>confdefs.h <<\_ACEOF
-#define TCL_MEM_DEBUG 1
-_ACEOF
+printf "%s\n" "#define TCL_MEM_DEBUG 1" >>confdefs.h
fi
if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
-cat >>confdefs.h <<\_ACEOF
-#define TCL_COMPILE_DEBUG 1
-_ACEOF
+printf "%s\n" "#define TCL_COMPILE_DEBUG 1" >>confdefs.h
-cat >>confdefs.h <<\_ACEOF
-#define TCL_COMPILE_STATS 1
-_ACEOF
+printf "%s\n" "#define TCL_COMPILE_STATS 1" >>confdefs.h
fi
if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
if test "$tcl_ok" = "all"; then
- echo "$as_me:$LINENO: result: enabled symbols mem compile debugging" >&5
-echo "${ECHO_T}enabled symbols mem compile debugging" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled symbols mem compile debugging" >&5
+printf "%s\n" "enabled symbols mem compile debugging" >&6; }
else
- echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5
-echo "${ECHO_T}enabled $tcl_ok debugging" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5
+printf "%s\n" "enabled $tcl_ok debugging" >&6; }
fi
fi
-TK_DBGX=${DBGX}
-
#--------------------------------------------------------------------
# Embed the manifest if we can determine how
#--------------------------------------------------------------------
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+printf %s "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test ${ac_cv_prog_CPP+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) # Double quotes because $CC needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"
+then :
+
+else case e in #(
+ e) # Broken: fails on valid input.
+continue ;;
+esac
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"
+then :
+ # Broken: success on invalid input.
+continue
+else case e in #(
+ e) # Passes both tests.
+ac_preproc_ok=:
+break ;;
+esac
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok
+then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+ ;;
+esac
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+printf "%s\n" "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"
+then :
+
+else case e in #(
+ e) # Broken: fails on valid input.
+continue ;;
+esac
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"
+then :
+ # Broken: success on invalid input.
+continue
+else case e in #(
+ e) # Passes both tests.
+ac_preproc_ok=:
+break ;;
+esac
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok
+then :
+
+else case e in #(
+ e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See 'config.log' for more details" "$LINENO" 5; } ;;
+esac
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep -e" >&5
+printf %s "checking for egrep -e... " >&6; }
+if test ${ac_cv_path_EGREP_TRADITIONAL+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if test -z "$EGREP_TRADITIONAL"; then
+ ac_path_EGREP_TRADITIONAL_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_prog in grep ggrep
+ do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue
+# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found.
+ # Check for GNU $ac_path_EGREP_TRADITIONAL
+case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #(
+*GNU*)
+ ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;;
+#(
+*)
+ ac_count=0
+ printf %s 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl"
+ "$ac_path_EGREP_TRADITIONAL" -E 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL"
+ ac_path_EGREP_TRADITIONAL_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_TRADITIONAL_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then
+ :
+ fi
+else
+ ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL
+fi
+
+ if test "$ac_cv_path_EGREP_TRADITIONAL"
+then :
+ ac_cv_path_EGREP_TRADITIONAL="$ac_cv_path_EGREP_TRADITIONAL -E"
+else case e in #(
+ e) if test -z "$EGREP_TRADITIONAL"; then
+ ac_path_EGREP_TRADITIONAL_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_prog in egrep
+ do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue
+# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found.
+ # Check for GNU $ac_path_EGREP_TRADITIONAL
+case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #(
+*GNU*)
+ ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;;
+#(
+*)
+ ac_count=0
+ printf %s 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl"
+ "$ac_path_EGREP_TRADITIONAL" 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL"
+ ac_path_EGREP_TRADITIONAL_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
- echo "$as_me:$LINENO: checking whether to embed manifest" >&5
-echo $ECHO_N "checking whether to embed manifest... $ECHO_C" >&6
- # Check whether --enable-embedded-manifest or --disable-embedded-manifest was given.
-if test "${enable_embedded_manifest+set}" = set; then
- enableval="$enable_embedded_manifest"
- embed_ok=$enableval
+ $ac_path_EGREP_TRADITIONAL_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
else
- embed_ok=yes
-fi;
+ ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL
+fi
+ ;;
+esac
+fi ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP_TRADITIONAL" >&5
+printf "%s\n" "$ac_cv_path_EGREP_TRADITIONAL" >&6; }
+ EGREP_TRADITIONAL=$ac_cv_path_EGREP_TRADITIONAL
+
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to embed manifest" >&5
+printf %s "checking whether to embed manifest... " >&6; }
+ # Check whether --enable-embedded-manifest was given.
+if test ${enable_embedded_manifest+y}
+then :
+ enableval=$enable_embedded_manifest; embed_ok=$enableval
+else case e in #(
+ e) embed_ok=yes ;;
+esac
+fi
+
VC_MANIFEST_EMBED_DLL=
VC_MANIFEST_EMBED_EXE=
@@ -5274,11 +5602,7 @@ fi;
if test "$embed_ok" = "yes" -a "${SHARED_BUILD}" = "1" \
-a "$GCC" != "yes" ; then
# Add the magic to embed the manifest into the dll/exe
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#if defined(_MSC_VER) && _MSC_VER >= 1400
@@ -5287,7 +5611,8 @@ print("manifest needed")
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "manifest needed" >/dev/null 2>&1; then
+ $EGREP_TRADITIONAL "manifest needed" >/dev/null 2>&1
+then :
# Could do a CHECK_PROG for mt, but should always be with MSVC8+
# Could add 'if test -f' check, but manifest should be created
@@ -5303,31 +5628,32 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
fi
fi
-rm -f conftest*
+rm -rf conftest*
fi
- echo "$as_me:$LINENO: result: $result" >&5
-echo "${ECHO_T}$result" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $result" >&5
+printf "%s\n" "$result" >&6; }
- echo "$as_me:$LINENO: checking for tclsh in Tcl build directory" >&5
-echo $ECHO_N "checking for tclsh in Tcl build directory... $ECHO_C" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tclsh in Tcl build directory" >&5
+printf %s "checking for tclsh in Tcl build directory... " >&6; }
BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}\${EXESUFFIX}
- echo "$as_me:$LINENO: result: $BUILD_TCLSH" >&5
-echo "${ECHO_T}$BUILD_TCLSH" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BUILD_TCLSH" >&5
+printf "%s\n" "$BUILD_TCLSH" >&6; }
- echo "$as_me:$LINENO: checking for tclsh" >&5
-echo $ECHO_N "checking for tclsh... $ECHO_C" >&6
-
- if test "${ac_cv_path_tclsh+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5
+printf %s "checking for tclsh... " >&6; }
+ if test ${ac_cv_path_tclsh+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e)
search_path=`echo ${PATH} | sed -e 's/:/ /g'`
for dir in $search_path ; do
for j in `ls -r $dir/tclsh[8-9]*.exe 2> /dev/null` \
@@ -5340,23 +5666,197 @@ else
fi
done
done
-
+ ;;
+esac
fi
if test -f "$ac_cv_path_tclsh" ; then
TCLSH_PROG="$ac_cv_path_tclsh"
- echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
-echo "${ECHO_T}$TCLSH_PROG" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $TCLSH_PROG" >&5
+printf "%s\n" "$TCLSH_PROG" >&6; }
else
# It is not an error if an installed version of Tcl can't be located.
TCLSH_PROG=""
- echo "$as_me:$LINENO: result: No tclsh found on PATH" >&5
-echo "${ECHO_T}No tclsh found on PATH" >&6
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No tclsh found on PATH" >&5
+printf "%s\n" "No tclsh found on PATH" >&6; }
+ fi
+
+
+
+#--------------------------------------------------------------------
+# Zipfs support - Tip 430
+#--------------------------------------------------------------------
+# Check whether --enable-zipfs was given.
+if test ${enable_zipfs+y}
+then :
+ enableval=$enable_zipfs; tcl_ok=$enableval
+else case e in #(
+ e) tcl_ok=yes ;;
+esac
+fi
+
+if test "$tcl_ok" = "yes" ; then
+ #
+ # Find a native compiler
+ #
+ # Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+ if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+ else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5
+printf %s "checking for gcc... " >&6; }
+ if test ${ac_cv_path_cc+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e)
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/gcc 2> /dev/null` \
+ `ls -r $dir/gcc 2> /dev/null` ; do
+ if test x"$ac_cv_path_cc" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_cc=$j
+ break
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+fi
+
+ fi
+fi
+
+# Also set EXEEXT_FOR_BUILD.
+if test "x$cross_compiling" = "xno"; then
+ EXEEXT_FOR_BUILD='$(EXEEXT)'
+ OBJEXT_FOR_BUILD='$(OBJEXT)'
+else
+ OBJEXT_FOR_BUILD='.no'
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5
+printf %s "checking for build system executable suffix... " >&6; }
+if test ${bfd_cv_build_exeext+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5
+printf "%s\n" "$bfd_cv_build_exeext" >&6; }
+ EXEEXT_FOR_BUILD=""
+ test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
+fi
+
+ #
+ # Find a native zip implementation
+ #
+
+ ZIP_PROG=""
+ ZIP_PROG_OPTIONS=""
+ ZIP_PROG_VFSSEARCH=""
+ ZIP_INSTALL_OBJS=""
+
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zip" >&5
+printf %s "checking for zip... " >&6; }
+ if test ${ac_cv_path_zip+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e)
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/zip 2> /dev/null` \
+ `ls -r $dir/zip 2> /dev/null` ; do
+ if test x"$ac_cv_path_zip" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_zip=$j
+ break
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+fi
+
+ if test -f "$ac_cv_path_zip" ; then
+ ZIP_PROG="$ac_cv_path_zip"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5
+printf "%s\n" "$ZIP_PROG" >&6; }
+ ZIP_PROG_OPTIONS="-rq"
+ ZIP_PROG_VFSSEARCH="*"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Found INFO Zip in environment" >&5
+printf "%s\n" "Found INFO Zip in environment" >&6; }
+ # Use standard arguments for zip
+ else
+ # It is not an error if an installed version of Zip can't be located.
+ # We can use the locally distributed minizip instead
+ ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
+ ZIP_PROG_OPTIONS="-o -r"
+ ZIP_PROG_VFSSEARCH="*"
+ ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5
+printf "%s\n" "No zip found on PATH building minizip" >&6; }
fi
+
+
+ ZIPFS_BUILD=1
+ TK_ZIP_FILE=libtk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_PATCH_LEVEL}.zip
+else
+ ZIPFS_BUILD=0
+ TCL_ZIP_FILE=
+fi
+# Do checking message here to not mess up interleaved configure output
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5
+printf %s "checking for building with zipfs... " >&6; }
+if test "${ZIPFS_BUILD}" = 1; then
+ if test "${SHARED_BUILD}" = 0; then
+ ZIPFS_BUILD=2;
+
+printf "%s\n" "#define ZIPFS_BUILD 2" >>confdefs.h
+
+ INSTALL_LIBRARIES=install-libraries-zipfs-static
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+ else
+
+printf "%s\n" "#define ZIPFS_BUILD 1" >>confdefs.h
+\
+ INSTALL_LIBRARIES=install-libraries-zipfs-shared
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+ fi
+else
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+INSTALL_LIBRARIES=install-libraries
+INSTALL_MSGS=install-msgs
+fi
+
+
+
+
+
+
#------------------------------------------------------------------------
# tkConfig.sh refers to this by a different name
#------------------------------------------------------------------------
@@ -5372,22 +5872,45 @@ TK_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
eval "TK_SRC_DIR=\"`cd $srcdir/..; $CYGPATH $(pwd)`\""
+eval "TK_DLL_FILE_TCL8=tk$VER${DLLSUFFIX}"
+eval "TK_DLL_FILE_TCL9=tcl9tk$VER${DLLSUFFIX}"
+if test ${TCL_MAJOR_VERSION} = 8 ; then
eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}"
if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}"
else
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a"
fi
+else
+eval "TK_DLL_FILE=tcl9tk$VER${DLLSUFFIX}"
+if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then
+ eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${LIBSUFFIX}"
+else
+ eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${DLLSUFFIX}.a"
+fi
+fi
-eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}"
+if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
+ eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${LIBSUFFIX}" ;
+else
+ eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}" ;
+fi
# FIXME: All of this var junk needs to be done in tcl.m4 !!!!
# I left out the other vars that also need to get defined here.
# we also need to double check about spaces in path names
-eval "TK_LIB_FLAG=\"-ltk${VER}${LIBFLAGSUFFIX}\""
+TK_LIB_FLAG="-l"
+if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
+ TK_LIB_FLAG="${TK_LIB_FLAG}tcl9"
+fi
+eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}${VER}${LIBFLAGSUFFIX}\""
TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
eval "TK_BUILD_LIB_SPEC=\"-L`$CYGPATH $(pwd)` ${TK_LIB_FLAG}\""
-eval "TK_STUB_LIB_FLAG=\"-ltkstub${VER}${LIBFLAGSUFFIX}\""
+if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
+ eval "TK_STUB_LIB_FLAG=\"-ltkstub${LIBFLAGSUFFIX}\""
+else
+ eval "TK_STUB_LIB_FLAG=\"-ltkstub${VER}${LIBFLAGSUFFIX}\""
+fi
eval "TK_BUILD_STUB_LIB_SPEC=\"-L`$CYGPATH $(pwd)` ${TK_STUB_LIB_FLAG}\""
TK_STUB_LIB_SPEC="-L${libdir} ${TK_STUB_LIB_FLAG}"
@@ -5408,18 +5931,10 @@ CFG_TK_UNSHARED_LIB_SUFFIX=${TK_UNSHARED_LIB_SUFFIX}
#--------------------------------------------------------------------
if test ${SHARED_BUILD} = 0; then
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD ${RC_DEFINE} DEBUG"
- else
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
- fi
+ RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
TK_RES=""
else
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} DEBUG"
- else
- RC_DEFINES=""
- fi
+ RC_DEFINES=""
TK_RES='tk.$(RES)'
fi
@@ -5516,7 +6031,7 @@ TK_WIN_VERSION="$TK_VERSION.$TK_RELEASE_LEVEL.`echo $TK_PATCH_LEVEL | tr -d ab.`
- ac_config_files="$ac_config_files Makefile tkConfig.sh wish.exe.manifest"
+ac_config_files="$ac_config_files Makefile tkConfig.sh wish.exe.manifest"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -5528,47 +6043,78 @@ cat >confcache <<\_ACEOF
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# 'ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* 'ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
+# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
-{
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # 'set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
+ ;; #(
*)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ # 'set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
- esac;
-} |
+ esac |
+ sort
+) |
sed '
+ /^ac_cv_env_/b end
t clear
- : clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/
t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
- cat confcache >$cache_file
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+printf "%s\n" "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
- echo "not updating unwritable cache $cache_file"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
@@ -5577,63 +6123,53 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[ ]*$//;
-}'
-fi
-
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
#
# If the first sed substitution is executed (which looks for macros that
-# take arguments), then we branch to the quote section. Otherwise,
+# take arguments), then branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
-cat >confdef2opt.sed <<\_ACEOF
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
t clear
-: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
t quote
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
t quote
-d
-: quote
-s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
-s,\[,\\&,g
-s,\],\\&,g
-s,\$,$$,g
-p
-_ACEOF
-# We use echo to avoid assuming a particular line-breaking character.
-# The extra dot is to prevent the shell from consuming trailing
-# line-breaks from the sub-command output. A line-break within
-# single-quotes doesn't work because, if this script is created in a
-# platform that uses two characters for line-breaks (e.g., DOS), tr
-# would break.
-ac_LF_and_DOT=`echo; echo .`
-DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
-rm -f confdef2opt.sed
+b any
+:quote
+s/[][ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
ac_libobjs=
ac_ltlibobjs=
+U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
- ac_i=`echo "$ac_i" |
- sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
- # 2. Add them.
- ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
@@ -5641,12 +6177,14 @@ LTLIBOBJS=$ac_ltlibobjs
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
@@ -5656,81 +6194,237 @@ cat >$CONFIG_STATUS <<_ACEOF
debug=false
ac_cs_recheck=false
ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
+then :
emulate sh
NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
+ setopt NO_GLOB_SUBST
+else case e in #(
+ e) case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac ;;
+esac
fi
-DUALCASE=1; export DUALCASE # for MKS sh
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+# Reset variables that may have inherited troublesome values from
+# the environment.
+
+# IFS needs to be set, to space, tab, and newline, in precisely that order.
+# (If _AS_PATH_WALK were called with IFS unset, it would have the
+# side effect of setting IFS to empty, thus disabling word splitting.)
+# Quoting is to prevent editors from complaining about space-tab.
+as_nl='
+'
+export as_nl
+IFS=" "" $as_nl"
+
PS1='$ '
PS2='> '
PS4='+ '
-# NLS nuisances.
-for as_var in \
- LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
- LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
+# Ensure predictable behavior from utilities with locale-dependent output.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# We cannot yet rely on "unset" to work, but we need these variables
+# to be unset--not just set to an empty or harmless value--now, to
+# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct
+# also avoids known problems related to "unset" and subshell syntax
+# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
+for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
+do eval test \${$as_var+y} \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+
+# Ensure that fds 0, 1, and 2 are open.
+if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
+if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
+if (exec 3>&2) ; then :; else exec 2>/dev/null; fi
+
+# The user is always right.
+if ${PATH_SEPARATOR+false} :; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
do
- if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
- eval $as_var=C; export $as_var
- else
- $as_unset $as_var
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ test -r "$as_dir$0" && as_myself=$as_dir$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as 'sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
-done
+ printf "%s\n" "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
+then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else case e in #(
+ e) as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ } ;;
+esac
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
+then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else case e in #(
+ e) as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ } ;;
+esac
+fi # as_fn_arith
+
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
-# Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
-
-# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@@ -5738,181 +6432,145 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
- sed '
- N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
- t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
- ' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
- # Exit status is that of the last command.
- exit
-}
-
-
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+# Determine whether it's possible to make 'echo' print without a newline.
+# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
+# for compatibility with existing Makefiles.
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
+# For backward compatibility with old third-party macros, we provide
+# the shell variables $as_echo and $as_echo_n. New code should use
+# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
+as_echo='printf %s\n'
+as_echo_n='printf %s'
rm -f conf$$ conf$$.exe conf$$.file
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
- as_ln_s='cp -p'
- else
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable.
+ # In both cases, we have to default to 'cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
fi
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-as_executable_p="test -f"
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated
# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
+as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed '$as_sed_sh'" # deprecated
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
exec 6>&1
-
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by tk $as_me 8.6, which was
-generated by GNU Autoconf 2.59. Invocation command line was
+# values after options handling.
+ac_log="
+This file was extended by tk $as_me 8.7, which was
+generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -5920,124 +6578,118 @@ generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
_ACEOF
-# Files that config.status was made for.
-if test -n "$ac_config_files"; then
- echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
-if test -n "$ac_config_headers"; then
- echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-if test -n "$ac_config_links"; then
- echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-if test -n "$ac_config_commands"; then
- echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
-cat >>$CONFIG_STATUS <<\_ACEOF
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+'$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
-Usage: $0 [OPTIONS] [FILE]...
+Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
- -V, --version print version number, then exit
- -q, --quiet do not print progress messages
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
Configuration files:
$config_files
-Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
+Report bugs to the package provider."
-cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
+ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"`
+ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"`
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-tk config.status 8.6
-configured by $0, generated by GNU Autoconf 2.59,
- with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+tk config.status 8.7
+configured by $0, generated by GNU Autoconf 2.72,
+ with options \\"\$ac_cs_config\\"
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 2023 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+test -n "\$AWK" || AWK=awk
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value. By we need to know if files were specified by the user.
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
ac_need_defaults=:
while test $# != 0
do
case $1 in
- --*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
- -*)
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
esac
case $ac_option in
# Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ printf "%s\n" "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ printf "%s\n" "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ case $ac_optarg in
+ *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ printf "%s\n" "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
- -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; } ;;
+ -*) as_fn_error $? "unrecognized option: '$1'
+Try '$0 --help' for more information." ;;
- *) ac_config_targets="$ac_config_targets $1" ;;
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
esac
shift
@@ -6051,453 +6703,463 @@ if $ac_cs_silent; then
fi
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
fi
_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ printf "%s\n" "$ac_log"
+} >&5
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-
-
-cat >>$CONFIG_STATUS <<\_ACEOF
+# Handling of arguments.
for ac_config_target in $ac_config_targets
do
- case "$ac_config_target" in
- # Handling of arguments.
- "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "tkConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tkConfig.sh" ;;
- "wish.exe.manifest" ) CONFIG_FILES="$CONFIG_FILES wish.exe.manifest" ;;
- *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
+ case $ac_config_target in
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "tkConfig.sh") CONFIG_FILES="$CONFIG_FILES tkConfig.sh" ;;
+ "wish.exe.manifest") CONFIG_FILES="$CONFIG_FILES wish.exe.manifest" ;;
+
+ *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;;
esac
done
+
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files
fi
# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
+# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to '$tmp'.
$debug ||
{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
}
-
# Create a (secure) tmp directory for tmp files.
{
- tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
} ||
{
- tmp=./confstat$$-$RANDOM
- (umask 077 && mkdir $tmp)
-} ||
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with './config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
}
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
-#
-# CONFIG_FILES section.
-#
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@AR@,$AR,;t t
-s,@ac_ct_AR@,$ac_ct_AR,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@RC@,$RC,;t t
-s,@ac_ct_RC@,$ac_ct_RC,;t t
-s,@SET_MAKE@,$SET_MAKE,;t t
-s,@TCL_THREADS@,$TCL_THREADS,;t t
-s,@TCL_VERSION@,$TCL_VERSION,;t t
-s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t
-s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t
-s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t
-s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t
-s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t
-s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t
-s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t
-s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t
-s,@TCL_DEFS@,$TCL_DEFS,;t t
-s,@CYGPATH@,$CYGPATH,;t t
-s,@CELIB_DIR@,$CELIB_DIR,;t t
-s,@DL_LIBS@,$DL_LIBS,;t t
-s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t
-s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t
-s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t
-s,@CFLAGS_NOLTO@,$CFLAGS_NOLTO,;t t
-s,@MAN2TCLFLAGS@,$MAN2TCLFLAGS,;t t
-s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t
-s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t
-s,@VC_MANIFEST_EMBED_DLL@,$VC_MANIFEST_EMBED_DLL,;t t
-s,@VC_MANIFEST_EMBED_EXE@,$VC_MANIFEST_EMBED_EXE,;t t
-s,@BUILD_TCLSH@,$BUILD_TCLSH,;t t
-s,@TCLSH_PROG@,$TCLSH_PROG,;t t
-s,@TK_WIN_VERSION@,$TK_WIN_VERSION,;t t
-s,@MACHINE@,$MACHINE,;t t
-s,@TK_VERSION@,$TK_VERSION,;t t
-s,@TK_MAJOR_VERSION@,$TK_MAJOR_VERSION,;t t
-s,@TK_MINOR_VERSION@,$TK_MINOR_VERSION,;t t
-s,@TK_PATCH_LEVEL@,$TK_PATCH_LEVEL,;t t
-s,@TK_DBGX@,$TK_DBGX,;t t
-s,@TK_LIB_FILE@,$TK_LIB_FILE,;t t
-s,@TK_DLL_FILE@,$TK_DLL_FILE,;t t
-s,@TK_STUB_LIB_FILE@,$TK_STUB_LIB_FILE,;t t
-s,@TK_STUB_LIB_FLAG@,$TK_STUB_LIB_FLAG,;t t
-s,@TK_BUILD_STUB_LIB_SPEC@,$TK_BUILD_STUB_LIB_SPEC,;t t
-s,@TK_SRC_DIR@,$TK_SRC_DIR,;t t
-s,@TK_BIN_DIR@,$TK_BIN_DIR,;t t
-s,@TCL_MAJOR_VERSION@,$TCL_MAJOR_VERSION,;t t
-s,@TCL_MINOR_VERSION@,$TCL_MINOR_VERSION,;t t
-s,@TCL_PATCH_LEVEL@,$TCL_PATCH_LEVEL,;t t
-s,@TCL_DBGX@,$TCL_DBGX,;t t
-s,@CFG_TK_SHARED_LIB_SUFFIX@,$CFG_TK_SHARED_LIB_SUFFIX,;t t
-s,@CFG_TK_UNSHARED_LIB_SUFFIX@,$CFG_TK_UNSHARED_LIB_SUFFIX,;t t
-s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t
-s,@DEPARG@,$DEPARG,;t t
-s,@CC_OBJNAME@,$CC_OBJNAME,;t t
-s,@CC_EXENAME@,$CC_EXENAME,;t t
-s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t
-s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t
-s,@LDFLAGS_CONSOLE@,$LDFLAGS_CONSOLE,;t t
-s,@LDFLAGS_WINDOW@,$LDFLAGS_WINDOW,;t t
-s,@TK_RES@,$TK_RES,;t t
-s,@STLIB_LD@,$STLIB_LD,;t t
-s,@SHLIB_LD@,$SHLIB_LD,;t t
-s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t
-s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t
-s,@SHLIB_SUFFIX@,$SHLIB_SUFFIX,;t t
-s,@TK_SHARED_BUILD@,$TK_SHARED_BUILD,;t t
-s,@LIBS_GUI@,$LIBS_GUI,;t t
-s,@DLLSUFFIX@,$DLLSUFFIX,;t t
-s,@LIBPREFIX@,$LIBPREFIX,;t t
-s,@LIBSUFFIX@,$LIBSUFFIX,;t t
-s,@EXESUFFIX@,$EXESUFFIX,;t t
-s,@LIBRARIES@,$LIBRARIES,;t t
-s,@MAKE_LIB@,$MAKE_LIB,;t t
-s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t
-s,@POST_MAKE_LIB@,$POST_MAKE_LIB,;t t
-s,@MAKE_DLL@,$MAKE_DLL,;t t
-s,@MAKE_EXE@,$MAKE_EXE,;t t
-s,@TK_LIB_FLAG@,$TK_LIB_FLAG,;t t
-s,@TK_LIB_SPEC@,$TK_LIB_SPEC,;t t
-s,@TK_BUILD_LIB_SPEC@,$TK_BUILD_LIB_SPEC,;t t
-s,@TK_STUB_LIB_SPEC@,$TK_STUB_LIB_SPEC,;t t
-s,@TK_STUB_LIB_PATH@,$TK_STUB_LIB_PATH,;t t
-s,@TK_BUILD_STUB_LIB_PATH@,$TK_BUILD_STUB_LIB_PATH,;t t
-s,@TK_CC_SEARCH_FLAGS@,$TK_CC_SEARCH_FLAGS,;t t
-s,@TK_LD_SEARCH_FLAGS@,$TK_LD_SEARCH_FLAGS,;t t
-s,@RC_OUT@,$RC_OUT,;t t
-s,@RC_TYPE@,$RC_TYPE,;t t
-s,@RC_INCLUDE@,$RC_INCLUDE,;t t
-s,@RC_DEFINE@,$RC_DEFINE,;t t
-s,@RC_DEFINES@,$RC_DEFINES,;t t
-s,@RES@,$RES,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-_ACEOF
+eval set X " :F $CONFIG_FILES "
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
- cat >>$CONFIG_STATUS <<\_ACEOF
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain ':'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is 'configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+printf "%s\n" "$as_me: creating $ac_file" >&6;}
fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
- fi
-fi # test -n "$CONFIG_FILES"
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`printf "%s\n" "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
esac
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+ ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+printf "%s\n" X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
case $srcdir in
- .) # No --srcdir option. We are building in place.
+ .) # We are building in place.
ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
- case "$ac_dir" in
- .) ac_abs_builddir=`pwd`;;
- [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
- *) ac_abs_builddir=`pwd`/"$ac_dir";;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
- case ${ac_top_builddir}. in
- .) ac_abs_top_builddir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
- *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
- case $ac_srcdir in
- .) ac_abs_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
- *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
- esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
- case $ac_top_srcdir in
- .) ac_abs_top_srcdir=$ac_abs_builddir;;
- [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
- *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
- esac;;
-esac
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+_ACEOF
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo "$f";;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo "$f"
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo "$srcdir/$f"
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- sed "$ac_vpsub
+
+# Neutralize VPATH when '$srcdir' = '.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-{ (exit 0); exit 0; }
+ esac
+
+done # for ac_tag
+
+
+as_fn_exit 0
_ACEOF
-chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
@@ -6517,7 +7179,12 @@ if test "$no_create" != yes; then
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
diff --git a/win/configure.in b/win/configure.ac
index 8fe1feb..752b0a6 100644
--- a/win/configure.in
+++ b/win/configure.ac
@@ -3,19 +3,19 @@
# generate the file "configure", which is run during Tk installation
# to configure the system for the local environment.
-AC_INIT([tk],[8.6])
+AC_INIT([tk],[8.7])
AC_CONFIG_SRCDIR([../generic/tk.h])
-AC_PREREQ([2.59])
+AC_PREREQ([2.69])
# The following define is needed when building with Cygwin since newer
# versions of autoconf incorrectly set SHELL to /bin/bash instead of
# /bin/sh. The bash shell seems to suffer from some strange failures.
SHELL=/bin/sh
-TK_VERSION=8.6
+TK_VERSION=8.7
TK_MAJOR_VERSION=8
-TK_MINOR_VERSION=6
-TK_PATCH_LEVEL=".14"
+TK_MINOR_VERSION=7
+TK_PATCH_LEVEL="b1"
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
#------------------------------------------------------------------------
@@ -43,7 +43,7 @@ fi
AC_PROG_CC
AC_C_INLINE
-AC_HEADER_STDC
+AC_CHECK_INCLUDES_DEFAULT
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib)
@@ -63,12 +63,6 @@ AC_OBJEXT
AC_EXEEXT
#--------------------------------------------------------------------
-# Check whether --enable-threads or --disable-threads was given.
-#--------------------------------------------------------------------
-
-SC_ENABLE_THREADS
-
-#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtk as a shared library instead of a static library.
#--------------------------------------------------------------------
@@ -82,15 +76,17 @@ SC_ENABLE_SHARED
SC_PATH_TCLCONFIG($TK_PATCH_LEVEL)
SC_LOAD_TCLCONFIG
+if test "${TCL_MAJOR_VERSION}" -lt 9 ; then
if test "${TCL_MAJOR_VERSION}" != "${TK_MAJOR_VERSION}"; then
AC_MSG_ERROR([${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}.])
+Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+.
+Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better.])
fi
-if test "${TCL_MINOR_VERSION}" -lt "${TK_MINOR_VERSION}"; then
+if test "${TCL_MINOR_VERSION}" -lt 6; then
AC_MSG_ERROR([${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
-Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
-Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}.])
+Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+.
+Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better.])
+fi
fi
#--------------------------------------------------------------------
@@ -101,6 +97,10 @@ fi
SC_CONFIG_CFLAGS
+AC_CHECK_TYPES([intptr_t, uintptr_t],,,[[
+#include <stdint.h>
+]])
+
#--------------------------------------------------------------------
# man2tcl needs this so that it can use errno.h
#--------------------------------------------------------------------
@@ -152,17 +152,6 @@ AC_CHECK_TYPE([uintptr_t], [
])
#--------------------------------------------------------------------
-# Windows XP theme engine header for Ttk
-#--------------------------------------------------------------------
-
-AC_CHECK_HEADER([uxtheme.h], [AC_DEFINE(HAVE_UXTHEME_H)],
- [AC_MSG_NOTICE([xpnative theme will be unavailable])],
- [#include <windows.h>])
-AC_CHECK_HEADER([vssym32.h], [AC_DEFINE(HAVE_VSSYM32_H)], [],
- [#include <windows.h>
-#include <uxtheme.h>])
-
-#--------------------------------------------------------------------
# Set the default compiler switches based on the --enable-symbols
# option. This macro depends on C flags, and should be called
# after SC_CONFIG_CFLAGS macro is called.
@@ -170,8 +159,6 @@ AC_CHECK_HEADER([vssym32.h], [AC_DEFINE(HAVE_VSSYM32_H)], [],
SC_ENABLE_SYMBOLS
-TK_DBGX=${DBGX}
-
#--------------------------------------------------------------------
# Embed the manifest if we can determine how
#--------------------------------------------------------------------
@@ -181,6 +168,52 @@ SC_EMBED_MANIFEST(wish.exe.manifest)
SC_BUILD_TCLSH
SC_PROG_TCLSH
+#--------------------------------------------------------------------
+# Zipfs support - Tip 430
+#--------------------------------------------------------------------
+AC_ARG_ENABLE(zipfs,
+ AS_HELP_STRING([--enable-zipfs],
+ [build with Zipfs support (default: on)]),
+ [tcl_ok=$enableval], [tcl_ok=yes])
+if test "$tcl_ok" = "yes" ; then
+ #
+ # Find a native compiler
+ #
+ AX_CC_FOR_BUILD
+ #
+ # Find a native zip implementation
+ #
+ SC_ZIPFS_SUPPORT
+ ZIPFS_BUILD=1
+ TK_ZIP_FILE=libtk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_PATCH_LEVEL}.zip
+else
+ ZIPFS_BUILD=0
+ TCL_ZIP_FILE=
+fi
+# Do checking message here to not mess up interleaved configure output
+AC_MSG_CHECKING([for building with zipfs])
+if test "${ZIPFS_BUILD}" = 1; then
+ if test "${SHARED_BUILD}" = 0; then
+ ZIPFS_BUILD=2;
+ AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?])
+ INSTALL_LIBRARIES=install-libraries-zipfs-static
+ AC_MSG_RESULT([yes])
+ else
+ AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\
+ INSTALL_LIBRARIES=install-libraries-zipfs-shared
+ AC_MSG_RESULT([yes])
+ fi
+else
+AC_MSG_RESULT([no])
+INSTALL_LIBRARIES=install-libraries
+INSTALL_MSGS=install-msgs
+fi
+AC_SUBST(ZIPFS_BUILD)
+AC_SUBST(TK_ZIP_FILE)
+AC_SUBST(INSTALL_LIBRARIES)
+AC_SUBST(INSTALL_MSGS)
+
+
#------------------------------------------------------------------------
# tkConfig.sh refers to this by a different name
#------------------------------------------------------------------------
@@ -196,22 +229,45 @@ TK_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
eval "TK_SRC_DIR=\"`cd $srcdir/..; $CYGPATH $(pwd)`\""
+eval "TK_DLL_FILE_TCL8=tk$VER${DLLSUFFIX}"
+eval "TK_DLL_FILE_TCL9=tcl9tk$VER${DLLSUFFIX}"
+if test ${TCL_MAJOR_VERSION} = 8 ; then
eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}"
if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}"
else
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a"
fi
+else
+eval "TK_DLL_FILE=tcl9tk$VER${DLLSUFFIX}"
+if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then
+ eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${LIBSUFFIX}"
+else
+ eval "TK_LIB_FILE=${LIBPREFIX}tcl9tk${VER}${DLLSUFFIX}.a"
+fi
+fi
-eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}"
+if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
+ eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${LIBSUFFIX}" ;
+else
+ eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}" ;
+fi
# FIXME: All of this var junk needs to be done in tcl.m4 !!!!
# I left out the other vars that also need to get defined here.
# we also need to double check about spaces in path names
-eval "TK_LIB_FLAG=\"-ltk${VER}${LIBFLAGSUFFIX}\""
+TK_LIB_FLAG="-l"
+if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
+ TK_LIB_FLAG="${TK_LIB_FLAG}tcl9"
+fi
+eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}${VER}${LIBFLAGSUFFIX}\""
TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
eval "TK_BUILD_LIB_SPEC=\"-L`$CYGPATH $(pwd)` ${TK_LIB_FLAG}\""
-eval "TK_STUB_LIB_FLAG=\"-ltkstub${VER}${LIBFLAGSUFFIX}\""
+if test "${TCL_MAJOR_VERSION}" -gt 8 ; then
+ eval "TK_STUB_LIB_FLAG=\"-ltkstub${LIBFLAGSUFFIX}\""
+else
+ eval "TK_STUB_LIB_FLAG=\"-ltkstub${VER}${LIBFLAGSUFFIX}\""
+fi
eval "TK_BUILD_STUB_LIB_SPEC=\"-L`$CYGPATH $(pwd)` ${TK_STUB_LIB_FLAG}\""
TK_STUB_LIB_SPEC="-L${libdir} ${TK_STUB_LIB_FLAG}"
@@ -232,18 +288,10 @@ CFG_TK_UNSHARED_LIB_SUFFIX=${TK_UNSHARED_LIB_SUFFIX}
#--------------------------------------------------------------------
if test ${SHARED_BUILD} = 0; then
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD ${RC_DEFINE} DEBUG"
- else
- RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
- fi
+ RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
TK_RES=""
else
- if test "${DBGX}" = "d"; then
- RC_DEFINES="${RC_DEFINE} DEBUG"
- else
- RC_DEFINES=""
- fi
+ RC_DEFINES=""
TK_RES='tk.$(RES)'
fi
@@ -264,9 +312,10 @@ AC_SUBST(TK_VERSION)
AC_SUBST(TK_MAJOR_VERSION)
AC_SUBST(TK_MINOR_VERSION)
AC_SUBST(TK_PATCH_LEVEL)
-AC_SUBST(TK_DBGX)
AC_SUBST(TK_LIB_FILE)
AC_SUBST(TK_DLL_FILE)
+AC_SUBST(TK_DLL_FILE_TCL8)
+AC_SUBST(TK_DLL_FILE_TCL9)
AC_SUBST(TK_STUB_LIB_FILE)
AC_SUBST(TK_STUB_LIB_FLAG)
AC_SUBST(TK_BUILD_STUB_LIB_SPEC)
@@ -280,7 +329,6 @@ AC_SUBST(TCL_PATCH_LEVEL)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_BIN_DIR)
-AC_SUBST(TCL_DBGX)
AC_SUBST(CFG_TK_SHARED_LIB_SUFFIX)
AC_SUBST(CFG_TK_UNSHARED_LIB_SUFFIX)
diff --git a/win/makefile.vc b/win/makefile.vc
index 3858102..6356ad9 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -20,8 +20,9 @@
# For MACRODEF, see TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md)
# or examine Sections 7-9 in rules.vc. This makefile has the following
# values for the OPTS macro in addition to the ones described there.
-# noxp = If you do not have the uxtheme.h header then you
-# cannot include support for XP themeing.
+# noembed = Embeds Tcl scripts into the wish executable. Currently only
+# applicable for static builds. Non-static builds currently
+# never embed.
# square = Include the demo square widget.
#
# Possible values for TARGET are:
@@ -88,6 +89,12 @@ RCFILE = tk.rc
# the build configuration, macros, output directories etc.
!include "rules-ext.vc"
+!if ($(TCL_MAJOR_VERSION) > 8) || ($(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) > 6)
+USING_PRE87_TCL = 0
+!else
+USING_PRE87_TCL = 1
+!endif
+
# TCLINSTALL is set to 1 by rules.vc to indicate we are building against
# an installed Tcl and 0 if building against Tcl source. Tk needs the latter.
!if $(TCLINSTALL)
@@ -98,21 +105,33 @@ RCFILE = tk.rc
# Extra makefile options processing for non-standard OPTS values ...
!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
-HAVE_UXTHEME_H = 1
TTK_SQUARE_WIDGET = 0
+TK_EMBED_SCRIPTS = 1
!else
-!if [nmakehlp -f $(OPTS) "noxp"]
-!message *** Exclude support for XP theme
-HAVE_UXTHEME_H = 0
-!else
-HAVE_UXTHEME_H = 1
-!endif
!if [nmakehlp -f "$(OPTS)" "square"]
!message *** Include ttk square demo widget
TTK_SQUARE_WIDGET = 1
!else
TTK_SQUARE_WIDGET = 0
!endif
+!if [nmakehlp -f $(OPTS) "noembed"]
+!message *** Option noembed specified. Tk script library will not be appended to the binary.
+TK_EMBED_SCRIPTS = 0
+!else
+!message *** Tk script library will be appended to the binary.
+TK_EMBED_SCRIPTS = 1
+!endif
+!endif
+
+!if $(USING_PRE87_TCL)
+TK_EMBED_SCRIPTS = 0
+!endif
+
+TK_NO_DEPRECATED = 0
+!if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"]
+!if [nmakehlp -f $(CHECKS) "nodep"]
+TK_NO_DEPRECATED = 1
+!endif
!endif
WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe"
@@ -122,7 +141,7 @@ CAT32 = "$(OUT_DIR)\cat32.exe"
WISHOBJS = \
$(TMP_DIR)\winMain.obj \
-!if $(TCL_USE_STATIC_PACKAGES)
+!if $(STATIC_BUILD) && !$(STATIC_BUILD)
$(TCLDDELIB) \
$(TCLREGLIB) \
!endif
@@ -159,6 +178,8 @@ TKOBJS = \
$(TMP_DIR)\tkWinDraw.obj \
$(TMP_DIR)\tkWinEmbed.obj \
$(TMP_DIR)\tkWinFont.obj \
+ $(TMP_DIR)\tkWinGDI.obj \
+ $(TMP_DIR)\tkWinIco.obj \
$(TMP_DIR)\tkWinImage.obj \
$(TMP_DIR)\tkWinInit.obj \
$(TMP_DIR)\tkWinKey.obj \
@@ -169,6 +190,7 @@ TKOBJS = \
$(TMP_DIR)\tkWinScrlbr.obj \
$(TMP_DIR)\tkWinSend.obj \
$(TMP_DIR)\tkWinSendCom.obj \
+ $(TMP_DIR)\tkWinSysTray.obj \
$(TMP_DIR)\tkWinWindow.obj \
$(TMP_DIR)\tkWinWm.obj \
$(TMP_DIR)\tkWinX.obj \
@@ -207,11 +229,14 @@ TKOBJS = \
$(TMP_DIR)\tkGet.obj \
$(TMP_DIR)\tkGrab.obj \
$(TMP_DIR)\tkGrid.obj \
+ $(TMP_DIR)\tkIcu.obj \
$(TMP_DIR)\tkImage.obj \
$(TMP_DIR)\tkImgBmap.obj \
+ $(TMP_DIR)\tkImgListFormat.obj \
$(TMP_DIR)\tkImgGIF.obj \
$(TMP_DIR)\tkImgPNG.obj \
$(TMP_DIR)\tkImgPPM.obj \
+ $(TMP_DIR)\tkImgSVGnano.obj \
$(TMP_DIR)\tkImgPhoto.obj \
$(TMP_DIR)\tkImgPhInstance.obj \
$(TMP_DIR)\tkImgUtil.obj \
@@ -228,6 +253,7 @@ TKOBJS = \
$(TMP_DIR)\tkOldConfig.obj \
$(TMP_DIR)\tkOption.obj \
$(TMP_DIR)\tkPack.obj \
+ $(TMP_DIR)\tkPkgConfig.obj \
$(TMP_DIR)\tkPlace.obj \
$(TMP_DIR)\tkPointer.obj \
$(TMP_DIR)\tkRectOval.obj \
@@ -299,25 +325,30 @@ XLIBDIR = $(ROOT)\xlib
TTKDIR = $(ROOT)\generic\ttk
BITMAPDIR = $(ROOT)\bitmaps
+# Directories where to build TIP430 ZIP files
+# One for Tk - always built, contains Tk scripts
+# One for Wish - for static builds, contains Tcl+Tk scripts
+LIBTKVFS = $(OUT_DIR)\libtk.vfs
+WISHSCRIPTZIP = $(OUT_DIR)\wish.zip
+
# Additional include and C macro definitions for the implicit rules
# defined in rules.vc
PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)"
-CONFIG_DEFS =/DSTDC_HEADERS=1 /DHAVE_SYS_TYPES_H=1 /DHAVE_SYS_STAT_H=1 \
- /DHAVE_STDLIB_H=1 /DHAVE_STRING_H=1 /DHAVE_MEMORY_H=1 \
- /DHAVE_STRINGS_H=1 \
-!if $(HAVE_UXTHEME_H)
- /DHAVE_UXTHEME_H=1 \
-!endif
+CONFIG_DEFS =/DHAVE_SYS_TYPES_H=1 /DHAVE_SYS_STAT_H=1 \
+ /DHAVE_STRING_H=1 /DHAVE_MEMORY_H=1 \
+ /DHAVE_STRINGS_H=1 /DTCL_UTF_MAX=3 \
!if $(TTK_SQUARE_WIDGET)
/DTTK_SQUARE_WIDGET=1 \
!endif
+!if $(TK_NO_DEPRECATED)
+ /DTK_NO_DEPRECATED=1
+!endif
PRJ_DEFINES = /DBUILD_ttk $(CONFIG_DEFS) /Dinline=__inline /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
# Additional Link libraries needed beyond those in rules.vc
-PRJ_LIBS = netapi32.lib gdi32.lib user32.lib userenv.lib
-
+PRJ_LIBS = netapi32.lib gdi32.lib user32.lib userenv.lib winspool.lib shell32.lib ole32.lib uuid.lib
#---------------------------------------------------------------------
# TkTest flags
@@ -332,9 +363,26 @@ TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
#---------------------------------------------------------------------
release: setup $(TKSTUBLIB) $(WISH)
+!if !$(USING_PRE87_TCL)
+release: libtkzip embed
+!endif
all: release $(CAT32)
core: setup $(TKSTUBLIB) $(TKLIB)
cwish: $(WISHC)
+libtkzip: setup $(TKSCRIPTZIP)
+!if $(TK_EMBED_SCRIPTS)
+!if $(STATIC_BUILD)
+embed: setup $(WISH) $(WISHSCRIPTZIP)
+ @copy /y /b "$(WISH)"+"$(WISHSCRIPTZIP)" "$(WISH)"
+!else
+embed: setup $(TKLIB) $(TKSCRIPTZIP)
+ @copy /y /b "$(TKLIB)"+"$(TKSCRIPTZIP)" "$(TKLIB)"
+!endif
+!else
+# ! TK_EMBED_SCRIPTS - still need to build the zip even if not embedded
+embed: $(TKSCRIPTZIP)
+!endif
+
install: install-binaries install-libraries install-docs
!if $(SYMBOLS)
install: install-pdbs
@@ -451,6 +499,32 @@ $(TKTEST): $(TKTESTOBJS) $(TKSTUBLIB) $(TKIMPLIB)
$(GUIEXECMD) -stack:2300000 $**
$(_VC_MANIFEST_EMBED_EXE)
+TKSCRIPTZIPTOP = tk_library
+#TKSCRIPTZIPTOP = "tk$(DOTVERSION)"
+$(TKSCRIPTZIP): .PHONY
+ @echo Building Tk library zip file
+ @if not exist "$(LIBTKVFS)" $(MKDIR) "$(LIBTKVFS)"
+ @if exist "$(LIBTKVFS)\$(TKSCRIPTZIPTOP)" $(RMDIR) "$(LIBTKVFS)\$(TKSCRIPTZIPTOP)"
+ @$(CPYDIR) $(LIBDIR) "$(LIBTKVFS)\$(TKSCRIPTZIPTOP)"
+ @$(TCLSH) <<
+cd {$(OUT_DIR)}
+file delete -force {$@}
+zipfs mkzip {$@} {$(LIBTKVFS)} {$(LIBTKVFS)}
+<<
+
+!if $(STATIC_BUILD)
+$(WISHSCRIPTZIP): $(TKSCRIPTZIP)
+ @echo Building Wish Tcl+Tk library zip file
+ @if exist "$(LIBTKVFS)\tcl_library" $(RMDIR) "$(LIBTKVFS)\tcl_library"
+ @$(TCLSH) <<
+cd {$(OUT_DIR)}
+file delete -force {$@}
+zipfs mount "$(TCLSCRIPTZIP:\=/)" mnt
+file copy [file join [zipfs root] mnt tcl_library] "$(LIBTKVFS:\=/)"
+zipfs mkzip {$@} {$(LIBTKVFS)} {$(LIBTKVFS)}
+<<
+!endif
+
$(CAT32): $(_TCLDIR)\win\cat.c
$(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE /DUNICODE /D_UNICODE -Fo$(TMP_DIR)\ $?
@@ -529,9 +603,10 @@ install-pdbs:
# Special case object file targets
#---------------------------------------------------------------------
+# Note: Static builds now always mandate statically linking Tcl registry etc.
$(TMP_DIR)\testMain.obj: $(WIN_DIR)\winMain.c
$(cc32) $(appcflags_nostubs) /DTK_TEST /DUNICODE /D_UNICODE \
- /DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
+ /DTCL_USE_STATIC_PACKAGES=$(STATIC_BUILD) \
-Fo$@ $?
$(ROOT)\manifest.uuid:
@@ -553,14 +628,20 @@ $(TMP_DIR)\tkWinTest.obj: $(WIN_DIR)\tkWinTest.c
$(TMP_DIR)\tkSquare.obj: $(GENERICDIR)\tkSquare.c
$(cc32) $(appcflags_nostubs) -Fo$@ $?
+# Note: Static builds now always mandate statically linking Tcl registry etc.
$(TMP_DIR)\winMain.obj: $(WIN_DIR)\winMain.c
$(cc32) $(appcflags_nostubs) /DUNICODE /D_UNICODE \
- /DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
+ /DTCL_USE_STATIC_PACKAGES=$(STATIC_BUILD) \
-Fo$@ $?
$(TMP_DIR)\tkMain2.obj: $(GENERICDIR)\tkMain.c
$(cc32) $(pkgcflags) /DUNICODE /D_UNICODE -Fo$@ $?
+$(TMP_DIR)\tkPkgConfig.obj: $(GENERICDIR)\tkPkgConfig.c
+ $(cc32) $(pkgcflags) \
+ -DCFG_RUNTIME_DLLFILE="\"$(TKLIBNAME)\"" \
+ -Fo$@ $?
+
$(TMP_DIR)\tkWindow.obj: $(GENERICDIR)\tkWindow.c $(TMP_DIR)\tkUuid.h
$(cc32) $(pkgcflags) -I$(TMP_DIR) -Fo$@ $?
@@ -606,7 +687,6 @@ $(TKOBJS)
#---------------------------------------------------------------------
$(TMP_DIR)\tk.res: \
- $(RCDIR)\buttons.bmp \
$(RCDIR)\cursor*.cur \
$(RCDIR)\tk.ico
@@ -662,13 +742,22 @@ install-binaries:
!if !$(STATIC_BUILD)
@echo creating package index
@type << > $(OUT_DIR)\pkgIndex.tcl
-if {![package vsatisfies [package provide Tcl] 8.6.0]} return
+if {![package vsatisfies [package provide Tcl] 8.7-]} return
if {($$::tcl_platform(platform) eq "unix") && ([info exists ::env(DISPLAY)]
|| ([info exists ::argv] && ("-display" in $$::argv)))} {
- package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin libtk$(DOTVERSION).dll]]
+ if {[package vsatisfies [package provide Tcl] 9.0]} {
+ package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin libtcl9tk$(DOTVERSION).dll]]]
+ } else {
+ package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin libtk$(DOTVERSION).dll]]]
+ }
} else {
- package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin $(TKLIBNAME)]]
+ if {[package vsatisfies [package provide Tcl] 9.0]} {
+ package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin $(TKLIBNAME9)]]]
+ } else {
+ package ifneeded tk $(TK_PATCH_LEVEL) [list load [file normalize [file join $$dir .. .. bin $(TKLIBNAME8)]]]
+ }
}
+package ifneeded Tk $(TK_PATCH_LEVEL) [list package require -exact tk $(TK_PATCH_LEVEL)]
<<
@$(CPY) $(OUT_DIR)\pkgIndex.tcl "$(SCRIPT_INSTALL_DIR)\"
!endif
@@ -682,6 +771,10 @@ install-libraries:
@$(CPY) "$(GENERICDIR)\tkPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(GENERICDIR)\tkIntXlibDecls.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(XLIBDIR)\X11\*.h" "$(INCLUDE_INSTALL_DIR)\X11\"
+!if !$(USING_PRE87_TCL)
+ @$(CPY) "$(TKSCRIPTZIP)" "$(LIB_INSTALL_DIR)"
+!endif
+!if !$(TK_EMBED_SCRIPTS)
@echo installing script library
@$(CPY) "$(LIBDIR)\*" "$(SCRIPT_INSTALL_DIR)\"
@echo installing theme library
@@ -690,6 +783,7 @@ install-libraries:
@$(CPY) "$(LIBDIR)\images\*" "$(SCRIPT_INSTALL_DIR)\images\"
@echo installing language files
@$(CPY) "$(LIBDIR)\msgs\*" "$(SCRIPT_INSTALL_DIR)\msgs\"
+!endif
@echo installing demos
@$(CPY) "$(DEMODIR)\*" "$(DEMO_INSTALL_DIR)\"
@$(CPY) "$(DEMODIR)\images\*" "$(DEMO_INSTALL_DIR)\images\"
@@ -717,3 +811,8 @@ tidy:
@echo Removing $(TKSTUBLIB) ...
@if exist $(TKSTUBLIB) del $(TKSTUBLIB)
+.PHONY:
+
+# Local Variables:
+# mode: makefile
+# End:
diff --git a/win/mkd.bat b/win/mkd.bat
deleted file mode 100644
index 1bd5ccb..0000000
--- a/win/mkd.bat
+++ /dev/null
@@ -1,12 +0,0 @@
-@echo off
-
-if exist %1\nul goto end
-
-md %1
-if errorlevel 1 goto end
-
-echo Created directory %1
-
-:end
-
-
diff --git a/win/rc/buttons.bmp b/win/rc/buttons.bmp
deleted file mode 100644
index f37a4c9..0000000
--- a/win/rc/buttons.bmp
+++ /dev/null
Binary files differ
diff --git a/win/rc/lamp.bmp b/win/rc/lamp.bmp
deleted file mode 100644
index 1e2f9d4..0000000
--- a/win/rc/lamp.bmp
+++ /dev/null
Binary files differ
diff --git a/win/rc/tk.rc b/win/rc/tk.rc
index 45f508f..6a23236 100644
--- a/win/rc/tk.rc
+++ b/win/rc/tk.rc
@@ -8,19 +8,13 @@
//
// build-up the name suffix that defines the type of build this is.
//
-#if TCL_THREADS
-#define SUFFIX_THREADS "t"
-#else
-#define SUFFIX_THREADS ""
-#endif
-
#if DEBUG && !UNCHECKED
#define SUFFIX_DEBUG "g"
#else
#define SUFFIX_DEBUG ""
#endif
-#define SUFFIX SUFFIX_THREADS SUFFIX_DEBUG
+#define SUFFIX SUFFIX_DEBUG
VS_VERSION_INFO VERSIONINFO
diff --git a/win/rc/tk_base.rc b/win/rc/tk_base.rc
index e6ab016..143ff44 100644
--- a/win/rc/tk_base.rc
+++ b/win/rc/tk_base.rc
@@ -50,12 +50,6 @@ END
//
-// Bitmaps
-//
-
-buttons BITMAP DISCARDABLE "buttons.bmp"
-
-//
// Cursors
//
diff --git a/win/rc/wish.rc b/win/rc/wish.rc
index 85a33e3..572e82d 100644
--- a/win/rc/wish.rc
+++ b/win/rc/wish.rc
@@ -8,12 +8,6 @@
//
// build-up the name suffix that defines the type of build this is.
//
-#if TCL_THREADS
-#define SUFFIX_THREADS "t"
-#else
-#define SUFFIX_THREADS ""
-#endif
-
#if STATIC_BUILD
#define SUFFIX_STATIC "s"
#else
@@ -26,7 +20,7 @@
#define SUFFIX_DEBUG ""
#endif
-#define SUFFIX SUFFIX_THREADS SUFFIX_STATIC SUFFIX_DEBUG
+#define SUFFIX SUFFIX_STATIC SUFFIX_DEBUG
VS_VERSION_INFO VERSIONINFO
diff --git a/win/rmd.bat b/win/rmd.bat
deleted file mode 100644
index 820b76f..0000000
--- a/win/rmd.bat
+++ /dev/null
@@ -1,20 +0,0 @@
-@echo off
-
-if not exist %1\nul goto end
-
-echo Removing directory %1
-
-if "%OS%" == "Windows_NT" goto winnt
-
-deltree /y %1
-if errorlevel 1 goto end
-goto success
-
-:winnt
-rmdir /s /q %1
-if errorlevel 1 goto end
-
-:success
-echo Deleted directory %1
-
-:end
diff --git a/win/rules.vc b/win/rules.vc
index b15978f..143ea9e 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -24,7 +24,7 @@ _RULES_VC = 1
# For modifications that are not backward-compatible, you *must* change
# the major version.
RULES_VERSION_MAJOR = 1
-RULES_VERSION_MINOR = 10
+RULES_VERSION_MINOR = 11
# The PROJECT macro must be defined by parent makefile.
!if "$(PROJECT)" == ""
@@ -877,6 +877,11 @@ TCL_THREADS = 0
USE_THREAD_ALLOC= 0
!endif
+!if [nmakehlp -f $(OPTS) "tcl8"]
+!message *** Build for Tcl8
+TCL_BUILD_FOR = 8
+!endif
+
!if $(TCL_MAJOR_VERSION) == 8
!if [nmakehlp -f $(OPTS) "time64bit"]
!message *** Force 64-bit time_t
@@ -1089,7 +1094,7 @@ SUFX = $(SUFX:x=)
!else
TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=)
EXT = lib
-!if !$(MSVCRT)
+!if $(MSVCRT) && $(TCL_VERSION) > 86 || !$(MSVCRT) && $(TCL_VERSION) < 87
TMP_DIRFULL = $(TMP_DIRFULL:X=)
SUFX = $(SUFX:x=)
!endif
@@ -1141,7 +1146,11 @@ TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
TCLLIB = $(OUT_DIR)\$(TCLLIBNAME)
TCLSCRIPTZIP = $(OUT_DIR)\$(TCLSCRIPTZIPNAME)
+!if $(TCL_MAJOR_VERSION) == 8
TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
+!else
+TCLSTUBLIBNAME = $(STUBPREFIX).lib
+!endif
TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME)
TCL_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)"
@@ -1157,7 +1166,11 @@ TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe
TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX:t=).exe
!endif
+!if $(TCL_MAJOR_VERSION) == 8
TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib
+!else
+TCLSTUBLIB = $(_TCLDIR)\lib\tclstub.lib
+!endif
TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:t=).lib
# When building extensions, may be linking against Tcl that does not add
# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility.
@@ -1177,7 +1190,11 @@ TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe
!if !exist($(TCLSH))
TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX:t=).exe
!endif
+!if $(TCL_MAJOR_VERSION) == 8
TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib
+!else
+TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub.lib
+!endif
TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib
# When building extensions, may be linking against Tcl that does not add
# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility.
@@ -1193,7 +1210,11 @@ TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
!endif # TCLINSTALL
+!if !$(STATIC_BUILD) && "$(TCL_BUILD_FOR)" == "8"
+tcllibs = "$(TCLSTUBLIB)"
+!else
tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)"
+!endif
!endif # $(DOING_TCL)
@@ -1213,14 +1234,18 @@ WISHNAMEPREFIX = wish
WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe
TKLIBNAME8 = tk$(TK_VERSION)$(SUFX).$(EXT)
TKLIBNAME9 = tcl9tk$(TK_VERSION)$(SUFX).$(EXT)
-!if $(TCL_MAJOR_VERSION) == 8
+!if $(TCL_MAJOR_VERSION) == 8 || "$(TCL_BUILD_FOR)" == "8"
TKLIBNAME = tk$(TK_VERSION)$(SUFX).$(EXT)
TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib
!else
TKLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).$(EXT)
TKIMPLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).lib
!endif
+!if $(TK_MAJOR_VERSION) == 8
TKSTUBLIBNAME = tkstub$(TK_VERSION).lib
+!else
+TKSTUBLIBNAME = tkstub.lib
+!endif
!if $(DOING_TK)
WISH = $(OUT_DIR)\$(WISHNAME)
@@ -1270,14 +1295,18 @@ tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)"
PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
PRJLIBNAME8 = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
PRJLIBNAME9 = tcl9$(PROJECT)$(VERSION)$(SUFX).$(EXT)
-!if $(TCL_MAJOR_VERSION) == 8
+!if $(TCL_MAJOR_VERSION) == 8 || "$(TCL_BUILD_FOR)" == "8"
PRJLIBNAME = $(PRJLIBNAME8)
!else
PRJLIBNAME = $(PRJLIBNAME9)
!endif
PRJLIB = $(OUT_DIR)\$(PRJLIBNAME)
+!if $(TCL_MAJOR_VERSION) == 8
PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
+!else
+PRJSTUBLIBNAME = $(STUBPREFIX).lib
+!endif
PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME)
# If extension parent makefile has not defined a resource definition file,
@@ -1421,6 +1450,9 @@ OPTDEFINES = $(OPTDEFINES) /D_USE_64BIT_TIME_T=1
# _ATL_XP_TARGETING - Newer SDK's need this to build for XP
COMPILERFLAGS = /D_ATL_XP_TARGETING
!endif
+!if "$(TCL_BUILD_FOR)" == "8"
+OPTDEFINES = $(OPTDEFINES) /DTCL_MAJOR_VERSION=8
+!endif
# Like the TEA system only set this non empty for non-Tk extensions
# Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME
@@ -1503,6 +1535,10 @@ INCLUDES = $(INCLUDES) -I"$(GENERICDIR)" -I"$(WIN_DIR)" -I"$(COMPATDIR)"
# cflags contains generic flags used for building practically all object files
cflags = -nologo -c $(COMPILERFLAGS) $(carch) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug)
+!if $(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) < 7
+cflags = $(cflags) -DTcl_Size=int
+!endif
+
# appcflags contains $(cflags) and flags for building the application
# object files (e.g. tclsh, or wish) pkgcflags contains $(cflags) plus
# flags used for building shared object files The two differ in the
diff --git a/win/stubs.c b/win/stubs.c
index 93a086e..2cd4d34 100644
--- a/win/stubs.c
+++ b/win/stubs.c
@@ -6,10 +6,8 @@
int
_XInitImageFuncPtrs(
- XImage *image)
+ TCL_UNUSED(XImage *))
{
- (void)image;
-
return Success;
}
@@ -19,25 +17,18 @@ _XInitImageFuncPtrs(
void
XSetWMClientMachine(
- Display *display,
- Window w,
- XTextProperty *text_prop)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(XTextProperty *))
{
- (void)display;
- (void)w;
- (void)text_prop;
}
Status
XStringListToTextProperty(
- char **list,
- int count,
- XTextProperty *text_prop_return)
+ TCL_UNUSED(char **),
+ TCL_UNUSED(int),
+ TCL_UNUSED(XTextProperty *))
{
- (void)list;
- (void)count;
- (void)text_prop_return;
-
return Success;
}
@@ -47,485 +38,333 @@ XStringListToTextProperty(
int
XChangeProperty(
- Display *display,
- Window w,
- Atom property,
- Atom type,
- int format,
- int mode,
- _Xconst unsigned char *data,
- int nelements)
-{
- (void)display;
- (void)w;
- (void)property;
- (void)type;
- (void)format;
- (void)mode;
- (void)data;
- (void)nelements;
-
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Atom),
+ TCL_UNUSED(Atom),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
+ TCL_UNUSED(_Xconst unsigned char *),
+ TCL_UNUSED(int))
+{
return Success;
}
XIC
-XCreateIC(XIM xim, ...)
+XCreateIC(TCL_UNUSED(XIM), ...)
{
- (void)xim;
return NULL;
}
int
XDeleteProperty(
- Display *display,
- Window w,
- Atom property)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Atom))
{
- (void)display;
- (void)w;
- (void)property;
-
return Success;
}
Bool
XFilterEvent(
- XEvent *event,
- Window window)
+ TCL_UNUSED(XEvent *),
+ TCL_UNUSED(Window))
{
- (void)event;
- (void)window;
-
return 0;
}
int
XForceScreenSaver(
- Display *display,
- int mode)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(int))
{
- (void)display;
- (void)mode;
-
return Success;
}
int
XFreeCursor(
- Display *display,
- Cursor cursor)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Cursor))
{
- (void)display;
- (void)cursor;
-
return Success;
}
GContext
XGContextFromGC(
- GC gc)
+ TCL_UNUSED(GC))
{
- (void)gc;
-
return (GContext) NULL;
}
char *
XGetAtomName(
- Display *display,
- Atom atom)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Atom))
{
- (void)display;
- (void)atom;
-
return NULL;
}
int
XGetWindowAttributes(
- Display *display,
- Window w,
- XWindowAttributes *window_attributes_return)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(XWindowAttributes *))
{
- (void)display;
- (void)w;
- (void)window_attributes_return;
-
return Success;
}
Status
XGetWMColormapWindows(
- Display *display,
- Window w,
- Window **windows_return,
- int *count_return)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Window **),
+ TCL_UNUSED(int *))
{
- (void)display;
- (void)w;
- (void)windows_return;
- (void)count_return;
-
return Success;
}
int
XIconifyWindow(
- Display *display,
- Window w,
- int screen_number)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(int))
{
- (void)display;
- (void)w;
- (void)screen_number;
-
return Success;
}
XHostAddress *
XListHosts(
- Display *display,
- int *nhosts_return,
- Bool *state_return)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(int *),
+ TCL_UNUSED(Bool *))
{
- (void)display;
- (void)nhosts_return;
- (void)state_return;
-
return NULL;
}
int
XLookupColor(
- Display *display,
- Colormap colormap,
- _Xconst char *color_name,
- XColor *exact_def_return,
- XColor *screen_def_return)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Colormap),
+ TCL_UNUSED(_Xconst char *),
+ TCL_UNUSED(XColor *),
+ TCL_UNUSED(XColor *))
{
- (void)display;
- (void)colormap;
- (void)color_name;
- (void)exact_def_return;
- (void)screen_def_return;
-
return Success;
}
int
XNextEvent(
- Display *display,
- XEvent *event_return)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(XEvent *))
{
- (void)display;
- (void)event_return;
-
return Success;
}
int
XPutBackEvent(
- Display *display,
- XEvent *event)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(XEvent *))
{
- (void)display;
- (void)event;
-
return Success;
}
int
XQueryColors(
- Display *display,
- Colormap colormap,
- XColor *defs_in_out,
- int ncolors)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Colormap),
+ TCL_UNUSED(XColor *),
+ TCL_UNUSED(int))
{
- (void)display;
- (void)colormap;
- (void)defs_in_out;
- (void)ncolors;
-
return Success;
}
int
XQueryTree(
- Display *display,
- Window w,
- Window *root_return,
- Window *parent_return,
- Window **children_return,
- unsigned int *nchildren_return)
-{
- (void)display;
- (void)w;
- (void)root_return;
- (void)parent_return;
- (void)children_return;
- (void)nchildren_return;
-
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Window *),
+ TCL_UNUSED(Window *),
+ TCL_UNUSED(Window **),
+ TCL_UNUSED(unsigned int *))
+{
return Success;
}
int
XRefreshKeyboardMapping(
- XMappingEvent *event_map)
+ TCL_UNUSED(XMappingEvent *))
{
- (void)event_map;
-
return Success;
}
Window
XRootWindow(
- Display *display,
- int screen_number)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(int))
{
- (void)display;
- (void)screen_number;
-
return (Window) NULL;
}
int
XSelectInput(
- Display *display,
- Window w,
- long event_mask)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(long))
{
- (void)display;
- (void)w;
- (void)event_mask;
-
return Success;
}
int
XSendEvent(
- Display *display,
- Window w,
- Bool propagate,
- long event_mask,
- XEvent *event_send)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Bool),
+ TCL_UNUSED(long),
+ TCL_UNUSED(XEvent *))
{
- (void)display;
- (void)w;
- (void)propagate;
- (void)event_mask;
- (void)event_send;
-
return Success;
}
int
XSetCommand(
- Display *display,
- Window w,
- char **argv,
- int argc)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(char **),
+ TCL_UNUSED(int))
{
- (void)display;
- (void)w;
- (void)argv;
- (void)argc;
-
return Success;
}
XErrorHandler
XSetErrorHandler(
- XErrorHandler handler)
+ TCL_UNUSED(XErrorHandler))
{
- (void)handler;
-
return NULL;
}
int
XSetIconName(
- Display *display,
- Window w,
- _Xconst char *icon_name)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(_Xconst char *))
{
- (void)display;
- (void)w;
- (void)icon_name;
-
return Success;
}
int
XSetWindowBackground(
- Display *display,
- Window w,
- unsigned long background_pixel)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(unsigned long))
{
- (void)display;
- (void)w;
- (void)background_pixel;
-
return Success;
}
int
XSetWindowBackgroundPixmap(
- Display *display,
- Window w,
- Pixmap background_pixmap)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Pixmap))
{
- (void)display;
- (void)w;
- (void)background_pixmap;
-
return Success;
}
int
XSetWindowBorder(
- Display *display,
- Window w,
- unsigned long border_pixel)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(unsigned long))
{
- (void)display;
- (void)w;
- (void)border_pixel;
-
return Success;
}
int
XSetWindowBorderPixmap(
- Display *display,
- Window w,
- Pixmap border_pixmap)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Pixmap))
{
- (void)display;
- (void)w;
- (void)border_pixmap;
-
return Success;
}
int
XSetWindowBorderWidth(
- Display *display,
- Window w,
- unsigned int width)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(unsigned int))
{
- (void)display;
- (void)w;
- (void)width;
-
return Success;
}
int
XSetWindowColormap(
- Display *display,
- Window w,
- Colormap colormap)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Colormap))
{
- (void)display;
- (void)w;
- (void)colormap;
-
return Success;
}
Bool
XTranslateCoordinates(
- Display *display,
- Window src_w,
- Window dest_w,
- int src_x,
- int src_y,
- int *dest_x_return,
- int *dest_y_return,
- Window *child_return)
-{
- (void)display;
- (void)src_w;
- (void)dest_w;
- (void)src_x;
- (void)src_y;
- (void)dest_x_return;
- (void)dest_y_return;
- (void)child_return;
-
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int *),
+ TCL_UNUSED(int *),
+ TCL_UNUSED(Window *))
+{
return 0;
}
int
XWindowEvent(
- Display *display,
- Window w,
- long event_mask,
- XEvent *event_return)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(long),
+ TCL_UNUSED(XEvent *))
{
- (void)display;
- (void)w;
- (void)event_mask;
- (void)event_return;
-
return Success;
}
int
XWithdrawWindow(
- Display *display,
- Window w,
- int screen_number)
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(int))
{
- (void)display;
- (void)w;
- (void)screen_number;
-
return Success;
}
int
XmbLookupString(
- XIC ic,
- XKeyPressedEvent *event,
- char *buffer_return,
- int bytes_buffer,
- KeySym *keysym_return,
- Status *status_return)
-{
- (void)ic;
- (void)event;
- (void)buffer_return;
- (void)bytes_buffer;
- (void)keysym_return;
- (void)status_return;
-
+ TCL_UNUSED(XIC),
+ TCL_UNUSED(XKeyPressedEvent *),
+ TCL_UNUSED(char *),
+ TCL_UNUSED(int),
+ TCL_UNUSED(KeySym *),
+ TCL_UNUSED(Status *))
+{
return Success;
}
int
XGetWindowProperty(
- Display *display,
- Window w,
- Atom property,
- long long_offset,
- long long_length,
- Bool del,
- Atom req_type,
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Atom),
+ TCL_UNUSED(long),
+ TCL_UNUSED(long),
+ TCL_UNUSED(Bool),
+ TCL_UNUSED(Atom),
Atom *actual_type_return,
int *actual_format_return,
unsigned long *nitems_return,
unsigned long *bytes_after_return,
unsigned char **prop_return)
{
- (void)display;
- (void)w;
- (void)property;
- (void)long_offset;
- (void)long_length;
- (void)del;
- (void)req_type;
-
*actual_type_return = None;
*actual_format_return = 0;
*nitems_return = 0;
@@ -540,28 +379,22 @@ XGetWindowProperty(
int
XFlush(
- Display *display)
+ TCL_UNUSED(Display *))
{
- (void)display;
-
return 0;
}
int
XGrabServer(
- Display *display)
+ TCL_UNUSED(Display *))
{
- (void)display;
-
return 0;
}
int
XUngrabServer(
- Display *display)
+ TCL_UNUSED(Display *))
{
- (void)display;
-
return 0;
}
@@ -569,7 +402,7 @@ int
XFree(
void *data)
{
- if ((data) != NULL) {
+ if (data != NULL) {
ckfree(data);
}
return 0;
@@ -586,10 +419,8 @@ XNoOp(
XAfterFunction
XSynchronize(
Display *display,
- Bool onoff)
+ TCL_UNUSED(Bool))
{
- (void)onoff;
-
LastKnownRequestProcessed(display)++;
return NULL;
}
@@ -597,10 +428,8 @@ XSynchronize(
int
XSync(
Display *display,
- Bool discard)
+ TCL_UNUSED(Bool))
{
- (void)discard;
-
LastKnownRequestProcessed(display)++;
return 0;
}
@@ -614,13 +443,9 @@ XVisualIDFromVisual(
int
XOffsetRegion(
- Region rgn,
- int dx,
- int dy)
+ TCL_UNUSED(Region),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
- (void)rgn;
- (void)dx;
- (void)dy;
-
return 0;
}
diff --git a/win/tcl.m4 b/win/tcl.m4
index a0797e8..fff706b 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -279,14 +279,6 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
fi
- #
- # eval is required to do the TCL_DBGX substitution
- #
-
- eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
- eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
- eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
-
eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
@@ -372,42 +364,7 @@ AC_DEFUN([SC_ENABLE_SHARED], [
SHARED_BUILD=0
AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
fi
-])
-
-#------------------------------------------------------------------------
-# SC_ENABLE_THREADS --
-#
-# Specify if thread support should be enabled
-#
-# Arguments:
-# none
-#
-# Results:
-#
-# Adds the following arguments to configure:
-# --enable-threads=yes|no
-#
-# Defines the following vars:
-# TCL_THREADS
-#------------------------------------------------------------------------
-
-AC_DEFUN([SC_ENABLE_THREADS], [
- AC_MSG_CHECKING(for building with threads)
- AC_ARG_ENABLE(threads, [ --enable-threads build with threads (default: on)],
- [tcl_ok=$enableval], [tcl_ok=yes])
-
- if test "$tcl_ok" = "yes"; then
- AC_MSG_RESULT([yes (default)])
- TCL_THREADS=1
- AC_DEFINE(TCL_THREADS)
- # USE_THREAD_ALLOC tells us to try the special thread-based
- # allocator that significantly reduces lock contention
- AC_DEFINE(USE_THREAD_ALLOC)
- else
- TCL_THREADS=0
- AC_MSG_RESULT(no)
- fi
- AC_SUBST(TCL_THREADS)
+ AC_SUBST(SHARED_BUILD)
])
#------------------------------------------------------------------------
@@ -434,7 +391,6 @@ AC_DEFUN([SC_ENABLE_THREADS], [
# Sets to $(CFLAGS_OPTIMIZE) if false
# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
# Sets to $(LDFLAGS_OPTIMIZE) if false
-# DBGX Debug library extension
#
#------------------------------------------------------------------------
@@ -445,7 +401,6 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [
if test "$tcl_ok" = "no"; then
CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
- DBGX=""
AC_DEFINE(NDEBUG, 1, [Is no debugging enabled?])
AC_MSG_RESULT([no])
@@ -453,7 +408,6 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [
else
CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
- DBGX=g
if test "$tcl_ok" = "yes"; then
AC_MSG_RESULT([yes (standard debugging)])
fi
@@ -537,22 +491,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no])
AC_MSG_RESULT($do64bit)
- # Cross-compiling options for Windows/CE builds
-
- AC_MSG_CHECKING([if Windows/CE build is requested])
- AC_ARG_ENABLE(wince,[ --enable-wince enable Win/CE support (where applicable)], [doWince=$enableval], [doWince=no])
- AC_MSG_RESULT($doWince)
-
- AC_MSG_CHECKING([for Windows/CE celib directory])
- AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR],
- CELIB_DIR=$withval, CELIB_DIR=NO_CELIB)
- AC_MSG_RESULT([$CELIB_DIR])
-
# Set some defaults (may get changed below)
EXTRA_CFLAGS=""
AC_DEFINE(MODULE_SCOPE, [extern], [No need to mark inidividual symbols as hidden])
AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo)
+ AC_CHECK_PROG(WINE, wine, wine,)
SHLIB_SUFFIX=".dll"
@@ -682,6 +626,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
else
CFLAGS_NOLTO=""
fi
+ AC_CACHE_CHECK([if the compiler understands -finput-charset],
+ tcl_cv_cc_input_charset, [
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_input_charset=yes],[tcl_cv_cc_input_charset=no])
+ CFLAGS=$hold_cflags])
+ if test $tcl_cv_cc_input_charset = yes; then
+ extra_cflags="$extra_cflags -finput-charset=UTF-8"
+ fi
fi
hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Wl,--enable-auto-image-base"
@@ -702,7 +654,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
SHLIB_LD_LIBS='${LIBS}'
LIBS="-lnetapi32 -lkernel32 -luser32 -ladvapi32 -luserenv -lws2_32"
# mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't
- LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32"
+ LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32 -lwinspool"
STLIB_LD='${AR} cr'
RC_OUT=-o
RC_TYPE=
@@ -720,7 +672,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_MSG_RESULT([using static flags])
runtime=
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
else
# dynamic
AC_MSG_RESULT([using shared flags])
@@ -734,7 +686,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
runtime=
# Add SHLIB_LD_LIBS to the Make rule, not here.
- EXESUFFIX="\${DBGX}.exe"
+ EXESUFFIX=".exe"
LIBRARIES="\${SHARED_LIBRARIES}"
fi
# Link with gcc since ld does not link to default libs like
@@ -745,16 +697,16 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
-Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\[$]@)"
# 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}.a"
- LIBFLAGSUFFIX="\${DBGX}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".a"
+ LIBFLAGSUFFIX=""
SHLIB_SUFFIX=.dll
EXTRA_CFLAGS="${extra_cflags}"
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
@@ -763,7 +715,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format"
;;
*)
- CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement"
+ CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -fextended-identifiers"
;;
esac
@@ -823,14 +775,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_MSG_RESULT([using static flags])
runtime=-MT
LIBRARIES="\${STATIC_LIBRARIES}"
- EXESUFFIX="s\${DBGX}.exe"
+ EXESUFFIX="s.exe"
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"
+ EXESUFFIX=".exe"
case "x`echo \${VisualStudioVersion}`" in
x1[[4-9]]*)
lflags="${lflags} -nodefaultlib:libucrt.lib"
@@ -842,9 +794,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
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}"
+ DLLSUFFIX=".dll"
+ LIBSUFFIX=".lib"
+ LIBFLAGSUFFIX=""
if test "$do64bit" != "no" ; then
case "$do64bit" in
@@ -891,98 +843,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
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 ...
- TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
- ARCH=ARM; # could be ARM MIPS X86EM ...
- PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
- if test "$doWince" != "yes"; then
- # If !yes then the user specified something
- # Reset ARCH to allow user to skip specifying it
- ARCH=
- eval `echo $doWince | awk -F "," '{ \
- if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
- if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
- if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
- if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
- if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
- }'`
- if test "x${ARCH}" = "x" ; then
- ARCH=$TARGETCPU;
- fi
- fi
- OSVERSION=WCE$CEVERSION;
- if test "x${WCEROOT}" = "x" ; then
- WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
- if test ! -d "${WCEROOT}" ; then
- WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
- fi
- fi
- if test "x${SDKROOT}" = "x" ; then
- SDKROOT="C:/Program Files/Windows CE Tools"
- if test ! -d "${SDKROOT}" ; then
- SDKROOT="C:/Windows CE Tools"
- fi
- fi
- # The space-based-path will work for the Makefile, but will
- # not work if AC_TRY_COMPILE is called.
- WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
- SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
- CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
- if test ! -d "${CELIB_DIR}/inc"; then
- AC_MSG_ERROR([Invalid celib directory "${CELIB_DIR}"])
- fi
- if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"\
- -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
- AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
- else
- CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
- if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
- CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
- fi
- CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
- fi
- fi
-
- if test "$doWince" != "no" ; then
- CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
- if test "${TARGETCPU}" = "X86"; then
- CC="${CEBINROOT}/cl.exe"
- else
- CC="${CEBINROOT}/cl${ARCH}.exe"
- fi
- CC="\"${CC}\" -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
- RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
- arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
- defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS"
- for i in $defs ; do
- AC_DEFINE_UNQUOTED($i)
- done
-# if test "${ARCH}" = "X86EM"; then
-# AC_DEFINE_UNQUOTED(_WIN32_WCE_EMULATION)
-# fi
- AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION)
- AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION)
- CFLAGS_DEBUG="-nologo -Zi -Od"
- CFLAGS_OPTIMIZE="-nologo -O2"
- lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
- lflags="-nodefaultlib -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
- LINKBIN="\"${CEBINROOT}/link.exe\""
- AC_SUBST(CELIB_DIR)
- if test "${CEVERSION}" -lt 400 ; then
- LIBS="coredll.lib corelibc.lib winsock.lib"
- else
- LIBS="coredll.lib corelibc.lib ws2.lib"
- fi
- # celib currently stuck at wce300 status
- #LIBS="$LIBS \${CELIB_DIR}/wince-${ARCH}-pocket-${OSVERSION}-release/celib.lib"
- LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\""
- LIBS_GUI="commctrl.lib commdlg.lib"
- else
- LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib"
- fi
+ LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib winspool.lib"
SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}"
SHLIB_LD_LIBS='${LIBS}'
@@ -1013,7 +874,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# Specify linker flags depending on the type of app being
# built -- Console vs. Window.
- if test "$doWince" != "no" -a "${TARGETCPU}" != "X86"; then
+ if test "${TARGETCPU}" != "X86"; then
LDFLAGS_CONSOLE="-link ${lflags}"
LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
else
@@ -1077,29 +938,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
[Defined when cygwin/mingw does not support EXCEPTION DISPOSITION])
fi
- # Check to see if winnt.h defines CHAR, SHORT, and LONG
- # even if VOID has already been #defined. The win32api
- # used by mingw and cygwin is known to do this.
-
- AC_CACHE_CHECK(for winnt.h that ignores VOID define,
- tcl_cv_winnt_ignore_void,
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #define VOID void
- #define WIN32_LEAN_AND_MEAN
- #include <windows.h>
- #undef WIN32_LEAN_AND_MEAN
- ]], [[
- CHAR c;
- SHORT s;
- LONG l;
- ]])],
- [tcl_cv_winnt_ignore_void=yes],
- [tcl_cv_winnt_ignore_void=no])
- )
- if test "$tcl_cv_winnt_ignore_void" = "yes" ; then
- AC_DEFINE(HAVE_WINNT_IGNORE_VOID, 1,
- [Defined when cygwin/mingw ignores VOID define in winnt.h])
- fi
+ AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have <stdbool.h>?])],)
# See if the compiler supports casting to a union type.
# This is used to stop gcc from printing a compiler
@@ -1146,13 +985,13 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
#------------------------------------------------------------------------
AC_DEFUN([SC_WITH_TCL], [
- if test -d ../../tcl8.6$1/win; then
- TCL_BIN_DEFAULT=../../tcl8.6$1/win
+ if test -d ../../tcl8.7$1/win; then
+ TCL_BIN_DEFAULT=../../tcl8.7$1/win
else
- TCL_BIN_DEFAULT=../../tcl8.6/win
+ TCL_BIN_DEFAULT=../../tcl8.7/win
fi
- AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.6 binaries from DIR],
+ AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.7 binaries from DIR],
TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DEFAULT; pwd`)
if test ! -d $TCL_BIN_DIR; then
AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist)
@@ -1261,8 +1100,7 @@ AC_DEFUN([SC_TCL_CFG_ENCODING], [
if test x"${with_tcencoding}" != x ; then
AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}")
else
- # Default encoding on windows is not "iso8859-1"
- AC_DEFINE(TCL_CFGVAL_ENCODING,"cp1252")
+ AC_DEFINE(TCL_CFGVAL_ENCODING,"utf-8")
fi
])
@@ -1317,3 +1155,126 @@ print("manifest needed")
AC_SUBST(VC_MANIFEST_EMBED_DLL)
AC_SUBST(VC_MANIFEST_EMBED_EXE)
])
+
+#------------------------------------------------------------------------
+# SC_CC_FOR_BUILD
+# For cross compiles, locate a C compiler that can generate native binaries.
+#
+# Arguments:
+# none
+#
+# Results:
+# Substitutes the following vars:
+# CC_FOR_BUILD
+# EXEEXT_FOR_BUILD
+#------------------------------------------------------------------------
+
+dnl Get a default for CC_FOR_BUILD to put into Makefile.
+AC_DEFUN([AX_CC_FOR_BUILD],
+[# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+ if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+ else
+ AC_MSG_CHECKING([for gcc])
+ AC_CACHE_VAL(ac_cv_path_cc, [
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/gcc 2> /dev/null` \
+ `ls -r $dir/gcc 2> /dev/null` ; do
+ if test x"$ac_cv_path_cc" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_cc=$j
+ break
+ fi
+ fi
+ done
+ done
+ ])
+ fi
+fi
+AC_SUBST(CC_FOR_BUILD)
+# Also set EXEEXT_FOR_BUILD.
+if test "x$cross_compiling" = "xno"; then
+ EXEEXT_FOR_BUILD='$(EXEEXT)'
+ OBJEXT_FOR_BUILD='$(OBJEXT)'
+else
+ OBJEXT_FOR_BUILD='.no'
+ AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
+ [rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.c
+ bfd_cv_build_exeext=
+ ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+ *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ rm -f conftest*
+ test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
+ EXEEXT_FOR_BUILD=""
+ test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
+fi
+AC_SUBST(EXEEXT_FOR_BUILD)])dnl
+AC_SUBST(OBJEXT_FOR_BUILD)])dnl
+
+
+
+#------------------------------------------------------------------------
+# SC_ZIPFS_SUPPORT
+# Locate a zip encoder installed on the system path, or none.
+#
+# Arguments:
+# none
+#
+# Results:
+# Substitutes the following vars:
+# ZIP_PROG
+# ZIP_PROG_OPTIONS
+# ZIP_PROG_VFSSEARCH
+# ZIP_INSTALL_OBJS
+#------------------------------------------------------------------------
+
+AC_DEFUN([SC_ZIPFS_SUPPORT], [
+ ZIP_PROG=""
+ ZIP_PROG_OPTIONS=""
+ ZIP_PROG_VFSSEARCH=""
+ ZIP_INSTALL_OBJS=""
+
+ AC_MSG_CHECKING([for zip])
+ AC_CACHE_VAL(ac_cv_path_zip, [
+ search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+ for dir in $search_path ; do
+ for j in `ls -r $dir/zip 2> /dev/null` \
+ `ls -r $dir/zip 2> /dev/null` ; do
+ if test x"$ac_cv_path_zip" = x ; then
+ if test -f "$j" ; then
+ ac_cv_path_zip=$j
+ break
+ fi
+ fi
+ done
+ done
+ ])
+ if test -f "$ac_cv_path_zip" ; then
+ ZIP_PROG="$ac_cv_path_zip"
+ AC_MSG_RESULT([$ZIP_PROG])
+ ZIP_PROG_OPTIONS="-rq"
+ ZIP_PROG_VFSSEARCH="*"
+ AC_MSG_RESULT([Found INFO Zip in environment])
+ # Use standard arguments for zip
+ else
+ # It is not an error if an installed version of Zip can't be located.
+ # We can use the locally distributed minizip instead
+ ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}"
+ ZIP_PROG_OPTIONS="-o -r"
+ ZIP_PROG_VFSSEARCH="*"
+ ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}"
+ AC_MSG_RESULT([No zip found on PATH building minizip])
+ fi
+ AC_SUBST(ZIP_PROG)
+ AC_SUBST(ZIP_PROG_OPTIONS)
+ AC_SUBST(ZIP_PROG_VFSSEARCH)
+ AC_SUBST(ZIP_INSTALL_OBJS)
+])
diff --git a/win/tkConfig.sh.in b/win/tkConfig.sh.in
index cb6d8b9..d889e16 100644
--- a/win/tkConfig.sh.in
+++ b/win/tkConfig.sh.in
@@ -25,8 +25,9 @@ TK_DEFS='@DEFS@'
# Flag, 1: we built a shared lib, 0 we didn't
TK_SHARED_BUILD=@TK_SHARED_BUILD@
-# This indicates if Tk was build with debugging symbols
-TK_DBGX=@TK_DBGX@
+# TK_DBGX used to be used to distinguish debug vs. non-debug builds.
+# This was a righteous pain so the core doesn't do that any more.
+TK_DBGX=
# The name of the Tk library (may be either a .a file or a shared library):
TK_LIB_FILE='@TK_LIB_FILE@'
diff --git a/win/tkWin.h b/win/tkWin.h
index 21869da..460d0c1 100644
--- a/win/tkWin.h
+++ b/win/tkWin.h
@@ -4,7 +4,7 @@
* Declarations of public types and interfaces that are only
* available under Windows.
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -18,14 +18,18 @@
* the SystemParametersInfo API doesn't like to receive structures that
* are larger than it expects which affects the font assignments.
*
- * WINVER = 0x0500 means Windows 2000 and above
+ * WINVER = 0x0600 means Windows Vista and above. Even though we still
+ * support Windows XP, but the Vista-specifics are tested at runtime.
*/
#ifndef WINVER
-#define WINVER 0x0500
+# define WINVER 0x0601
#endif
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
+# define _WIN32_WINNT 0x0601
+#endif
+#ifndef _WIN32_IE
+# define _WIN32_IE 0x0800
#endif
#ifndef _TK
diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c
index 5161333..1e4bf1b 100644
--- a/win/tkWin32Dll.c
+++ b/win/tkWin32Dll.c
@@ -3,7 +3,7 @@
*
* This file contains a stub dll entry point.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -104,6 +104,7 @@ DllMain(
#if defined(HAVE_NO_SEH) && !defined(__aarch64__)
TCLEXCEPTION_REGISTRATION registration;
#endif
+ (void)reserved;
/*
* If we are attaching to the DLL from a new process, tell Tk about the
diff --git a/win/tkWin3d.c b/win/tkWin3d.c
index 91fe42e..2c2181b 100644
--- a/win/tkWin3d.c
+++ b/win/tkWin3d.c
@@ -4,7 +4,7 @@
* This file contains the platform specific routines for drawing 3D
* borders in the Windows 95 style.
*
- * Copyright (c) 1996 Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -43,7 +43,7 @@ typedef struct {
TkBorder *
TkpGetBorder(void)
{
- WinBorder *borderPtr = ckalloc(sizeof(WinBorder));
+ WinBorder *borderPtr = (WinBorder *)ckalloc(sizeof(WinBorder));
borderPtr->light2ColorPtr = NULL;
borderPtr->dark2ColorPtr = NULL;
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index d6af35b..e0998b5 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -4,7 +4,7 @@
* This file implements the Windows specific portion of the button
* widgets.
*
- * Copyright (c) 1996-1998 Sun Microsystems, Inc.
+ * Copyright © 1996-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -36,41 +36,72 @@ typedef struct WinButton {
} WinButton;
/*
- * The following macro reverses the order of RGB bytes to convert between
- * RGBQUAD and COLORREF values.
+ * Cached information about the checkbutton and radiobutton indicator boxes
*/
-#define FlipColor(rgb) (RGB(GetBValue(rgb),GetGValue(rgb),GetRValue(rgb)))
+typedef struct {
+ BOOLEAN initialized;
+ int boxSize; /* Width & height of the box. */
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
/*
- * The following enumeration defines the meaning of the palette entries in the
- * "buttons" image used to draw checkbox and radiobutton indicators.
+ * Data of the SVG images used for drawing the indicators
*/
-enum {
- PAL_CHECK = 0,
- PAL_TOP_OUTER = 1,
- PAL_BOTTOM_OUTER = 2,
- PAL_BOTTOM_INNER = 3,
- PAL_INTERIOR = 4,
- PAL_TOP_INNER = 5,
- PAL_BACKGROUND = 6
-};
-
-/*
- * Cached information about the boxes bitmap, and the default border width for
- * a button in string form for use in Tk_OptionSpec for the various button
- * widget classes.
- */
-
-typedef struct {
- BITMAPINFOHEADER *boxesPtr; /* Information about the bitmap. */
- DWORD *boxesPalette; /* Pointer to color palette. */
- LPSTR boxesBits; /* Pointer to bitmap data. */
- DWORD boxHeight; /* Height of each sub-image. */
- DWORD boxWidth; /* Width of each sub-image. */
-} ThreadSpecificData;
-static Tcl_ThreadDataKey dataKey;
+static const char checkbtnOffData[] = "\
+ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\
+ <path d='m0 0v15h1v-14h14v-1z' fill='#a0a0a0'/>\n\
+ <path d='m1 1v13h1v-12h12v-1z' fill='#696969'/>\n\
+ <path d='m14 1v13h-13v1h14v-14z' fill='#e3e3e3'/>\n\
+ <path d='m15 0v15h-15v1h16v-16z' fill='#eeeeee'/>\n\
+ <rect x='2' y='2' width='12' height='12' fill='#ffffff'/>\n\
+ </svg>";
+
+static const char checkbtnOnData[] = "\
+ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\
+ <path d='m0 0v15h1v-14h14v-1z' fill='#a0a0a0'/>\n\
+ <path d='m1 1v13h1v-12h12v-1z' fill='#696969'/>\n\
+ <path d='m14 1v13h-13v1h14v-14z' fill='#e3e3e3'/>\n\
+ <path d='m15 0v15h-15v1h16v-16z' fill='#eeeeee'/>\n\
+ <rect x='2' y='2' width='12' height='12' fill='#ffffff'/>\n\
+ <path d='m4.5 8 3 3 4-6' fill='none' stroke='#000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'/>\n\
+ </svg>";
+
+static const char radiobtnOffData[] = "\
+ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\
+ <defs>\n\
+ <linearGradient id='linearGradientOuter' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\
+ <stop stop-color='#a0a0a0' offset='0'/>\n\
+ <stop stop-color='#eeeeee' offset='1'/>\n\
+ </linearGradient>\n\
+ <linearGradient id='linearGradientInner' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\
+ <stop stop-color='#696969' offset='0'/>\n\
+ <stop stop-color='#e3e3e3' offset='1'/>\n\
+ </linearGradient>\n\
+ </defs>\n\
+ <circle cx='8' cy='8' r='8' fill='url(#linearGradientOuter)'/>\n\
+ <circle cx='8' cy='8' r='7' fill='url(#linearGradientInner)'/>\n\
+ <circle cx='8' cy='8' r='6' fill='#ffffff'/>\n\
+ </svg>";
+
+static const char radiobtnOnData[] = "\
+ <svg width='16' height='16' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n\
+ <defs>\n\
+ <linearGradient id='linearGradientOuter' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\
+ <stop stop-color='#a0a0a0' offset='0'/>\n\
+ <stop stop-color='#eeeeee' offset='1'/>\n\
+ </linearGradient>\n\
+ <linearGradient id='linearGradientInner' x1='5' y1='5' x2='11' y2='11' gradientUnits='userSpaceOnUse'>\n\
+ <stop stop-color='#696969' offset='0'/>\n\
+ <stop stop-color='#e3e3e3' offset='1'/>\n\
+ </linearGradient>\n\
+ </defs>\n\
+ <circle cx='8' cy='8' r='8' fill='url(#linearGradientOuter)'/>\n\
+ <circle cx='8' cy='8' r='7' fill='url(#linearGradientInner)'/>\n\
+ <circle cx='8' cy='8' r='6' fill='#ffffff'/>\n\
+ <circle cx='8' cy='8' r='3' fill='#000000'/>\n\
+ </svg>";
/*
* Declarations for functions defined in this file.
@@ -79,8 +110,14 @@ static Tcl_ThreadDataKey dataKey;
static LRESULT CALLBACK ButtonProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
static Window CreateProc(Tk_Window tkwin, Window parent,
- ClientData instanceData);
-static void InitBoxes(void);
+ void *instanceData);
+static void InitBoxes(Tk_Window tkwin);
+static void ColorToStr(COLORREF color, char *colorStr);
+static void ImageChanged(void *clientData,
+ int x, int y, int width, int height,
+ int imageWidth, int imageHeight);
+static void TkpDrawIndicator(TkButton *butPtr, Drawable d,
+ Tk_3DBorder border, GC gc, int dim, int x, int y);
/*
* The class procedure table for the button widgets.
@@ -90,7 +127,7 @@ const Tk_ClassProcs tkpButtonProcs = {
sizeof(Tk_ClassProcs), /* size */
TkButtonWorldChanged, /* worldChangedProc */
CreateProc, /* createProc */
- NULL /* modalProc */
+ NULL /* modalProc */
};
@@ -99,68 +136,27 @@ const Tk_ClassProcs tkpButtonProcs = {
*
* InitBoxes --
*
- * This function load the Tk 3d button bitmap. "buttons" is a 16 color
- * bitmap that is laid out such that the top row contains the 4 checkbox
- * images, and the bottom row contains the radio button images. Note that
- * the bitmap is stored in bottom-up format. Also, the first seven
- * palette entries are used to identify the different parts of the
- * bitmaps so we can do the appropriate color mappings based on the
- * current button colors.
+ * This function computes the size of the checkbutton and radiobutton
+ * indicator boxes, according to the display's scaling percentage.
*
* Results:
* None.
*
* Side effects:
- * Loads the "buttons" resource.
+ * Populates the thread-private data.
*
*----------------------------------------------------------------------
*/
static void
-InitBoxes(void)
+InitBoxes(Tk_Window tkwin)
{
- /*
- * For DLLs like Tk, the HINSTANCE is the same as the HMODULE.
- */
-
- HMODULE module = (HINSTANCE) Tk_GetHINSTANCE();
- HRSRC hrsrc;
- HGLOBAL hblk;
- LPBITMAPINFOHEADER newBitmap;
- size_t size;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ double scalingLevel = TkScalingLevel(tkwin);
- hrsrc = FindResourceW(module, L"buttons", (LPWSTR) RT_BITMAP);
- if (hrsrc == NULL) {
- Tcl_Panic("FindResourceW() failed for buttons bitmap resource, "
- "resources in tk_base.rc must be linked into Tk dll or static executable");
- } else {
- hblk = LoadResource(module, hrsrc);
- tsdPtr->boxesPtr = (LPBITMAPINFOHEADER)LockResource(hblk);
- }
-
- /*
- * Copy the DIBitmap into writable memory.
- */
-
- if (tsdPtr->boxesPtr != NULL && !(tsdPtr->boxesPtr->biWidth % 4)
- && !(tsdPtr->boxesPtr->biHeight % 2)) {
- size = tsdPtr->boxesPtr->biSize
- + (sizeof(RGBQUAD) << tsdPtr->boxesPtr->biBitCount)
- + tsdPtr->boxesPtr->biSizeImage;
- newBitmap = (LPBITMAPINFOHEADER)ckalloc(size);
- memcpy(newBitmap, tsdPtr->boxesPtr, size);
- tsdPtr->boxesPtr = newBitmap;
- tsdPtr->boxWidth = tsdPtr->boxesPtr->biWidth / 4;
- tsdPtr->boxHeight = tsdPtr->boxesPtr->biHeight / 2;
- tsdPtr->boxesPalette = (DWORD*) (((LPSTR) tsdPtr->boxesPtr)
- + tsdPtr->boxesPtr->biSize);
- tsdPtr->boxesBits = ((LPSTR) tsdPtr->boxesPalette)
- + (sizeof(RGBQUAD) << tsdPtr->boxesPtr->biBitCount);
- } else {
- tsdPtr->boxesPtr = NULL;
- }
+ tsdPtr->boxSize = (int)(16.0 * scalingLevel);
+ tsdPtr->initialized = TRUE;
}
/*
@@ -238,7 +234,7 @@ static Window
CreateProc(
Tk_Window tkwin, /* Token for window. */
Window parentWin, /* Parent of new window. */
- ClientData instanceData) /* Button instance data. */
+ void *instanceData) /* Button instance data. */
{
Window window;
HWND parent;
@@ -296,6 +292,228 @@ TkpDestroyButton(
/*
*----------------------------------------------------------------------
*
+ * ColorToStr --
+ *
+ * Writes a given color to a string, in the format "RRGGBB".
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Changes the content of the memory area pointed to by the 2nd argument.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ColorToStr(
+ COLORREF color, /* specifies a color */
+ char *colorStr) /* memory area to which the color is to be
+ output in the format "RRGGBB" */
+{
+ snprintf(colorStr, 7, "%02x%02x%02x",
+ GetRValue(color), GetGValue(color), GetBValue(color));
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ImageChanged --
+ *
+ * Dummy function to be passed to Tk_GetImage().
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ImageChanged(
+ void *clientData,
+ int x, int y, int width, int height,
+ int imageWidth, int imageHeight)
+{
+ (void)clientData;
+ (void)x; (void)y; (void)width; (void)height;
+ (void)imageWidth; (void)imageHeight;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawIndicator -
+ *
+ * Draws the indicator image in the drawable at the (x,y) location.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * An image is drawn in the drawable at the given location.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TkpDrawIndicator(
+ TkButton *butPtr, /* checkbutton or radiobutton */
+ Drawable d, /* what to draw on */
+ Tk_3DBorder border, /* colors of the border */
+ GC gc, /* graphics context */
+ int dim, /* width & height of the indicator */
+ int x, int y) /* where to draw */
+{
+ Tk_Window tkwin = butPtr->tkwin;
+ char topOuterColorStr[7], btmOuterColorStr[7], topInnerColorStr[7],
+ btmInnerColorStr[7], interiorColorStr[7], checkColorStr[7];
+ Tcl_Interp *interp = Tk_Interp(tkwin);
+ char imgName[80];
+ Tk_Image img;
+ const char *svgDataPtr;
+ size_t svgDataLen;
+ char *svgDataCopy;
+ char *topOuterColorPtr, *btmOuterColorPtr, *topInnerColorPtr,
+ *btmInnerColorPtr, *interiorColorPtr, *checkColorPtr;
+ const char *cmdFmt;
+ size_t scriptSize;
+ char *script;
+ int code;
+
+ /*
+ * Construct the color strings topOuterColorStr, btmOuterColorStr,
+ * topInnerColorStr, btmInnerColorStr, interiorColorStr, and checkColorStr
+ */
+
+ ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_DARK_GC),
+ topOuterColorStr);
+ ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_LIGHT_GC),
+ btmOuterColorStr);
+ ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_DARK2),
+ topInnerColorStr);
+ ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_LIGHT2),
+ btmInnerColorStr);
+
+ if (butPtr->state == STATE_ACTIVE) {
+ ColorToStr(TkWinGetBorderPixels(tkwin, butPtr->activeBorder,
+ TK_3D_FLAT_GC), interiorColorStr);
+ } else if (butPtr->state == STATE_DISABLED || (butPtr->flags & TRISTATED)) {
+ ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_LIGHT2),
+ interiorColorStr);
+ } else if (butPtr->selectBorder != NULL) {
+ ColorToStr(TkWinGetBorderPixels(tkwin, butPtr->selectBorder,
+ TK_3D_FLAT_GC), interiorColorStr);
+ } else {
+ ColorToStr(GetSysColor(COLOR_WINDOW), interiorColorStr);
+ }
+
+ if (butPtr->state == STATE_DISABLED && butPtr->disabledFg == NULL) {
+ ColorToStr(TkWinGetBorderPixels(tkwin, border, TK_3D_DARK_GC),
+ checkColorStr);
+ } else {
+ ColorToStr(gc->foreground, checkColorStr);
+ }
+
+ /*
+ * Check whether there is an SVG image of this size for the indicator's
+ * type (0 = checkbtn, 1 = radiobtn) and these color strings
+ */
+
+ snprintf(imgName, sizeof(imgName),
+ "::tk::icons::indicator%d_%d_%s_%s_%s_%s_%s_%s",
+ dim, butPtr->type == TYPE_RADIO_BUTTON,
+ topOuterColorStr, btmOuterColorStr, topInnerColorStr,
+ btmInnerColorStr, interiorColorStr,
+ (butPtr->flags & (SELECTED|TRISTATED)) ? checkColorStr : "XXXXXX");
+ img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL);
+ if (img == NULL) {
+ /*
+ * Determine the SVG data to use for the photo image
+ */
+
+ if (butPtr->type == TYPE_CHECK_BUTTON) {
+ svgDataPtr = ((butPtr->flags & (SELECTED|TRISTATED)) ?
+ checkbtnOnData : checkbtnOffData);
+ } else {
+ svgDataPtr = ((butPtr->flags & (SELECTED|TRISTATED)) ?
+ radiobtnOnData : radiobtnOffData);
+ }
+
+ /*
+ * Copy the string pointed to by svgDataPtr to
+ * a newly allocated memory area svgDataCopy
+ */
+
+ svgDataLen = strlen(svgDataPtr);
+ svgDataCopy = (char *)attemptckalloc(svgDataLen + 1);
+ if (svgDataCopy == NULL) {
+ return;
+ }
+ memcpy(svgDataCopy, svgDataPtr, svgDataLen);
+ svgDataCopy[svgDataLen] = '\0';
+
+ /*
+ * Update the colors within svgDataCopy
+ */
+
+ topOuterColorPtr = strstr(svgDataCopy, "a0a0a0");
+ btmOuterColorPtr = strstr(svgDataCopy, "eeeeee");
+ topInnerColorPtr = strstr(svgDataCopy, "696969");
+ btmInnerColorPtr = strstr(svgDataCopy, "e3e3e3");
+ interiorColorPtr = strstr(svgDataCopy, "ffffff");
+ checkColorPtr = strstr(svgDataCopy, "000000");
+
+ assert(topOuterColorPtr);
+ assert(btmOuterColorPtr);
+ assert(topInnerColorPtr);
+ assert(btmInnerColorPtr);
+ assert(interiorColorPtr);
+
+ memcpy(topOuterColorPtr, topOuterColorStr, 6);
+ memcpy(btmOuterColorPtr, btmOuterColorStr, 6);
+ memcpy(topInnerColorPtr, topInnerColorStr, 6);
+ memcpy(btmInnerColorPtr, btmInnerColorStr, 6);
+ memcpy(interiorColorPtr, interiorColorStr, 6);
+ if (checkColorPtr != NULL) {
+ memcpy(checkColorPtr, checkColorStr, 6);
+ }
+
+ /*
+ * Create an SVG photo image from svgDataCopy
+ */
+
+ cmdFmt = "image create photo %s -format $::tk::svgFmt -data {%s}";
+ scriptSize = strlen(cmdFmt) + strlen(imgName) + svgDataLen;
+ script = (char *)attemptckalloc(scriptSize);
+ if (script == NULL) {
+ ckfree(svgDataCopy);
+ return;
+ }
+ snprintf(script, scriptSize, cmdFmt, imgName, svgDataCopy);
+ ckfree(svgDataCopy);
+ code = Tcl_EvalEx(interp, script, TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
+ ckfree(script);
+ if (code != TCL_OK) {
+ Tcl_BackgroundException(interp, code);
+ return;
+ }
+ img = Tk_GetImage(interp, tkwin, imgName, ImageChanged, NULL);
+ }
+
+ /*
+ * Display the image
+ */
+
+ Tk_RedrawImage(img, 0, 0, dim, dim, d, x, y);
+ Tk_FreeImage(img);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkpDisplayButton --
*
* This procedure is invoked to display a button widget. It is normally
@@ -312,7 +530,7 @@ TkpDestroyButton(
void
TkpDisplayButton(
- ClientData clientData) /* Information about widget. */
+ void *clientData) /* Information about widget. */
{
TkWinDCState state;
HDC dc;
@@ -338,17 +556,20 @@ TkpDisplayButton(
int imageXOffset = 0, imageYOffset = 0;
/* Image information that will be used to
* restrict disabled pixmap as well. */
- DWORD *boxesPalette;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- boxesPalette= tsdPtr->boxesPalette;
butPtr->flags &= ~REDRAW_PENDING;
if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
return;
}
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->borderWidthPtr, &butPtr->borderWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->highlightWidthPtr, &butPtr->highlightWidth);
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->padXPtr, &butPtr->padX);
+ Tk_GetPixelsFromObj(NULL, tkwin, butPtr->padYPtr, &butPtr->padY);
+
border = butPtr->normalBorder;
if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) {
gc = butPtr->disabledGC;
@@ -407,7 +628,7 @@ TkpDisplayButton(
if (butPtr->type == TYPE_LABEL) {
defaultWidth = butPtr->highlightWidth;
- offset = 0;
+ offset = 0;
} else if (butPtr->type == TYPE_BUTTON) {
defaultWidth = ((butPtr->defaultState == DEFAULT_ACTIVE)
? butPtr->highlightWidth : 0);
@@ -653,65 +874,16 @@ TkpDisplayButton(
y += height/2;
/*
- * Draw the indicator for check buttons and radio buttons. At this point x
- * and y refer to the top-left corner of the text or image or bitmap.
+ * Draw the indicator for check buttons and radio buttons. At this point
+ * x and y refer to the top-left corner of the text or image or bitmap.
*/
if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn
- && tsdPtr->boxesPtr) {
- int xSrc, ySrc;
-
+ && tsdPtr->initialized) {
x -= butPtr->indicatorSpace;
y -= butPtr->indicatorDiameter / 2;
- xSrc = (butPtr->flags & (SELECTED|TRISTATED)) ? tsdPtr->boxWidth : 0;
- if (butPtr->state == STATE_ACTIVE) {
- xSrc += tsdPtr->boxWidth*2;
- }
- ySrc = (butPtr->type == TYPE_RADIO_BUTTON) ? 0 : tsdPtr->boxHeight;
-
- /*
- * Update the palette in the boxes bitmap to reflect the current
- * button colors. Note that this code relies on the layout of the
- * bitmap's palette. Also, all of the colors used to draw the bitmap
- * must be in the palette that is selected into the DC of the
- * offscreen pixmap. This requires that the static colors be placed
- * into the palette.
- */
-
- if ((butPtr->state == STATE_DISABLED)
- && (butPtr->disabledFg == NULL)) {
- boxesPalette[PAL_CHECK] = FlipColor(TkWinGetBorderPixels(tkwin,
- border, TK_3D_DARK_GC));
- } else {
- boxesPalette[PAL_CHECK] = FlipColor(gc->foreground);
- }
- boxesPalette[PAL_TOP_OUTER] = FlipColor(TkWinGetBorderPixels(tkwin,
- border, TK_3D_DARK_GC));
- boxesPalette[PAL_TOP_INNER] = FlipColor(TkWinGetBorderPixels(tkwin,
- border, TK_3D_DARK2));
- boxesPalette[PAL_BOTTOM_INNER] = FlipColor(TkWinGetBorderPixels(tkwin,
- border, TK_3D_LIGHT2));
- boxesPalette[PAL_BOTTOM_OUTER] = FlipColor(TkWinGetBorderPixels(tkwin,
- border, TK_3D_LIGHT_GC));
- if ((butPtr->state == STATE_DISABLED) || (butPtr->flags & TRISTATED)) {
- boxesPalette[PAL_INTERIOR] = FlipColor(TkWinGetBorderPixels(tkwin,
- border, TK_3D_LIGHT2));
- } else if (butPtr->selectBorder != NULL) {
- boxesPalette[PAL_INTERIOR] = FlipColor(TkWinGetBorderPixels(tkwin,
- butPtr->selectBorder, TK_3D_FLAT_GC));
- } else {
- boxesPalette[PAL_INTERIOR] = FlipColor(GetSysColor(COLOR_WINDOW));
- }
- boxesPalette[PAL_BACKGROUND] = FlipColor(TkWinGetBorderPixels(tkwin,
- border, TK_3D_FLAT_GC));
-
- dc = TkWinGetDrawableDC(butPtr->display, pixmap, &state);
- StretchDIBits(dc, x, y, (int)tsdPtr->boxWidth, (int)tsdPtr->boxHeight,
- xSrc, ySrc, (int)tsdPtr->boxWidth, (int)tsdPtr->boxHeight,
- tsdPtr->boxesBits, (LPBITMAPINFO) tsdPtr->boxesPtr,
- DIB_RGB_COLORS, SRCCOPY);
- TkWinReleaseDrawableDC(pixmap, dc, &state);
+ TkpDrawIndicator(butPtr, pixmap, border, gc, tsdPtr->boxSize, x, y + 1);
}
/*
@@ -757,19 +929,19 @@ TkpDisplayButton(
if (relief != TK_RELIEF_FLAT) {
Tk_Draw3DRectangle(tkwin, pixmap, border,
defaultWidth, defaultWidth,
- Tk_Width(tkwin) - 2*defaultWidth,
- Tk_Height(tkwin) - 2*defaultWidth,
+ Tk_Width(tkwin) - 2 * defaultWidth,
+ Tk_Height(tkwin) - 2 * defaultWidth,
butPtr->borderWidth, relief);
}
if (defaultWidth != 0) {
- int highlightColor;
+ int highlightColor;
dc = TkWinGetDrawableDC(butPtr->display, pixmap, &state);
- if (butPtr->type == TYPE_LABEL) {
- highlightColor = (int) Tk_3DBorderColor(butPtr->highlightBorder)->pixel;
- } else {
- highlightColor = (int) butPtr->highlightColorPtr->pixel;
- }
+ if (butPtr->type == TYPE_LABEL) {
+ highlightColor = (int) Tk_3DBorderColor(butPtr->highlightBorder)->pixel;
+ } else {
+ highlightColor = (int) butPtr->highlightColorPtr->pixel;
+ }
TkWinFillRect(dc, 0, 0, Tk_Width(tkwin), defaultWidth,
highlightColor);
TkWinFillRect(dc, 0, 0, defaultWidth, Tk_Height(tkwin),
@@ -833,14 +1005,14 @@ TkpComputeButtonGeometry(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- if (butPtr->highlightWidth < 0) {
- butPtr->highlightWidth = 0;
- }
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->highlightWidthPtr, &butPtr->highlightWidth);
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->borderWidthPtr, &butPtr->borderWidth);
+
butPtr->inset = butPtr->highlightWidth + butPtr->borderWidth;
butPtr->indicatorSpace = 0;
- if (!tsdPtr->boxesPtr) {
- InitBoxes();
+ if (!tsdPtr->initialized) {
+ InitBoxes(butPtr->tkwin);
}
/*
@@ -867,7 +1039,7 @@ TkpComputeButtonGeometry(
Tk_FreeTextLayout(butPtr->textLayout);
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
- Tcl_GetString(butPtr->textPtr), -1, butPtr->wrapLength,
+ Tcl_GetString(butPtr->textPtr), TCL_INDEX_NONE, butPtr->wrapLength,
butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
txtWidth = butPtr->textWidth;
@@ -1028,6 +1200,9 @@ TkpComputeButtonGeometry(
* because otherwise it is not really a compound button.
*/
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->padXPtr, &butPtr->padX);
+ Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->padYPtr, &butPtr->padY);
+
if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
switch ((enum compound) butPtr->compound) {
case COMPOUND_TOP:
@@ -1098,8 +1273,8 @@ TkpComputeButtonGeometry(
height = butPtr->height;
}
- width += 2*butPtr->padX;
- height += 2*butPtr->padY;
+ width += 2 * butPtr->padX;
+ height += 2 * butPtr->padY;
} else if (haveImage) {
if (butPtr->width > 0) {
width = butPtr->width;
@@ -1162,7 +1337,7 @@ TkpComputeButtonGeometry(
if (butPtr->type == TYPE_RADIO_BUTTON
|| butPtr->type == TYPE_CHECK_BUTTON) {
if (butPtr->indicatorOn) {
- butPtr->indicatorDiameter = tsdPtr->boxHeight;
+ butPtr->indicatorDiameter = tsdPtr->boxSize;
/*
* Make sure we can see the whole indicator, even if the text or
@@ -1202,8 +1377,8 @@ TkpComputeButtonGeometry(
*
* ButtonProc --
*
- * This function is call by Windows whenever an event occurs on a button
- * control created by Tk.
+ * This function is called by Windows whenever an event occurs on a
+ * button control created by Tk.
*
* Results:
* Standard Windows return value.
@@ -1282,7 +1457,7 @@ ButtonProc(
* causes all buttons to fire once a second, so we need to make sure
* that we are not dealing with the chromium life check.
*/
- if (wParam != 0 || lParam != 0) {
+ if (wParam != 0 || lParam != 0) {
int code;
Tcl_Interp *interp = butPtr->info.interp;
@@ -1302,7 +1477,7 @@ ButtonProc(
}
/* FALLTHRU */
default:
- if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ if (TkTranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
return result;
}
}
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c
index 1cf2219..f51bf8a 100644
--- a/win/tkWinClipboard.c
+++ b/win/tkWinClipboard.c
@@ -3,8 +3,8 @@
*
* This file contains functions for managing the clipboard.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 Scriptics Corporation.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -47,7 +47,7 @@ TkSelGetSelection(
* returned. */
Tk_GetSelProc *proc, /* Procedure to call to process the selection,
* once it has been retrieved. */
- ClientData clientData) /* Arbitrary value to pass to proc. */
+ void *clientData) /* Arbitrary value to pass to proc. */
{
char *data, *destPtr;
Tcl_DString ds;
@@ -60,10 +60,10 @@ TkSelGetSelection(
goto error;
}
if (!OpenClipboard(NULL)) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "clipboard cannot be opened, another application grabbed it"));
- Tcl_SetErrorCode(interp, "TK", "CLIPBOARD", "BUSY", NULL);
- return TCL_ERROR;
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "clipboard cannot be opened, another application grabbed it"));
+ Tcl_SetErrorCode(interp, "TK", "CLIPBOARD", "BUSY", NULL);
+ return TCL_ERROR;
}
/*
@@ -100,7 +100,7 @@ TkSelGetSelection(
*/
Tcl_DStringInit(&ds);
- Tcl_DStringAppend(&ds, "cp######", -1);
+ Tcl_DStringAppend(&ds, "cp######", TCL_INDEX_NONE);
data = (char *)GlobalLock(handle);
/*
@@ -109,8 +109,8 @@ TkSelGetSelection(
*/
locale = LANGIDFROMLCID(*((int*)data));
- GetLocaleInfoA(locale, LOCALE_IDEFAULTANSICODEPAGE,
- Tcl_DStringValue(&ds)+2, Tcl_DStringLength(&ds)-2);
+ GetLocaleInfoA((ULONG)locale, LOCALE_IDEFAULTANSICODEPAGE,
+ Tcl_DStringValue(&ds)+2, (int)Tcl_DStringLength(&ds)-2);
GlobalUnlock(handle);
encoding = Tcl_GetEncoding(NULL, Tcl_DStringValue(&ds));
@@ -132,7 +132,7 @@ TkSelGetSelection(
goto error;
}
data = (char *)GlobalLock(handle);
- Tcl_ExternalToUtfDString(encoding, data, -1, &ds);
+ (void)Tcl_ExternalToUtfDString(encoding, data, TCL_INDEX_NONE, &ds);
GlobalUnlock(handle);
if (encoding) {
Tcl_FreeEncoding(encoding);
@@ -281,7 +281,7 @@ TkWinClipboardRender(
TkClipboardBuffer *cbPtr;
HGLOBAL handle;
char *buffer, *p, *rawText, *endPtr;
- int length;
+ size_t length;
Tcl_DString ds;
for (targetPtr = dispPtr->clipTargetPtr; targetPtr != NULL;
@@ -329,21 +329,21 @@ TkWinClipboardRender(
}
*buffer = '\0';
- Tcl_DStringInit(&ds);
- Tcl_UtfToWCharDString(rawText, -1, &ds);
- ckfree(rawText);
- handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
- Tcl_DStringLength(&ds) + 2);
- if (!handle) {
+ Tcl_DStringInit(&ds);
+ Tcl_UtfToWCharDString(rawText, TCL_INDEX_NONE, &ds);
+ ckfree(rawText);
+ handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
+ Tcl_DStringLength(&ds) + 2);
+ if (!handle) {
+ Tcl_DStringFree(&ds);
+ return;
+ }
+ buffer = (char *)GlobalLock(handle);
+ memcpy(buffer, Tcl_DStringValue(&ds),
+ Tcl_DStringLength(&ds) + 2);
+ GlobalUnlock(handle);
Tcl_DStringFree(&ds);
- return;
- }
- buffer = (char *)GlobalLock(handle);
- memcpy(buffer, Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds) + 2);
- GlobalUnlock(handle);
- Tcl_DStringFree(&ds);
- SetClipboardData(CF_UNICODETEXT, handle);
+ SetClipboardData(CF_UNICODETEXT, handle);
}
/*
diff --git a/win/tkWinColor.c b/win/tkWinColor.c
index 1312bcb..63af7d9 100644
--- a/win/tkWinColor.c
+++ b/win/tkWinColor.c
@@ -3,8 +3,8 @@
*
* Functions to map color names to system color values.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
- * Copyright (c) 1994 Software Research Associates, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
+ * Copyright © 1994 Software Research Associates, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -58,6 +58,7 @@ static const SystemColorEntry sysColors[] = {
{"InfoText", COLOR_INFOTEXT},
{"Menu", COLOR_MENU},
{"MenuText", COLOR_MENUTEXT},
+ {"PlaceHolderText", COLOR_GRAYTEXT},
{"Scrollbar", COLOR_SCROLLBAR},
{"Window", COLOR_WINDOW},
{"WindowFrame", COLOR_WINDOWFRAME},
@@ -308,13 +309,13 @@ XAllocColor(
PALETTEENTRY entry, closeEntry;
HDC dc = GetDC(NULL);
- entry.peRed = (color->red) >> 8;
- entry.peGreen = (color->green) >> 8;
- entry.peBlue = (color->blue) >> 8;
+ entry.peRed = (BYTE)((color->red) >> 8);
+ entry.peGreen = (BYTE)((color->green) >> 8);
+ entry.peBlue = (BYTE)((color->blue) >> 8);
entry.peFlags = 0;
if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) {
- unsigned long sizePalette = GetDeviceCaps(dc, SIZEPALETTE);
+ unsigned long sizePalette = (unsigned long)GetDeviceCaps(dc, SIZEPALETTE);
UINT newPixel, closePixel;
int isNew;
size_t refCount;
diff --git a/win/tkWinConfig.c b/win/tkWinConfig.c
index 6cda300..e2f8ac1 100644
--- a/win/tkWinConfig.c
+++ b/win/tkWinConfig.c
@@ -4,7 +4,7 @@
* This module implements the Windows system defaults for the
* configuration package.
*
- * Copyright (c) 1997 Sun Microsystems, Inc.
+ * Copyright © 1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -16,7 +16,7 @@
/*
*----------------------------------------------------------------------
*
- * TkpGetSystemDefault --
+ * Tk_GetSystemDefault --
*
* Given a dbName and className for a configuration option, return a
* string representation of the option.
@@ -33,7 +33,7 @@
*/
Tcl_Obj *
-TkpGetSystemDefault(
+Tk_GetSystemDefault(
Tk_Window tkwin, /* A window to use. */
const char *dbName, /* The option database name. */
const char *className) /* The name of the option class. */
diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c
index 8c9399a..635ae66 100644
--- a/win/tkWinCursor.c
+++ b/win/tkWinCursor.c
@@ -3,7 +3,7 @@
*
* This file contains Win32 specific cursor related routines.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -98,8 +98,9 @@ TkGetCursorByName(
{
const struct CursorName *namePtr;
TkWinCursor *cursorPtr;
- int argc;
+ Tcl_Size argc;
const char **argv = NULL;
+ (void)tkwin;
/*
* All cursor names are valid lists of one element (for
@@ -113,7 +114,7 @@ TkGetCursorByName(
goto badCursorSpec;
}
- cursorPtr = ckalloc(sizeof(TkWinCursor));
+ cursorPtr = (TkWinCursor *)ckalloc(sizeof(TkWinCursor));
cursorPtr->info.cursor = (Tk_Cursor) cursorPtr;
cursorPtr->winCursor = NULL;
cursorPtr->system = 0;
@@ -131,7 +132,7 @@ TkGetCursorByName(
if (Tcl_IsSafe(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't get cursor from a file in a safe interpreter",-1));
+ "can't get cursor from a file in a safe interpreter", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "SAFE", "CURSOR_FILE", NULL);
ckfree(argv);
ckfree(cursorPtr);
@@ -201,6 +202,16 @@ TkCreateCursorFromData(
XColor fgColor, /* Foreground color for cursor. */
XColor bgColor) /* Background color for cursor. */
{
+ (void)tkwin;
+ (void)source;
+ (void)mask;
+ (void)width;
+ (void)height;
+ (void)xHot;
+ (void)yHot;
+ (void)fgColor;
+ (void)bgColor;
+
return NULL;
}
@@ -225,6 +236,8 @@ void
TkpFreeCursor(
TkCursor *cursorPtr)
{
+ (void)cursorPtr;
+
/* TkWinCursor *winCursorPtr = (TkWinCursor *) cursorPtr; */
}
diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h
index b03cbd7..3de7fb2 100644
--- a/win/tkWinDefault.h
+++ b/win/tkWinDefault.h
@@ -4,7 +4,7 @@
* This file defines the defaults for all options for all of
* the Tk widgets.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -69,7 +69,7 @@
#define DEF_BUTTON_HIGHLIGHT HIGHLIGHT
#define DEF_LABEL_HIGHLIGHT_WIDTH "0"
#define DEF_BUTTON_HIGHLIGHT_WIDTH "1"
-#define DEF_BUTTON_IMAGE ((char *) NULL)
+#define DEF_BUTTON_IMAGE NULL
#define DEF_BUTTON_INDICATOR "1"
#define DEF_BUTTON_JUSTIFY "center"
#define DEF_BUTTON_OFF_VALUE "0"
@@ -85,14 +85,13 @@
#define DEF_BUTTON_REPEAT_INTERVAL "0"
#define DEF_BUTTON_SELECT_COLOR INDICATOR
#define DEF_BUTTON_SELECT_MONO BLACK
-#define DEF_BUTTON_SELECT_IMAGE ((char *) NULL)
+#define DEF_BUTTON_SELECT_IMAGE NULL
#define DEF_BUTTON_STATE "normal"
#define DEF_LABEL_TAKE_FOCUS "0"
-#define DEF_BUTTON_TAKE_FOCUS ((char *) NULL)
+#define DEF_BUTTON_TAKE_FOCUS NULL
#define DEF_BUTTON_TEXT ""
#define DEF_BUTTON_TEXT_VARIABLE ""
#define DEF_BUTTON_TRISTATE_VALUE ""
-#define DEF_BUTTON_UNDERLINE "-1"
#define DEF_BUTTON_VALUE ""
#define DEF_BUTTON_WIDTH "0"
#define DEF_BUTTON_WRAP_LENGTH "0"
@@ -127,7 +126,7 @@
#define DEF_CANVAS_SELECT_BD_MONO "0"
#define DEF_CANVAS_SELECT_FG_COLOR SELECT_FG
#define DEF_CANVAS_SELECT_FG_MONO WHITE
-#define DEF_CANVAS_TAKE_FOCUS ((char *) NULL)
+#define DEF_CANVAS_TAKE_FOCUS NULL
#define DEF_CANVAS_WIDTH "10c"
#define DEF_CANVAS_X_SCROLL_CMD ""
#define DEF_CANVAS_X_SCROLL_INCREMENT "0"
@@ -158,6 +157,8 @@
#define DEF_ENTRY_INSERT_ON_TIME "600"
#define DEF_ENTRY_INSERT_WIDTH "2"
#define DEF_ENTRY_JUSTIFY "left"
+#define DEF_ENTRY_PLACEHOLDER ""
+#define DEF_ENTRY_PLACEHOLDERFG "SystemPlaceHolderText"
#define DEF_ENTRY_READONLY_BG_COLOR "SystemButtonFace"
#define DEF_ENTRY_READONLY_BG_MONO WHITE
#define DEF_ENTRY_RELIEF "sunken"
@@ -168,9 +169,9 @@
#define DEF_ENTRY_SELECT_BD_MONO "0"
#define DEF_ENTRY_SELECT_FG_COLOR SELECT_FG
#define DEF_ENTRY_SELECT_FG_MONO WHITE
-#define DEF_ENTRY_SHOW ((char *) NULL)
+#define DEF_ENTRY_SHOW NULL
#define DEF_ENTRY_STATE "normal"
-#define DEF_ENTRY_TAKE_FOCUS ((char *) NULL)
+#define DEF_ENTRY_TAKE_FOCUS NULL
#define DEF_ENTRY_TEXT_VARIABLE ""
#define DEF_ENTRY_WIDTH "20"
@@ -179,7 +180,9 @@
*/
#define DEF_FRAME_BG_COLOR NORMAL_BG
+#define DEF_FRAME_BG_IMAGE NULL
#define DEF_FRAME_BG_MONO WHITE
+#define DEF_FRAME_BG_TILE "0"
#define DEF_FRAME_BORDER_WIDTH "0"
#define DEF_FRAME_CLASS "Frame"
#define DEF_FRAME_COLORMAP ""
@@ -237,37 +240,36 @@
#define DEF_LISTBOX_SELECT_MODE "browse"
#define DEF_LISTBOX_SET_GRID "0"
#define DEF_LISTBOX_STATE "normal"
-#define DEF_LISTBOX_TAKE_FOCUS ((char *) NULL)
+#define DEF_LISTBOX_TAKE_FOCUS NULL
#define DEF_LISTBOX_WIDTH "20"
/*
* Defaults for individual entries of menus:
*/
-#define DEF_MENU_ENTRY_ACTIVE_BG ((char *) NULL)
-#define DEF_MENU_ENTRY_ACTIVE_FG ((char *) NULL)
-#define DEF_MENU_ENTRY_ACCELERATOR ((char *) NULL)
-#define DEF_MENU_ENTRY_BG ((char *) NULL)
+#define DEF_MENU_ENTRY_ACTIVE_BG NULL
+#define DEF_MENU_ENTRY_ACTIVE_FG NULL
+#define DEF_MENU_ENTRY_ACCELERATOR NULL
+#define DEF_MENU_ENTRY_BG NULL
#define DEF_MENU_ENTRY_BITMAP NULL
#define DEF_MENU_ENTRY_COLUMN_BREAK "0"
-#define DEF_MENU_ENTRY_COMMAND ((char *) NULL)
+#define DEF_MENU_ENTRY_COMMAND NULL
#define DEF_MENU_ENTRY_COMPOUND "none"
-#define DEF_MENU_ENTRY_FG ((char *) NULL)
-#define DEF_MENU_ENTRY_FONT ((char *) NULL)
+#define DEF_MENU_ENTRY_FG NULL
+#define DEF_MENU_ENTRY_FONT NULL
#define DEF_MENU_ENTRY_HIDE_MARGIN "0"
-#define DEF_MENU_ENTRY_IMAGE ((char *) NULL)
+#define DEF_MENU_ENTRY_IMAGE NULL
#define DEF_MENU_ENTRY_INDICATOR "1"
-#define DEF_MENU_ENTRY_LABEL ((char *) NULL)
-#define DEF_MENU_ENTRY_MENU ((char *) NULL)
+#define DEF_MENU_ENTRY_LABEL NULL
+#define DEF_MENU_ENTRY_MENU NULL
#define DEF_MENU_ENTRY_OFF_VALUE "0"
#define DEF_MENU_ENTRY_ON_VALUE "1"
-#define DEF_MENU_ENTRY_SELECT_IMAGE ((char *) NULL)
+#define DEF_MENU_ENTRY_SELECT_IMAGE NULL
#define DEF_MENU_ENTRY_STATE "normal"
-#define DEF_MENU_ENTRY_VALUE ((char *) NULL)
-#define DEF_MENU_ENTRY_CHECK_VARIABLE ((char *) NULL)
+#define DEF_MENU_ENTRY_VALUE NULL
+#define DEF_MENU_ENTRY_CHECK_VARIABLE NULL
#define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton"
-#define DEF_MENU_ENTRY_SELECT ((char *) NULL)
-#define DEF_MENU_ENTRY_UNDERLINE "-1"
+#define DEF_MENU_ENTRY_SELECT NULL
/*
* Defaults for menus overall:
@@ -278,6 +280,7 @@
#define DEF_MENU_ACTIVE_BORDER_WIDTH "0"
#define DEF_MENU_ACTIVE_FG_COLOR SELECT_FG
#define DEF_MENU_ACTIVE_FG_MONO WHITE
+#define DEF_MENU_ACTIVE_RELIEF "flat"
#define DEF_MENU_BG_COLOR MENU_BG
#define DEF_MENU_BG_MONO WHITE
#define DEF_MENU_BORDER_WIDTH "0"
@@ -291,8 +294,8 @@
#define DEF_MENU_SELECT_COLOR MENU_FG
#define DEF_MENU_SELECT_MONO BLACK
#define DEF_MENU_TAKE_FOCUS "0"
-#define DEF_MENU_TEAROFF "1"
-#define DEF_MENU_TEAROFF_CMD ((char *) NULL)
+#define DEF_MENU_TEAROFF "0"
+#define DEF_MENU_TEAROFF_CMD NULL
#define DEF_MENU_TITLE ""
#define DEF_MENU_TYPE "normal"
@@ -320,7 +323,7 @@
#define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO
#define DEF_MENUBUTTON_HIGHLIGHT HIGHLIGHT
#define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
-#define DEF_MENUBUTTON_IMAGE ((char *) NULL)
+#define DEF_MENUBUTTON_IMAGE NULL
#define DEF_MENUBUTTON_INDICATOR "0"
#define DEF_MENUBUTTON_JUSTIFY "center"
#define DEF_MENUBUTTON_MENU ""
@@ -331,7 +334,6 @@
#define DEF_MENUBUTTON_TAKE_FOCUS "0"
#define DEF_MENUBUTTON_TEXT ""
#define DEF_MENUBUTTON_TEXT_VARIABLE ""
-#define DEF_MENUBUTTON_UNDERLINE "-1"
#define DEF_MENUBUTTON_WIDTH "0"
#define DEF_MENUBUTTON_WRAP_LENGTH "0"
@@ -404,7 +406,7 @@
#define DEF_SCALE_ACTIVE_BG_MONO BLACK
#define DEF_SCALE_BG_COLOR NORMAL_BG
#define DEF_SCALE_BG_MONO WHITE
-#define DEF_SCALE_BIG_INCREMENT "0"
+#define DEF_SCALE_BIG_INCREMENT "0.0"
#define DEF_SCALE_BORDER_WIDTH "1"
#define DEF_SCALE_COMMAND ""
#define DEF_SCALE_CURSOR ""
@@ -412,7 +414,7 @@
#define DEF_SCALE_FONT "TkDefaultFont"
#define DEF_SCALE_FG_COLOR NORMAL_FG
#define DEF_SCALE_FG_MONO BLACK
-#define DEF_SCALE_FROM "0"
+#define DEF_SCALE_FROM "0.0"
#define DEF_SCALE_HIGHLIGHT_BG_COLOR DEF_SCALE_BG_COLOR
#define DEF_SCALE_HIGHLIGHT_BG_MONO DEF_SCALE_BG_MONO
#define DEF_SCALE_HIGHLIGHT HIGHLIGHT
@@ -423,16 +425,16 @@
#define DEF_SCALE_RELIEF "flat"
#define DEF_SCALE_REPEAT_DELAY "300"
#define DEF_SCALE_REPEAT_INTERVAL "100"
-#define DEF_SCALE_RESOLUTION "1"
+#define DEF_SCALE_RESOLUTION "1.0"
#define DEF_SCALE_TROUGH_COLOR TROUGH
#define DEF_SCALE_TROUGH_MONO WHITE
#define DEF_SCALE_SHOW_VALUE "1"
#define DEF_SCALE_SLIDER_LENGTH "30"
#define DEF_SCALE_SLIDER_RELIEF "raised"
#define DEF_SCALE_STATE "normal"
-#define DEF_SCALE_TAKE_FOCUS ((char *) NULL)
-#define DEF_SCALE_TICK_INTERVAL "0"
-#define DEF_SCALE_TO "100"
+#define DEF_SCALE_TAKE_FOCUS NULL
+#define DEF_SCALE_TICK_INTERVAL "0.0"
+#define DEF_SCALE_TO "100.0"
#define DEF_SCALE_VARIABLE ""
#define DEF_SCALE_WIDTH "15"
@@ -457,7 +459,7 @@
#define DEF_SCROLLBAR_RELIEF "sunken"
#define DEF_SCROLLBAR_REPEAT_DELAY "300"
#define DEF_SCROLLBAR_REPEAT_INTERVAL "100"
-#define DEF_SCROLLBAR_TAKE_FOCUS ((char *) NULL)
+#define DEF_SCROLLBAR_TAKE_FOCUS NULL
#define DEF_SCROLLBAR_TROUGH_COLOR TROUGH
#define DEF_SCROLLBAR_TROUGH_MONO WHITE
#define DEF_SCROLLBAR_WIDTH "10"
@@ -505,7 +507,7 @@
#define DEF_TEXT_STATE "normal"
#define DEF_TEXT_TABS ""
#define DEF_TEXT_TABSTYLE "tabular"
-#define DEF_TEXT_TAKE_FOCUS ((char *) NULL)
+#define DEF_TEXT_TAKE_FOCUS NULL
#define DEF_TEXT_UNDO "0"
#define DEF_TEXT_WIDTH "80"
#define DEF_TEXT_WRAP "char"
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index fca6cf1..6ced04a 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -3,7 +3,7 @@
*
* Contains the Windows implementation of the common dialog boxes.
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -177,9 +177,9 @@ typedef struct OFNOpts {
int mustExist; /* Used only for */
int forceXPStyle; /* XXX - Force XP style even on newer systems */
WCHAR file[TK_MULTI_MAX_PATH]; /* File name
- XXX - fixed size because it was so
- historically. Why not malloc'ed ?
- */
+ XXX - fixed size because it was so
+ historically. Why not malloc'ed ?
+ */
} OFNOpts;
/* Define the operation for which option parsing is to be done. */
@@ -254,26 +254,26 @@ typedef struct IShellItemArrayVtbl
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IShellItemArray *, REFIID riid,void **ppvObject);
+ IShellItemArray *, REFIID riid,void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(IShellItemArray *);
ULONG ( STDMETHODCALLTYPE *Release )(IShellItemArray *);
HRESULT ( STDMETHODCALLTYPE *BindToHandler )(IShellItemArray *,
- IBindCtx *, REFGUID, REFIID, void **);
+ IBindCtx *, REFGUID, REFIID, void **);
/* flags is actually is enum GETPROPERTYSTOREFLAGS */
HRESULT ( STDMETHODCALLTYPE *GetPropertyStore )(
- IShellItemArray *, int, REFIID, void **);
+ IShellItemArray *, int, REFIID, void **);
/* keyType actually REFPROPERTYKEY */
HRESULT ( STDMETHODCALLTYPE *GetPropertyDescriptionList )(
- IShellItemArray *, void *, REFIID, void **);
+ IShellItemArray *, void *, REFIID, void **);
HRESULT ( STDMETHODCALLTYPE *GetAttributes )(IShellItemArray *,
- SIATTRIBFLAGS, SFGAOF, SFGAOF *);
+ SIATTRIBFLAGS, SFGAOF, SFGAOF *);
HRESULT ( STDMETHODCALLTYPE *GetCount )(
- IShellItemArray *, DWORD *);
+ IShellItemArray *, DWORD *);
HRESULT ( STDMETHODCALLTYPE *GetItemAt )(
- IShellItemArray *, DWORD, IShellItem **);
+ IShellItemArray *, DWORD, IShellItem **);
/* ppenumShellItems actually (IEnumShellItems **) */
HRESULT ( STDMETHODCALLTYPE *EnumItems )(
- IShellItemArray *, void **);
+ IShellItemArray *, void **);
END_INTERFACE
} IShellItemArrayVtbl;
@@ -354,56 +354,56 @@ typedef struct IFileDialogVtbl
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IFileDialog *, REFIID, void **);
+ IFileDialog *, REFIID, void **);
ULONG ( STDMETHODCALLTYPE *AddRef )( IFileDialog *);
ULONG ( STDMETHODCALLTYPE *Release )( IFileDialog *);
HRESULT ( STDMETHODCALLTYPE *Show )( IFileDialog *, HWND);
HRESULT ( STDMETHODCALLTYPE *SetFileTypes )( IFileDialog *,
- UINT, const TCLCOMDLG_FILTERSPEC *);
+ UINT, const TCLCOMDLG_FILTERSPEC *);
HRESULT ( STDMETHODCALLTYPE *SetFileTypeIndex )(IFileDialog *, UINT);
HRESULT ( STDMETHODCALLTYPE *GetFileTypeIndex )(IFileDialog *, UINT *);
/* XXX - Actually pfde is IFileDialogEvents* but we do not use
this call and do not want to define IFileDialogEvents as that
pulls in a whole bunch of other stuff. */
HRESULT ( STDMETHODCALLTYPE *Advise )(
- IFileDialog *, void *, DWORD *);
+ IFileDialog *, void *, DWORD *);
HRESULT ( STDMETHODCALLTYPE *Unadvise )(IFileDialog *, DWORD);
HRESULT ( STDMETHODCALLTYPE *SetOptions )(
- IFileDialog *, FILEOPENDIALOGOPTIONS);
+ IFileDialog *, FILEOPENDIALOGOPTIONS);
HRESULT ( STDMETHODCALLTYPE *GetOptions )(
- IFileDialog *, FILEOPENDIALOGOPTIONS *);
+ IFileDialog *, FILEOPENDIALOGOPTIONS *);
HRESULT ( STDMETHODCALLTYPE *SetDefaultFolder )(
- IFileDialog *, IShellItem *);
+ IFileDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *SetFolder )(
- IFileDialog *, IShellItem *);
+ IFileDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *GetFolder )(
- IFileDialog *, IShellItem **);
+ IFileDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *GetCurrentSelection )(
- IFileDialog *, IShellItem **);
+ IFileDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *SetFileName )(
- IFileDialog *, LPCWSTR);
+ IFileDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetFileName )(
- IFileDialog *, LPWSTR *);
+ IFileDialog *, LPWSTR *);
HRESULT ( STDMETHODCALLTYPE *SetTitle )(
- IFileDialog *, LPCWSTR);
+ IFileDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetOkButtonLabel )(
- IFileDialog *, LPCWSTR);
+ IFileDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetFileNameLabel )(
- IFileDialog *, LPCWSTR);
+ IFileDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetResult )(
- IFileDialog *, IShellItem **);
+ IFileDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *AddPlace )(
- IFileDialog *, IShellItem *, FDAP);
+ IFileDialog *, IShellItem *, FDAP);
HRESULT ( STDMETHODCALLTYPE *SetDefaultExtension )(
- IFileDialog *, LPCWSTR);
+ IFileDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *Close )( IFileDialog *, HRESULT);
HRESULT ( STDMETHODCALLTYPE *SetClientGuid )(
- IFileDialog *, REFGUID);
+ IFileDialog *, REFGUID);
HRESULT ( STDMETHODCALLTYPE *ClearClientData )( IFileDialog *);
/* pFilter actually IShellItemFilter. But deprecated in Win7 AND we do
not use it anyways. So define as void* */
HRESULT ( STDMETHODCALLTYPE *SetFilter )(
- IFileDialog *, void *);
+ IFileDialog *, void *);
END_INTERFACE
} IFileDialogVtbl;
@@ -418,67 +418,67 @@ typedef struct IFileSaveDialogVtbl {
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IFileSaveDialog *, REFIID, void **);
+ IFileSaveDialog *, REFIID, void **);
ULONG ( STDMETHODCALLTYPE *AddRef )( IFileSaveDialog *);
ULONG ( STDMETHODCALLTYPE *Release )( IFileSaveDialog *);
HRESULT ( STDMETHODCALLTYPE *Show )(
- IFileSaveDialog *, HWND);
+ IFileSaveDialog *, HWND);
HRESULT ( STDMETHODCALLTYPE *SetFileTypes )( IFileSaveDialog *,
- UINT, const TCLCOMDLG_FILTERSPEC *);
+ UINT, const TCLCOMDLG_FILTERSPEC *);
HRESULT ( STDMETHODCALLTYPE *SetFileTypeIndex )(
- IFileSaveDialog *, UINT);
+ IFileSaveDialog *, UINT);
HRESULT ( STDMETHODCALLTYPE *GetFileTypeIndex )(
- IFileSaveDialog *, UINT *);
+ IFileSaveDialog *, UINT *);
/* Actually pfde is IFileSaveDialogEvents* */
HRESULT ( STDMETHODCALLTYPE *Advise )(
- IFileSaveDialog *, void *, DWORD *);
+ IFileSaveDialog *, void *, DWORD *);
HRESULT ( STDMETHODCALLTYPE *Unadvise )( IFileSaveDialog *, DWORD);
HRESULT ( STDMETHODCALLTYPE *SetOptions )(
- IFileSaveDialog *, FILEOPENDIALOGOPTIONS);
+ IFileSaveDialog *, FILEOPENDIALOGOPTIONS);
HRESULT ( STDMETHODCALLTYPE *GetOptions )(
- IFileSaveDialog *, FILEOPENDIALOGOPTIONS *);
+ IFileSaveDialog *, FILEOPENDIALOGOPTIONS *);
HRESULT ( STDMETHODCALLTYPE *SetDefaultFolder )(
- IFileSaveDialog *, IShellItem *);
+ IFileSaveDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *SetFolder )(
- IFileSaveDialog *, IShellItem *);
+ IFileSaveDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *GetFolder )(
- IFileSaveDialog *, IShellItem **);
+ IFileSaveDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *GetCurrentSelection )(
- IFileSaveDialog *, IShellItem **);
+ IFileSaveDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *SetFileName )(
- IFileSaveDialog *, LPCWSTR);
+ IFileSaveDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetFileName )(
- IFileSaveDialog *, LPWSTR *);
+ IFileSaveDialog *, LPWSTR *);
HRESULT ( STDMETHODCALLTYPE *SetTitle )(
- IFileSaveDialog *, LPCWSTR);
+ IFileSaveDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetOkButtonLabel )(
- IFileSaveDialog *, LPCWSTR);
+ IFileSaveDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetFileNameLabel )(
- IFileSaveDialog *, LPCWSTR);
+ IFileSaveDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetResult )(
- IFileSaveDialog *, IShellItem **);
+ IFileSaveDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *AddPlace )(
- IFileSaveDialog *, IShellItem *, FDAP);
+ IFileSaveDialog *, IShellItem *, FDAP);
HRESULT ( STDMETHODCALLTYPE *SetDefaultExtension )(
- IFileSaveDialog *, LPCWSTR);
+ IFileSaveDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *Close )( IFileSaveDialog *, HRESULT);
HRESULT ( STDMETHODCALLTYPE *SetClientGuid )(
- IFileSaveDialog *, REFGUID);
+ IFileSaveDialog *, REFGUID);
HRESULT ( STDMETHODCALLTYPE *ClearClientData )( IFileSaveDialog *);
/* pFilter Actually IShellItemFilter* */
HRESULT ( STDMETHODCALLTYPE *SetFilter )(
- IFileSaveDialog *, void *);
+ IFileSaveDialog *, void *);
HRESULT ( STDMETHODCALLTYPE *SetSaveAsItem )(
- IFileSaveDialog *, IShellItem *);
+ IFileSaveDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *SetProperties )(
- IFileSaveDialog *, IPropertyStore *);
+ IFileSaveDialog *, IPropertyStore *);
HRESULT ( STDMETHODCALLTYPE *SetCollectedProperties )(
- IFileSaveDialog *, IPropertyDescriptionList *, BOOL);
+ IFileSaveDialog *, IPropertyDescriptionList *, BOOL);
HRESULT ( STDMETHODCALLTYPE *GetProperties )(
- IFileSaveDialog *, IPropertyStore **);
+ IFileSaveDialog *, IPropertyStore **);
HRESULT ( STDMETHODCALLTYPE *ApplyProperties )(
- IFileSaveDialog *, IShellItem *, IPropertyStore *,
- HWND, IFileOperationProgressSink *);
+ IFileSaveDialog *, IShellItem *, IPropertyStore *,
+ HWND, IFileOperationProgressSink *);
END_INTERFACE
@@ -493,61 +493,61 @@ typedef struct IFileOpenDialogVtbl {
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
- IFileOpenDialog *, REFIID, void **);
+ IFileOpenDialog *, REFIID, void **);
ULONG ( STDMETHODCALLTYPE *AddRef )( IFileOpenDialog *);
ULONG ( STDMETHODCALLTYPE *Release )( IFileOpenDialog *);
HRESULT ( STDMETHODCALLTYPE *Show )( IFileOpenDialog *, HWND);
HRESULT ( STDMETHODCALLTYPE *SetFileTypes )( IFileOpenDialog *,
- UINT, const TCLCOMDLG_FILTERSPEC *);
+ UINT, const TCLCOMDLG_FILTERSPEC *);
HRESULT ( STDMETHODCALLTYPE *SetFileTypeIndex )(
- IFileOpenDialog *, UINT);
+ IFileOpenDialog *, UINT);
HRESULT ( STDMETHODCALLTYPE *GetFileTypeIndex )(
- IFileOpenDialog *, UINT *);
+ IFileOpenDialog *, UINT *);
/* Actually pfde is IFileDialogEvents* */
HRESULT ( STDMETHODCALLTYPE *Advise )(
- IFileOpenDialog *, void *, DWORD *);
+ IFileOpenDialog *, void *, DWORD *);
HRESULT ( STDMETHODCALLTYPE *Unadvise )( IFileOpenDialog *, DWORD);
HRESULT ( STDMETHODCALLTYPE *SetOptions )(
- IFileOpenDialog *, FILEOPENDIALOGOPTIONS);
+ IFileOpenDialog *, FILEOPENDIALOGOPTIONS);
HRESULT ( STDMETHODCALLTYPE *GetOptions )(
- IFileOpenDialog *, FILEOPENDIALOGOPTIONS *);
+ IFileOpenDialog *, FILEOPENDIALOGOPTIONS *);
HRESULT ( STDMETHODCALLTYPE *SetDefaultFolder )(
- IFileOpenDialog *, IShellItem *);
+ IFileOpenDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *SetFolder )(
- IFileOpenDialog *, IShellItem *);
+ IFileOpenDialog *, IShellItem *);
HRESULT ( STDMETHODCALLTYPE *GetFolder )(
- IFileOpenDialog *, IShellItem **);
+ IFileOpenDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *GetCurrentSelection )(
- IFileOpenDialog *, IShellItem **);
+ IFileOpenDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *SetFileName )(
- IFileOpenDialog *, LPCWSTR);
+ IFileOpenDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetFileName )(
- IFileOpenDialog *, LPWSTR *);
+ IFileOpenDialog *, LPWSTR *);
HRESULT ( STDMETHODCALLTYPE *SetTitle )(
- IFileOpenDialog *, LPCWSTR);
+ IFileOpenDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetOkButtonLabel )(
- IFileOpenDialog *, LPCWSTR);
+ IFileOpenDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *SetFileNameLabel )(
- IFileOpenDialog *, LPCWSTR);
+ IFileOpenDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *GetResult )(
- IFileOpenDialog *, IShellItem **);
+ IFileOpenDialog *, IShellItem **);
HRESULT ( STDMETHODCALLTYPE *AddPlace )(
- IFileOpenDialog *, IShellItem *, FDAP);
+ IFileOpenDialog *, IShellItem *, FDAP);
HRESULT ( STDMETHODCALLTYPE *SetDefaultExtension )(
- IFileOpenDialog *, LPCWSTR);
+ IFileOpenDialog *, LPCWSTR);
HRESULT ( STDMETHODCALLTYPE *Close )( IFileOpenDialog *, HRESULT);
HRESULT ( STDMETHODCALLTYPE *SetClientGuid )(
- IFileOpenDialog *, REFGUID);
+ IFileOpenDialog *, REFGUID);
HRESULT ( STDMETHODCALLTYPE *ClearClientData )(
- IFileOpenDialog *);
+ IFileOpenDialog *);
HRESULT ( STDMETHODCALLTYPE *SetFilter )(
- IFileOpenDialog *,
- /* pFilter is actually IShellItemFilter */
- void *);
+ IFileOpenDialog *,
+ /* pFilter is actually IShellItemFilter */
+ void *);
HRESULT ( STDMETHODCALLTYPE *GetResults )(
- IFileOpenDialog *, IShellItemArray **);
+ IFileOpenDialog *, IShellItemArray **);
HRESULT ( STDMETHODCALLTYPE *GetSelectedItems )(
- IFileOpenDialog *, IShellItemArray **);
+ IFileOpenDialog *, IShellItemArray **);
END_INTERFACE
} IFileOpenDialogVtbl;
@@ -569,18 +569,18 @@ static UINT CALLBACK ColorDlgHookProc(HWND hDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam);
static void CleanupOFNOptions(OFNOpts *optsPtr);
static int ParseOFNOptions(void *clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[], enum OFNOper oper, OFNOpts *optsPtr);
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[], enum OFNOper oper, OFNOpts *optsPtr);
static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr,
- enum OFNOper oper);
+ enum OFNOper oper);
static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
- enum OFNOper oper);
+ enum OFNOper oper);
static int GetFileName(void *clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[], enum OFNOper oper);
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[], enum OFNOper oper);
static int MakeFilterVista(Tcl_Interp *interp, OFNOpts *optsPtr,
- DWORD *countPtr, TCLCOMDLG_FILTERSPEC **dlgFilterPtrPtr,
- DWORD *defaultFilterIndexPtr);
+ DWORD *countPtr, TCLCOMDLG_FILTERSPEC **dlgFilterPtrPtr,
+ DWORD *defaultFilterIndexPtr);
static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr);
static int MakeFilter(Tcl_Interp *interp, Tcl_Obj *valuePtr,
Tcl_DString *dsPtr, Tcl_Obj *initialPtr,
@@ -590,63 +590,7 @@ static UINT APIENTRY OFNHookProc(HWND hdlg, UINT uMsg, WPARAM wParam,
static LRESULT CALLBACK MsgBoxCBTProc(int nCode, WPARAM wParam, LPARAM lParam);
static void SetTkDialog(void *clientData);
static const char *ConvertExternalFilename(LPCWSTR, Tcl_DString *);
-static void LoadShellProcs(void);
-
-/* Definitions of dynamically loaded Win32 calls */
-typedef HRESULT (STDAPICALLTYPE SHCreateItemFromParsingNameProc)(
- PCWSTR pszPath, IBindCtx *pbc, REFIID riid, void **ppv);
-struct ShellProcPointers {
- SHCreateItemFromParsingNameProc *SHCreateItemFromParsingName;
-} ShellProcs;
-
-
-/*
- *-------------------------------------------------------------------------
- *
- * LoadShellProcs --
- *
- * Some shell functions are not available on older versions of
- * Windows. This function dynamically loads them and stores pointers
- * to them in ShellProcs. Any function that is not available has
- * the corresponding pointer set to NULL.
- *
- * Note this call never fails. Unavailability of a function is not
- * a reason for failure. Caller should check whether a particular
- * function pointer is NULL or not. Once loaded a function stays
- * forever loaded.
- *
- * XXX - we load the function pointers into global memory. This implies
- * there is a potential (however small) for race conditions between
- * threads. However, Tk is in any case meant to be loaded in exactly
- * one thread so this should not be an issue and saves us from
- * unnecessary bookkeeping.
- *
- * Return value:
- * None.
- *
- * Side effects:
- * ShellProcs is populated.
- *-------------------------------------------------------------------------
- */
-static void LoadShellProcs(void)
-{
- static HMODULE shell32_handle = NULL;
-
- if (shell32_handle != NULL) {
- return; /* We have already been through here. */
- }
-
- shell32_handle = GetModuleHandleW(L"shell32.dll");
- if (shell32_handle == NULL) { /* Should never happen but check anyways. */
- return;
- }
-
- ShellProcs.SHCreateItemFromParsingName = (SHCreateItemFromParsingNameProc*)
- (void *)GetProcAddress(shell32_handle, "SHCreateItemFromParsingName");
-}
-
-
/*
*-------------------------------------------------------------------------
*
@@ -923,7 +867,7 @@ ColorDlgHookProc(
Tcl_DString ds;
Tcl_DStringInit(&ds);
- SetWindowTextW(hDlg, Tcl_UtfToWCharDString(title, -1, &ds));
+ SetWindowTextW(hDlg, Tcl_UtfToWCharDString(title, TCL_INDEX_NONE, &ds));
Tcl_DStringFree(&ds);
}
if (tsdPtr->debugFlag) {
@@ -1040,7 +984,7 @@ ParseOFNOptions(
enum options {
FILE_DEFAULT, FILE_TYPES, FILE_INITDIR, FILE_INITFILE, FILE_PARENT,
FILE_TITLE, FILE_TYPEVARIABLE, FILE_MULTIPLE, FILE_CONFIRMOW,
- FILE_MUSTEXIST,
+ FILE_MUSTEXIST,
};
struct Options {
const char *name;
@@ -1098,31 +1042,31 @@ ParseOFNOptions(
if (Tcl_GetIndexFromObjStruct(interp, objv[i], options,
sizeof(struct Options), "option", 0, &index) != TCL_OK) {
- /*
- * XXX -xpstyle is explicitly checked for as it is undocumented
- * and we do not want it to show in option error messages.
- */
- if (strcmp(Tcl_GetString(objv[i]), "-xpstyle"))
- goto error_return;
- if (i + 1 == objc) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("value for \"-xpstyle\" missing", -1));
- Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL);
- goto error_return;
- }
+ /*
+ * XXX -xpstyle is explicitly checked for as it is undocumented
+ * and we do not want it to show in option error messages.
+ */
+ if (strcmp(Tcl_GetString(objv[i]), "-xpstyle"))
+ goto error_return;
+ if (i + 1 == objc) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("value for \"-xpstyle\" missing", TCL_INDEX_NONE));
+ Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL);
+ goto error_return;
+ }
if (Tcl_GetBooleanFromObj(interp, objv[i+1],
- &optsPtr->forceXPStyle) != TCL_OK)
- goto error_return;
+ &optsPtr->forceXPStyle) != TCL_OK)
+ goto error_return;
- continue;
+ continue;
} else if (i + 1 == objc) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "value for \"%s\" missing", options[index].name));
- Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL);
- goto error_return;
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "value for \"%s\" missing", options[index].name));
+ Tcl_SetErrorCode(interp, "TK", "FILEDIALOG", "VALUE", NULL);
+ goto error_return;
}
- valuePtr = objv[i + 1];
+ valuePtr = objv[i + 1];
string = Tcl_GetString(valuePtr);
switch (options[index].value) {
case FILE_DEFAULT:
@@ -1134,15 +1078,16 @@ ParseOFNOptions(
case FILE_INITDIR:
Tcl_DStringFree(&optsPtr->utfDirString);
if (Tcl_TranslateFileName(interp, string,
- &optsPtr->utfDirString) == NULL)
+ &optsPtr->utfDirString) == NULL)
goto error_return;
break;
case FILE_INITFILE:
if (Tcl_TranslateFileName(interp, string, &ds) == NULL)
goto error_return;
Tcl_UtfToExternal(NULL, TkWinGetUnicodeEncoding(),
- Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), 0,
- NULL, (char *)&optsPtr->file[0], sizeof(optsPtr->file), NULL, NULL, NULL);
+ Tcl_DStringValue(&ds), Tcl_DStringLength(&ds),
+ TCL_ENCODING_PROFILE_TCL8, NULL, (char *)&optsPtr->file[0],
+ sizeof(optsPtr->file), NULL, NULL, NULL);
Tcl_DStringFree(&ds);
break;
case FILE_PARENT:
@@ -1156,23 +1101,23 @@ ParseOFNOptions(
case FILE_TYPEVARIABLE:
optsPtr->typeVariableObj = valuePtr;
optsPtr->initialTypeObj = Tcl_ObjGetVar2(interp, valuePtr,
- NULL, TCL_GLOBAL_ONLY);
+ NULL, TCL_GLOBAL_ONLY);
break;
case FILE_MULTIPLE:
if (Tcl_GetBooleanFromObj(interp, valuePtr,
- &optsPtr->multi) != TCL_OK)
- goto error_return;
+ &optsPtr->multi) != TCL_OK)
+ goto error_return;
break;
case FILE_CONFIRMOW:
if (Tcl_GetBooleanFromObj(interp, valuePtr,
- &optsPtr->confirmOverwrite) != TCL_OK)
- goto error_return;
+ &optsPtr->confirmOverwrite) != TCL_OK)
+ goto error_return;
break;
- case FILE_MUSTEXIST:
+ case FILE_MUSTEXIST:
if (Tcl_GetBooleanFromObj(interp, valuePtr,
- &optsPtr->mustExist) != TCL_OK)
- goto error_return;
- break;
+ &optsPtr->mustExist) != TCL_OK)
+ goto error_return;
+ break;
}
}
@@ -1206,29 +1151,26 @@ static int VistaFileDialogsAvailable(void)
HRESULT hr;
IFileDialog *fdlgPtr = NULL;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->newFileDialogsState == FDLG_STATE_INIT) {
tsdPtr->newFileDialogsState = FDLG_STATE_USE_OLD;
- LoadShellProcs();
- if (ShellProcs.SHCreateItemFromParsingName != NULL) {
- hr = CoInitialize(0);
- /* XXX - need we schedule CoUninitialize at thread shutdown ? */
+ hr = CoInitialize(0);
+ /* XXX - need we schedule CoUninitialize at thread shutdown ? */
- /* Ensure all COM interfaces we use are available */
+ /* Ensure all COM interfaces we use are available */
+ if (SUCCEEDED(hr)) {
+ hr = CoCreateInstance(&ClsidFileOpenDialog, NULL,
+ CLSCTX_INPROC_SERVER, &IIDIFileOpenDialog, (void **) &fdlgPtr);
if (SUCCEEDED(hr)) {
- hr = CoCreateInstance(&ClsidFileOpenDialog, NULL,
- CLSCTX_INPROC_SERVER, &IIDIFileOpenDialog, (void **) &fdlgPtr);
+ fdlgPtr->lpVtbl->Release(fdlgPtr);
+ hr = CoCreateInstance(&ClsidFileSaveDialog, NULL,
+ CLSCTX_INPROC_SERVER, &IIDIFileSaveDialog, (void **) &fdlgPtr);
if (SUCCEEDED(hr)) {
fdlgPtr->lpVtbl->Release(fdlgPtr);
- hr = CoCreateInstance(&ClsidFileSaveDialog, NULL,
- CLSCTX_INPROC_SERVER, &IIDIFileSaveDialog, (void **) &fdlgPtr);
- if (SUCCEEDED(hr)) {
- fdlgPtr->lpVtbl->Release(fdlgPtr);
- /* Looks like we have all we need */
- tsdPtr->newFileDialogsState = FDLG_STATE_USE_NEW;
- }
+ /* Looks like we have all we need */
+ tsdPtr->newFileDialogsState = FDLG_STATE_USE_NEW;
}
}
}
@@ -1256,7 +1198,7 @@ static int VistaFileDialogsAvailable(void)
*----------------------------------------------------------------------
*/
static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
- enum OFNOper oper)
+ enum OFNOper oper)
{
HRESULT hr;
HWND hWnd;
@@ -1290,8 +1232,8 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
* is the filter specification so do that before creating
*/
if (MakeFilterVista(interp, optsPtr, &nfilters, &filterPtr,
- &defaultFilterIndex) != TCL_OK)
- return TCL_ERROR;
+ &defaultFilterIndex) != TCL_OK)
+ return TCL_ERROR;
/*
* Beyond this point, do not just return on error as there will be
@@ -1299,14 +1241,14 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
*/
if (oper == OFN_FILE_OPEN || oper == OFN_DIR_CHOOSE)
- hr = CoCreateInstance(&ClsidFileOpenDialog, NULL,
- CLSCTX_INPROC_SERVER, &IIDIFileOpenDialog, (void **) &fdlgIf);
+ hr = CoCreateInstance(&ClsidFileOpenDialog, NULL,
+ CLSCTX_INPROC_SERVER, &IIDIFileOpenDialog, (void **) &fdlgIf);
else
- hr = CoCreateInstance(&ClsidFileSaveDialog, NULL,
- CLSCTX_INPROC_SERVER, &IIDIFileSaveDialog, (void **) &fdlgIf);
+ hr = CoCreateInstance(&ClsidFileSaveDialog, NULL,
+ CLSCTX_INPROC_SERVER, &IIDIFileSaveDialog, (void **) &fdlgIf);
if (FAILED(hr))
- goto vamoose;
+ goto vamoose;
/*
* Get current settings first because we want to preserve existing
@@ -1315,20 +1257,20 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
*/
hr = fdlgIf->lpVtbl->GetOptions(fdlgIf, &flags);
if (FAILED(hr))
- goto vamoose;
+ goto vamoose;
if (filterPtr) {
- /*
- * Causes -filetypes {{All *}} -defaultextension ext to return
- * foo.ext.ext when foo is typed into the entry box
- * flags |= FOS_STRICTFILETYPES;
- */
- hr = fdlgIf->lpVtbl->SetFileTypes(fdlgIf, nfilters, filterPtr);
- if (FAILED(hr))
- goto vamoose;
- hr = fdlgIf->lpVtbl->SetFileTypeIndex(fdlgIf, defaultFilterIndex);
- if (FAILED(hr))
- goto vamoose;
+ /*
+ * Causes -filetypes {{All *}} -defaultextension ext to return
+ * foo.ext.ext when foo is typed into the entry box
+ * flags |= FOS_STRICTFILETYPES;
+ */
+ hr = fdlgIf->lpVtbl->SetFileTypes(fdlgIf, nfilters, filterPtr);
+ if (FAILED(hr))
+ goto vamoose;
+ hr = fdlgIf->lpVtbl->SetFileTypeIndex(fdlgIf, defaultFilterIndex);
+ if (FAILED(hr))
+ goto vamoose;
}
/* Flags are equivalent to those we used in the older API */
@@ -1339,88 +1281,88 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
* semantics than OFN_NOVALIDATE in the old API.
*/
flags |=
- FOS_FORCEFILESYSTEM | /* Only want files, not other shell items */
- FOS_NOVALIDATE | /* Don't check for access denied etc. */
- FOS_PATHMUSTEXIST; /* The *directory* path must exist */
+ FOS_FORCEFILESYSTEM | /* Only want files, not other shell items */
+ FOS_NOVALIDATE | /* Don't check for access denied etc. */
+ FOS_PATHMUSTEXIST; /* The *directory* path must exist */
if (oper == OFN_DIR_CHOOSE) {
- flags |= FOS_PICKFOLDERS;
- if (optsPtr->mustExist)
- flags |= FOS_FILEMUSTEXIST; /* XXX - check working */
+ flags |= FOS_PICKFOLDERS;
+ if (optsPtr->mustExist)
+ flags |= FOS_FILEMUSTEXIST; /* XXX - check working */
} else
- flags &= ~ FOS_PICKFOLDERS;
+ flags &= ~ FOS_PICKFOLDERS;
if (optsPtr->multi)
- flags |= FOS_ALLOWMULTISELECT;
+ flags |= FOS_ALLOWMULTISELECT;
else
- flags &= ~FOS_ALLOWMULTISELECT;
+ flags &= ~FOS_ALLOWMULTISELECT;
if (optsPtr->confirmOverwrite)
- flags |= FOS_OVERWRITEPROMPT;
+ flags |= FOS_OVERWRITEPROMPT;
else
- flags &= ~FOS_OVERWRITEPROMPT;
+ flags &= ~FOS_OVERWRITEPROMPT;
hr = fdlgIf->lpVtbl->SetOptions(fdlgIf, flags);
if (FAILED(hr))
- goto vamoose;
+ goto vamoose;
if (optsPtr->extObj != NULL) {
- Tcl_DString ds;
- const char *src;
+ Tcl_DString ds;
+ const char *src;
- src = Tcl_GetString(optsPtr->extObj);
- Tcl_DStringInit(&ds);
- wstr = Tcl_UtfToWCharDString(src, optsPtr->extObj->length, &ds);
- if (wstr[0] == '.')
- ++wstr;
- hr = fdlgIf->lpVtbl->SetDefaultExtension(fdlgIf, wstr);
- Tcl_DStringFree(&ds);
- if (FAILED(hr))
- goto vamoose;
+ src = Tcl_GetString(optsPtr->extObj);
+ Tcl_DStringInit(&ds);
+ wstr = Tcl_UtfToWCharDString(src, optsPtr->extObj->length, &ds);
+ if (wstr[0] == '.')
+ ++wstr;
+ hr = fdlgIf->lpVtbl->SetDefaultExtension(fdlgIf, wstr);
+ Tcl_DStringFree(&ds);
+ if (FAILED(hr))
+ goto vamoose;
}
if (optsPtr->titleObj != NULL) {
- Tcl_DString ds;
- const char *src;
+ Tcl_DString ds;
+ const char *src;
- src = Tcl_GetString(optsPtr->titleObj);
- Tcl_DStringInit(&ds);
- wstr = Tcl_UtfToWCharDString(src, optsPtr->titleObj->length, &ds);
- hr = fdlgIf->lpVtbl->SetTitle(fdlgIf, wstr);
- Tcl_DStringFree(&ds);
- if (FAILED(hr))
- goto vamoose;
+ src = Tcl_GetString(optsPtr->titleObj);
+ Tcl_DStringInit(&ds);
+ wstr = Tcl_UtfToWCharDString(src, optsPtr->titleObj->length, &ds);
+ hr = fdlgIf->lpVtbl->SetTitle(fdlgIf, wstr);
+ Tcl_DStringFree(&ds);
+ if (FAILED(hr))
+ goto vamoose;
}
if (optsPtr->file[0]) {
- hr = fdlgIf->lpVtbl->SetFileName(fdlgIf, optsPtr->file);
- if (FAILED(hr))
- goto vamoose;
+ hr = fdlgIf->lpVtbl->SetFileName(fdlgIf, optsPtr->file);
+ if (FAILED(hr))
+ goto vamoose;
}
if (Tcl_DStringValue(&optsPtr->utfDirString)[0] != '\0') {
- Tcl_Obj *normPath, *iniDirPath;
- iniDirPath = Tcl_NewStringObj(Tcl_DStringValue(&optsPtr->utfDirString), -1);
- Tcl_IncrRefCount(iniDirPath);
- normPath = Tcl_FSGetNormalizedPath(interp, iniDirPath);
- /* XXX - Note on failures do not raise error, simply ignore ini dir */
- if (normPath) {
- LPCWSTR nativePath;
- Tcl_IncrRefCount(normPath);
- nativePath = (LPCWSTR)Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/
- if (nativePath) {
- hr = ShellProcs.SHCreateItemFromParsingName(
- nativePath, NULL,
- &IIDIShellItem, (void **) &dirIf);
- if (SUCCEEDED(hr)) {
- /* Note we use SetFolder, not SetDefaultFolder - see MSDN */
- fdlgIf->lpVtbl->SetFolder(fdlgIf, dirIf); /* Ignore errors */
- }
- }
- Tcl_DecrRefCount(normPath); /* ALSO INVALIDATES nativePath !! */
- }
- Tcl_DecrRefCount(iniDirPath);
+ Tcl_Obj *normPath, *iniDirPath;
+ iniDirPath = Tcl_NewStringObj(Tcl_DStringValue(&optsPtr->utfDirString), TCL_INDEX_NONE);
+ Tcl_IncrRefCount(iniDirPath);
+ normPath = Tcl_FSGetNormalizedPath(interp, iniDirPath);
+ /* XXX - Note on failures do not raise error, simply ignore ini dir */
+ if (normPath) {
+ LPCWSTR nativePath;
+ Tcl_IncrRefCount(normPath);
+ nativePath = (LPCWSTR)Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/
+ if (nativePath) {
+ hr = SHCreateItemFromParsingName(
+ nativePath, NULL,
+ &IIDIShellItem, (void **) &dirIf);
+ if (SUCCEEDED(hr)) {
+ /* Note we use SetFolder, not SetDefaultFolder - see MSDN */
+ fdlgIf->lpVtbl->SetFolder(fdlgIf, dirIf); /* Ignore errors */
+ }
+ }
+ Tcl_DecrRefCount(normPath); /* ALSO INVALIDATES nativePath !! */
+ }
+ Tcl_DecrRefCount(iniDirPath);
}
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
@@ -1435,7 +1377,7 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
*/
if (hWnd)
- EnableWindow(hWnd, 1);
+ EnableWindow(hWnd, 1);
/*
* Clear interp result since it might have been set during the modal loop.
@@ -1444,108 +1386,108 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
Tcl_ResetResult(interp);
if (SUCCEEDED(hr)) {
- if ((oper == OFN_FILE_OPEN) && optsPtr->multi) {
- IShellItemArray *multiIf;
- DWORD dw, count;
- IFileOpenDialog *fodIf = (IFileOpenDialog *) fdlgIf;
- hr = fodIf->lpVtbl->GetResults(fodIf, &multiIf);
- if (SUCCEEDED(hr)) {
- Tcl_Obj *multiObj;
- hr = multiIf->lpVtbl->GetCount(multiIf, &count);
- multiObj = Tcl_NewListObj(count, NULL);
- if (SUCCEEDED(hr)) {
- IShellItem *itemIf;
- for (dw = 0; dw < count; ++dw) {
- hr = multiIf->lpVtbl->GetItemAt(multiIf, dw, &itemIf);
- if (FAILED(hr))
- break;
- hr = itemIf->lpVtbl->GetDisplayName(itemIf,
- SIGDN_FILESYSPATH, &wstr);
- if (SUCCEEDED(hr)) {
- Tcl_DString fnds;
-
- ConvertExternalFilename(wstr, &fnds);
- CoTaskMemFree(wstr);
- Tcl_ListObjAppendElement(
- interp, multiObj,
- Tcl_NewStringObj(Tcl_DStringValue(&fnds),
- Tcl_DStringLength(&fnds)));
- Tcl_DStringFree(&fnds);
- }
- itemIf->lpVtbl->Release(itemIf);
- if (FAILED(hr))
- break;
- }
- }
- multiIf->lpVtbl->Release(multiIf);
- if (SUCCEEDED(hr))
- resultObj = multiObj;
- else
- Tcl_DecrRefCount(multiObj);
- }
- } else {
- IShellItem *resultIf;
- hr = fdlgIf->lpVtbl->GetResult(fdlgIf, &resultIf);
- if (SUCCEEDED(hr)) {
- hr = resultIf->lpVtbl->GetDisplayName(resultIf, SIGDN_FILESYSPATH,
- &wstr);
- if (SUCCEEDED(hr)) {
- Tcl_DString fnds;
-
- ConvertExternalFilename(wstr, &fnds);
- resultObj = Tcl_NewStringObj(Tcl_DStringValue(&fnds),
- Tcl_DStringLength(&fnds));
- CoTaskMemFree(wstr);
- Tcl_DStringFree(&fnds);
- }
- resultIf->lpVtbl->Release(resultIf);
- }
- }
- if (SUCCEEDED(hr)) {
- if (filterPtr && optsPtr->typeVariableObj) {
- UINT ftix;
-
- hr = fdlgIf->lpVtbl->GetFileTypeIndex(fdlgIf, &ftix);
- if (SUCCEEDED(hr)) {
- /* Note ftix is a 1-based index */
- if (ftix > 0 && ftix <= nfilters) {
- Tcl_DString ftds;
- Tcl_Obj *ftobj;
-
- Tcl_DStringInit(&ftds);
- Tcl_WCharToUtfDString(filterPtr[ftix-1].pszName, wcslen(filterPtr[ftix-1].pszName), &ftds);
- ftobj = Tcl_NewStringObj(Tcl_DStringValue(&ftds),
- Tcl_DStringLength(&ftds));
- Tcl_ObjSetVar2(interp, optsPtr->typeVariableObj, NULL,
- ftobj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
- Tcl_DStringFree(&ftds);
- }
- }
- }
- }
+ if ((oper == OFN_FILE_OPEN) && optsPtr->multi) {
+ IShellItemArray *multiIf;
+ DWORD dw, count;
+ IFileOpenDialog *fodIf = (IFileOpenDialog *) fdlgIf;
+ hr = fodIf->lpVtbl->GetResults(fodIf, &multiIf);
+ if (SUCCEEDED(hr)) {
+ Tcl_Obj *multiObj;
+ hr = multiIf->lpVtbl->GetCount(multiIf, &count);
+ multiObj = Tcl_NewListObj(count, NULL);
+ if (SUCCEEDED(hr)) {
+ IShellItem *itemIf;
+ for (dw = 0; dw < count; ++dw) {
+ hr = multiIf->lpVtbl->GetItemAt(multiIf, dw, &itemIf);
+ if (FAILED(hr))
+ break;
+ hr = itemIf->lpVtbl->GetDisplayName(itemIf,
+ SIGDN_FILESYSPATH, &wstr);
+ if (SUCCEEDED(hr)) {
+ Tcl_DString fnds;
+
+ ConvertExternalFilename(wstr, &fnds);
+ CoTaskMemFree(wstr);
+ Tcl_ListObjAppendElement(
+ interp, multiObj,
+ Tcl_NewStringObj(Tcl_DStringValue(&fnds),
+ Tcl_DStringLength(&fnds)));
+ Tcl_DStringFree(&fnds);
+ }
+ itemIf->lpVtbl->Release(itemIf);
+ if (FAILED(hr))
+ break;
+ }
+ }
+ multiIf->lpVtbl->Release(multiIf);
+ if (SUCCEEDED(hr))
+ resultObj = multiObj;
+ else
+ Tcl_DecrRefCount(multiObj);
+ }
+ } else {
+ IShellItem *resultIf;
+ hr = fdlgIf->lpVtbl->GetResult(fdlgIf, &resultIf);
+ if (SUCCEEDED(hr)) {
+ hr = resultIf->lpVtbl->GetDisplayName(resultIf, SIGDN_FILESYSPATH,
+ &wstr);
+ if (SUCCEEDED(hr)) {
+ Tcl_DString fnds;
+
+ ConvertExternalFilename(wstr, &fnds);
+ resultObj = Tcl_NewStringObj(Tcl_DStringValue(&fnds),
+ Tcl_DStringLength(&fnds));
+ CoTaskMemFree(wstr);
+ Tcl_DStringFree(&fnds);
+ }
+ resultIf->lpVtbl->Release(resultIf);
+ }
+ }
+ if (SUCCEEDED(hr)) {
+ if (filterPtr && optsPtr->typeVariableObj) {
+ UINT ftix;
+
+ hr = fdlgIf->lpVtbl->GetFileTypeIndex(fdlgIf, &ftix);
+ if (SUCCEEDED(hr)) {
+ /* Note ftix is a 1-based index */
+ if (ftix > 0 && ftix <= nfilters) {
+ Tcl_DString ftds;
+ Tcl_Obj *ftobj;
+
+ Tcl_DStringInit(&ftds);
+ Tcl_WCharToUtfDString(filterPtr[ftix-1].pszName, wcslen(filterPtr[ftix-1].pszName), &ftds);
+ ftobj = Tcl_NewStringObj(Tcl_DStringValue(&ftds),
+ Tcl_DStringLength(&ftds));
+ Tcl_ObjSetVar2(interp, optsPtr->typeVariableObj, NULL,
+ ftobj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
+ Tcl_DStringFree(&ftds);
+ }
+ }
+ }
+ }
} else {
- if (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED))
- hr = 0; /* User cancelled, return empty string */
+ if (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED))
+ hr = 0; /* User cancelled, return empty string */
}
vamoose: /* (hr != 0) => error */
if (dirIf)
- dirIf->lpVtbl->Release(dirIf);
+ dirIf->lpVtbl->Release(dirIf);
if (fdlgIf)
- fdlgIf->lpVtbl->Release(fdlgIf);
+ fdlgIf->lpVtbl->Release(fdlgIf);
if (filterPtr)
- FreeFilterVista(nfilters, filterPtr);
+ FreeFilterVista(nfilters, filterPtr);
if (hr == 0) {
- if (resultObj) /* May be NULL if user cancelled */
- Tcl_SetObjResult(interp, resultObj);
- return TCL_OK;
+ if (resultObj) /* May be NULL if user cancelled */
+ Tcl_SetObjResult(interp, resultObj);
+ return TCL_OK;
} else {
- if (resultObj)
- Tcl_DecrRefCount(resultObj);
- Tcl_SetObjResult(interp, TkWin32ErrorObj(hr));
- return TCL_ERROR;
+ if (resultObj)
+ Tcl_DecrRefCount(resultObj);
+ Tcl_SetObjResult(interp, TkWin32ErrorObj(hr));
+ return TCL_ERROR;
}
}
@@ -1576,16 +1518,16 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
Tcl_DString extString, filterString, dirString, titleString;
const char *str;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
memset(&ofnData, 0, sizeof(OFNData));
Tcl_DStringInit(&utfFilterString);
Tcl_DStringInit(&dirString); /* XXX - original code was missing this
- leaving dirString uninitialized for
- the unlikely code path where cwd failed */
+ leaving dirString uninitialized for
+ the unlikely code path where cwd failed */
if (MakeFilter(interp, optsPtr->filterObj, &utfFilterString,
- optsPtr->initialTypeObj, &filterIndex) != TCL_OK) {
+ optsPtr->initialTypeObj, &filterIndex) != TCL_OK) {
goto end;
}
@@ -1629,7 +1571,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
++str;
}
Tcl_DStringInit(&extString);
- ofn.lpstrDefExt = Tcl_UtfToWCharDString(str, -1, &extString);
+ ofn.lpstrDefExt = Tcl_UtfToWCharDString(str, TCL_INDEX_NONE, &extString);
}
Tcl_DStringInit(&filterString);
@@ -1652,11 +1594,11 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
Tcl_DStringFree(&optsPtr->utfDirString);
if ((Tcl_GetCwd(interp, &optsPtr->utfDirString) == NULL) ||
(Tcl_TranslateFileName(interp,
- Tcl_DStringValue(&optsPtr->utfDirString), &cwd) == NULL)) {
+ Tcl_DStringValue(&optsPtr->utfDirString), &cwd) == NULL)) {
Tcl_ResetResult(interp);
} else {
- Tcl_DStringInit(&dirString);
- Tcl_UtfToWCharDString(Tcl_DStringValue(&cwd),
+ Tcl_DStringInit(&dirString);
+ Tcl_UtfToWCharDString(Tcl_DStringValue(&cwd),
Tcl_DStringLength(&cwd), &dirString);
}
Tcl_DStringFree(&cwd);
@@ -1665,7 +1607,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
if (optsPtr->titleObj != NULL) {
Tcl_DStringInit(&titleString);
- ofn.lpstrTitle = Tcl_UtfToWCharDString(Tcl_GetString(optsPtr->titleObj), -1, &titleString);
+ ofn.lpstrTitle = Tcl_UtfToWCharDString(Tcl_GetString(optsPtr->titleObj), TCL_INDEX_NONE, &titleString);
}
/*
@@ -1754,7 +1696,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
fullnameObj = Tcl_NewStringObj(Tcl_DStringValue(&ds),
Tcl_DStringLength(&ds));
- Tcl_AppendToObj(fullnameObj, "/", -1);
+ Tcl_AppendToObj(fullnameObj, "/", TCL_INDEX_NONE);
Tcl_AppendToObj(fullnameObj, Tcl_DStringValue(&filenameBuf),
Tcl_DStringLength(&filenameBuf));
gotFilename = 1;
@@ -1777,14 +1719,14 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
Tcl_DStringFree(&ds);
} else {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- ConvertExternalFilename(ofn.lpstrFile, &ds), -1));
+ ConvertExternalFilename(ofn.lpstrFile, &ds), TCL_INDEX_NONE));
gotFilename = (Tcl_DStringLength(&ds) > 0);
Tcl_DStringFree(&ds);
}
result = TCL_OK;
if ((ofn.nFilterIndex > 0) && gotFilename && optsPtr->typeVariableObj
&& optsPtr->filterObj) {
- int listObjc, count;
+ Tcl_Size listObjc, count;
Tcl_Obj **listObjv = NULL;
Tcl_Obj **typeInfo = NULL;
@@ -1796,23 +1738,23 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
&typeInfo) != TCL_OK) {
result = TCL_ERROR;
} else {
- /*
- * BUGFIX for d43a10ce2fed950e00890049f3c273f2cdd12583
- * The original code was broken because it passed typeinfo[0]
- * directly into Tcl_ObjSetVar2. In the case of typeInfo[0]
- * pointing into a list which is also referenced by
- * typeVariableObj, TOSV2 shimmers the object into
- * variable intrep which loses the list representation.
- * This invalidates typeInfo[0] which is freed but
- * nevertheless stored as the value of the variable.
- */
- Tcl_Obj *selFilterObj = typeInfo[0];
- Tcl_IncrRefCount(selFilterObj);
- if (Tcl_ObjSetVar2(interp, optsPtr->typeVariableObj, NULL,
- selFilterObj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) {
- result = TCL_ERROR;
- }
- Tcl_DecrRefCount(selFilterObj);
+ /*
+ * BUGFIX for d43a10ce2fed950e00890049f3c273f2cdd12583
+ * The original code was broken because it passed typeinfo[0]
+ * directly into Tcl_ObjSetVar2. In the case of typeInfo[0]
+ * pointing into a list which is also referenced by
+ * typeVariableObj, TOSV2 shimmers the object into
+ * variable intrep which loses the list representation.
+ * This invalidates typeInfo[0] which is freed but
+ * nevertheless stored as the value of the variable.
+ */
+ Tcl_Obj *selFilterObj = typeInfo[0];
+ Tcl_IncrRefCount(selFilterObj);
+ if (Tcl_ObjSetVar2(interp, optsPtr->typeVariableObj, NULL,
+ selFilterObj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) {
+ result = TCL_ERROR;
+ }
+ Tcl_DecrRefCount(selFilterObj);
}
}
} else if (cdlgerr == FNERR_INVALIDFILENAME) {
@@ -1830,8 +1772,8 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
Tcl_DStringFree(&titleString);
}
if (ofn.lpstrInitialDir != NULL) {
- /* XXX - huh? lpstrInitialDir is set from Tcl_DStringValue which
- can never return NULL */
+ /* XXX - huh? lpstrInitialDir is set from Tcl_DStringValue which
+ can never return NULL */
Tcl_DStringFree(&dirString);
}
Tcl_DStringFree(&filterString);
@@ -1880,12 +1822,12 @@ GetFileName(
result = ParseOFNOptions(clientData, interp, objc, objv, oper, &ofnOpts);
if (result != TCL_OK)
- return result;
+ return result;
if (VistaFileDialogsAvailable() && ! ofnOpts.forceXPStyle)
- result = GetFileNameVista(interp, &ofnOpts, oper);
+ result = GetFileNameVista(interp, &ofnOpts, oper);
else
- result = GetFileNameXP(interp, &ofnOpts, oper);
+ result = GetFileNameXP(interp, &ofnOpts, oper);
CleanupOFNOptions(&ofnOpts);
return result;
@@ -2037,7 +1979,7 @@ OFNHookProc(
* information every time it gets a WM_WINDOWPOSCHANGED message.
*/
- ofnPtr = (OPENFILENAME *)TkWinGetUserData(hdlg);
+ ofnPtr = (OPENFILENAME *) TkWinGetUserData(hdlg);
if (ofnPtr != NULL) {
ofnData = (OFNData *) ofnPtr->lCustData;
if (ofnData->interp != NULL) {
@@ -2112,7 +2054,7 @@ MakeFilter(
*p = '\0';
} else {
- int len;
+ Tcl_Size len;
if (valuePtr == NULL) {
len = 0;
@@ -2221,14 +2163,14 @@ MakeFilter(
static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr)
{
if (dlgFilterPtr != NULL) {
- DWORD dw;
- for (dw = 0; dw < count; ++dw) {
- if (dlgFilterPtr[dw].pszName != NULL)
- ckfree(dlgFilterPtr[dw].pszName);
- if (dlgFilterPtr[dw].pszSpec != NULL)
- ckfree(dlgFilterPtr[dw].pszSpec);
- }
- ckfree(dlgFilterPtr);
+ DWORD dw;
+ for (dw = 0; dw < count; ++dw) {
+ if (dlgFilterPtr[dw].pszName != NULL)
+ ckfree((char *)dlgFilterPtr[dw].pszName);
+ if (dlgFilterPtr[dw].pszSpec != NULL)
+ ckfree((char *)dlgFilterPtr[dw].pszSpec);
+ }
+ ckfree(dlgFilterPtr);
}
}
@@ -2253,9 +2195,9 @@ static int MakeFilterVista(
OFNOpts *optsPtr, /* Caller specified options */
DWORD *countPtr, /* Will hold number of filters */
TCLCOMDLG_FILTERSPEC **dlgFilterPtrPtr, /* Will hold pointer to filter array.
- Set to NULL if no filters specified.
- Must be freed by calling
- FreeFilterVista */
+ Set to NULL if no filters specified.
+ Must be freed by calling
+ FreeFilterVista */
DWORD *initialIndexPtr) /* Will hold index of default type */
{
TCLCOMDLG_FILTERSPEC *dlgFilterPtr;
@@ -2267,9 +2209,9 @@ static int MakeFilterVista(
int i;
if (optsPtr->filterObj == NULL) {
- *dlgFilterPtrPtr = NULL;
- *countPtr = 0;
- return TCL_OK;
+ *dlgFilterPtrPtr = NULL;
+ *countPtr = 0;
+ return TCL_OK;
}
if (optsPtr->initialTypeObj)
@@ -2280,9 +2222,9 @@ static int MakeFilterVista(
return TCL_ERROR;
if (flist.filters == NULL) {
- *dlgFilterPtrPtr = NULL;
- *countPtr = 0;
- return TCL_OK;
+ *dlgFilterPtrPtr = NULL;
+ *countPtr = 0;
+ return TCL_OK;
}
Tcl_DStringInit(&ds);
@@ -2290,19 +2232,19 @@ static int MakeFilterVista(
dlgFilterPtr = (TCLCOMDLG_FILTERSPEC *)ckalloc(flist.numFilters * sizeof(*dlgFilterPtr));
for (i = 0, filterPtr = flist.filters;
- filterPtr;
- filterPtr = filterPtr->next, ++i) {
+ filterPtr;
+ filterPtr = filterPtr->next, ++i) {
const char *sep;
FileFilterClause *clausePtr;
- int nbytes;
+ size_t nbytes;
/* Check if this entry should be shown as the default */
if (initial && strcmp(initial, filterPtr->name) == 0)
- initialIndex = i+1; /* Windows filter indices are 1-based */
+ initialIndex = i+1; /* Windows filter indices are 1-based */
/* First stash away the text description of the pattern */
Tcl_DStringInit(&ds);
- Tcl_UtfToWCharDString(filterPtr->name, -1, &ds);
+ Tcl_UtfToWCharDString(filterPtr->name, TCL_INDEX_NONE, &ds);
nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */
nbytes += sizeof(WCHAR); /* Terminating \0 */
dlgFilterPtr[i].pszName = (LPCWSTR)ckalloc(nbytes);
@@ -2323,15 +2265,15 @@ static int MakeFilterVista(
GlobPattern *globPtr;
for (globPtr = clausePtr->patterns; globPtr;
globPtr = globPtr->next) {
- Tcl_DStringAppend(&patterns, sep, -1);
- Tcl_DStringAppend(&patterns, globPtr->pattern, -1);
+ Tcl_DStringAppend(&patterns, sep, TCL_INDEX_NONE);
+ Tcl_DStringAppend(&patterns, globPtr->pattern, TCL_INDEX_NONE);
sep = ";";
}
}
/* Again we need a Unicode form of the string */
Tcl_DStringInit(&ds);
- Tcl_UtfToWCharDString(Tcl_DStringValue(&patterns), -1, &ds);
+ Tcl_UtfToWCharDString(Tcl_DStringValue(&patterns), TCL_INDEX_NONE, &ds);
nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */
nbytes += sizeof(WCHAR); /* Terminating \0 */
dlgFilterPtr[i].pszSpec = (LPCWSTR)ckalloc(nbytes);
@@ -2445,15 +2387,15 @@ Tk_ChooseDirectoryObjCmd(
const char *utfDir;
result = ParseOFNOptions(clientData, interp, objc, objv,
- OFN_DIR_CHOOSE, &ofnOpts);
+ OFN_DIR_CHOOSE, &ofnOpts);
if (result != TCL_OK)
- return result;
+ return result;
/* Use new dialogs if available */
if (VistaFileDialogsAvailable() && ! ofnOpts.forceXPStyle) {
- result = GetFileNameVista(interp, &ofnOpts, OFN_DIR_CHOOSE);
- CleanupOFNOptions(&ofnOpts);
- return result;
+ result = GetFileNameVista(interp, &ofnOpts, OFN_DIR_CHOOSE);
+ CleanupOFNOptions(&ofnOpts);
+ return result;
}
/* Older dialogs */
@@ -2468,8 +2410,8 @@ Tk_ChooseDirectoryObjCmd(
LPCWSTR uniStr;
Tcl_DStringInit(&tempString);
- Tcl_UtfToWCharDString(Tcl_DStringValue(&ofnOpts.utfDirString), -1,
- &tempString);
+ Tcl_UtfToWCharDString(Tcl_DStringValue(&ofnOpts.utfDirString), TCL_INDEX_NONE,
+ &tempString);
uniStr = (WCHAR *) Tcl_DStringValue(&tempString);
/* Convert possible relative path to full path to keep dialog happy. */
@@ -2501,7 +2443,7 @@ Tk_ChooseDirectoryObjCmd(
if (ofnOpts.titleObj != NULL) {
Tcl_DStringInit(&titleString);
- bInfo.lpszTitle = Tcl_UtfToWCharDString(Tcl_GetString(ofnOpts.titleObj), -1, &titleString);
+ bInfo.lpszTitle = Tcl_UtfToWCharDString(Tcl_GetString(ofnOpts.titleObj), TCL_INDEX_NONE, &titleString);
} else {
bInfo.lpszTitle = L"Please choose a directory, then select OK.";
}
@@ -2538,10 +2480,10 @@ Tk_ChooseDirectoryObjCmd(
oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
GetCurrentDirectoryW(MAX_PATH, saveDir);
if (SHGetMalloc(&pMalloc) == NOERROR) {
- /*
- * XXX - MSDN says CoInitialize must have been called before
- * SHBrowseForFolder can be used but don't see that called anywhere.
- */
+ /*
+ * XXX - MSDN says CoInitialize must have been called before
+ * SHBrowseForFolder can be used but don't see that called anywhere.
+ */
pidl = SHBrowseForFolderW(&bInfo);
/*
@@ -2559,7 +2501,7 @@ Tk_ChooseDirectoryObjCmd(
if (pidl != NULL) {
if (!SHGetPathFromIDListW(pidl, path)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "error: not a file system folder", -1));
+ "error: not a file system folder", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "DIRDIALOG", "PSEUDO", NULL);
}
pMalloc->lpVtbl->Free(pMalloc, (void *) pidl);
@@ -2589,7 +2531,7 @@ Tk_ChooseDirectoryObjCmd(
Tcl_DString ds;
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- ConvertExternalFilename(path, &ds), -1));
+ ConvertExternalFilename(path, &ds), TCL_INDEX_NONE));
Tcl_DStringFree(&ds);
}
@@ -2657,7 +2599,7 @@ ChooseDirectoryValidateProc(
return 1;
}
Tcl_DStringSetLength(&initDirString, 0);
- wcsncpy(string, Tcl_UtfToWCharDString(Tcl_DStringValue(&tempString), -1, &initDirString),
+ wcsncpy(string, Tcl_UtfToWCharDString(Tcl_DStringValue(&tempString), TCL_INDEX_NONE, &initDirString),
MAX_PATH);
Tcl_DStringFree(&initDirString);
Tcl_DStringFree(&tempString);
@@ -2678,7 +2620,7 @@ ChooseDirectoryValidateProc(
*/
wsprintfW(selDir, L"Directory '%s' does not exist,\n"
- L"please select or enter an existing directory.",
+ L"please select or enter an existing directory.",
chooseDirSharedData->retDir);
MessageBoxW(NULL, selDir, NULL, MB_ICONEXCLAMATION|MB_OK);
chooseDirSharedData->retDir[0] = '\0';
@@ -2962,7 +2904,7 @@ Tk_MessageBoxObjCmd(
Tcl_DecrRefCount(tmpObj);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- TkFindStateString(buttonMap, winCode), -1));
+ TkFindStateString(buttonMap, winCode), TCL_INDEX_NONE));
return TCL_OK;
}
@@ -3079,24 +3021,24 @@ GetFontObj(
Tcl_DStringInit(&ds);
Tcl_WCharToUtfDString(plf->lfFaceName, wcslen(plf->lfFaceName), &ds);
Tcl_ListObjAppendElement(NULL, resObj,
- Tcl_NewStringObj(Tcl_DStringValue(&ds), -1));
+ Tcl_NewStringObj(Tcl_DStringValue(&ds), TCL_INDEX_NONE));
Tcl_DStringFree(&ds);
pt = -MulDiv(plf->lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY));
- Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewIntObj(pt));
+ Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewWideIntObj(pt));
if (plf->lfWeight >= 700) {
- Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj("bold", -1));
+ Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj("bold", TCL_INDEX_NONE));
}
if (plf->lfItalic) {
Tcl_ListObjAppendElement(NULL, resObj,
- Tcl_NewStringObj("italic", -1));
+ Tcl_NewStringObj("italic", TCL_INDEX_NONE));
}
if (plf->lfUnderline) {
Tcl_ListObjAppendElement(NULL, resObj,
- Tcl_NewStringObj("underline", -1));
+ Tcl_NewStringObj("underline", TCL_INDEX_NONE));
}
if (plf->lfStrikeOut) {
Tcl_ListObjAppendElement(NULL, resObj,
- Tcl_NewStringObj("overstrike", -1));
+ Tcl_NewStringObj("overstrike", TCL_INDEX_NONE));
}
return resObj;
}
@@ -3108,7 +3050,7 @@ ApplyLogfont(
HDC hdc,
LOGFONTW *logfontPtr)
{
- int objc;
+ Tcl_Size objc;
Tcl_Obj **objv, **tmpv;
Tcl_ListObjGetElements(NULL, cmdObj, &objc, &objv);
@@ -3164,7 +3106,7 @@ HookProc(
Tcl_DString title;
Tcl_DStringInit(&title);
- Tcl_UtfToWCharDString(Tcl_GetString(phd->titleObj), -1, &title);
+ Tcl_UtfToWCharDString(Tcl_GetString(phd->titleObj), TCL_INDEX_NONE, &title);
if (Tcl_DStringLength(&title) > 0) {
SetWindowTextW(hwndDlg, (LPCWSTR) Tcl_DStringValue(&title));
}
@@ -3183,13 +3125,13 @@ HookProc(
if (IsWindow(hwndCtrl)) {
EnableWindow(hwndCtrl, FALSE);
}
- TkSendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
+ Tk_SendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
return 1; /* we handled the message */
}
if (WM_DESTROY == msg) {
phd->hwnd = NULL;
- TkSendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
+ Tk_SendVirtualEvent(phd->parent, "TkFontchooserVisibility", NULL);
return 0;
}
@@ -3207,7 +3149,7 @@ HookProc(
ApplyLogfont(phd->interp, phd->cmdObj, hdc, &lf);
}
if (phd && phd->parent) {
- TkSendVirtualEvent(phd->parent, "TkFontchooserFontChanged", NULL);
+ Tk_SendVirtualEvent(phd->parent, "TkFontchooserFontChanged", NULL);
}
return 1;
}
@@ -3220,7 +3162,7 @@ HookProc(
*/
enum FontchooserOption {
- FontchooserParent, FontchooserTitle, FontchooserFont, FontchooserCmd,
+ FontchooserCmd, FontchooserFont, FontchooserParent, FontchooserTitle,
FontchooserVisible
};
@@ -3290,15 +3232,15 @@ static int
FontchooserConfigureCmd(
void *clientData, /* Main window */
Tcl_Interp *interp,
- int objc,
+ Tcl_Size objc,
Tcl_Obj *const objv[])
{
Tk_Window tkwin = (Tk_Window)clientData;
HookData *hdPtr = NULL;
- int i;
+ Tcl_Size i;
int r = TCL_OK;
static const char *const optionStrings[] = {
- "-parent", "-title", "-font", "-command", "-visible", NULL
+ "-command", "-font", "-parent", "-title", "-visible", NULL
};
hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
@@ -3312,7 +3254,7 @@ FontchooserConfigureCmd(
Tcl_Obj *dictObj = Tcl_NewDictObj();
for (i = 0; r == TCL_OK && optionStrings[i] != NULL; ++i) {
- keyObj = Tcl_NewStringObj(optionStrings[i], -1);
+ keyObj = Tcl_NewStringObj(optionStrings[i], TCL_INDEX_NONE);
valueObj = FontchooserCget(hdPtr, i);
r = Tcl_DictObjPut(interp, dictObj, keyObj, valueObj);
}
@@ -3348,7 +3290,7 @@ FontchooserConfigureCmd(
static const char *msg = "cannot change read-only option "
"\"-visible\": use the show or hide command";
- Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "FONTDIALOG", "READONLY", NULL);
return TCL_ERROR;
}
@@ -3434,7 +3376,7 @@ static int
FontchooserShowCmd(
void *clientData, /* Main window */
Tcl_Interp *interp,
- TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Size),
TCL_UNUSED(Tcl_Obj *const *))
{
Tcl_DString ds;
@@ -3483,7 +3425,7 @@ FontchooserShowCmd(
fontPtr = (TkFont *) f;
cf.Flags |= CF_INITTOLOGFONTSTRUCT;
Tcl_DStringInit(&ds);
- wcsncpy(lf.lfFaceName, Tcl_UtfToWCharDString(fontPtr->fa.family, -1, &ds),
+ wcsncpy(lf.lfFaceName, Tcl_UtfToWCharDString(fontPtr->fa.family, TCL_INDEX_NONE, &ds),
LF_FACESIZE-1);
Tcl_DStringFree(&ds);
lf.lfFaceName[LF_FACESIZE-1] = 0;
@@ -3505,7 +3447,7 @@ FontchooserShowCmd(
}
if (TCL_OK == r && hdPtr->cmdObj != NULL) {
- int len = 0;
+ Tcl_Size len = 0;
r = Tcl_ListObjLength(interp, hdPtr->cmdObj, &len);
if (len > 0) {
@@ -3520,7 +3462,7 @@ FontchooserShowCmd(
ApplyLogfont(hdPtr->interp, hdPtr->cmdObj, hdc, &lf);
}
if (hdPtr->parent) {
- TkSendVirtualEvent(hdPtr->parent, "TkFontchooserFontChanged", NULL);
+ Tk_SendVirtualEvent(hdPtr->parent, "TkFontchooserFontChanged", NULL);
}
}
Tcl_SetServiceMode(oldMode);
@@ -3548,7 +3490,7 @@ static int
FontchooserHideCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp,
- TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Size),
TCL_UNUSED(Tcl_Obj *const *))
{
HookData *hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index d0df3ec..1022be4 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -4,8 +4,8 @@
* This file contains the Xlib emulation functions pertaining to actually
* drawing objects on a window.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
- * Copyright (c) 1994 Software Research Associates, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
+ * Copyright © 1994 Software Research Associates, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -244,7 +244,7 @@ ConvertPoints(
if (tsdPtr->winPoints != NULL) {
ckfree(tsdPtr->winPoints);
}
- tsdPtr->winPoints = ckalloc(sizeof(POINT) * npoints);
+ tsdPtr->winPoints = (POINT *)ckalloc(sizeof(POINT) * (size_t)npoints);
if (tsdPtr->winPoints == NULL) {
tsdPtr->nWinPoints = -1;
return NULL;
@@ -412,7 +412,7 @@ XCopyPlane(
*/
fgBrush = CreateSolidBrush(gc->foreground);
- oldBrush = SelectObject(destDC, fgBrush);
+ oldBrush = (HBRUSH)SelectObject(destDC, fgBrush);
SetBkColor(destDC, RGB(255,255,255));
SetTextColor(destDC, RGB(0,0,0));
BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, srcDC,
@@ -450,7 +450,7 @@ XCopyPlane(
BitBlt(memDC, 0, 0, (int) width, (int) height, maskDC,
dest_x - gc->clip_x_origin, dest_y - gc->clip_y_origin,
SRCAND);
- oldBrush = SelectObject(destDC, fgBrush);
+ oldBrush = (HBRUSH)SelectObject(destDC, fgBrush);
BitBlt(destDC, dest_x, dest_y, (int) width, (int) height, memDC,
0, 0, MASKPAT);
@@ -553,17 +553,17 @@ TkPutImage(
usePalette = (image->bits_per_pixel < 16);
if (usePalette) {
- infoPtr = ckalloc(sizeof(BITMAPINFOHEADER)
- + sizeof(RGBQUAD)*ncolors);
+ infoPtr = (BITMAPINFO *)ckalloc(sizeof(BITMAPINFOHEADER)
+ + sizeof(RGBQUAD)*(size_t)ncolors);
} else {
- infoPtr = ckalloc(sizeof(BITMAPINFOHEADER));
+ infoPtr = (BITMAPINFO *)ckalloc(sizeof(BITMAPINFOHEADER));
}
infoPtr->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
infoPtr->bmiHeader.biWidth = image->width;
infoPtr->bmiHeader.biHeight = -image->height; /* Top-down order */
infoPtr->bmiHeader.biPlanes = 1;
- infoPtr->bmiHeader.biBitCount = image->bits_per_pixel;
+ infoPtr->bmiHeader.biBitCount = (WORD)image->bits_per_pixel;
infoPtr->bmiHeader.biCompression = BI_RGB;
infoPtr->bmiHeader.biSizeImage = 0;
infoPtr->bmiHeader.biXPelsPerMeter = 0;
@@ -571,7 +571,7 @@ TkPutImage(
infoPtr->bmiHeader.biClrImportant = 0;
if (usePalette) {
- infoPtr->bmiHeader.biClrUsed = ncolors;
+ infoPtr->bmiHeader.biClrUsed = (DWORD)ncolors;
for (i = 0; i < ncolors; i++) {
infoPtr->bmiColors[i].rgbBlue = GetBValue(colors[i]);
infoPtr->bmiColors[i].rgbGreen = GetGValue(colors[i]);
@@ -586,9 +586,11 @@ TkPutImage(
ckfree(infoPtr);
}
if (!bitmap) {
- Tcl_Panic("Fail to allocate bitmap");
+ DeleteDC(dcMem);
+ TkWinReleaseDrawableDC(d, dc, &state);
+ return BadValue;
}
- bitmap = SelectObject(dcMem, bitmap);
+ bitmap = (HBITMAP)SelectObject(dcMem, bitmap);
BitBlt(dc, dest_x, dest_y, (int) width, (int) height, dcMem, src_x, src_y,
SRCCOPY);
DeleteObject(SelectObject(dcMem, bitmap));
@@ -597,6 +599,7 @@ TkPutImage(
return Success;
}
+#undef XPutImage
int
XPutImage(
Display *display,
@@ -668,7 +671,7 @@ XFillRectangles(
stipple = CreatePatternBrush(twdPtr->bitmap.handle);
SetBrushOrgEx(dc, gc->ts_x_origin, gc->ts_y_origin, NULL);
- oldBrush = SelectObject(dc, stipple);
+ oldBrush = (HBRUSH)SelectObject(dc, stipple);
dcMem = CreateCompatibleDC(dc);
/*
@@ -680,7 +683,7 @@ XFillRectangles(
while (nrectangles-- > 0) {
bitmap = CreateCompatibleBitmap(dc, rectangles[0].width,
rectangles[0].height);
- oldBitmap = SelectObject(dcMem, bitmap);
+ oldBitmap = (HBITMAP)SelectObject(dcMem, bitmap);
rect.left = 0;
rect.top = 0;
rect.right = rectangles[0].width;
@@ -715,8 +718,8 @@ XFillRectangles(
}
} else {
HPEN newPen = CreatePen(PS_NULL, 0, gc->foreground);
- HPEN oldPen = SelectObject(dc, newPen);
- oldBrush = SelectObject(dc, brush);
+ HPEN oldPen = (HPEN)SelectObject(dc, newPen);
+ oldBrush = (HBRUSH)SelectObject(dc, brush);
while (nrectangles-- > 0) {
Rectangle(dc, rectangles[0].x, rectangles[0].y,
@@ -758,10 +761,10 @@ MakeAndStrokePath(
POINT *winPoints,
int npoints,
WinDrawFunc func) /* Name of the Windows GDI drawing function:
- this is either Polyline or Polygon. */
+ this is either Polyline or Polygon. */
{
BeginPath(dc);
- func(dc, winPoints, npoints);
+ func(dc, winPoints, (int)npoints);
/*
* In the case of closed polylines, the first and last points
* are the same. We want miter or bevel join be rendered also
@@ -769,15 +772,15 @@ MakeAndStrokePath(
* path is closed.
*/
if (func == Polyline) {
- if ((winPoints[0].x == winPoints[npoints-1].x) &&
- (winPoints[0].y == winPoints[npoints-1].y)) {
- CloseFigure(dc);
- }
- EndPath(dc);
- StrokePath(dc);
+ if ((winPoints[0].x == winPoints[npoints-1].x) &&
+ (winPoints[0].y == winPoints[npoints-1].y)) {
+ CloseFigure(dc);
+ }
+ EndPath(dc);
+ StrokePath(dc);
} else {
- EndPath(dc);
- StrokeAndFillPath(dc);
+ EndPath(dc);
+ StrokeAndFillPath(dc);
}
}
@@ -845,7 +848,7 @@ RenderObject(
*/
SetBrushOrgEx(dc, gc->ts_x_origin, gc->ts_y_origin, NULL);
- oldBrush = SelectObject(dc, CreatePatternBrush(twdPtr->bitmap.handle));
+ oldBrush = (HBRUSH)SelectObject(dc, CreatePatternBrush(twdPtr->bitmap.handle));
/*
* Create temporary drawing surface containing a copy of the
@@ -853,9 +856,9 @@ RenderObject(
*/
dcMem = CreateCompatibleDC(dc);
- oldBitmap = SelectObject(dcMem, CreateCompatibleBitmap(dc, width,
+ oldBitmap = (HBITMAP)SelectObject(dcMem, CreateCompatibleBitmap(dc, width,
height));
- oldPen = SelectObject(dcMem, pen);
+ oldPen = (HPEN)SelectObject(dcMem, pen);
BitBlt(dcMem, 0, 0, width, height, dc, rect.left, rect.top, SRCCOPY);
/*
@@ -875,8 +878,8 @@ RenderObject(
SetPolyFillMode(dcMem, (gc->fill_rule == EvenOddRule) ? ALTERNATE
: WINDING);
- oldMemBrush = SelectObject(dcMem, CreateSolidBrush(gc->foreground));
- MakeAndStrokePath(dcMem, winPoints, npoints, func);
+ oldMemBrush = (HBRUSH)SelectObject(dcMem, CreateSolidBrush(gc->foreground));
+ MakeAndStrokePath(dcMem, winPoints, npoints, func);
BitBlt(dc, rect.left, rect.top, width, height, dcMem, 0, 0, COPYFG);
/*
@@ -888,7 +891,7 @@ RenderObject(
if (gc->fill_style == FillOpaqueStippled) {
DeleteObject(SelectObject(dcMem,
CreateSolidBrush(gc->background)));
- MakeAndStrokePath(dcMem, winPoints, npoints, func);
+ MakeAndStrokePath(dcMem, winPoints, npoints, func);
BitBlt(dc, rect.left, rect.top, width, height, dcMem, 0, 0,
COPYBG);
}
@@ -898,13 +901,13 @@ RenderObject(
DeleteObject(SelectObject(dcMem, oldBitmap));
DeleteDC(dcMem);
} else {
- oldPen = SelectObject(dc, pen);
- oldBrush = SelectObject(dc, CreateSolidBrush(gc->foreground));
+ oldPen = (HPEN)SelectObject(dc, pen);
+ oldBrush = (HBRUSH)SelectObject(dc, CreateSolidBrush(gc->foreground));
SetROP2(dc, tkpWinRopModes[gc->function]);
SetPolyFillMode(dc, (gc->fill_rule == EvenOddRule) ? ALTERNATE
: WINDING);
- MakeAndStrokePath(dc, winPoints, npoints, func);
+ MakeAndStrokePath(dc, winPoints, npoints, func);
SelectObject(dc, oldPen);
}
DeleteObject(SelectObject(dc, oldBrush));
@@ -977,7 +980,7 @@ XFillPolygon(
GC gc,
XPoint *points,
int npoints,
- int shape,
+ TCL_UNUSED(int),
int mode)
{
HPEN pen;
@@ -990,7 +993,7 @@ XFillPolygon(
dc = TkWinGetDrawableDC(display, d, &state);
- pen = GetStockObject(NULL_PEN);
+ pen = (HPEN)GetStockObject(NULL_PEN);
RenderObject(dc, gc, points, npoints, mode, pen, Polygon);
TkWinReleaseDrawableDC(d, dc, &state);
@@ -1034,11 +1037,11 @@ XDrawRectangle(
pen = SetUpGraphicsPort(gc);
SetBkMode(dc, TRANSPARENT);
- oldPen = SelectObject(dc, pen);
- oldBrush = SelectObject(dc, GetStockObject(NULL_BRUSH));
+ oldPen = (HPEN)SelectObject(dc, pen);
+ oldBrush = (HBRUSH)SelectObject(dc, GetStockObject(NULL_BRUSH));
SetROP2(dc, tkpWinRopModes[gc->function]);
- Rectangle(dc, x, y, (int) x+width+1, (int) y+height+1);
+ Rectangle(dc, x, y, x + (int)width + 1, y + (int)height + 1);
DeleteObject(SelectObject(dc, oldPen));
SelectObject(dc, oldBrush);
@@ -1260,7 +1263,7 @@ DrawOrFillArc(
*/
pen = SetUpGraphicsPort(gc);
- oldPen = SelectObject(dc, pen);
+ oldPen = (HPEN)SelectObject(dc, pen);
if (!fill) {
/*
* Note that this call will leave a gap of one pixel at the end of the
@@ -1269,16 +1272,16 @@ DrawOrFillArc(
*/
SetBkMode(dc, TRANSPARENT);
- Arc(dc, x, y, (int) (x+width+1), (int) (y+height+1), xstart, ystart,
+ Arc(dc, x, y, x + (int)width + 1, y + (int)height + 1, xstart, ystart,
xend, yend);
} else {
brush = CreateSolidBrush(gc->foreground);
- oldBrush = SelectObject(dc, brush);
+ oldBrush = (HBRUSH)SelectObject(dc, brush);
if (gc->arc_mode == ArcChord) {
- Chord(dc, x, y, (int) (x+width+1), (int) (y+height+1),
+ Chord(dc, x, y, x + (int)width + 1, y + (int)height + 1,
xstart, ystart, xend, yend);
} else if (gc->arc_mode == ArcPieSlice) {
- Pie(dc, x, y, (int) (x+width+1), (int) (y+height+1),
+ Pie(dc, x, y, x+(int)width+1, y + (int)height + 1,
xstart, ystart, xend, yend);
}
DeleteObject(SelectObject(dc, oldBrush));
@@ -1395,11 +1398,11 @@ SetUpGraphicsPort(
int
TkScrollWindow(
Tk_Window tkwin, /* The window to be scrolled. */
- GC gc, /* GC for window to be scrolled. */
+ TCL_UNUSED(GC), /* GC for window to be scrolled. */
int x, int y, int width, int height,
/* Position rectangle to be scrolled. */
int dx, int dy, /* Distance rectangle should be moved. */
- TkRegion damageRgn) /* Region to accumulate damage in. */
+ Region damageRgn) /* Region to accumulate damage in. */
{
HWND hwnd = TkWinGetHWND(Tk_WindowId(tkwin));
RECT scrollRect;
@@ -1452,7 +1455,7 @@ TkWinFillRect(
/*
*----------------------------------------------------------------------
*
- * TkpDrawHighlightBorder --
+ * Tk_DrawHighlightBorder --
*
* This function draws a rectangular ring around the outside of a widget
* to indicate that it has received the input focus.
@@ -1472,10 +1475,10 @@ TkWinFillRect(
*/
void
-TkpDrawHighlightBorder(
+Tk_DrawHighlightBorder(
Tk_Window tkwin,
GC fgGC,
- GC bgGC,
+ TCL_UNUSED(GC),
int highlightWidth,
Drawable drawable)
{
@@ -1485,7 +1488,7 @@ TkpDrawHighlightBorder(
/*
*----------------------------------------------------------------------
*
- * TkpDrawFrame --
+ * TkpDrawFrameEx --
*
* This function draws the rectangular frame area.
*
@@ -1499,14 +1502,15 @@ TkpDrawHighlightBorder(
*/
void
-TkpDrawFrame(
+TkpDrawFrameEx(
Tk_Window tkwin,
+ Drawable drawable,
Tk_3DBorder border,
int highlightWidth,
int borderWidth,
int relief)
{
- Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, highlightWidth,
+ Tk_Fill3DRectangle(tkwin, drawable, border, highlightWidth,
highlightWidth, Tk_Width(tkwin) - 2 * highlightWidth,
Tk_Height(tkwin) - 2 * highlightWidth, borderWidth, relief);
}
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index 36c6047..34cd8ca 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -6,7 +6,7 @@
* one application can use as its main window an internal window from
* another application).
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 1996-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -41,7 +41,7 @@ typedef struct {
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
-static void ContainerEventProc(ClientData clientData,
+static void ContainerEventProc(void *clientData,
XEvent *eventPtr);
static void EmbedGeometryRequest(Container *containerPtr,
int width, int height);
@@ -69,7 +69,7 @@ void
TkWinCleanupContainerList(void)
{
Container *nextPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (; tsdPtr->firstContainerPtr != NULL;
@@ -96,14 +96,18 @@ TkWinCleanupContainerList(void)
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
TkpTestembedCmd(
- ClientData clientData,
+ void *dummy,
Tcl_Interp *interp,
- int objc,
+ Tcl_Size objc,
Tcl_Obj *const objv[])
{
+ (void)dummy;
+ (void)interp;
+ (void)objc;
+ (void)objv;
+
return TCL_OK;
}
@@ -160,7 +164,7 @@ void Tk_MapEmbeddedWindow(
{
if(!(winPtr->flags & TK_ALREADY_DEAD)) {
HWND hwnd = (HWND)winPtr->privatePtr;
- int state = SendMessageW(hwnd, TK_STATE, -1, -1) - 1;
+ int state = SendMessageW(hwnd, TK_STATE, -1, (WPARAM)-1) - 1;
if (state < 0 || state > 3) {
state = NormalState;
@@ -173,13 +177,13 @@ void Tk_MapEmbeddedWindow(
TkpWmSetState(winPtr, state);
TkWmMapWindow(winPtr);
}
- Tcl_Release((ClientData)winPtr);
+ Tcl_Release(winPtr);
}
/*
*----------------------------------------------------------------------
*
- * TkpUseWindow --
+ * Tk_UseWindow --
*
* This procedure causes a Tk window to use a given Windows handle for a
* window as its underlying window, rather than a new Windows window
@@ -225,7 +229,7 @@ void Tk_MapEmbeddedWindow(
*/
int
-TkpUseWindow(
+Tk_UseWindow(
Tcl_Interp *interp, /* If not NULL, used for error reporting if
* string is bogus. */
Tk_Window tkwin, /* Tk window that does not yet have an
@@ -244,7 +248,7 @@ TkpUseWindow(
/*
if (winPtr->window != None) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't modify container after widget is created", -1));
+ "can't modify container after widget is created", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "EMBED", "POST_CREATE", NULL);
return TCL_ERROR;
}
@@ -287,13 +291,13 @@ TkpUseWindow(
if (id == PTR2INT(hwnd)) {
if (!SendMessageW(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "The container is already in use", -1));
+ "The container is already in use", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "EMBED", "IN_USE", NULL);
return TCL_ERROR;
}
} else if (id == -PTR2INT(hwnd)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "the window to use is not a Tk container", -1));
+ "the window to use is not a Tk container", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "EMBED", "CONTAINER", NULL);
return TCL_ERROR;
} else {
@@ -309,7 +313,7 @@ TkpUseWindow(
if (IDCANCEL == MessageBoxW(hwnd, msg, L"Tk Warning",
MB_OKCANCEL | MB_ICONWARNING)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "Operation has been canceled", -1));
+ "Operation has been canceled", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "EMBED", "CANCEL", NULL);
return TCL_ERROR;
}
@@ -331,8 +335,8 @@ TkpUseWindow(
* window.
*/
- Tcl_Preserve((ClientData) winPtr);
- Tcl_DoWhenIdle((Tcl_IdleProc*) Tk_MapEmbeddedWindow, (ClientData) winPtr);
+ Tcl_Preserve(winPtr);
+ Tcl_DoWhenIdle((Tcl_IdleProc*) Tk_MapEmbeddedWindow, winPtr);
return TCL_OK;
}
@@ -340,7 +344,7 @@ TkpUseWindow(
/*
*----------------------------------------------------------------------
*
- * TkpMakeContainer --
+ * Tk_MakeContainer --
*
* This procedure is called to indicate that a particular window will be
* a container for an embedded application. This changes certain aspects
@@ -357,7 +361,7 @@ TkpUseWindow(
*/
void
-TkpMakeContainer(
+Tk_MakeContainer(
Tk_Window tkwin)
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -371,7 +375,7 @@ TkpMakeContainer(
*/
Tk_MakeWindowExist(tkwin);
- containerPtr = ckalloc(sizeof(Container));
+ containerPtr = (Container *)ckalloc(sizeof(Container));
containerPtr->parentPtr = winPtr;
containerPtr->parentHWnd = Tk_GetHWND(Tk_WindowId(tkwin));
containerPtr->embeddedHWnd = NULL;
@@ -392,7 +396,7 @@ TkpMakeContainer(
*/
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
- ContainerEventProc, (ClientData) containerPtr);
+ ContainerEventProc, containerPtr);
}
/*
@@ -849,7 +853,7 @@ EmbedGeometryRequest(
static void
ContainerEventProc(
- ClientData clientData, /* Token for container window. */
+ void *clientData, /* Token for container window. */
XEvent *eventPtr) /* ResizeRequest event. */
{
Container *containerPtr = (Container *)clientData;
@@ -858,12 +862,12 @@ ContainerEventProc(
if (eventPtr->type == ConfigureNotify) {
/*
- * Send a ConfigureNotify to the embedded application.
- */
+ * Send a ConfigureNotify to the embedded application.
+ */
- if (containerPtr->embeddedPtr != NULL) {
- TkDoConfigureNotify(containerPtr->embeddedPtr);
- }
+ if (containerPtr->embeddedPtr != NULL) {
+ TkDoConfigureNotify(containerPtr->embeddedPtr);
+ }
/*
* Resize the embedded window, if there is any.
@@ -885,13 +889,13 @@ ContainerEventProc(
/*
*----------------------------------------------------------------------
*
- * TkpGetOtherWindow --
+ * Tk_GetOtherWindow --
*
* If both the container and embedded window are in the same process,
* this procedure will return either one, given the other.
*
* Results:
- * If winPtr is a container, the return value is the token for the
+ * If tkwin is a container, the return value is the token for the
* embedded window, and vice versa. If the "other" window isn't in this
* process, NULL is returned.
*
@@ -901,9 +905,9 @@ ContainerEventProc(
*----------------------------------------------------------------------
*/
-TkWindow *
-TkpGetOtherWindow(
- TkWindow *winPtr) /* Tk's structure for a container or embedded
+Tk_Window
+Tk_GetOtherWindow(
+ Tk_Window tkwin) /* Tk's structure for a container or embedded
* window. */
{
Container *containerPtr;
@@ -912,10 +916,10 @@ TkpGetOtherWindow(
for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL;
containerPtr = containerPtr->nextPtr) {
- if (containerPtr->embeddedPtr == winPtr) {
- return containerPtr->parentPtr;
- } else if (containerPtr->parentPtr == winPtr) {
- return containerPtr->embeddedPtr;
+ if ((Tk_Window)containerPtr->embeddedPtr == tkwin) {
+ return (Tk_Window)containerPtr->parentPtr;
+ } else if ((Tk_Window)containerPtr->parentPtr == tkwin) {
+ return (Tk_Window)containerPtr->embeddedPtr;
}
}
return NULL;
@@ -1050,6 +1054,8 @@ TkpRedirectKeyEvent(
XEvent *eventPtr) /* X event to redirect (should be KeyPress or
* KeyRelease). */
{
+ (void)winPtr;
+ (void)eventPtr;
/* not implemented */
}
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index daa79b8..1802b35 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -4,9 +4,9 @@
* Contains the Windows implementation of the platform-independent font
* package interface.
*
- * Copyright (c) 1994 Software Research Associates, Inc.
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 Scriptics Corporation.
+ * Copyright © 1994 Software Research Associates, Inc.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -702,7 +702,7 @@ TkpGetSubFonts(
fontPtr = (WinFont *) tkfont;
for (i = 0; i < fontPtr->numSubFonts; i++) {
familyPtr = fontPtr->subFontArray[i].familyPtr;
- strPtr = Tcl_NewStringObj(familyPtr->faceName, -1);
+ strPtr = Tcl_NewStringObj(familyPtr->faceName, TCL_INDEX_NONE);
Tcl_ListObjAppendElement(NULL, resultPtr, strPtr);
}
Tcl_SetObjResult(interp, resultPtr);
@@ -790,9 +790,9 @@ Tk_MeasureChars(
Tk_Font tkfont, /* Font in which characters will be drawn. */
const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
- int numBytes, /* Maximum number of bytes to consider from
+ Tcl_Size numBytes, /* Maximum number of bytes to consider from
* source string. */
- int maxLength, /* If >= 0, maxLength specifies the longest
+ int maxLength, /* If >= 0, maxLength specifies the longest
* permissible line length in pixels; don't
* consider any character that would cross
* this x-position. If < 0, then line length
@@ -849,11 +849,10 @@ Tk_MeasureChars(
thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
if (thisSubFontPtr != lastSubFontPtr) {
familyPtr = lastSubFontPtr->familyPtr;
- Tcl_UtfToExternalDString(familyPtr->encoding, start,
+ WCHAR *wstr = (WCHAR *)Tcl_UtfToExternalDString(familyPtr->encoding, start,
p - start, &runString);
size.cx = 0;
- familyPtr->getTextExtentPoint32Proc(hdc,
- (WCHAR *)Tcl_DStringValue(&runString),
+ familyPtr->getTextExtentPoint32Proc(hdc, wstr,
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
&size);
Tcl_DStringFree(&runString);
@@ -877,10 +876,10 @@ Tk_MeasureChars(
*/
familyPtr = lastSubFontPtr->familyPtr;
- Tcl_UtfToExternalDString(familyPtr->encoding, start,
+ WCHAR *wstr = (WCHAR *)Tcl_UtfToExternalDString(familyPtr->encoding, start,
p - start, &runString);
size.cx = 0;
- familyPtr->getTextExtentPoint32Proc(hdc, (WCHAR *) Tcl_DStringValue(&runString),
+ familyPtr->getTextExtentPoint32Proc(hdc, wstr,
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
&size);
Tcl_DStringFree(&runString);
@@ -909,7 +908,7 @@ Tk_MeasureChars(
for (p = start; p < end; ) {
next = p + TkUtfToUniChar(p, &ch);
Tcl_UtfToExternal(NULL, familyPtr->encoding, p,
- (int) (next - p), 0, NULL, buf, sizeof(buf), NULL,
+ (int) (next - p), TCL_ENCODING_PROFILE_TCL8, NULL, buf, sizeof(buf), NULL,
&dstWrote, NULL);
Tcl_DStringAppend(&runString,buf,dstWrote);
size.cx = 0;
@@ -1016,10 +1015,10 @@ TkpMeasureCharsInContext(
Tk_Font tkfont, /* Font in which characters will be drawn. */
const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
- TCL_UNUSED(int), /* Maximum number of bytes to consider from
+ TCL_UNUSED(Tcl_Size), /* Maximum number of bytes to consider from
* source string in all. */
- int rangeStart, /* Index of first byte to measure. */
- int rangeLength, /* Length of range to measure in bytes. */
+ Tcl_Size rangeStart, /* Index of first byte to measure. */
+ Tcl_Size rangeLength, /* Length of range to measure in bytes. */
int maxLength, /* If >= 0, maxLength specifies the longest
* permissible line length; don't consider any
* character that would cross this x-position.
@@ -1072,7 +1071,7 @@ Tk_DrawChars(
* is passed to this function. If they are not
* stripped out, they will be displayed as
* regular printing characters. */
- int numBytes, /* Number of bytes in string. */
+ Tcl_Size numBytes, /* Number of bytes in string. */
int x, int y) /* Coordinates at which to place origin of
* string when drawing. */
{
@@ -1219,7 +1218,7 @@ TkDrawAngledChars(
* is passed to this function. If they are not
* stripped out, they will be displayed as
* regular printing characters. */
- int numBytes, /* Number of bytes in string. */
+ Tcl_Size numBytes, /* Number of bytes in string. */
double x, double y, /* Coordinates at which to place origin of
* string when drawing. */
double angle)
@@ -1388,9 +1387,9 @@ TkpDrawCharsInContext(
* is passed to this function. If they are not
* stripped out, they will be displayed as
* regular printing characters. */
- TCL_UNUSED(int), /* Number of bytes in string. */
- int rangeStart, /* Index of first byte to draw. */
- int rangeLength, /* Length of range to draw in bytes. */
+ TCL_UNUSED(Tcl_Size), /* Number of bytes in string. */
+ Tcl_Size rangeStart, /* Index of first byte to draw. */
+ Tcl_Size rangeLength, /* Length of range to draw in bytes. */
int x, int y) /* Coordinates at which to place origin of the
* whole (not just the range) string when
* drawing. */
@@ -1416,9 +1415,9 @@ TkpDrawAngledCharsInContext(
* passed to this function. If they are not
* stripped out, they will be displayed as
* regular printing characters. */
- TCL_UNUSED(int), /* Number of bytes in string. */
- int rangeStart, /* Index of first byte to draw. */
- int rangeLength, /* Length of range to draw in bytes. */
+ TCL_UNUSED(Tcl_Size), /* Number of bytes in string. */
+ Tcl_Size rangeStart, /* Index of first byte to draw. */
+ Tcl_Size rangeLength, /* Length of range to draw in bytes. */
double x, double y, /* Coordinates at which to place origin of the
* whole (not just the range) string when
* drawing. */
@@ -1492,14 +1491,12 @@ MultiFontTextOut(
if ((thisSubFontPtr != lastSubFontPtr) || (p-source > 200)) {
if (p > source) {
familyPtr = lastSubFontPtr->familyPtr;
- Tcl_UtfToExternalDString(familyPtr->encoding, source,
+ WCHAR *wstr = (WCHAR *)Tcl_UtfToExternalDString(familyPtr->encoding, source,
p - source, &runString);
familyPtr->textOutProc(hdc, (int)(x-(double)tm.tmOverhang/2.0), y,
- (WCHAR *)Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
+ wstr, Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
familyPtr->getTextExtentPoint32Proc(hdc,
- (WCHAR *)Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
+ wstr, Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
&size);
x += cosA*size.cx;
y -= sinA*size.cx;
@@ -1514,11 +1511,10 @@ MultiFontTextOut(
}
if (p > source) {
familyPtr = lastSubFontPtr->familyPtr;
- Tcl_UtfToExternalDString(familyPtr->encoding, source,
+ WCHAR *wstr = (WCHAR *)Tcl_UtfToExternalDString(familyPtr->encoding, source,
p - source, &runString);
familyPtr->textOutProc(hdc, (int)(x-(double)tm.tmOverhang/2.0), y,
- (WCHAR *)Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
+ wstr, Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
Tcl_DStringFree(&runString);
}
SelectObject(hdc, oldFont);
@@ -2546,24 +2542,8 @@ FamilyExists(
int result;
Tcl_DString faceString;
- /*
- * Just immediately rule out the following fonts, because they look so
- * ugly on windows. The caller's fallback mechanism will cause the
- * corresponding appropriate TrueType fonts to be selected.
- */
-
- if (strcasecmp(faceName, "Courier") == 0) {
- return 0;
- }
- if (strcasecmp(faceName, "Times") == 0) {
- return 0;
- }
- if (strcasecmp(faceName, "Helvetica") == 0) {
- return 0;
- }
-
Tcl_DStringInit(&faceString);
- Tcl_UtfToWCharDString(faceName, -1, &faceString);
+ Tcl_UtfToWCharDString(faceName, TCL_INDEX_NONE, &faceString);
/*
* If the family exists, WinFontExistProc() will be called and
@@ -2747,7 +2727,8 @@ LoadFontRanges(
* range information. */
int *symbolPtr)
{
- int n, i, j, k, swapped, offset, cbData, segCount;
+ int n, i, j, k, swapped, segCount;
+ size_t cbData, offset;
DWORD cmapKey;
USHORT *startCount, *endCount;
CMAPTABLE cmapTable;
diff --git a/win/tkWinGDI.c b/win/tkWinGDI.c
new file mode 100644
index 0000000..7611880
--- /dev/null
+++ b/win/tkWinGDI.c
@@ -0,0 +1,3886 @@
+/*
+ * tkWinGDI.c --
+ *
+ * This module implements access to the Win32 GDI API.
+ *
+ * Copyright © 1991-2018 Microsoft Corp.
+ * Copyright © 2009, Michael I. Schwartz.
+ * Copyright © 1998-2019 Harald Oehlmann, Elmicron GmbH
+ * Copyright © 2021 Kevin Walzer/WordTech Communications LLC.
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+
+#include <windows.h>
+#include <math.h>
+#include <wtypes.h>
+#include <winspool.h>
+#include <commdlg.h>
+#include <wingdi.h>
+
+#include <tcl.h>
+
+#include "tkWinInt.h"
+
+/*
+ * Create a standard "DrawFunc" to make this more workable....
+ */
+#ifdef _MSC_VER
+typedef BOOL (WINAPI *DrawFunc) (
+ HDC, int, int, int, int, int, int, int, int); /* Arc, Chord, Pie. */
+#else
+typedef BOOL WINAPI (*DrawFunc) (
+ HDC, int, int, int, int, int, int, int, int); /* Arc, Chord, Pie. */
+#endif
+
+/* Real functions. */
+static Tcl_ObjCmdProc GdiArc;
+static Tcl_ObjCmdProc GdiBitmap;
+static Tcl_ObjCmdProc GdiCharWidths;
+static Tcl_ObjCmdProc GdiImage;
+static Tcl_ObjCmdProc GdiPhoto;
+static Tcl_ObjCmdProc GdiLine;
+static Tcl_ObjCmdProc GdiOval;
+static Tcl_ObjCmdProc GdiPolygon;
+static Tcl_ObjCmdProc GdiRectangle;
+static Tcl_ObjCmdProc GdiText;
+static Tcl_ObjCmdProc GdiMap;
+static Tcl_ObjCmdProc GdiCopyBits;
+
+/* Local copies of similar routines elsewhere in Tcl/Tk. */
+static int GdiGetColor(Tcl_Obj *nameObj, COLORREF *color);
+
+/*
+ * Helper functions.
+ */
+static int GdiMakeLogFont(Tcl_Interp *interp, const char *str,
+ LOGFONTW *lf, HDC hDC);
+static int GdiMakePen(Tcl_Interp *interp, int width,
+ int dashstyle, const char *dashstyledata,
+ int capstyle, int joinstyle,
+ int stipplestyle, const char *stippledata,
+ unsigned long color, HDC hDC, HGDIOBJ *oldPen);
+static int GdiFreePen(Tcl_Interp *interp, HDC hDC, HGDIOBJ oldPen);
+static int GdiMakeBrush(unsigned long color, long hatch,
+ LOGBRUSH *lb, HDC hDC, HBRUSH *oldBrush);
+static void GdiFreeBrush(Tcl_Interp *interp, HDC hDC,
+ HGDIOBJ oldBrush);
+static int GdiGetHdcInfo(HDC hdc,
+ LPPOINT worigin, LPSIZE wextent,
+ LPPOINT vorigin, LPSIZE vextent);
+
+/* Helper functions for printing the window client area. */
+enum PrintType { PTWindow = 0, PTClient = 1, PTScreen = 2 };
+
+static HANDLE CopyToDIB(HWND wnd, enum PrintType type);
+static HBITMAP CopyScreenToBitmap(LPRECT lpRect);
+static HANDLE BitmapToDIB(HBITMAP hb, HPALETTE hp);
+static HANDLE CopyScreenToDIB(LPRECT lpRect);
+static int DIBNumColors(LPBITMAPINFOHEADER lpDIB);
+static int PalEntriesOnDevice(HDC hDC);
+static HPALETTE GetSystemPalette(void);
+static void GetDisplaySize(LONG *width, LONG *height);
+static int GdiWordToWeight(const char *str);
+static int GdiParseFontWords(Tcl_Interp *interp, LOGFONTW *lf,
+ const char *str[], int numargs);
+static Tcl_ObjCmdProc PrintSelectPrinter;
+static Tcl_ObjCmdProc PrintOpenPrinter;
+static Tcl_ObjCmdProc PrintClosePrinter;
+static Tcl_ObjCmdProc PrintOpenDoc;
+static Tcl_ObjCmdProc PrintCloseDoc;
+static Tcl_ObjCmdProc PrintOpenPage;
+static Tcl_ObjCmdProc PrintClosePage;
+
+/*
+ * Global state.
+ */
+
+static PRINTDLGW pd;
+static DOCINFOW di;
+static WCHAR *localPrinterName = NULL;
+static int copies, paper_width, paper_height, dpi_x, dpi_y;
+static LPDEVNAMES devnames;
+static HDC printDC;
+
+/*
+ * To make the "subcommands" follow a standard convention, add them to this
+ * array. The first element is the subcommand name, and the second a standard
+ * Tcl command handler.
+ */
+
+static const struct gdi_command {
+ const char *command_string;
+ Tcl_ObjCmdProc *command;
+} gdi_commands[] = {
+ { "arc", GdiArc },
+ { "bitmap", GdiBitmap },
+ { "characters", GdiCharWidths },
+ { "image", GdiImage },
+ { "line", GdiLine },
+ { "map", GdiMap },
+ { "oval", GdiOval },
+ { "photo", GdiPhoto },
+ { "polygon", GdiPolygon },
+ { "rectangle", GdiRectangle },
+ { "text", GdiText },
+ { "copybits", GdiCopyBits },
+};
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiArc --
+ *
+ * Map canvas arcs to GDI context.
+ *
+ * Results:
+ * Renders arcs.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiArc(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ Tcl_Obj *const *objv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi arc hdc x1 y1 x2 y2 "
+ "-extent angle -start angle -style arcstyle "
+ "-fill color -outline color "
+ "-width dimension -dash dashrule "
+ "-outlinestipple ignored -stipple ignored\n" ;
+ int x1, y1, x2, y2;
+ int xr0, yr0, xr1, yr1;
+ HDC hDC;
+ double extent = 0.0, start = 0.0;
+ DrawFunc drawfunc;
+ int width = 0;
+ HPEN hPen;
+ COLORREF linecolor = 0, fillcolor = BS_NULL;
+ int dolinecolor = 0, dofillcolor = 0;
+ HBRUSH hBrush = NULL;
+ LOGBRUSH lbrush;
+ HGDIOBJ oldobj = NULL;
+ int dodash = 0;
+ const char *dashdata = 0;
+
+ drawfunc = Pie;
+
+ /* Verrrrrry simple for now.... */
+ if (argc < 6) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ if ((Tcl_GetIntFromObj(interp, objv[2], &x1) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[3], &y1) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[4], &x2) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[5], &y2) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+
+ argc -= 6;
+ objv += 6;
+ while (argc >= 2) {
+ if (strcmp(Tcl_GetString(objv[0]), "-extent") == 0) {
+ extent = atof(Tcl_GetString(objv[1]));
+ } else if (strcmp(Tcl_GetString(objv[0]), "-start") == 0) {
+ start = atof(Tcl_GetString(objv[1]));
+ } else if (strcmp(Tcl_GetString(objv[0]), "-style") == 0) {
+ if (strcmp(Tcl_GetString(objv[1]), "pieslice") == 0) {
+ drawfunc = Pie;
+ } else if (strcmp(Tcl_GetString(objv[1]), "arc") == 0) {
+ drawfunc = Arc;
+ } else if (strcmp(Tcl_GetString(objv[1]), "chord") == 0) {
+ drawfunc = Chord;
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-fill") == 0) {
+ /* Handle all args, even if we don't use them yet. */
+ if (GdiGetColor(objv[1], &fillcolor)) {
+ dofillcolor = 1;
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-outline") == 0) {
+ if (GdiGetColor(objv[1], &linecolor)) {
+ dolinecolor = 1;
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-outlinestipple") == 0) {
+ /* ignored */
+ } else if (strcmp(Tcl_GetString(objv[0]), "-stipple") == 0) {
+ /* ignored */
+ } else if (strcmp(Tcl_GetString(objv[0]), "-width") == 0) {
+ if (Tcl_GetIntFromObj(interp, objv[1], &width)) {
+ return TCL_ERROR;
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-dash") == 0) {
+ if (Tcl_GetString(objv[1])) {
+ dodash = 1;
+ dashdata = Tcl_GetString(objv[1]);
+ }
+ } else {
+ /* Don't know that option! */
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+ argc -= 2;
+ objv += 2;
+ }
+ xr0 = xr1 = (x1 + x2) / 2;
+ yr0 = yr1 = (y1 + y2) / 2;
+
+ /*
+ * The angle used by the arc must be "warped" by the eccentricity of the
+ * ellipse. Thanks to Nigel Dodd <nigel.dodd@avellino.com> for bringing a
+ * nice example.
+ */
+
+ xr0 += (int)(100.0 * (x2 - x1) * cos((start * 2.0 * 3.14159265) / 360.0));
+ yr0 -= (int)(100.0 * (y2 - y1) * sin((start * 2.0 * 3.14159265) / 360.0));
+ xr1 += (int)(100.0 * (x2 - x1) * cos(((start+extent) * 2.0 * 3.14159265) / 360.0));
+ yr1 -= (int)(100.0 * (y2 - y1) * sin(((start+extent) * 2.0 * 3.14159265) / 360.0));
+
+ /*
+ * Under Win95, SetArcDirection isn't implemented--so we have to assume
+ * that arcs are drawn counterclockwise (e.g., positive extent) So if it's
+ * negative, switch the coordinates!
+ */
+
+ if (extent < 0) {
+ int xr2 = xr0;
+ int yr2 = yr0;
+
+ xr0 = xr1;
+ xr1 = xr2;
+ yr0 = yr1;
+ yr1 = yr2;
+ }
+
+ if (dofillcolor) {
+ GdiMakeBrush(fillcolor, 0, &lbrush, hDC, &hBrush);
+ } else {
+ oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH));
+ }
+
+ if (width || dolinecolor) {
+ GdiMakePen(interp, width, dodash, dashdata,
+ 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+
+ (*drawfunc)(hDC, x1, y1, x2, y2, xr0, yr0, xr1, yr1);
+
+ if (width || dolinecolor) {
+ GdiFreePen(interp, hDC, hPen);
+ }
+ if (hBrush) {
+ GdiFreeBrush(interp, hDC, hBrush);
+ } else {
+ SelectObject(hDC, oldobj);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiBitmap --
+ *
+ * Unimplemented for now. Should use the same techniques as
+ * CanvasPsBitmap (tkCanvPs.c).
+ *
+ * Results:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiBitmap(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ Tcl_Obj *const *objv)
+{
+ /*
+ * Skip this for now. Should be based on common code with the copybits
+ * command.
+ */
+
+ Tcl_WrongNumArgs(interp, 1, objv, "hdc x y "
+ "-anchor [center|n|e|s|w] -background color "
+ "-bitmap bitmap -foreground color\n"
+ "Not implemented yet. Sorry!");
+ return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiImage --
+ *
+ * Unimplemented for now. Unimplemented for now. Should switch on image
+ * type and call either GdiPhoto or GdiBitmap. This code is similar to
+ * that in tkWinImage.c.
+ *
+ * Results:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiImage(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ Tcl_Obj *const *objv)
+{
+ /* Skip this for now..... */
+ /* Should be based on common code with the copybits command. */
+
+ Tcl_WrongNumArgs(interp, 1, objv, "hdc x y -anchor [center|n|e|s|w] -image name\n"
+ "Not implemented yet. Sorry!");
+ /* Normally, usage results in TCL_ERROR--but wait til' it's implemented. */
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiPhoto --
+ *
+ * Contributed by Lukas Rosenthaler <lukas.rosenthaler@balcab.ch>
+ *
+ * Note: The canvas doesn't directly support photos (only as images), so
+ * this is the first ::tk::print::_gdi command without an equivalent
+ * canvas command. This code may be modified to support photo images on
+ * the canvas.
+ *
+ * Results:
+ * Renders a photo.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiPhoto(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ Tcl_Obj *const *objv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi photo hdc [-destination x y [w [h]]] -photo name\n";
+ HDC dst;
+ int dst_x = 0, dst_y = 0, dst_w = 0, dst_h = 0;
+ int nx, ny, sll;
+ const char *photoname = 0; /* For some reason Tk_FindPhoto takes a char *. */
+ Tk_PhotoHandle photo_handle;
+ Tk_PhotoImageBlock img_block;
+ BITMAPINFO bitmapinfo; /* Since we don't need the bmiColors table,
+ * there is no need for dynamic allocation. */
+ int oldmode; /* For saving the old stretch mode. */
+ POINT pt; /* For saving the brush org. */
+ char *pbuf = NULL;
+ int i, j, k;
+ int retval = TCL_OK;
+
+ /*
+ * Parse the arguments.
+ */
+
+ /* HDC is required. */
+ if (argc < 2) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ dst = printDC;
+
+ /*
+ * Next, check to see if 'dst' can support BitBlt.
+ * If not, raise an error.
+ */
+
+ if ((GetDeviceCaps(dst, RASTERCAPS) & RC_STRETCHDIB) == 0) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "::tk::print::_gdi photo not supported on device context (0x%s)",
+ Tcl_GetString(objv[1])));
+ return TCL_ERROR;
+ }
+
+ /* Parse the command line arguments. */
+ for (j = 2; j < argc; j++) {
+ if (strcmp(Tcl_GetString(objv[j]), "-destination") == 0) {
+ double x, y, w, h;
+ int count = 0;
+ char dummy;
+
+ if (j < argc) {
+ count = sscanf(Tcl_GetString(objv[++j]), "%lf%lf%lf%lf%c",
+ &x, &y, &w, &h, &dummy);
+ }
+
+ if (count < 2 || count > 4) {
+ /* Destination must provide at least 2 arguments. */
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "-destination requires a list of 2 to 4 numbers\n%s",
+ usage_message));
+ return TCL_ERROR;
+ }
+
+ dst_x = (int) x;
+ dst_y = (int) y;
+ if (count == 3) {
+ dst_w = (int) w;
+ dst_h = -1;
+ } else if (count == 4) {
+ dst_w = (int) w;
+ dst_h = (int) h;
+ }
+ } else if (strcmp(Tcl_GetString(objv[j]), "-photo") == 0) {
+ photoname = Tcl_GetString(objv[++j]);
+ }
+ }
+
+ if (photoname == 0) { /* No photo provided. */
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "No photo name provided to ::tk::print::_gdi photo\n%s",
+ usage_message));
+ return TCL_ERROR;
+ }
+
+ photo_handle = Tk_FindPhoto(interp, photoname);
+ if (photo_handle == 0) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "::tk::print::_gdi photo: Photo name %s can't be located\n%s",
+ photoname, usage_message));
+ return TCL_ERROR;
+ }
+ Tk_PhotoGetImage(photo_handle, &img_block);
+
+ nx = img_block.width;
+ ny = img_block.height;
+ sll = ((3*nx + 3) / 4)*4; /* Must be multiple of 4. */
+
+ /*
+ * Buffer is potentially large enough that failure to allocate might be
+ * recoverable.
+ */
+
+ pbuf = (char *)attemptckalloc(sll * ny * sizeof(char));
+ if (pbuf == 0) { /* Memory allocation failure. */
+ Tcl_AppendResult(interp,
+ "::tk::print::_gdi photo failed--out of memory", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ /* After this, all returns must go through retval. */
+
+ /* BITMAP expects BGR; photo provides RGB. */
+ for (k = 0; k < ny; k++) {
+ for (i = 0; i < nx; i++) {
+ pbuf[k*sll + 3*i] = img_block.pixelPtr[
+ k*img_block.pitch + i*img_block.pixelSize + img_block.offset[2]];
+ pbuf[k*sll + 3*i + 1] = img_block.pixelPtr[
+ k*img_block.pitch + i*img_block.pixelSize + img_block.offset[1]];
+ pbuf[k*sll + 3*i + 2] = img_block.pixelPtr[
+ k*img_block.pitch + i*img_block.pixelSize + img_block.offset[0]];
+ }
+ }
+
+ memset(&bitmapinfo, 0L, sizeof(BITMAPINFO));
+
+ bitmapinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bitmapinfo.bmiHeader.biWidth = nx;
+ bitmapinfo.bmiHeader.biHeight = -ny;
+ bitmapinfo.bmiHeader.biPlanes = 1;
+ bitmapinfo.bmiHeader.biBitCount = 24;
+ bitmapinfo.bmiHeader.biCompression = BI_RGB;
+ bitmapinfo.bmiHeader.biSizeImage = 0; /* sll*ny;. */
+ bitmapinfo.bmiHeader.biXPelsPerMeter = 0;
+ bitmapinfo.bmiHeader.biYPelsPerMeter = 0;
+ bitmapinfo.bmiHeader.biClrUsed = 0;
+ bitmapinfo.bmiHeader.biClrImportant = 0;
+
+ oldmode = SetStretchBltMode(dst, HALFTONE);
+ /*
+ * According to the Win32 Programmer's Manual, we have to set the brush
+ * org, now.
+ */
+ SetBrushOrgEx(dst, 0, 0, &pt);
+
+ if (dst_w <= 0) {
+ dst_w = nx;
+ dst_h = ny;
+ } else if (dst_h <= 0) {
+ dst_h = ny*dst_w / nx;
+ }
+
+ if (StretchDIBits(dst, dst_x, dst_y, dst_w, dst_h, 0, 0, nx, ny,
+ pbuf, &bitmapinfo, DIB_RGB_COLORS, SRCCOPY) == (int)GDI_ERROR) {
+ int errcode = GetLastError();
+
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "::tk::print::_gdi photo internal failure: "
+ "StretchDIBits error code %d", errcode));
+ retval = TCL_ERROR;
+ }
+
+ /* Clean up the hDC. */
+ if (oldmode != 0) {
+ SetStretchBltMode(dst, oldmode);
+ SetBrushOrgEx(dst, pt.x, pt.y, &pt);
+ }
+
+ ckfree(pbuf);
+
+ if (retval == TCL_OK) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "%d %d %d %d", dst_x, dst_y, dst_w, dst_h));
+ }
+
+ return retval;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Bezierize --
+ *
+ * Interface to Tk's line smoother, used for lines and pollies.
+ * Provided by Jasper Taylor <jasper.taylor@ed.ac.uk>.
+ *
+ * Results:
+ * Smooths lines.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int Bezierize(
+ POINT* polypoints,
+ int npoly,
+ int nStep,
+ POINT* bpointptr)
+{
+ /* First, translate my points into a list of doubles. */
+ double *inPointList, *outPointList;
+ int n;
+ int nbpoints = 0;
+ POINT* bpoints;
+
+ inPointList = (double *)attemptckalloc(2 * sizeof(double) * npoly);
+ if (inPointList == 0) {
+ /* TODO: unreachable */
+ return nbpoints; /* 0. */
+ }
+
+ for (n=0; n<npoly; n++) {
+ inPointList[2*n] = polypoints[n].x;
+ inPointList[2*n + 1] = polypoints[n].y;
+ }
+
+ nbpoints = 1 + npoly * nStep; /* this is the upper limit. */
+ outPointList = (double *)attemptckalloc(2 * sizeof(double) * nbpoints);
+ if (outPointList == 0) {
+ /* TODO: unreachable */
+ ckfree(inPointList);
+ return 0;
+ }
+
+ nbpoints = TkMakeBezierCurve(NULL, inPointList, npoly, nStep,
+ NULL, outPointList);
+
+ ckfree(inPointList);
+ bpoints = (POINT *)attemptckalloc(sizeof(POINT)*nbpoints);
+ if (bpoints == 0) {
+ /* TODO: unreachable */
+ ckfree(outPointList);
+ return 0;
+ }
+
+ for (n=0; n<nbpoints; n++) {
+ bpoints[n].x = (long)outPointList[2*n];
+ bpoints[n].y = (long)outPointList[2*n + 1];
+ }
+ ckfree(outPointList);
+ *bpointptr = *bpoints;
+ return nbpoints;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiLine --
+ *
+ * Maps lines to GDI context.
+ *
+ * Results:
+ * Renders lines.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiLine(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ Tcl_Obj *const *objv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi line hdc x1 y1 ... xn yn "
+ "-arrow [first|last|both|none] -arrowshape {d1 d2 d3} "
+ "-dash dashlist "
+ "-capstyle [butt|projecting|round] -fill color "
+ "-joinstyle [bevel|miter|round] -smooth [true|false|bezier] "
+ "-splinesteps number -stipple bitmap -width linewid";
+ char *strend;
+ POINT *polypoints;
+ int npoly;
+ int x, y;
+ HDC hDC;
+ HPEN hPen;
+
+ LOGBRUSH lbrush;
+ HBRUSH hBrush = NULL;
+
+ int width = 0;
+ COLORREF linecolor = 0;
+ int dolinecolor = 0;
+ int dosmooth = 0;
+ int doarrow = 0; /* 0=none; 1=end; 2=start; 3=both. */
+ int arrowshape[3];
+
+ int nStep = 12;
+
+ int dodash = 0;
+ const char *dashdata = 0;
+
+ arrowshape[0] = 8;
+ arrowshape[1] = 10;
+ arrowshape[2] = 3;
+
+ /* Verrrrrry simple for now.... */
+ if (argc < 6) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ polypoints = (POINT *)attemptckalloc((argc - 1) * sizeof(POINT));
+ if (polypoints == 0) {
+ Tcl_AppendResult(interp, "Out of memory in GdiLine", (char *)NULL);
+ return TCL_ERROR;
+ }
+ if ((Tcl_GetIntFromObj(interp, objv[2], (int *)&polypoints[0].x) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[3], (int *)&polypoints[0].y) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[4], (int *)&polypoints[1].x) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[5], (int *)&polypoints[1].y) != TCL_OK)
+ ) {
+ return TCL_ERROR;
+ }
+ argc -= 6;
+ objv += 6;
+ npoly = 2;
+
+ while (argc >= 2) {
+ /* Check for a number. */
+ x = strtoul(Tcl_GetString(objv[0]), &strend, 0);
+ if (strend > Tcl_GetString(objv[0])) {
+ /* One number.... */
+ y = strtoul(Tcl_GetString(objv[1]), &strend, 0);
+ if (strend > Tcl_GetString(objv[1])) {
+ /* TWO numbers!. */
+ polypoints[npoly].x = x;
+ polypoints[npoly].y = y;
+ npoly++;
+ argc -= 2;
+ objv += 2;
+ } else {
+ /* Only one number... Assume a usage error. */
+ ckfree(polypoints);
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+ } else {
+ if (strcmp(Tcl_GetString(*objv), "-arrow") == 0) {
+ if (strcmp(Tcl_GetString(objv[1]), "none") == 0) {
+ doarrow = 0;
+ } else if (strcmp(Tcl_GetString(objv[1]), "both") == 0) {
+ doarrow = 3;
+ } else if (strcmp(Tcl_GetString(objv[1]), "first") == 0) {
+ doarrow = 2;
+ } else if (strcmp(Tcl_GetString(objv[1]), "last") == 0) {
+ doarrow = 1;
+ }
+ objv += 2;
+ argc -= 2;
+ } else if (strcmp(Tcl_GetString(*objv), "-arrowshape") == 0) {
+ /* List of 3 numbers--set arrowshape array. */
+ int a1, a2, a3;
+ char dummy;
+
+ if (sscanf(Tcl_GetString(objv[1]), "%d%d%d%c", &a1, &a2, &a3, &dummy) == 3
+ && a1 > 0 && a2 > 0 && a3 > 0) {
+ arrowshape[0] = a1;
+ arrowshape[1] = a2;
+ arrowshape[2] = a3;
+ }
+ /* Else the argument was bad. */
+
+ objv += 2;
+ argc -= 2;
+ } else if (strcmp(Tcl_GetString(*objv), "-capstyle") == 0) {
+ objv += 2;
+ argc -= 2;
+ } else if (strcmp(Tcl_GetString(*objv), "-fill") == 0) {
+ if (GdiGetColor(objv[1], &linecolor)) {
+ dolinecolor = 1;
+ }
+ objv += 2;
+ argc -= 2;
+ } else if (strcmp(Tcl_GetString(*objv), "-joinstyle") == 0) {
+ objv += 2;
+ argc -= 2;
+ } else if (strcmp(Tcl_GetString(*objv), "-smooth") == 0) {
+ /* Argument is true/false or 1/0 or bezier. */
+ if (Tcl_GetString(objv[1])) {
+ switch (Tcl_GetString(objv[1])[0]) {
+ case 't': case 'T':
+ case '1':
+ case 'b': case 'B': /* bezier. */
+ dosmooth = 1;
+ break;
+ default:
+ dosmooth = 0;
+ break;
+ }
+ objv += 2;
+ argc -= 2;
+ }
+ } else if (strcmp(Tcl_GetString(*objv), "-splinesteps") == 0) {
+ if (Tcl_GetIntFromObj(interp, objv[1], &nStep) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ objv += 2;
+ argc -= 2;
+ } else if (strcmp(Tcl_GetString(*objv), "-dash") == 0) {
+ if (Tcl_GetString(objv[1])) {
+ dodash = 1;
+ dashdata = Tcl_GetString(objv[1]);
+ }
+ objv += 2;
+ argc -= 2;
+ } else if (strcmp(Tcl_GetString(*objv), "-dashoffset") == 0) {
+ objv += 2;
+ argc -= 2;
+ } else if (strcmp(Tcl_GetString(*objv), "-stipple") == 0) {
+ objv += 2;
+ argc -= 2;
+ } else if (strcmp(Tcl_GetString(*objv), "-width") == 0) {
+ if (Tcl_GetIntFromObj(interp, objv[1], &width) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ objv += 2;
+ argc -= 2;
+ } else { /* It's an unknown argument!. */
+ argc--;
+ objv++;
+ }
+ /* Check for arguments
+ * Most of the arguments affect the "Pen"
+ */
+ }
+ }
+
+ if (width || dolinecolor || dodash) {
+ GdiMakePen(interp, width, dodash, dashdata,
+ 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+ if (doarrow != 0) {
+ GdiMakeBrush(linecolor, 0, &lbrush, hDC, &hBrush);
+ }
+
+ if (dosmooth) { /* Use PolyBezier. */
+ int nbpoints;
+ POINT *bpoints = 0;
+
+ nbpoints = Bezierize(polypoints,npoly,nStep,bpoints);
+ if (nbpoints > 0) {
+ Polyline(hDC, bpoints, nbpoints);
+ } else {
+ Polyline(hDC, polypoints, npoly); /* Out of memory? Just draw a regular line. */
+ }
+ if (bpoints != 0) {
+ ckfree(bpoints);
+ }
+ } else {
+ Polyline(hDC, polypoints, npoly);
+ }
+
+ if (dodash && doarrow) { /* Don't use dashed or thick pen for the arrows! */
+ GdiFreePen(interp, hDC, hPen);
+ GdiMakePen(interp, width, 0, 0, 0, 0, 0, 0,
+ linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+
+ /* Now the arrowheads, if any. */
+ if (doarrow & 1) {
+ /* Arrowhead at end = polypoints[npoly-1].x, polypoints[npoly-1].y. */
+ POINT ahead[6];
+ double dx, dy, length;
+ double sinTheta, cosTheta;
+ double vertX, vertY, temp;
+ double fracHeight;
+
+ fracHeight = 2.0 / arrowshape[2];
+
+ ahead[0].x = ahead[5].x = polypoints[npoly-1].x;
+ ahead[0].y = ahead[5].y = polypoints[npoly-1].y;
+ dx = ahead[0].x - polypoints[npoly-2].x;
+ dy = ahead[0].y - polypoints[npoly-2].y;
+ if ((length = hypot(dx, dy)) == 0) {
+ sinTheta = cosTheta = 0.0;
+ } else {
+ sinTheta = dy / length;
+ cosTheta = dx / length;
+ }
+ vertX = ahead[0].x - arrowshape[0]*cosTheta;
+ vertY = ahead[0].y - arrowshape[0]*sinTheta;
+ temp = arrowshape[2]*sinTheta;
+ ahead[1].x = (long)(ahead[0].x - arrowshape[1]*cosTheta + temp);
+ ahead[4].x = (long)(ahead[1].x - 2 * temp);
+ temp = arrowshape[2]*cosTheta;
+ ahead[1].y = (long)(ahead[0].y - arrowshape[1]*sinTheta - temp);
+ ahead[4].y = (long)(ahead[1].y + 2 * temp);
+ ahead[2].x = (long)(ahead[1].x*fracHeight + vertX*(1.0-fracHeight));
+ ahead[2].y = (long)(ahead[1].y*fracHeight + vertY*(1.0-fracHeight));
+ ahead[3].x = (long)(ahead[4].x*fracHeight + vertX*(1.0-fracHeight));
+ ahead[3].y = (long)(ahead[4].y*fracHeight + vertY*(1.0-fracHeight));
+
+ Polygon(hDC, ahead, 6);
+ }
+
+ if (doarrow & 2) {
+ /* Arrowhead at end = polypoints[0].x, polypoints[0].y. */
+ POINT ahead[6];
+ double dx, dy, length;
+ double sinTheta, cosTheta;
+ double vertX, vertY, temp;
+ double fracHeight;
+
+ fracHeight = 2.0 / arrowshape[2];
+
+ ahead[0].x = ahead[5].x = polypoints[0].x;
+ ahead[0].y = ahead[5].y = polypoints[0].y;
+ dx = ahead[0].x - polypoints[1].x;
+ dy = ahead[0].y - polypoints[1].y;
+ if ((length = hypot(dx, dy)) == 0) {
+ sinTheta = cosTheta = 0.0;
+ } else {
+ sinTheta = dy / length;
+ cosTheta = dx / length;
+ }
+ vertX = ahead[0].x - arrowshape[0]*cosTheta;
+ vertY = ahead[0].y - arrowshape[0]*sinTheta;
+ temp = arrowshape[2]*sinTheta;
+ ahead[1].x = (long)(ahead[0].x - arrowshape[1]*cosTheta + temp);
+ ahead[4].x = (long)(ahead[1].x - 2 * temp);
+ temp = arrowshape[2]*cosTheta;
+ ahead[1].y = (long)(ahead[0].y - arrowshape[1]*sinTheta - temp);
+ ahead[4].y = (long)(ahead[1].y + 2 * temp);
+ ahead[2].x = (long)(ahead[1].x*fracHeight + vertX*(1.0-fracHeight));
+ ahead[2].y = (long)(ahead[1].y*fracHeight + vertY*(1.0-fracHeight));
+ ahead[3].x = (long)(ahead[4].x*fracHeight + vertX*(1.0-fracHeight));
+ ahead[3].y = (long)(ahead[4].y*fracHeight + vertY*(1.0-fracHeight));
+
+ Polygon(hDC, ahead, 6);
+ }
+
+ if (width || dolinecolor || dodash) {
+ GdiFreePen(interp, hDC, hPen);
+ }
+ if (hBrush) {
+ GdiFreeBrush(interp, hDC, hBrush);
+ }
+
+ ckfree(polypoints);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiOval --
+ *
+ * Maps ovals to GDI context.
+ *
+ * Results:
+ * Renders ovals.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiOval(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ Tcl_Obj *const *objv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi oval hdc x1 y1 x2 y2 -fill color -outline color "
+ "-stipple bitmap -width linewid";
+ int x1, y1, x2, y2;
+ HDC hDC;
+ HPEN hPen;
+ int width = 0;
+ COLORREF linecolor = 0, fillcolor = 0;
+ int dolinecolor = 0, dofillcolor = 0;
+ HBRUSH hBrush = NULL;
+ LOGBRUSH lbrush;
+ HGDIOBJ oldobj = NULL;
+
+ int dodash = 0;
+ const char *dashdata = 0;
+
+ /* Verrrrrry simple for now.... */
+ if (argc < 6) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ if ((Tcl_GetIntFromObj(interp, objv[2], &x1) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[2], &y1) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[3], &x2) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[4], &y2) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ if (x1 > x2) {
+ int x3 = x1;
+ x1 = x2;
+ x2 = x3;
+ }
+ if (y1 > y2) {
+ int y3 = y1;
+ y1 = y2;
+ y2 = y3;
+ }
+ argc -= 6;
+ objv += 6;
+
+ while (argc > 0) {
+ /* Now handle any other arguments that occur. */
+ if (strcmp(Tcl_GetString(objv[0]), "-fill") == 0) {
+ if (Tcl_GetString(objv[1]) && GdiGetColor(objv[1], &fillcolor)) {
+ dofillcolor = 1;
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-outline") == 0) {
+ if (Tcl_GetString(objv[1]) && GdiGetColor(objv[1], &linecolor)) {
+ dolinecolor = 1;
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-stipple") == 0) {
+ /* Not actually implemented */
+ } else if (strcmp(Tcl_GetString(objv[0]), "-width") == 0) {
+ if (Tcl_GetString(objv[1])) {
+ if (Tcl_GetIntFromObj(interp, objv[1], &width) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-dash") == 0) {
+ if (Tcl_GetString(objv[1])) {
+ dodash = 1;
+ dashdata = Tcl_GetString(objv[1]);
+ }
+ }
+ objv += 2;
+ argc -= 2;
+ }
+
+ if (dofillcolor) {
+ GdiMakeBrush(fillcolor, 0, &lbrush, hDC, &hBrush);
+ } else {
+ oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH));
+ }
+
+ if (width || dolinecolor) {
+ GdiMakePen(interp, width, dodash, dashdata,
+ 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+ /*
+ * Per Win32, Rectangle includes lower and right edges--per Tcl8.3.2 and
+ * earlier documentation, canvas rectangle does not. Thus, add 1 to right
+ * and lower bounds to get appropriate behavior.
+ */
+ Ellipse(hDC, x1, y1, x2+1, y2+1);
+
+ if (width || dolinecolor) {
+ GdiFreePen(interp, hDC, hPen);
+ }
+ if (hBrush) {
+ GdiFreeBrush(interp, hDC, hBrush);
+ } else {
+ SelectObject(hDC, oldobj);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiPolygon --
+ *
+ * Maps polygons to GDI context.
+ *
+ * Results:
+ * Renders polygons.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiPolygon(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ Tcl_Obj *const *objv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi polygon hdc x1 y1 ... xn yn "
+ "-fill color -outline color -smooth [true|false|bezier] "
+ "-splinesteps number -stipple bitmap -width linewid";
+
+ char *strend;
+ POINT *polypoints;
+ int npoly;
+ int dosmooth = 0;
+ int nStep = 12;
+ int x, y;
+ HDC hDC;
+ HPEN hPen;
+ int width = 0;
+ COLORREF linecolor = 0, fillcolor = BS_NULL;
+ int dolinecolor = 0, dofillcolor = 0;
+ LOGBRUSH lbrush;
+ HBRUSH hBrush = NULL;
+ HGDIOBJ oldobj = NULL;
+
+ int dodash = 0;
+ const char *dashdata = 0;
+
+ /* Verrrrrry simple for now.... */
+ if (argc < 6) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ polypoints = (POINT *)attemptckalloc((argc - 1) * sizeof(POINT));
+ if (polypoints == 0) {
+ /* TODO: unreachable */
+ Tcl_AppendResult(interp, "Out of memory in GdiLine", (char *)NULL);
+ return TCL_ERROR;
+ }
+ if ((Tcl_GetIntFromObj(interp, objv[2], (int *)&polypoints[0].x) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[3], (int *)&polypoints[0].y) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[4], (int *)&polypoints[1].x) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[5], (int *)&polypoints[1].y) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ argc -= 6;
+ objv += 6;
+ npoly = 2;
+
+ while (argc >= 2) {
+ /* Check for a number */
+ x = strtoul(Tcl_GetString(objv[0]), &strend, 0);
+ if (strend > Tcl_GetString(objv[0])) {
+ /* One number.... */
+ y = strtoul(Tcl_GetString(objv[1]), &strend, 0);
+ if (strend > Tcl_GetString(objv[1])) {
+ /* TWO numbers!. */
+ polypoints[npoly].x = x;
+ polypoints[npoly].y = y;
+ npoly++;
+ argc -= 2;
+ objv += 2;
+ } else {
+ /* Only one number... Assume a usage error. */
+ ckfree(polypoints);
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+ } else {
+ /*
+ * Check for arguments.
+ * Most of the arguments affect the "Pen" and "Brush".
+ */
+ if (strcmp(Tcl_GetString(objv[0]), "-fill") == 0) {
+ if (Tcl_GetString(objv[1]) && GdiGetColor(objv[1], &fillcolor)) {
+ dofillcolor = 1;
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-outline") == 0) {
+ if (GdiGetColor(objv[1], &linecolor)) {
+ dolinecolor = 0;
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-smooth") == 0) {
+ if (Tcl_GetString(objv[1])) {
+ switch (Tcl_GetString(objv[1])[0]) {
+ case 't': case 'T':
+ case '1':
+ case 'b': case 'B': /* bezier. */
+ dosmooth = 1;
+ break;
+ default:
+ dosmooth = 0;
+ break;
+ }
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-splinesteps") == 0) {
+ if (Tcl_GetString(objv[1])) {
+ if (Tcl_GetIntFromObj(interp, objv[1], &nStep) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-stipple") == 0) {
+ /* Not supported */
+ } else if (strcmp(Tcl_GetString(objv[0]), "-width") == 0) {
+ if (Tcl_GetString(objv[1])) {
+ if (Tcl_GetIntFromObj(interp, objv[1], &width) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-dash") == 0) {
+ if (Tcl_GetString(objv[1])) {
+ dodash = 1;
+ dashdata = Tcl_GetString(objv[1]);
+ }
+ }
+ argc -= 2;
+ objv += 2;
+ }
+ }
+
+ if (dofillcolor) {
+ GdiMakeBrush(fillcolor, 0, &lbrush, hDC, &hBrush);
+ } else {
+ oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH));
+ }
+
+ if (width || dolinecolor) {
+ GdiMakePen(interp, width, dodash, dashdata, 0, 0, 0, 0,
+ linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+
+ if (dosmooth) {
+ int nbpoints;
+ POINT *bpoints = 0;
+ nbpoints = Bezierize(polypoints,npoly,nStep,bpoints);
+ if (nbpoints > 0) {
+ Polygon(hDC, bpoints, nbpoints);
+ } else {
+ Polygon(hDC, polypoints, npoly);
+ }
+ if (bpoints != 0) {
+ ckfree(bpoints);
+ }
+ } else {
+ Polygon(hDC, polypoints, npoly);
+ }
+
+ if (width || dolinecolor) {
+ GdiFreePen(interp, hDC, hPen);
+ }
+ if (hBrush) {
+ GdiFreeBrush(interp, hDC, hBrush);
+ } else {
+ SelectObject(hDC, oldobj);
+ }
+
+ ckfree(polypoints);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiRectangle --
+ *
+ * Maps rectangles to GDI context.
+ *
+ * Results:
+ * Renders rectangles.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiRectangle(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ Tcl_Obj *const *objv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi rectangle hdc x1 y1 x2 y2 "
+ "-fill color -outline color "
+ "-stipple bitmap -width linewid";
+
+ int x1, y1, x2, y2;
+ HDC hDC;
+ HPEN hPen;
+ int width = 0;
+ COLORREF linecolor = 0, fillcolor = BS_NULL;
+ int dolinecolor = 0, dofillcolor = 0;
+ LOGBRUSH lbrush;
+ HBRUSH hBrush = NULL;
+ HGDIOBJ oldobj = NULL;
+
+ int dodash = 0;
+ const char *dashdata = 0;
+
+ /* Verrrrrry simple for now.... */
+ if (argc < 6) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ if ((Tcl_GetIntFromObj(interp, objv[2], &x1) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[3], &y1) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[4], &x2) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[5], &y2) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ if (x1 > x2) {
+ int x3 = x1;
+ x1 = x2;
+ x2 = x3;
+ }
+ if (y1 > y2) {
+ int y3 = y1;
+ y1 = y2;
+ y2 = y3;
+ }
+ argc -= 6;
+ objv += 6;
+
+ /* Now handle any other arguments that occur. */
+ while (argc > 1) {
+ if (strcmp(Tcl_GetString(objv[0]), "-fill") == 0) {
+ if (Tcl_GetString(objv[1]) && GdiGetColor(objv[1], &fillcolor)) {
+ dofillcolor = 1;
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-outline") == 0) {
+ if (Tcl_GetString(objv[1]) && GdiGetColor(objv[1], &linecolor)) {
+ dolinecolor = 1;
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-stipple") == 0) {
+ /* Not supported; ignored */
+ } else if (strcmp(Tcl_GetString(objv[0]), "-width") == 0) {
+ if (Tcl_GetString(objv[1])) {
+ if (Tcl_GetIntFromObj(interp, objv[1], &width) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-dash") == 0) {
+ if (Tcl_GetString(objv[1])) {
+ dodash = 1;
+ dashdata = Tcl_GetString(objv[1]);
+ }
+ }
+
+ argc -= 2;
+ objv += 2;
+ }
+
+ /*
+ * Note: If any fill is specified, the function must create a brush and
+ * put the coordinates in a RECTANGLE structure, and call FillRect.
+ * FillRect requires a BRUSH / color.
+ * If not, the function Rectangle must be called.
+ */
+ if (dofillcolor) {
+ GdiMakeBrush(fillcolor, 0, &lbrush, hDC, &hBrush);
+ } else {
+ oldobj = SelectObject(hDC, GetStockObject(HOLLOW_BRUSH));
+ }
+
+ if (width || dolinecolor) {
+ GdiMakePen(interp, width, dodash, dashdata,
+ 0, 0, 0, 0, linecolor, hDC, (HGDIOBJ *)&hPen);
+ }
+ /*
+ * Per Win32, Rectangle includes lower and right edges--per Tcl8.3.2 and
+ * earlier documentation, canvas rectangle does not. Thus, add 1 to
+ * right and lower bounds to get appropriate behavior.
+ */
+ Rectangle(hDC, x1, y1, x2+1, y2+1);
+
+ if (width || dolinecolor) {
+ GdiFreePen(interp, hDC, hPen);
+ }
+ if (hBrush) {
+ GdiFreeBrush(interp, hDC, hBrush);
+ } else {
+ SelectObject(hDC, oldobj);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiCharWidths --
+ *
+ * Computes /character widths. This is completely inadequate for
+ * typesetting, but should work for simple text manipulation.
+ *
+ * Results:
+ * Returns character width.
+ *
+ *----------------------------------------------------------------------
+ */
+
+
+static int GdiCharWidths(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ Tcl_Obj *const *objv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi characters hdc [-font fontname] [-array ary]";
+ /*
+ * Returns widths of characters from font in an associative array.
+ * Font is currently selected font for HDC if not specified.
+ * Array name is GdiCharWidths if not specified.
+ * Widths should be in the same measures as all other values (1/1000 inch).
+ */
+
+ HDC hDC;
+ LOGFONTW lf;
+ HFONT hfont, oldfont;
+ int made_font = 0;
+ const char *aryvarname = "GdiCharWidths";
+ /* For now, assume 256 characters in the font.... */
+ int widths[256];
+ int retval;
+
+ if (argc < 2) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ hDC = printDC;
+
+ argc -= 2;
+ objv += 2;
+
+ while (argc > 0) {
+ if (strcmp(Tcl_GetString(objv[0]), "-font") == 0) {
+ argc--;
+ objv++;
+ if (GdiMakeLogFont(interp, Tcl_GetString(objv[0]), &lf, hDC)) {
+ if ((hfont = CreateFontIndirectW(&lf)) != NULL) {
+ made_font = 1;
+ oldfont = SelectObject(hDC, hfont);
+ }
+ }
+ /* Else leave the font alone!. */
+ } else if (strcmp(Tcl_GetString(objv[0]), "-array") == 0) {
+ objv++;
+ argc--;
+ if (argc > 0) {
+ aryvarname = Tcl_GetString(objv[0]);
+ }
+ }
+ objv++;
+ argc--;
+ }
+
+ /* Now, get the widths using the correct function for font type. */
+ if ((retval = GetCharWidth32W(hDC, 0, 255, widths)) == FALSE) {
+ retval = GetCharWidthW(hDC, 0, 255, widths);
+ }
+
+ /*
+ * Retval should be 1 (TRUE) if the function succeeded. If the function
+ * fails, get the "extended" error code and return. Be sure to deallocate
+ * the font if necessary.
+ */
+ if (retval == FALSE) {
+ DWORD val = GetLastError();
+
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "::tk::print::_gdi character failed with code %ld", val));
+ if (made_font) {
+ SelectObject(hDC, oldfont);
+ DeleteObject(hfont);
+ }
+ return TCL_ERROR;
+ }
+
+ {
+ int i;
+ char ind[2];
+ ind[1] = '\0';
+
+ for (i = 0; i < 255; i++) {
+ /* TODO: use a bytearray for the index name so NUL works */
+ ind[0] = i;
+ Tcl_SetVar2Ex(interp, aryvarname, ind, Tcl_NewIntObj(widths[i]),
+ TCL_GLOBAL_ONLY);
+ }
+ }
+ /* Now, remove the font if we created it only for this function. */
+ if (made_font) {
+ SelectObject(hDC, oldfont);
+ DeleteObject(hfont);
+ }
+
+ /* The return value should be the array name(?). */
+ Tcl_AppendResult(interp, aryvarname, (char *)NULL);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiText --
+ *
+ * Maps text to GDI context.
+ *
+ * Results:
+ * Renders text.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int GdiText(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ Tcl_Obj *const *objv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi text hdc x y -anchor [center|n|e|s|w] "
+ "-fill color -font fontname "
+ "-justify [left|right|center] "
+ "-stipple bitmap -text string -width linelen "
+ "-single -backfill";
+
+ HDC hDC;
+ int x, y;
+ const char *string = 0;
+ RECT sizerect;
+ UINT format_flags = DT_EXPANDTABS|DT_NOPREFIX; /* Like the canvas. */
+ Tk_Anchor anchor = 0;
+ LOGFONTW lf;
+ HFONT hfont, oldfont;
+ int made_font = 0;
+ int retval;
+ int dotextcolor = 0;
+ int dobgmode = 0;
+ int bgmode;
+ COLORREF textcolor = 0;
+ int usesingle = 0;
+ WCHAR *wstring;
+ Tcl_DString tds;
+
+ if (argc < 4) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ /* Parse the command. */
+
+ hDC = printDC;
+
+ if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ argc -= 4;
+ objv += 4;
+
+ sizerect.left = sizerect.right = x;
+ sizerect.top = sizerect.bottom = y;
+
+ while (argc > 0) {
+ if (strcmp(Tcl_GetString(objv[0]), "-anchor") == 0) {
+ argc--;
+ objv++;
+ if (argc > 0) {
+ Tk_GetAnchor(interp, Tcl_GetString(objv[0]), &anchor);
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-justify") == 0) {
+ argc--;
+ objv++;
+ if (argc > 0) {
+ if (strcmp(Tcl_GetString(objv[0]), "left") == 0) {
+ format_flags |= DT_LEFT;
+ } else if (strcmp(Tcl_GetString(objv[0]), "center") == 0) {
+ format_flags |= DT_CENTER;
+ } else if (strcmp(Tcl_GetString(objv[0]), "right") == 0) {
+ format_flags |= DT_RIGHT;
+ }
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-text") == 0) {
+ argc--;
+ objv++;
+ if (argc > 0) {
+ string = Tcl_GetString(objv[0]);
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-font") == 0) {
+ argc--;
+ objv++;
+ if (GdiMakeLogFont(interp, Tcl_GetString(objv[0]), &lf, hDC)) {
+ if ((hfont = CreateFontIndirectW(&lf)) != NULL) {
+ made_font = 1;
+ oldfont = SelectObject(hDC, hfont);
+ }
+ }
+ /* Else leave the font alone! */
+ } else if (strcmp(Tcl_GetString(objv[0]), "-stipple") == 0) {
+ argc--;
+ objv++;
+ /* Not implemented yet. */
+ } else if (strcmp(Tcl_GetString(objv[0]), "-fill") == 0) {
+ argc--;
+ objv++;
+ /* Get text color. */
+ if (GdiGetColor(objv[0], &textcolor)) {
+ dotextcolor = 1;
+ }
+ } else if (strcmp(Tcl_GetString(objv[0]), "-width") == 0) {
+ argc--;
+ objv++;
+ if (argc > 0) {
+ int value;
+ if (Tcl_GetIntFromObj(interp, objv[0], &value) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ sizerect.right += value;
+ }
+ /* If a width is specified, break at words. */
+ format_flags |= DT_WORDBREAK;
+ } else if (strcmp(Tcl_GetString(objv[0]), "-single") == 0) {
+ usesingle = 1;
+ } else if (strcmp(Tcl_GetString(objv[0]), "-backfill") == 0) {
+ dobgmode = 1;
+ }
+
+ argc--;
+ objv++;
+ }
+
+ if (string == 0) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ /* Set the format flags for -single: Overrides -width. */
+ if (usesingle == 1) {
+ format_flags |= DT_SINGLELINE;
+ format_flags |= DT_NOCLIP;
+ format_flags &= ~DT_WORDBREAK;
+ }
+
+ Tcl_DStringInit(&tds);
+ /* Just for fun, let's try translating string to Unicode. */
+ wstring = Tcl_UtfToWCharDString(string, TCL_INDEX_NONE, &tds);
+ DrawTextW(hDC, wstring, Tcl_DStringLength(&tds)/2, &sizerect,
+ format_flags | DT_CALCRECT);
+
+ /* Adjust the rectangle according to the anchor. */
+ x = y = 0;
+ switch (anchor) {
+ case TK_ANCHOR_N:
+ x = (sizerect.right - sizerect.left) / 2;
+ break;
+ case TK_ANCHOR_S:
+ x = (sizerect.right - sizerect.left) / 2;
+ y = (sizerect.bottom - sizerect.top);
+ break;
+ case TK_ANCHOR_E:
+ x = (sizerect.right - sizerect.left);
+ y = (sizerect.bottom - sizerect.top) / 2;
+ break;
+ case TK_ANCHOR_W:
+ y = (sizerect.bottom - sizerect.top) / 2;
+ break;
+ case TK_ANCHOR_NE:
+ x = (sizerect.right - sizerect.left);
+ break;
+ case TK_ANCHOR_NW:
+ break;
+ case TK_ANCHOR_SE:
+ x = (sizerect.right - sizerect.left);
+ y = (sizerect.bottom - sizerect.top);
+ break;
+ case TK_ANCHOR_SW:
+ y = (sizerect.bottom - sizerect.top);
+ break;
+ default:
+ x = (sizerect.right - sizerect.left) / 2;
+ y = (sizerect.bottom - sizerect.top) / 2;
+ break;
+ }
+ sizerect.right -= x;
+ sizerect.left -= x;
+ sizerect.top -= y;
+ sizerect.bottom -= y;
+
+ /* Get the color right. */
+ if (dotextcolor) {
+ textcolor = SetTextColor(hDC, textcolor);
+ }
+
+ if (dobgmode) {
+ bgmode = SetBkMode(hDC, OPAQUE);
+ } else {
+ bgmode = SetBkMode(hDC, TRANSPARENT);
+ }
+
+ /* Print the text. */
+ retval = DrawTextW(hDC, wstring,
+ Tcl_DStringLength(&tds)/2, &sizerect, format_flags);
+ Tcl_DStringFree(&tds);
+
+ /* Get the color set back. */
+ if (dotextcolor) {
+ textcolor = SetTextColor(hDC, textcolor);
+ }
+ SetBkMode(hDC, bgmode);
+ if (made_font) {
+ SelectObject(hDC, oldfont);
+ DeleteObject(hfont);
+ }
+
+ /* In this case, the return value is the height of the text. */
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(retval));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiGetHdcInfo --
+ *
+ * Gets salient characteristics of the CTM.
+ *
+ * Results:
+ * The return value is 0 if any failure occurs--in which case none of the
+ * other values are meaningful. Otherwise the return value is the
+ * current mapping mode.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiGetHdcInfo(
+ HDC hdc,
+ LPPOINT worigin,
+ LPSIZE wextent,
+ LPPOINT vorigin,
+ LPSIZE vextent)
+{
+ int mapmode;
+ int retval;
+
+ memset(worigin, 0, sizeof(POINT));
+ memset(vorigin, 0, sizeof(POINT));
+ memset(wextent, 0, sizeof(SIZE));
+ memset(vextent, 0, sizeof(SIZE));
+
+ if ((mapmode = GetMapMode(hdc)) == 0) {
+ /* Failed! */
+ retval = 0;
+ } else {
+ retval = mapmode;
+ }
+
+ if (GetWindowExtEx(hdc, wextent) == FALSE) {
+ /* Failed! */
+ retval = 0;
+ }
+ if (GetViewportExtEx(hdc, vextent) == FALSE) {
+ /* Failed! */
+ retval = 0;
+ }
+ if (GetWindowOrgEx(hdc, worigin) == FALSE) {
+ /* Failed! */
+ retval = 0;
+ }
+ if (GetViewportOrgEx(hdc, vorigin) == FALSE) {
+ /* Failed! */
+ retval = 0;
+ }
+
+ return retval;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiNameToMode --
+ *
+ * Converts Windows mapping mode names.
+ *
+ * Results:
+ * Mapping modes are delineated.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiNameToMode(
+ const char *name)
+{
+ static const struct gdimodes {
+ int mode;
+ const char *name;
+ } modes[] = {
+ { MM_ANISOTROPIC, "MM_ANISOTROPIC" },
+ { MM_HIENGLISH, "MM_HIENGLISH" },
+ { MM_HIMETRIC, "MM_HIMETRIC" },
+ { MM_ISOTROPIC, "MM_ISOTROPIC" },
+ { MM_LOENGLISH, "MM_LOENGLISH" },
+ { MM_LOMETRIC, "MM_LOMETRIC" },
+ { MM_TEXT, "MM_TEXT" },
+ { MM_TWIPS, "MM_TWIPS" }
+ };
+
+ size_t i;
+ for (i=0; i < sizeof(modes) / sizeof(struct gdimodes); i++) {
+ if (strcmp(modes[i].name, name) == 0) {
+ return modes[i].mode;
+ }
+ }
+ return atoi(name);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiModeToName --
+ *
+ * Converts the mode number to a printable form.
+ *
+ * Results:
+ * Mapping numbers are delineated.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static const char *GdiModeToName(
+ int mode)
+{
+ static const struct gdi_modes {
+ int mode;
+ const char *name;
+ } modes[] = {
+ { MM_ANISOTROPIC, "Anisotropic" },
+ { MM_HIENGLISH, "1/1000 inch" },
+ { MM_HIMETRIC, "1/100 mm" },
+ { MM_ISOTROPIC, "Isotropic" },
+ { MM_LOENGLISH, "1/100 inch" },
+ { MM_LOMETRIC, "1/10 mm" },
+ { MM_TEXT, "1 to 1" },
+ { MM_TWIPS, "1/1440 inch" }
+ };
+
+ size_t i;
+ for (i=0; i < sizeof(modes) / sizeof(struct gdi_modes); i++) {
+ if (modes[i].mode == mode) {
+ return modes[i].name;
+ }
+ }
+ return "Unknown";
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiMap --
+ *
+ * Sets mapping mode between logical and physical device space.
+ *
+ * Results:
+ * Bridges map modes.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiMap(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ Tcl_Obj *const *objv)
+{
+ static const char usage_message[] =
+ "::tk::print::_gdi map hdc "
+ "[-logical x[y]] [-physical x[y]] "
+ "[-offset {x y} ] [-default] [-mode mode]";
+ HDC hdc;
+ int mapmode; /* Mapping mode. */
+ SIZE wextent; /* Device extent. */
+ SIZE vextent; /* Viewport extent. */
+ POINT worigin; /* Device origin. */
+ POINT vorigin; /* Viewport origin. */
+ int argno;
+
+ /* Keep track of what parts of the function need to be executed. */
+ int need_usage = 0;
+ int use_logical = 0;
+ int use_physical = 0;
+ int use_offset = 0;
+ int use_default = 0;
+ int use_mode = 0;
+
+ /* Required parameter: HDC for printer. */
+ if (argc < 2) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ hdc = printDC;
+
+ if ((mapmode = GdiGetHdcInfo(hdc, &worigin, &wextent, &vorigin, &vextent)) == 0) {
+ /* Failed!. */
+ Tcl_AppendResult(interp, "Cannot get current HDC info", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ /* Parse remaining arguments. */
+ for (argno = 2; argno < argc; argno++) {
+ if (strcmp(Tcl_GetString(objv[argno]), "-default") == 0) {
+ vextent.cx = vextent.cy = wextent.cx = wextent.cy = 1;
+ vorigin.x = vorigin.y = worigin.x = worigin.y = 0;
+ mapmode = MM_TEXT;
+ use_default = 1;
+ } else if (strcmp(Tcl_GetString(objv[argno]), "-mode") == 0) {
+ if (argno + 1 >= argc) {
+ need_usage = 1;
+ } else {
+ mapmode = GdiNameToMode(Tcl_GetString(objv[argno + 1]));
+ use_mode = 1;
+ argno++;
+ }
+ } else if (strcmp(Tcl_GetString(objv[argno]), "-offset") == 0) {
+ if (argno + 1 >= argc) {
+ need_usage = 1;
+ } else {
+ /* It would be nice if this parsed units as well.... */
+ if (sscanf(Tcl_GetString(objv[argno + 1]), "%ld%ld",
+ &vorigin.x, &vorigin.y) == 2) {
+ use_offset = 1;
+ } else {
+ need_usage = 1;
+ }
+ argno++;
+ }
+ } else if (strcmp(Tcl_GetString(objv[argno]), "-logical") == 0) {
+ if (argno + 1 >= argc) {
+ need_usage = 1;
+ } else {
+ int count;
+
+ argno++;
+ /* In "real-life", this should parse units as well.. */
+ if ((count = sscanf(Tcl_GetString(objv[argno]), "%ld%ld",
+ &wextent.cx, &wextent.cy)) != 2) {
+ if (count == 1) {
+ mapmode = MM_ISOTROPIC;
+ use_logical = 1;
+ wextent.cy = wextent.cx; /* Make them the same. */
+ } else {
+ need_usage = 1;
+ }
+ } else {
+ mapmode = MM_ANISOTROPIC;
+ use_logical = 2;
+ }
+ }
+ } else if (strcmp(Tcl_GetString(objv[argno]), "-physical") == 0) {
+ if (argno + 1 >= argc) {
+ need_usage = 1;
+ } else {
+ int count;
+
+ argno++;
+ /* In "real-life", this should parse units as well.. */
+ if ((count = sscanf(Tcl_GetString(objv[argno]), "%ld%ld",
+ &vextent.cx, &vextent.cy)) != 2) {
+ if (count == 1) {
+ mapmode = MM_ISOTROPIC;
+ use_physical = 1;
+ vextent.cy = vextent.cx; /* Make them the same. */
+ } else {
+ need_usage = 1;
+ }
+ } else {
+ mapmode = MM_ANISOTROPIC;
+ use_physical = 2;
+ }
+ }
+ }
+ }
+
+ /* Check for any impossible combinations. */
+ if (use_logical != use_physical) {
+ need_usage = 1;
+ }
+ if (use_default && (use_logical || use_offset || use_mode)) {
+ need_usage = 1;
+ }
+ if (use_mode && use_logical &&
+ (mapmode != MM_ISOTROPIC && mapmode != MM_ANISOTROPIC)) {
+ need_usage = 1;
+ }
+
+ if (need_usage) {
+ Tcl_AppendResult(interp, usage_message, NULL);
+ return TCL_ERROR;
+ }
+
+ /* Call Windows CTM functions. */
+ if (use_logical || use_default || use_mode) { /* Don't call for offset only. */
+ SetMapMode(hdc, mapmode);
+ }
+
+ if (use_offset || use_default) {
+ POINT oldorg;
+ SetViewportOrgEx(hdc, vorigin.x, vorigin.y, &oldorg);
+ SetWindowOrgEx(hdc, worigin.x, worigin.y, &oldorg);
+ }
+
+ if (use_logical) { /* Same as use_physical. */
+ SIZE oldsiz;
+ SetWindowExtEx(hdc, wextent.cx, wextent.cy, &oldsiz);
+ SetViewportExtEx(hdc, vextent.cx, vextent.cy, &oldsiz);
+ }
+
+ /*
+ * Since we may not have set up every parameter, get them again for the
+ * report.
+ */
+ mapmode = GdiGetHdcInfo(hdc, &worigin, &wextent, &vorigin, &vextent);
+
+ /*
+ * Output current CTM info.
+ * Note: This should really be in terms that can be used in a
+ * ::tk::print::_gdi map command!
+ */
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Transform: \"(%ld, %ld) -> (%ld, %ld)\" "
+ "Origin: \"(%ld, %ld)\" "
+ "MappingMode: \"%s\"",
+ vextent.cx, vextent.cy, wextent.cx, wextent.cy,
+ vorigin.x, vorigin.y,
+ GdiModeToName(mapmode)));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiCopyBits --
+ *
+ * Copies window bits from source to destination.
+ *
+ * Results:
+ * Copies window bits.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiCopyBits(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int argc,
+ Tcl_Obj *const *objv)
+{
+ /* Goal: get the Tk_Window from the top-level
+ * convert it to an HWND
+ * get the HDC
+ * Do a bitblt to the given hdc
+ * Use an optional parameter to point to an arbitrary window instead of
+ * the main
+ * Use optional parameters to map to the width and height required for the
+ * dest.
+ */
+ static const char usage_message[] =
+ "::tk::print::_gdi copybits hdc [-window w|-screen] [-client] "
+ "[-source \"a b c d\"] "
+ "[-destination \"a b c d\"] [-scale number] [-calc]";
+
+ Tk_Window mainWin;
+ Tk_Window workwin;
+ Window wnd;
+ HDC src;
+ HDC dst;
+ HWND hwnd = 0;
+
+ HANDLE hDib; /* Handle for device-independent bitmap. */
+ LPBITMAPINFOHEADER lpDIBHdr;
+ LPSTR lpBits;
+ enum PrintType wintype = PTWindow;
+
+ int hgt, wid;
+ char *strend;
+ long errcode;
+ int k;
+
+ /* Variables to remember what we saw in the arguments. */
+ int do_window = 0;
+ int do_screen = 0;
+ int do_scale = 0;
+ int do_print = 1;
+
+ /* Variables to remember the values in the arguments. */
+ const char *window_spec;
+ double scale = 1.0;
+ int src_x = 0, src_y = 0, src_w = 0, src_h = 0;
+ int dst_x = 0, dst_y = 0, dst_w = 0, dst_h = 0;
+ int is_toplevel = 0;
+
+ /*
+ * The following steps are peculiar to the top level window.
+ * There is likely a clever way to do the mapping of a widget pathname to
+ * the proper window, to support the idea of using a parameter for this
+ * purpose.
+ */
+ if ((workwin = mainWin = Tk_MainWindow(interp)) == 0) {
+ Tcl_AppendResult(interp, "Can't find main Tk window", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Parse the arguments.
+ */
+ /* HDC is required. */
+ if (argc < 2) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ dst = printDC;
+
+ /*
+ * Next, check to see if 'dst' can support BitBlt. If not, raise an
+ * error.
+ */
+ if ((GetDeviceCaps(dst, RASTERCAPS) & RC_BITBLT) == 0) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Can't do bitmap operations on device context\n"));
+ return TCL_ERROR;
+ }
+
+ /* Loop through the remaining arguments. */
+ for (k=2; k<argc; k++) {
+ if (strcmp(Tcl_GetString(objv[k]), "-window") == 0) {
+ if (Tcl_GetString(objv[k+1]) && Tcl_GetString(objv[k+1])[0] == '.') {
+ do_window = 1;
+ workwin = Tk_NameToWindow(interp, window_spec = Tcl_GetString(objv[++k]), mainWin);
+ if (workwin == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Can't find window %s in this application",
+ window_spec));
+ return TCL_ERROR;
+ }
+ } else {
+ /* Use strtoul() so octal or hex representations will be
+ * parsed. */
+ hwnd = (HWND) INT2PTR(strtoul(Tcl_GetString(objv[++k]), &strend, 0));
+ if (strend == 0 || strend == Tcl_GetString(objv[k])) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Can't understand window id %s", Tcl_GetString(objv[k])));
+ return TCL_ERROR;
+ }
+ }
+ } else if (strcmp(Tcl_GetString(objv[k]), "-screen") == 0) {
+ do_screen = 1;
+ wintype = PTScreen;
+ } else if (strcmp(Tcl_GetString(objv[k]), "-client") == 0) {
+ wintype = PTClient;
+ } else if (strcmp(Tcl_GetString(objv[k]), "-source") == 0) {
+ float a, b, c, d;
+ int count = sscanf(Tcl_GetString(objv[++k]), "%f%f%f%f", &a, &b, &c, &d);
+
+ if (count < 2) { /* Can't make heads or tails of it.... */
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+ src_x = (int)a;
+ src_y = (int)b;
+ if (count == 4) {
+ src_w = (int)c;
+ src_h = (int)d;
+ }
+ } else if (strcmp(Tcl_GetString(objv[k]), "-destination") == 0) {
+ float a, b, c, d;
+ int count;
+
+ count = sscanf(Tcl_GetString(objv[++k]), "%f%f%f%f", &a, &b, &c, &d);
+ if (count < 2) { /* Can't make heads or tails of it.... */
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+ dst_x = (int)a;
+ dst_y = (int)b;
+ if (count == 3) {
+ dst_w = (int)c;
+ dst_h = -1;
+ } else if (count == 4) {
+ dst_w = (int)c;
+ dst_h = (int)d;
+ }
+ } else if (strcmp(Tcl_GetString(objv[k]), "-scale") == 0) {
+ if (Tcl_GetString(objv[++k])) {
+ if (Tcl_GetDouble(interp, Tcl_GetString(objv[k]), &scale) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (scale <= 0.01 || scale >= 100.0) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "Unreasonable scale specification %s", Tcl_GetString(objv[k])));
+ return TCL_ERROR;
+ }
+ do_scale = 1;
+ }
+ } else if (strcmp(Tcl_GetString(objv[k]), "-noprint") == 0
+ || strncmp(Tcl_GetString(objv[k]), "-calc", 5) == 0) {
+ /* This option suggested by Pascal Bouvier to get sizes without
+ * printing. */
+ do_print = 0;
+ }
+ }
+
+ /*
+ * Check to ensure no incompatible arguments were used.
+ */
+ if (do_window && do_screen) {
+ Tcl_AppendResult(interp, usage_message, (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Get the MS Window we want to copy. Given the HDC, we can get the
+ * "Window".
+ */
+ if (hwnd == 0) {
+ if (Tk_IsTopLevel(workwin)) {
+ is_toplevel = 1;
+ }
+
+ if ((wnd = Tk_WindowId(workwin)) == 0) {
+ Tcl_AppendResult(interp, "Can't get id for Tk window", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ /* Given the "Window" we can get a Microsoft Windows HWND. */
+
+ if ((hwnd = Tk_GetHWND(wnd)) == 0) {
+ Tcl_AppendResult(interp, "Can't get Windows handle for Tk window",
+ (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * If it's a toplevel, give it special treatment: Get the top-level
+ * window instead. If the user only wanted the client, the -client
+ * flag will take care of it. This uses "windows" tricks rather than
+ * Tk since the obvious method of getting the wrapper window didn't
+ * seem to work.
+ */
+ if (is_toplevel) {
+ HWND tmpWnd = hwnd;
+ while ((tmpWnd = GetParent(tmpWnd)) != 0) {
+ hwnd = tmpWnd;
+ }
+ }
+ }
+
+ /* Given the HWND, we can get the window's device context. */
+ if ((src = GetWindowDC(hwnd)) == 0) {
+ Tcl_AppendResult(interp, "Can't get device context for Tk window", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ if (do_screen) {
+ LONG w, h;
+ GetDisplaySize(&w, &h);
+ wid = w;
+ hgt = h;
+ } else if (is_toplevel) {
+ RECT tl;
+ GetWindowRect(hwnd, &tl);
+ wid = tl.right - tl.left;
+ hgt = tl.bottom - tl.top;
+ } else {
+ if ((hgt = Tk_Height(workwin)) <= 0) {
+ Tcl_AppendResult(interp, "Can't get height of Tk window", (char *)NULL);
+ ReleaseDC(hwnd,src);
+ return TCL_ERROR;
+ }
+
+ if ((wid = Tk_Width(workwin)) <= 0) {
+ Tcl_AppendResult(interp, "Can't get width of Tk window", (char *)NULL);
+ ReleaseDC(hwnd,src);
+ return TCL_ERROR;
+ }
+ }
+
+ /*
+ * Ensure all the widths and heights are set up right
+ * A: No dimensions are negative
+ * B: No dimensions exceed the maximums
+ * C: The dimensions don't lead to a 0 width or height image.
+ */
+ if (src_x < 0) {
+ src_x = 0;
+ }
+ if (src_y < 0) {
+ src_y = 0;
+ }
+ if (dst_x < 0) {
+ dst_x = 0;
+ }
+ if (dst_y < 0) {
+ dst_y = 0;
+ }
+
+ if (src_w > wid || src_w <= 0) {
+ src_w = wid;
+ }
+
+ if (src_h > hgt || src_h <= 0) {
+ src_h = hgt;
+ }
+
+ if (do_scale && dst_w == 0) {
+ /* Calculate destination width and height based on scale. */
+ dst_w = (int)(scale * src_w);
+ dst_h = (int)(scale * src_h);
+ }
+
+ if (dst_h == -1) {
+ dst_h = (int) (((long)src_h * dst_w) / (src_w + 1)) + 1;
+ }
+
+ if (dst_h == 0 || dst_w == 0) {
+ dst_h = src_h;
+ dst_w = src_w;
+ }
+
+ if (do_print) {
+ /*
+ * Based on notes from Heiko Schock and Arndt Roger Schneider, create
+ * this as a DIBitmap, to allow output to a greater range of devices.
+ * This approach will also allow selection of
+ * a) Whole screen
+ * b) Whole window
+ * c) Client window only
+ * for the "grab"
+ */
+ hDib = CopyToDIB(hwnd, wintype);
+
+ /* GdiFlush();. */
+
+ if (!hDib) {
+ Tcl_AppendResult(interp, "Can't create DIB", (char *)NULL);
+ ReleaseDC(hwnd,src);
+ return TCL_ERROR;
+ }
+
+ lpDIBHdr = (LPBITMAPINFOHEADER) GlobalLock(hDib);
+ if (!lpDIBHdr) {
+ Tcl_AppendResult(interp, "Can't get DIB header", (char *)NULL);
+ ReleaseDC(hwnd,src);
+ return TCL_ERROR;
+ }
+
+ lpBits = (LPSTR) lpDIBHdr + lpDIBHdr->biSize + DIBNumColors(lpDIBHdr) * sizeof(RGBQUAD);
+
+ /* stretch the DIBbitmap directly in the target device. */
+
+ if (StretchDIBits(dst,
+ dst_x, dst_y, dst_w, dst_h,
+ src_x, src_y, src_w, src_h,
+ lpBits, (LPBITMAPINFO)lpDIBHdr, DIB_RGB_COLORS,
+ SRCCOPY) == (int)GDI_ERROR) {
+ errcode = GetLastError();
+ GlobalUnlock(hDib);
+ GlobalFree(hDib);
+ ReleaseDC(hwnd,src);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "StretchDIBits failed with code %ld", errcode));
+ return TCL_ERROR;
+ }
+
+ /* free allocated memory. */
+ GlobalUnlock(hDib);
+ GlobalFree(hDib);
+ }
+
+ ReleaseDC(hwnd,src);
+
+ /*
+ * The return value should relate to the size in the destination space.
+ * At least the height should be returned (for page layout purposes).
+ */
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "%d %d %d %d", dst_x, dst_y, dst_w, dst_h));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DIBNumColors --
+ *
+ * Computes the number of colors required for a DIB palette.
+ *
+ * Results:
+ * Returns number of colors.
+
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int DIBNumColors(
+ LPBITMAPINFOHEADER lpDIB)
+{
+ WORD wBitCount; /* DIB bit count. */
+ DWORD dwClrUsed;
+
+ /*
+ * If this is a Windows-style DIB, the number of colors in the color table
+ * can be less than the number of bits per pixel allows for (i.e.
+ * lpbi->biClrUsed can be set to some value). If this is the case, return
+ * the appropriate value..
+ */
+
+ dwClrUsed = lpDIB->biClrUsed;
+ if (dwClrUsed) {
+ return (WORD) dwClrUsed;
+ }
+
+ /*
+ * Calculate the number of colors in the color table based on.
+ * The number of bits per pixel for the DIB.
+ */
+
+ wBitCount = lpDIB->biBitCount;
+
+ /* Return number of colors based on bits per pixel. */
+
+ switch (wBitCount) {
+ case 1:
+ return 2;
+ case 4:
+ return 16;
+ case 8:
+ return 256;
+ default:
+ return 0;
+ }
+}
+
+/*
+ * Helper functions
+ */
+
+/*
+ * ParseFontWords converts various keywords to modifyers of a
+ * font specification.
+ * For all words, later occurrences override earlier occurrences.
+ * Overstrike and underline cannot be "undone" by other words
+ */
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiParseFontWords --
+ *
+ * Converts various keywords to modifiers of a font specification. For
+ * all words, later occurrences override earlier occurrences. Overstrike
+ * and underline cannot be "undone" by other words
+ *
+ * Results:
+ * Keywords converted to modifiers.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiParseFontWords(
+ TCL_UNUSED(Tcl_Interp *),
+ LOGFONTW *lf,
+ const char *str[],
+ int numargs)
+{
+ int i;
+ int retval = 0; /* Number of words that could not be parsed. */
+
+ for (i=0; i<numargs; i++) {
+ if (str[i]) {
+ int wt;
+ if ((wt = GdiWordToWeight(str[i])) != -1) {
+ lf->lfWeight = wt;
+ } else if (strcmp(str[i], "roman") == 0) {
+ lf->lfItalic = FALSE;
+ } else if (strcmp(str[i], "italic") == 0) {
+ lf->lfItalic = TRUE;
+ } else if (strcmp(str[i], "underline") == 0) {
+ lf->lfUnderline = TRUE;
+ } else if (strcmp(str[i], "overstrike") == 0) {
+ lf->lfStrikeOut = TRUE;
+ } else {
+ retval++;
+ }
+ }
+ }
+ return retval;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiWordToWeight --
+ *
+ * Converts keywords to font weights.
+ *
+ * Results:
+ * Helps set the proper font for GDI rendering.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiWordToWeight(
+ const char *str)
+{
+ int retval = -1;
+ size_t i;
+ static const struct font_weight {
+ const char *name;
+ int weight;
+ } font_weights[] = {
+ { "thin", FW_THIN },
+ { "extralight", FW_EXTRALIGHT },
+ { "ultralight", FW_EXTRALIGHT },
+ { "light", FW_LIGHT },
+ { "normal", FW_NORMAL },
+ { "regular", FW_NORMAL },
+ { "medium", FW_MEDIUM },
+ { "semibold", FW_SEMIBOLD },
+ { "demibold", FW_SEMIBOLD },
+ { "bold", FW_BOLD },
+ { "extrabold", FW_EXTRABOLD },
+ { "ultrabold", FW_EXTRABOLD },
+ { "heavy", FW_HEAVY },
+ { "black", FW_HEAVY },
+ };
+
+ if (str == 0) {
+ return -1;
+ }
+
+ for (i=0; i<sizeof(font_weights) / sizeof(struct font_weight); i++) {
+ if (strcmp(str, font_weights[i].name) == 0) {
+ retval = font_weights[i].weight;
+ break;
+ }
+ }
+
+ return retval;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MakeLogFont --
+ *
+ * Takes the font description string and converts this into a logical
+ * font spec.
+ *
+ * Results:
+ * Sets font weight.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiMakeLogFont(
+ Tcl_Interp *interp,
+ const char *str,
+ LOGFONTW *lf,
+ HDC hDC)
+{
+ const char **list;
+ Tcl_Size count;
+
+ /* Set up defaults for logical font. */
+ memset(lf, 0, sizeof(*lf));
+ lf->lfWeight = FW_NORMAL;
+ lf->lfCharSet = DEFAULT_CHARSET;
+ lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
+ lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ lf->lfQuality = DEFAULT_QUALITY;
+ lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
+
+ /* The cast to (char *) is silly, based on prototype of Tcl_SplitList. */
+ if (Tcl_SplitList(interp, str, &count, &list) != TCL_OK) {
+ return 0;
+ }
+
+ /* Now we have the font structure broken into name, size, weight. */
+ if (count >= 1) {
+ Tcl_DString ds;
+
+ Tcl_DStringInit(&ds);
+ wcsncpy(lf->lfFaceName, Tcl_UtfToWCharDString(list[0], TCL_INDEX_NONE, &ds),
+ LF_FACESIZE-1);
+ Tcl_DStringFree(&ds);
+ lf->lfFaceName[LF_FACESIZE-1] = 0;
+ } else {
+ return 0;
+ }
+
+ if (count >= 2) {
+ int siz;
+ char *strend;
+ siz = strtol(list[1], &strend, 0);
+
+ /*
+ * Assumptions:
+ * 1) Like canvas, if a positive number is specified, it's in points.
+ * 2) Like canvas, if a negative number is specified, it's in pixels.
+ */
+ if (strend > list[1]) { /* If it looks like a number, it is a number.... */
+ if (siz > 0) { /* Size is in points. */
+ SIZE wextent, vextent;
+ POINT worigin, vorigin;
+ double factor;
+
+ switch (GdiGetHdcInfo(hDC, &worigin, &wextent, &vorigin, &vextent)) {
+ case MM_ISOTROPIC:
+ if (vextent.cy < -1 || vextent.cy > 1) {
+ factor = (double)wextent.cy / vextent.cy;
+ if (factor < 0.0) {
+ factor = -factor;
+ }
+ lf->lfHeight = (int)(-siz * GetDeviceCaps(hDC, LOGPIXELSY) * factor / 72.0);
+ } else if (vextent.cx < -1 || vextent.cx > 1) {
+ factor = (double)wextent.cx / vextent.cx;
+ if (factor < 0.0) {
+ factor = -factor;
+ }
+ lf->lfHeight = (int)(-siz * GetDeviceCaps(hDC, LOGPIXELSY) * factor / 72.0);
+ } else {
+ lf->lfHeight = -siz; /* This is bad news.... */
+ }
+ break;
+ case MM_ANISOTROPIC:
+ if (vextent.cy != 0) {
+ factor = (double)wextent.cy / vextent.cy;
+ if (factor < 0.0) {
+ factor = -factor;
+ }
+ lf->lfHeight = (int)(-siz * GetDeviceCaps(hDC, LOGPIXELSY) * factor / 72.0);
+ } else {
+ lf->lfHeight = -siz; /* This is bad news.... */
+ }
+ break;
+ case MM_TEXT:
+ default:
+ /* If mapping mode is MM_TEXT, use the documented
+ * formula. */
+ lf->lfHeight = -MulDiv(siz, GetDeviceCaps(hDC, LOGPIXELSY), 72);
+ break;
+ case MM_HIENGLISH:
+ lf->lfHeight = -MulDiv(siz, 1000, 72);
+ break;
+ case MM_LOENGLISH:
+ lf->lfHeight = -MulDiv(siz, 100, 72);
+ break;
+ case MM_HIMETRIC:
+ lf->lfHeight = -MulDiv(siz, (int)(1000*2.54), 72);
+ break;
+ case MM_LOMETRIC:
+ lf->lfHeight = -MulDiv(siz, (int)(100*2.54), 72);
+ break;
+ case MM_TWIPS:
+ lf->lfHeight = -MulDiv(siz, 1440, 72);
+ break;
+ }
+ } else if (siz == 0) { /* Use default size of 12 points. */
+ lf->lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);
+ } else { /* Use pixel size. */
+ lf->lfHeight = siz; /* Leave this negative. */
+ }
+ } else {
+ GdiParseFontWords(interp, lf, list+1, count-1);
+ }
+ }
+
+ if (count >= 3) {
+ GdiParseFontWords(interp, lf, list+2, count-2);
+ }
+
+ ckfree(list);
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiMakePen --
+ *
+ * Creates a logical pen based on input parameters and selects it into
+ * the hDC.
+ *
+ * Results:
+ * Sets rendering pen.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiMakePen(
+ Tcl_Interp *interp,
+ int width,
+ int dashstyle,
+ const char *dashstyledata,
+ TCL_UNUSED(int), /* Ignored for now. */
+ TCL_UNUSED(int), /* Ignored for now. */
+ TCL_UNUSED(int),
+ TCL_UNUSED(const char *), /* Ignored for now. */
+ unsigned long color,
+ HDC hDC,
+ HGDIOBJ *oldPen)
+{
+ /*
+ * The LOGPEN structure takes the following dash options:
+ * PS_SOLID: a solid pen
+ * PS_DASH: a dashed pen
+ * PS_DOT: a dotted pen
+ * PS_DASHDOT: a pen with a dash followed by a dot
+ * PS_DASHDOTDOT: a pen with a dash followed by 2 dots
+ *
+ * It seems that converting to ExtCreatePen may be more advantageous, as
+ * it matches the Tk canvas pens much better--but not for Win95, which
+ * does not support PS_USERSTYLE. An explicit test (or storage in a static
+ * after first failure) may suffice for working around this. The
+ * ExtCreatePen is not supported at all under Win32.
+ */
+
+ HPEN hPen;
+ LOGBRUSH lBrush;
+ DWORD pStyle = PS_SOLID; /* -dash should override*/
+ DWORD endStyle = PS_ENDCAP_ROUND; /* -capstyle should override. */
+ DWORD joinStyle = PS_JOIN_ROUND; /* -joinstyle should override. */
+ DWORD styleCount = 0;
+ DWORD *styleArray = 0;
+
+ /*
+ * To limit the propagation of allocated memory, the dashes will have a
+ * maximum here. If one wishes to remove the static allocation, please be
+ * sure to update GdiFreePen and ensure that the array is NOT freed if the
+ * LOGPEN option is used.
+ */
+ static DWORD pStyleData[24];
+ if (dashstyle != 0 && dashstyledata != 0) {
+ const char *cp;
+ size_t i;
+ char *dup = (char *) ckalloc(strlen(dashstyledata) + 1);
+ strcpy(dup, dashstyledata);
+ /* DEBUG. */
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "DEBUG: Found a dash spec of |%s|\n",
+ dashstyledata));
+
+ /* Parse the dash spec. */
+ if (isdigit(dashstyledata[0])) {
+ cp = strtok(dup, " \t,;");
+ for (i = 0; cp && i < sizeof(pStyleData) / sizeof(DWORD); i++) {
+ pStyleData[styleCount++] = atoi(cp);
+ cp = strtok(NULL, " \t,;");
+ }
+ } else {
+ for (i=0; dashstyledata[i] != '\0' && i< sizeof(pStyleData) / sizeof(DWORD); i++) {
+ switch (dashstyledata[i]) {
+ case ' ':
+ pStyleData[styleCount++] = 8;
+ break;
+ case ',':
+ pStyleData[styleCount++] = 4;
+ break;
+ case '_':
+ pStyleData[styleCount++] = 6;
+ break;
+ case '-':
+ pStyleData[styleCount++] = 4;
+ break;
+ case '.':
+ pStyleData[styleCount++] = 2;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ if (styleCount > 0) {
+ styleArray = pStyleData;
+ } else {
+ dashstyle = 0;
+ }
+ if (dup) {
+ ckfree(dup);
+ }
+ }
+
+ if (dashstyle != 0) {
+ pStyle = PS_USERSTYLE;
+ }
+
+ /* -stipple could affect this.... */
+ lBrush.lbStyle = BS_SOLID;
+ lBrush.lbColor = color;
+ lBrush.lbHatch = 0;
+
+ /* We only use geometric pens, even for 1-pixel drawing. */
+ hPen = ExtCreatePen(PS_GEOMETRIC|pStyle|endStyle|joinStyle,
+ width, &lBrush, styleCount, styleArray);
+
+ if (hPen == 0) { /* Failed for some reason...Fall back on CreatePenIndirect. */
+ LOGPEN lf;
+ lf.lopnWidth.x = width;
+ lf.lopnWidth.y = 0; /* Unused in LOGPEN. */
+ if (dashstyle == 0) {
+ lf.lopnStyle = PS_SOLID; /* For now...convert 'style' in the future. */
+ } else {
+ lf.lopnStyle = PS_DASH; /* REALLLLY simple for now. */
+ }
+ lf.lopnColor = color; /* Assume we're getting a COLORREF. */
+ /* Now we have a logical pen. Create the "real" pen and put it in the
+ * hDC. */
+ hPen = CreatePenIndirect(&lf);
+ }
+
+ *oldPen = SelectObject(hDC, hPen);
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiFreePen --
+ *
+ * Wraps the protocol to delete a created pen.
+ *
+ * Results:
+ * Deletes pen.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiFreePen(
+ TCL_UNUSED(Tcl_Interp *),
+ HDC hDC,
+ HGDIOBJ oldPen)
+{
+ HGDIOBJ gonePen = SelectObject(hDC, oldPen);
+
+ DeleteObject(gonePen);
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiMakeBrush--
+ *
+ * Creates a logical brush based on input parameters, and selects it into
+ * the hdc.
+ *
+ * Results:
+ * Creates brush.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiMakeBrush(
+ unsigned long color,
+ long hatch,
+ LOGBRUSH *lb,
+ HDC hDC,
+ HBRUSH *oldBrush)
+{
+ HBRUSH hBrush;
+ lb->lbStyle = BS_SOLID; /* Support other styles later. */
+ lb->lbColor = color; /* Assume this is a COLORREF. */
+ lb->lbHatch = hatch; /* Ignored for now, given BS_SOLID in the Style. */
+
+ /* Now we have the logical brush. Create the "real" brush and put it in
+ * the hDC. */
+ hBrush = CreateBrushIndirect(lb);
+ *oldBrush = (HBRUSH)SelectObject(hDC, hBrush);
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiFreeBrush --
+ *
+ * Wraps the protocol to delete a created brush.
+ *
+ * Results:
+ * Deletes brush.
+ *
+ *----------------------------------------------------------------------
+ */
+static void GdiFreeBrush(
+ TCL_UNUSED(Tcl_Interp *),
+ HDC hDC,
+ HGDIOBJ oldBrush)
+{
+ HGDIOBJ goneBrush;
+
+ goneBrush = SelectObject(hDC, oldBrush);
+ DeleteObject(goneBrush);
+}
+
+/*
+ * Utility functions from elsewhere in Tcl.
+ * Functions have removed reliance on X and Tk libraries, as well as removing
+ * the need for TkWindows.
+ * GdiGetColor is a copy of a TkpGetColor from tkWinColor.c
+ */
+typedef struct {
+ const char *name;
+ int index;
+} SystemColorEntry;
+
+static const SystemColorEntry sysColors[] = {
+ {"3dDarkShadow", COLOR_3DDKSHADOW},
+ {"3dLight", COLOR_3DLIGHT},
+ {"ActiveBorder", COLOR_ACTIVEBORDER},
+ {"ActiveCaption", COLOR_ACTIVECAPTION},
+ {"AppWorkspace", COLOR_APPWORKSPACE},
+ {"Background", COLOR_BACKGROUND},
+ {"ButtonFace", COLOR_BTNFACE},
+ {"ButtonHighlight", COLOR_BTNHIGHLIGHT},
+ {"ButtonShadow", COLOR_BTNSHADOW},
+ {"ButtonText", COLOR_BTNTEXT},
+ {"CaptionText", COLOR_CAPTIONTEXT},
+ {"DisabledText", COLOR_GRAYTEXT},
+ {"GrayText", COLOR_GRAYTEXT},
+ {"Highlight", COLOR_HIGHLIGHT},
+ {"HighlightText", COLOR_HIGHLIGHTTEXT},
+ {"InactiveBorder", COLOR_INACTIVEBORDER},
+ {"InactiveCaption", COLOR_INACTIVECAPTION},
+ {"InactiveCaptionText", COLOR_INACTIVECAPTIONTEXT},
+ {"InfoBackground", COLOR_INFOBK},
+ {"InfoText", COLOR_INFOTEXT},
+ {"Menu", COLOR_MENU},
+ {"MenuText", COLOR_MENUTEXT},
+ {"Scrollbar", COLOR_SCROLLBAR},
+ {"Window", COLOR_WINDOW},
+ {"WindowFrame", COLOR_WINDOWFRAME},
+ {"WindowText", COLOR_WINDOWTEXT}
+};
+
+static const size_t numsyscolors = sizeof(sysColors) / sizeof(SystemColorEntry);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GdiGetColor --
+ *
+ * Convert color name to color specification.
+ *
+ * Results:
+ * Color name converted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int GdiGetColor(
+ Tcl_Obj *nameObj,
+ COLORREF *color)
+{
+ const char *name = Tcl_GetString(nameObj);
+
+ if (_strnicmp(name, "system", 6) == 0) {
+ size_t i, l, u;
+ int r;
+
+ l = 0;
+ u = numsyscolors;
+ while (l <= u) {
+ i = (l + u) / 2;
+ if ((r = _strcmpi(name+6, sysColors[i].name)) == 0) {
+ break;
+ }
+ if (r < 0) {
+ u = i - 1;
+ } else {
+ l = i + 1;
+ }
+ }
+ if (l > u) {
+ return 0;
+ }
+ *color = GetSysColor(sysColors[i].index);
+ return 1;
+ } else {
+ int result;
+ XColor xcolor;
+ result = XParseColor(NULL, 0, name, &xcolor);
+ *color = ((xcolor.red & 0xFF00)>>8) | (xcolor.green & 0xFF00)
+ | ((xcolor.blue & 0xFF00)<<8);
+ return result;
+ }
+}
+
+/*
+ * Beginning of functions for screen-to-dib translations.
+ *
+ * Several of these functions are based on those in the WINCAP32 program
+ * provided as a sample by Microsoft on the VC++ 5.0 disk. The copyright on
+ * these functions is retained, even for those with significant changes.
+ */
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CopyToDIB --
+ *
+ * Copy window bits to a DIB.
+ *
+ * Results:
+ * Color specification converted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HANDLE CopyToDIB(
+ HWND hWnd,
+ enum PrintType type)
+{
+ HANDLE hDIB;
+ HBITMAP hBitmap;
+ HPALETTE hPalette;
+
+ /* Check for a valid window handle. */
+
+ if (!hWnd) {
+ return NULL;
+ }
+
+ switch (type) {
+ case PTWindow: { /* Copy entire window. */
+ RECT rectWnd;
+
+ /* Get the window rectangle. */
+
+ GetWindowRect(hWnd, &rectWnd);
+
+ /*
+ * Get the DIB of the window by calling CopyScreenToDIB and passing it
+ * the window rect.
+ */
+
+ hDIB = CopyScreenToDIB(&rectWnd);
+ break;
+ }
+
+ case PTClient: { /* Copy client area. */
+ RECT rectClient;
+ POINT pt1, pt2;
+
+ /* Get the client area dimensions. */
+
+ GetClientRect(hWnd, &rectClient);
+
+ /* Convert client coords to screen coords. */
+
+ pt1.x = rectClient.left;
+ pt1.y = rectClient.top;
+ pt2.x = rectClient.right;
+ pt2.y = rectClient.bottom;
+ ClientToScreen(hWnd, &pt1);
+ ClientToScreen(hWnd, &pt2);
+ rectClient.left = pt1.x;
+ rectClient.top = pt1.y;
+ rectClient.right = pt2.x;
+ rectClient.bottom = pt2.y;
+
+ /*
+ * Get the DIB of the client area by calling CopyScreenToDIB and
+ * passing it the client rect.
+ */
+
+ hDIB = CopyScreenToDIB(&rectClient);
+ break;
+ }
+
+ case PTScreen: { /* Entire screen. */
+ RECT Rect;
+
+ /*
+ * Get the device-dependent bitmap in lpRect by calling
+ * CopyScreenToBitmap and passing it the rectangle to grab.
+ */
+ Rect.top = Rect.left = 0;
+ GetDisplaySize(&Rect.right, &Rect.bottom);
+
+ hBitmap = CopyScreenToBitmap(&Rect);
+
+ /* Check for a valid bitmap handle. */
+
+ if (!hBitmap) {
+ return NULL;
+ }
+
+ /* Get the current palette. */
+
+ hPalette = GetSystemPalette();
+
+ /* Convert the bitmap to a DIB. */
+
+ hDIB = BitmapToDIB(hBitmap, hPalette);
+
+ /* Clean up. */
+
+ DeleteObject(hPalette);
+ DeleteObject(hBitmap);
+
+ /* Return handle to the packed-DIB. */
+ break;
+ }
+ default: /* Invalid print area. */
+ return NULL;
+ }
+
+ /* Return the handle to the DIB. */
+ return hDIB;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetDisplaySize--
+ *
+ * GetDisplaySize does just that. There may be an easier way, but it is
+ * not apparent.
+ *
+ * Results:
+ * Returns display size.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void GetDisplaySize(
+ LONG *width,
+ LONG *height)
+{
+ HDC hDC;
+
+ hDC = CreateDCW(L"DISPLAY", 0, 0, 0);
+ *width = GetDeviceCaps(hDC, HORZRES);
+ *height = GetDeviceCaps(hDC, VERTRES);
+ DeleteDC(hDC);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CopyScreenToBitmap--
+ *
+ * Copies screen to bitmap.
+ *
+ * Results:
+ * Screen is copied.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HBITMAP CopyScreenToBitmap(
+ LPRECT lpRect)
+{
+ HDC hScrDC, hMemDC; /* Screen DC and memory DC. */
+ HBITMAP hBitmap, hOldBitmap; /* Handles to deice-dependent bitmaps. */
+ int nX, nY, nX2, nY2; /* Coordinates of rectangle to grab. */
+ int nWidth, nHeight; /* DIB width and height */
+ int xScrn, yScrn; /* Screen resolution. */
+
+ /* Check for an empty rectangle. */
+
+ if (IsRectEmpty(lpRect)) {
+ return NULL;
+ }
+
+ /*
+ * Create a DC for the screen and create a memory DC compatible to screen
+ * DC.
+ */
+
+ hScrDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
+ hMemDC = CreateCompatibleDC(hScrDC);
+
+ /* Get points of rectangle to grab. */
+
+ nX = lpRect->left;
+ nY = lpRect->top;
+ nX2 = lpRect->right;
+ nY2 = lpRect->bottom;
+
+ /* Get screen resolution. */
+
+ xScrn = GetDeviceCaps(hScrDC, HORZRES);
+ yScrn = GetDeviceCaps(hScrDC, VERTRES);
+
+ /* Make sure bitmap rectangle is visible. */
+
+ if (nX < 0) {
+ nX = 0;
+ }
+ if (nY < 0) {
+ nY = 0;
+ }
+ if (nX2 > xScrn) {
+ nX2 = xScrn;
+ }
+ if (nY2 > yScrn) {
+ nY2 = yScrn;
+ }
+
+ nWidth = nX2 - nX;
+ nHeight = nY2 - nY;
+
+ /* Create a bitmap compatible with the screen DC. */
+ hBitmap = CreateCompatibleBitmap(hScrDC, nWidth, nHeight);
+
+ /* Select new bitmap into memory DC. */
+ hOldBitmap = SelectObject(hMemDC, hBitmap);
+
+ /* Bitblt screen DC to memory DC. */
+ BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY);
+
+ /*
+ * Select old bitmap back into memory DC and get handle to bitmap of the
+ * screen.
+ */
+
+ hBitmap = SelectObject(hMemDC, hOldBitmap);
+
+ /* Clean up. */
+
+ DeleteDC(hScrDC);
+ DeleteDC(hMemDC);
+
+ /* Return handle to the bitmap. */
+
+ return hBitmap;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * BitmapToDIB--
+ *
+ * Converts bitmap to DIB.
+ *
+ * Results:
+ * Bitmap converted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HANDLE BitmapToDIB(
+ HBITMAP hBitmap,
+ HPALETTE hPal)
+{
+ BITMAP bm;
+ BITMAPINFOHEADER bi;
+ LPBITMAPINFOHEADER lpbi;
+ DWORD dwLen;
+ HANDLE hDIB;
+ HANDLE h;
+ HDC hDC;
+ WORD biBits;
+
+ /* Check if bitmap handle is valid. */
+
+ if (!hBitmap) {
+ return NULL;
+ }
+
+ /* Fill in BITMAP structure, return NULL if it didn't work. */
+
+ if (!GetObjectW(hBitmap, sizeof(bm), (LPWSTR)&bm)) {
+ return NULL;
+ }
+
+ /* Ff no palette is specified, use default palette. */
+
+ if (hPal == NULL) {
+ hPal = GetStockObject(DEFAULT_PALETTE);
+ }
+
+ /* Calculate bits per pixel. */
+
+ biBits = bm.bmPlanes * bm.bmBitsPixel;
+
+ /* Make sure bits per pixel is valid. */
+
+ if (biBits <= 1) {
+ biBits = 1;
+ } else if (biBits <= 4) {
+ biBits = 4;
+ } else if (biBits <= 8) {
+ biBits = 8;
+ } else { /* If greater than 8-bit, force to 24-bit. */
+ biBits = 24;
+ }
+
+ /* Initialize BITMAPINFOHEADER. */
+
+ bi.biSize = sizeof(BITMAPINFOHEADER);
+ bi.biWidth = bm.bmWidth;
+ bi.biHeight = bm.bmHeight;
+ bi.biPlanes = 1;
+ bi.biBitCount = biBits;
+ bi.biCompression = BI_RGB;
+ bi.biSizeImage = 0;
+ bi.biXPelsPerMeter = 0;
+ bi.biYPelsPerMeter = 0;
+ bi.biClrUsed = 0;
+ bi.biClrImportant = 0;
+
+ /* Calculate size of memory block required to store BITMAPINFO. */
+
+ dwLen = bi.biSize + DIBNumColors(&bi) * sizeof(RGBQUAD);
+
+ /* Get a DC. */
+
+ hDC = GetDC(NULL);
+
+ /* Select and realize our palette. */
+
+ hPal = SelectPalette(hDC, hPal, FALSE);
+ RealizePalette(hDC);
+
+ /* Alloc memory block to store our bitmap. */
+
+ hDIB = GlobalAlloc(GHND, dwLen);
+
+ /* If we couldn't get memory block. */
+
+ if (!hDIB) {
+ /* clean up and return NULL. */
+
+ SelectPalette(hDC, hPal, TRUE);
+ RealizePalette(hDC);
+ ReleaseDC(NULL, hDC);
+ return NULL;
+ }
+
+ /* Lock memory and get pointer to it. */
+
+ lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
+
+ /* Use our bitmap info. to fill BITMAPINFOHEADER. */
+
+ *lpbi = bi;
+
+ /* Call GetDIBits with a NULL lpBits param, so it will calculate the
+ * biSizeImage field for us
+ */
+
+ GetDIBits(hDC, hBitmap, 0, (UINT)bi.biHeight, NULL, (LPBITMAPINFO)lpbi,
+ DIB_RGB_COLORS);
+
+ /* get the info. returned by GetDIBits and unlock memory block. */
+
+ bi = *lpbi;
+ GlobalUnlock(hDIB);
+
+ /* If the driver did not fill in the biSizeImage field, make one up. */
+ if (bi.biSizeImage == 0) {
+ bi.biSizeImage = (((((DWORD)bm.bmWidth * biBits) + 31) / 32) * 4)
+ * bm.bmHeight;
+ }
+
+ /* Realloc the buffer big enough to hold all the bits. */
+
+ dwLen = bi.biSize + DIBNumColors(&bi) * sizeof(RGBQUAD) + bi.biSizeImage;
+
+ if ((h = GlobalReAlloc(hDIB, dwLen, 0)) != 0) {
+ hDIB = h;
+ } else {
+ /* Clean up and return NULL. */
+
+ GlobalFree(hDIB);
+ SelectPalette(hDC, hPal, TRUE);
+ RealizePalette(hDC);
+ ReleaseDC(NULL, hDC);
+ return NULL;
+ }
+
+ /* Lock memory block and get pointer to it. */
+
+ lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
+
+ /* Call GetDIBits with a NON-NULL lpBits param, and actualy get the
+ * bits this time.
+ */
+
+ if (GetDIBits(hDC, hBitmap, 0, (UINT)bi.biHeight, (LPSTR)lpbi +
+ (WORD)lpbi->biSize + DIBNumColors(lpbi) * sizeof(RGBQUAD),
+ (LPBITMAPINFO)lpbi, DIB_RGB_COLORS) == 0) {
+ /* Clean up and return NULL. */
+
+ GlobalUnlock(hDIB);
+ SelectPalette(hDC, hPal, TRUE);
+ RealizePalette(hDC);
+ ReleaseDC(NULL, hDC);
+ return NULL;
+ }
+
+ bi = *lpbi;
+
+ /* Clean up. */
+ GlobalUnlock(hDIB);
+ SelectPalette(hDC, hPal, TRUE);
+ RealizePalette(hDC);
+ ReleaseDC(NULL, hDC);
+
+ /* Return handle to the DIB. */
+ return hDIB;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CopyScreenToDIB--
+ *
+ * Copies screen to DIB.
+ *
+ * Results:
+ * Screen copied.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HANDLE CopyScreenToDIB(
+ LPRECT lpRect)
+{
+ HBITMAP hBitmap;
+ HPALETTE hPalette;
+ HANDLE hDIB;
+
+ /*
+ * Get the device-dependent bitmap in lpRect by calling CopyScreenToBitmap
+ * and passing it the rectangle to grab.
+ */
+
+ hBitmap = CopyScreenToBitmap(lpRect);
+
+ /* Check for a valid bitmap handle. */
+
+ if (!hBitmap) {
+ return NULL;
+ }
+
+ /* Get the current palette. */
+
+ hPalette = GetSystemPalette();
+
+ /* convert the bitmap to a DIB. */
+
+ hDIB = BitmapToDIB(hBitmap, hPalette);
+
+ /* Clean up. */
+
+ DeleteObject(hPalette);
+ DeleteObject(hBitmap);
+
+ /* Return handle to the packed-DIB. */
+ return hDIB;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetSystemPalette--
+ *
+ * Obtains the system palette.
+ *
+ * Results:
+ * Returns palette.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HPALETTE GetSystemPalette(void)
+{
+ HDC hDC; /* Handle to a DC. */
+ static HPALETTE hPal = NULL; /* Handle to a palette. */
+ HANDLE hLogPal; /* Handle to a logical palette. */
+ LPLOGPALETTE lpLogPal; /* Pointer to a logical palette. */
+ int nColors; /* Number of colors. */
+
+ /* Find out how many palette entries we want.. */
+
+ hDC = GetDC(NULL);
+ if (!hDC) {
+ return NULL;
+ }
+
+ nColors = PalEntriesOnDevice(hDC); /* Number of palette entries. */
+
+ /* Allocate room for the palette and lock it.. */
+
+ hLogPal = GlobalAlloc(GHND, sizeof(LOGPALETTE) + nColors *
+ sizeof(PALETTEENTRY));
+ if (!hLogPal) {
+ /* If we didn't get a logical palette, return NULL. */
+
+ return NULL;
+ }
+
+ /* get a pointer to the logical palette. */
+
+ lpLogPal = (LPLOGPALETTE)GlobalLock(hLogPal);
+
+ /* Set some important fields. */
+
+ lpLogPal->palVersion = 0x300;
+ lpLogPal->palNumEntries = nColors;
+
+ /* Copy the current system palette into our logical palette. */
+
+ GetSystemPaletteEntries(hDC, 0, nColors,
+ (LPPALETTEENTRY) lpLogPal->palPalEntry);
+
+ /*
+ * Go ahead and create the palette. Once it's created, we no longer need
+ * the LOGPALETTE, so free it.
+ */
+
+ hPal = CreatePalette(lpLogPal);
+
+ /* Clean up. */
+
+ GlobalUnlock(hLogPal);
+ GlobalFree(hLogPal);
+ ReleaseDC(NULL, hDC);
+
+ return hPal;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * PalEntriesOnDevice--
+ *
+ * Returns the palettes on the device.
+ *
+ * Results:
+ * Returns palettes.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int PalEntriesOnDevice(
+ HDC hDC)
+{
+ return (1 << (GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES)));
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * Winprint_Init--
+ *
+ * Initializes printing module on Windows.
+ *
+ * Results:
+ * Module initialized.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int Winprint_Init(
+ Tcl_Interp * interp)
+{
+ size_t i;
+ Tcl_Namespace *namespacePtr;
+ static const char *gdiName = "::tk::print::_gdi";
+ static const size_t numCommands =
+ sizeof(gdi_commands) / sizeof(struct gdi_command);
+
+ /*
+ * Set up the low-level [_gdi] command.
+ */
+
+ namespacePtr = Tcl_CreateNamespace(interp, gdiName,
+ NULL, (Tcl_NamespaceDeleteProc *) NULL);
+ for (i=0; i<numCommands; i++) {
+ char buffer[100];
+
+ snprintf(buffer, sizeof(buffer), "%s::%s", gdiName, gdi_commands[i].command_string);
+ Tcl_CreateObjCommand(interp, buffer, gdi_commands[i].command,
+ NULL, (Tcl_CmdDeleteProc *) 0);
+ Tcl_Export(interp, namespacePtr, gdi_commands[i].command_string, 0);
+ }
+ Tcl_CreateEnsemble(interp, gdiName, namespacePtr, 0);
+
+ /*
+ * The other printing-related commands.
+ */
+
+ Tcl_CreateObjCommand(interp, "::tk::print::_selectprinter",
+ PrintSelectPrinter, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_openprinter",
+ PrintOpenPrinter, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_closeprinter",
+ PrintClosePrinter, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_opendoc",
+ PrintOpenDoc, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_closedoc",
+ PrintCloseDoc, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_openpage",
+ PrintOpenPage, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::print::_closepage",
+ PrintClosePage, NULL, NULL);
+ return TCL_OK;
+}
+
+/* Print API functions. */
+
+/*----------------------------------------------------------------------
+ *
+ * PrintSelectPrinter--
+ *
+ * Main dialog for selecting printer and initializing data for print job.
+ *
+ * Results:
+ * Printer selected.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int PrintSelectPrinter(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj* const*))
+{
+ LPCWSTR printerName = NULL;
+ PDEVMODEW returnedDevmode = NULL;
+ PDEVMODEW localDevmode = NULL;
+
+ copies = 0;
+ paper_width = 0;
+ paper_height = 0;
+ dpi_x = 0;
+ dpi_y = 0;
+
+ /* Set up print dialog and initalize property structure. */
+
+ memset(&pd, 0, sizeof(pd));
+ pd.lStructSize = sizeof(pd);
+ pd.hwndOwner = GetDesktopWindow();
+ pd.Flags = PD_HIDEPRINTTOFILE | PD_DISABLEPRINTTOFILE | PD_NOSELECTION;
+
+ if (PrintDlgW(&pd) == TRUE) {
+
+ /*Get document info.*/
+ memset(&di, 0, sizeof(di));
+ di.cbSize = sizeof(di);
+ di.lpszDocName = L"Tk Print Output";
+
+ /* Copy print attributes to local structure. */
+ returnedDevmode = (PDEVMODEW) GlobalLock(pd.hDevMode);
+ devnames = (LPDEVNAMES) GlobalLock(pd.hDevNames);
+ printerName = (LPCWSTR) devnames + devnames->wDeviceOffset;
+ localDevmode = (LPDEVMODEW) HeapAlloc(GetProcessHeap(),
+ HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS,
+ returnedDevmode->dmSize);
+
+ if (localDevmode != NULL) {
+ memcpy((LPVOID)localDevmode, (LPVOID)returnedDevmode,
+ returnedDevmode->dmSize);
+
+ /* Get values from user-set and built-in properties. */
+ localPrinterName = localDevmode->dmDeviceName;
+ dpi_y = localDevmode->dmYResolution;
+ dpi_x = localDevmode->dmPrintQuality;
+ /* Convert height and width to logical points. */
+ paper_height = (int) localDevmode->dmPaperLength / 0.254;
+ paper_width = (int) localDevmode->dmPaperWidth / 0.254;
+ copies = pd.nCopies;
+ /* Set device context here for all GDI printing operations. */
+ printDC = CreateDCW(L"WINSPOOL", printerName, NULL, localDevmode);
+ } else {
+ localDevmode = NULL;
+ }
+ }
+
+ if (pd.hDevMode != NULL) {
+ GlobalFree(pd.hDevMode);
+ }
+
+ /*
+ * Store print properties and link variables so they can be accessed from
+ * script level.
+ */
+ if (localPrinterName != NULL) {
+ char* varlink1 = (char*)ckalloc(100 * sizeof(char));
+ char** varlink2 = (char**)ckalloc(sizeof(char*));
+ *varlink2 = varlink1;
+ WideCharToMultiByte(CP_UTF8, 0, localPrinterName, -1, varlink1, 0, NULL, NULL);
+
+ Tcl_LinkVar(interp, "::tk::print::printer_name", (char*)varlink2,
+ TCL_LINK_STRING | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::copies", (char*)&copies,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::dpi_x", (char*)&dpi_x,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::dpi_y", (char*)&dpi_y,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::paper_width", (char*)&paper_width,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ Tcl_LinkVar(interp, "::tk::print::paper_height", (char*)&paper_height,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintOpenPrinter--
+ *
+ * Open the given printer.
+ *
+ * Results:
+ * Opens the selected printer.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintOpenPrinter(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ Tcl_DString ds;
+
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "printer");
+ return TCL_ERROR;
+ }
+
+ /*Start an individual page.*/
+ if (StartPage(printDC) <= 0) {
+ return TCL_ERROR;
+ }
+
+ const char *printer = Tcl_GetString(objv[1]);
+
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ Tcl_DStringInit(&ds);
+ if ((OpenPrinterW(Tcl_UtfToWCharDString(printer, -1, &ds),
+ (LPHANDLE)&printDC, NULL)) == FALSE) {
+ Tcl_AppendResult(interp, "unable to open printer", (char *)NULL);
+ Tcl_DStringFree(&ds);
+ return TCL_ERROR;
+ }
+
+ Tcl_DStringFree(&ds);
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintClosePrinter--
+ *
+ * Closes the given printer.
+ *
+ * Results:
+ * Printer closed.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintClosePrinter(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
+{
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ ClosePrinter(printDC);
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintOpenDoc--
+ *
+ * Opens the document for printing.
+ *
+ * Results:
+ * Opens the print document.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintOpenDoc(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
+{
+ int output = 0;
+
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Start printing.
+ */
+ output = StartDocW(printDC, &di);
+ if (output <= 0) {
+ Tcl_AppendResult(interp, "unable to start document", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintCloseDoc--
+ *
+ * Closes the document for printing.
+ *
+ * Results:
+ * Closes the print document.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintCloseDoc(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
+{
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ if (EndDoc(printDC) <= 0) {
+ Tcl_AppendResult(interp, "unable to establish close document", (char *)NULL);
+ return TCL_ERROR;
+ }
+ DeleteDC(printDC);
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintOpenPage--
+ *
+ * Opens a page for printing.
+ *
+ * Results:
+ * Opens the print page.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintOpenPage(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
+{
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ /*Start an individual page.*/
+ if (StartPage(printDC) <= 0) {
+ Tcl_AppendResult(interp, "unable to start page", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ return TCL_OK;
+}
+
+/*
+ * --------------------------------------------------------------------------
+ *
+ * PrintClosePage--
+ *
+ * Closes the printed page.
+ *
+ * Results:
+ * Closes the page.
+ *
+ * -------------------------------------------------------------------------
+ */
+
+int PrintClosePage(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
+{
+ if (printDC == NULL) {
+ Tcl_AppendResult(interp, "unable to establish device context", (char *)NULL);
+ return TCL_ERROR;
+ }
+
+ if (EndPage(printDC) <= 0) {
+ Tcl_AppendResult(interp, "unable to close page", (char *)NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinIco.c b/win/tkWinIco.c
new file mode 100644
index 0000000..899d437
--- /dev/null
+++ b/win/tkWinIco.c
@@ -0,0 +1,227 @@
+/*
+ * tkWinIco.c --
+ *
+ * This file contains functions for icon-manipulation routines
+ * in Windows.
+ *
+ * Copyright © 1995-1996 Microsoft Corp.
+ * Copyright © 1998 Brueckner & Jarosch Ing.GmbH, Erfurt, Germany
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkWinIco.h"
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DIBNumColors --
+ *
+ * Calculates the number of entries in the color table, given by LPSTR
+ * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code.
+ *
+ * Results:
+ * WORD - Number of entries in the color table.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static WORD
+DIBNumColors(
+ LPSTR lpbi)
+{
+ WORD wBitCount;
+ DWORD dwClrUsed;
+
+ dwClrUsed = ((LPBITMAPINFOHEADER) lpbi)->biClrUsed;
+
+ if (dwClrUsed) {
+ return (WORD) dwClrUsed;
+ }
+
+ wBitCount = ((LPBITMAPINFOHEADER) lpbi)->biBitCount;
+
+ switch (wBitCount) {
+ case 1:
+ return 2;
+ case 4:
+ return 16;
+ case 8:
+ return 256;
+ default:
+ return 0;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * PaletteSize --
+ *
+ * Calculates the number of bytes in the color table, as given by LPSTR
+ * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code.
+ *
+ * Results:
+ * Number of bytes in the color table
+ *
+ *----------------------------------------------------------------------
+ */
+static WORD
+PaletteSize(
+ LPSTR lpbi)
+{
+ return (WORD) (DIBNumColors(lpbi) * sizeof(RGBQUAD));
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FindDIBits --
+ *
+ * Locate the image bits in a CF_DIB format DIB, as given by LPSTR lpbi -
+ * pointer to the CF_DIB memory block. Used by titlebar icon code.
+ *
+ * Results:
+ * pointer to the image bits
+ *
+ * Side effects: None
+ *
+ *
+ *----------------------------------------------------------------------
+ */
+
+LPSTR
+FindDIBBits(
+ LPSTR lpbi)
+{
+ return lpbi + *((LPDWORD) lpbi) + PaletteSize(lpbi);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * BytesPerLine --
+ *
+ * Calculates the number of bytes in one scan line, as given by
+ * LPBITMAPINFOHEADER lpBMIH - pointer to the BITMAPINFOHEADER that
+ * begins the CF_DIB block. Used by titlebar icon code.
+ *
+ * Results:
+ * number of bytes in one scan line (DWORD aligned)
+ *
+ *----------------------------------------------------------------------
+ */
+
+DWORD
+BytesPerLine(
+ LPBITMAPINFOHEADER lpBMIH)
+{
+ return WIDTHBYTES(lpBMIH->biWidth * lpBMIH->biPlanes * lpBMIH->biBitCount);
+}
+/*
+ *----------------------------------------------------------------------
+ *
+ * CreateIcoFromPhoto --
+ *
+ * Create ico pointer from Tk photo block.
+ *
+ * Results:
+ * Icon image is created from a valid Tk photo image.
+ *
+ * Side effects:
+ * Icon is created.
+ *
+ *----------------------------------------------------------------------
+ */
+
+HICON
+CreateIcoFromPhoto(
+ int width, /* Width of image. */
+ int height, /* Height of image. */
+ Tk_PhotoImageBlock block) /* Image block to convert. */
+{
+ int idx, bufferSize;
+ union {unsigned char *ptr; void *voidPtr;} bgraPixel;
+ union {unsigned char *ptr; void *voidPtr;} bgraMask;
+ HICON hIcon;
+ BITMAPINFO bmInfo;
+ ICONINFO iconInfo;
+
+ /*
+ * Don't use CreateIcon to create the icon, as it requires color
+ * bitmap data in device-dependent format. Instead we use
+ * CreateIconIndirect which takes device-independent bitmaps and
+ * converts them as required. Initialise icon info structure.
+ */
+
+ memset(&iconInfo, 0, sizeof(iconInfo));
+ iconInfo.fIcon = TRUE;
+
+ /*
+ * Create device-independent color bitmap.
+ */
+
+ memset(&bmInfo, 0, sizeof bmInfo);
+ bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmInfo.bmiHeader.biWidth = width;
+ bmInfo.bmiHeader.biHeight = -height;
+ bmInfo.bmiHeader.biPlanes = 1;
+ bmInfo.bmiHeader.biBitCount = 32;
+ bmInfo.bmiHeader.biCompression = BI_RGB;
+
+ iconInfo.hbmColor = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS,
+ &bgraPixel.voidPtr, NULL, 0);
+ if (!iconInfo.hbmColor) {
+ return NULL;
+ }
+
+ /*
+ * Convert the photo image data into BGRA format (RGBQUAD).
+ */
+
+ bufferSize = height * width * 4;
+ for (idx = 0 ; idx < bufferSize ; idx += 4) {
+ bgraPixel.ptr[idx] = block.pixelPtr[idx+2];
+ bgraPixel.ptr[idx+1] = block.pixelPtr[idx+1];
+ bgraPixel.ptr[idx+2] = block.pixelPtr[idx+0];
+ bgraPixel.ptr[idx+3] = block.pixelPtr[idx+3];
+ }
+
+ /*
+ * Create a dummy mask bitmap. The contents of this don't appear to
+ * matter, as CreateIconIndirect will setup the icon mask based on the
+ * alpha channel in our color bitmap.
+ */
+
+ bmInfo.bmiHeader.biBitCount = 1;
+
+ iconInfo.hbmMask = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS,
+ &bgraMask.voidPtr, NULL, 0);
+ if (!iconInfo.hbmMask) {
+ DeleteObject(iconInfo.hbmColor);
+ return NULL;
+ }
+
+ memset(bgraMask.ptr, 0, width*height/8);
+
+ /*
+ * Create an icon from the bitmaps.
+ */
+
+ hIcon = CreateIconIndirect(&iconInfo);
+ DeleteObject(iconInfo.hbmColor);
+ DeleteObject(iconInfo.hbmMask);
+ if (hIcon == NULL) {
+ return NULL;
+ }
+
+ return hIcon;
+}
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/win/tkWinIco.h b/win/tkWinIco.h
new file mode 100644
index 0000000..d690f49
--- /dev/null
+++ b/win/tkWinIco.h
@@ -0,0 +1,101 @@
+/*
+ * tkWinIco.h --
+ *
+ * This file contains declarations for icon-manipulation routines
+ * in Windows.
+ *
+ * Copyright © 1995-1996 Microsoft Corp.
+ * Copyright © 1998 Brueckner & Jarosch Ing.GmbH, Erfurt, Germany
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkWin.h"
+#include <windows.h>
+#include <shellapi.h>
+
+/*
+ * These structures represent the contents of a icon, in terms of its image
+ * or resource.
+ */
+
+typedef struct {
+ UINT Width, Height, Colors; /* Width, Height and bpp */
+ LPBYTE lpBits; /* Ptr to DIB bits */
+ DWORD dwNumBytes; /* How many bytes? */
+ LPBITMAPINFO lpbi; /* Ptr to header */
+ LPBYTE lpXOR; /* Ptr to XOR image bits */
+ LPBYTE lpAND; /* Ptr to AND image bits */
+ HICON hIcon; /* DAS ICON */
+} ICONIMAGE, *LPICONIMAGE;
+
+typedef struct {
+ BOOL bHasChanged; // Has image changed?
+ TCHAR szOriginalICOFileName[MAX_PATH]; // Original name
+ TCHAR szOriginalDLLFileName[MAX_PATH]; // Original name
+ int nNumImages; // How many images?
+ ICONIMAGE IconImages[1]; // Image entries
+} ICONRESOURCE, *LPICONRESOURCE;
+
+/*
+ * This structure is how we represent a block of the above items. We will
+ * reallocate these structures according to how many images they need to
+ * contain.
+ */
+
+typedef struct {
+ int nNumImages; /* How many images? */
+ ICONIMAGE IconImages[1]; /* Image entries */
+} BlockOfIconImages, *BlockOfIconImagesPtr;
+
+/*
+ * These two structures are used to read in icons from an 'icon directory'
+ * (i.e. the contents of a .icr file, say). We only use these structures
+ * temporarily, since we copy the information we want into a
+ * BlockOfIconImages.
+ */
+
+typedef struct {
+ BYTE bWidth; /* Width of the image */
+ BYTE bHeight; /* Height of the image (times 2) */
+ BYTE bColorCount; /* Number of colors in image (0 if >=8bpp) */
+ BYTE bReserved; /* Reserved */
+ WORD wPlanes; /* Color Planes */
+ WORD wBitCount; /* Bits per pixel */
+ DWORD dwBytesInRes; /* How many bytes in this resource? */
+ DWORD dwImageOffset; /* Where in the file is this image */
+} ICONDIRENTRY, *LPICONDIRENTRY;
+
+typedef struct {
+ WORD idReserved; /* Reserved */
+ WORD idType; /* Resource type (1 for icons) */
+ WORD idCount; /* How many images? */
+ ICONDIRENTRY idEntries[1]; /* The entries for each image */
+} ICONDIR, *LPICONDIR;
+
+/*
+ * Used in BytesPerLine
+ */
+
+#define WIDTHBYTES(bits) ((((bits) + 31)>>5)<<2)
+
+/*
+ * The following are implemented in tkWinIco.c and also used in tkWinWm.c and tkWinSysTray.c.
+ */
+
+DWORD BytesPerLine(LPBITMAPINFOHEADER lpBMIH);
+LPSTR FindDIBBits(LPSTR lpbi);
+HICON CreateIcoFromPhoto(int width, int height, Tk_PhotoImageBlock block);
+
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
+
+
+
diff --git a/win/tkWinImage.c b/win/tkWinImage.c
index e4fb487..72f4d50 100644
--- a/win/tkWinImage.c
+++ b/win/tkWinImage.c
@@ -3,7 +3,7 @@
*
* This file contains routines for manipulation full-color images.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -201,8 +201,8 @@ PutPixel(
XImage *
XCreateImage(
- Display *display,
- Visual *visual,
+ TCL_UNUSED(Display *),
+ TCL_UNUSED(Visual *),
unsigned int depth,
int format,
int offset,
@@ -212,7 +212,8 @@ XCreateImage(
int bitmap_pad,
int bytes_per_line)
{
- XImage* imagePtr = ckalloc(sizeof(XImage));
+ XImage* imagePtr = (XImage*)ckalloc(sizeof(XImage));
+
imagePtr->width = width;
imagePtr->height = height;
imagePtr->xoffset = offset;
@@ -274,7 +275,7 @@ XCreateImage(
* None.
*
* This procedure is adapted from the XGetImage implementation in TkNT. That
- * code is Copyright (c) 1994 Software Research Associates, Inc.
+ * code is Copyright © 1994 Software Research Associates, Inc.
*
*----------------------------------------------------------------------
*/
@@ -285,7 +286,7 @@ XGetImageZPixmap(
Drawable d,
int x, int y,
unsigned int width, unsigned int height,
- unsigned long plane_mask,
+ TCL_UNUSED(unsigned long),
int format)
{
TkWinDrawable *twdPtr = (TkWinDrawable *)d;
@@ -315,7 +316,7 @@ XGetImageZPixmap(
hbmp = CreateCompatibleBitmap(hdc, (int) width, (int) height);
hdcMem = CreateCompatibleDC(hdc);
- hbmpPrev = SelectObject(hdcMem, hbmp);
+ hbmpPrev = (HBITMAP)SelectObject(hdcMem, hbmp);
hPal = state.palette;
if (hPal) {
hPalPrev1 = SelectPalette(hdcMem, hPal, FALSE);
@@ -350,7 +351,7 @@ XGetImageZPixmap(
if (depth <= 8) {
size += sizeof(unsigned short) << depth;
}
- bmInfo = ckalloc(size);
+ bmInfo = (BITMAPINFO *)ckalloc(size);
bmInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmInfo->bmiHeader.biWidth = width;
@@ -368,7 +369,7 @@ XGetImageZPixmap(
unsigned char *p, *pend;
GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_PAL_COLORS);
- data = ckalloc(bmInfo->bmiHeader.biSizeImage);
+ data = (unsigned char *)ckalloc(bmInfo->bmiHeader.biSizeImage);
if (!data) {
/* printf("Failed to allocate data area for XImage.\n"); */
ret_image = NULL;
@@ -404,7 +405,7 @@ XGetImageZPixmap(
unsigned char *p;
GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_PAL_COLORS);
- data = ckalloc(bmInfo->bmiHeader.biSizeImage);
+ data = (unsigned char *)ckalloc(bmInfo->bmiHeader.biSizeImage);
if (!data) {
/* printf("Failed to allocate data area for XImage.\n"); */
ret_image = NULL;
@@ -435,7 +436,7 @@ XGetImageZPixmap(
}
} else if (depth == 16) {
GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_RGB_COLORS);
- data = ckalloc(bmInfo->bmiHeader.biSizeImage);
+ data = (unsigned char *)ckalloc(bmInfo->bmiHeader.biSizeImage);
if (!data) {
/* printf("Failed to allocate data area for XImage.\n"); */
ret_image = NULL;
@@ -461,7 +462,7 @@ XGetImageZPixmap(
}
} else {
GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_RGB_COLORS);
- data = ckalloc(width * height * 4);
+ data = (unsigned char *)ckalloc(width * height * 4);
if (!data) {
/* printf("Failed to allocate data area for XImage.\n"); */
ret_image = NULL;
@@ -484,7 +485,7 @@ XGetImageZPixmap(
unsigned int byte_width, h, w;
byte_width = ((width * 3 + 3) & ~(unsigned)3);
- smallBitBase = ckalloc(byte_width * height);
+ smallBitBase = (unsigned char *)ckalloc(byte_width * height);
if (!smallBitBase) {
ckfree(ret_image->data);
ckfree(ret_image);
@@ -614,7 +615,7 @@ XGetImage(
imagePtr = XCreateImage(display, NULL, 32, format, 0, NULL,
width, height, 32, 0);
size = imagePtr->bytes_per_line * imagePtr->height;
- imagePtr->data = ckalloc(size);
+ imagePtr->data = (char *)ckalloc(size);
memset(imagePtr->data, 0, size);
for (yy = 0; yy < height; yy++) {
@@ -661,7 +662,7 @@ XGetImage(
imagePtr = XCreateImage(display, NULL, 1, XYBitmap, 0, NULL,
width, height, 32, 0);
- imagePtr->data = ckalloc(imagePtr->bytes_per_line * imagePtr->height);
+ imagePtr->data = (char *)ckalloc(imagePtr->bytes_per_line * imagePtr->height);
dc = GetDC(NULL);
diff --git a/win/tkWinInit.c b/win/tkWinInit.c
index 22f721f..cd35089 100644
--- a/win/tkWinInit.c
+++ b/win/tkWinInit.c
@@ -4,7 +4,7 @@
* This file contains Windows-specific interpreter initialization
* functions.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -33,14 +33,18 @@
int
TkpInit(
- TCL_UNUSED(Tcl_Interp *))
+ Tcl_Interp *interp)
{
/*
* This is necessary for static initialization, and is ok otherwise
- * because TkWinXInit flips a static bit to do its work just once.
+ * because TkWinXInit flips a static bit to do its work just once. Also,
+ * initialize printing and systray API's here.
*/
+ WinIcoInit(interp);
+ Winprint_Init(interp);
TkWinXInit(Tk_GetHINSTANCE());
+ Icu_Init(interp);
return TCL_OK;
}
@@ -67,7 +71,7 @@ TkpGetAppName(
Tcl_Interp *interp,
Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */
{
- int argc, namelength;
+ Tcl_Size argc, namelength;
const char **argv = NULL, *name, *p;
name = Tcl_GetVar2(interp, "argv0", NULL, TCL_GLOBAL_ONLY);
@@ -123,12 +127,12 @@ TkpDisplayWarning(
/* If running on Cygwin and we have a stderr channel, use it. */
#if !defined(STATIC_BUILD)
- if (tclStubsPtr->reserved9) {
+ if (tclStubsPtr->tcl_CreateFileHandler) {
Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
if (errChannel) {
- Tcl_WriteChars(errChannel, title, -1);
+ Tcl_WriteChars(errChannel, title, TCL_INDEX_NONE);
Tcl_WriteChars(errChannel, ": ", 2);
- Tcl_WriteChars(errChannel, msg, -1);
+ Tcl_WriteChars(errChannel, msg, TCL_INDEX_NONE);
Tcl_WriteChars(errChannel, "\n", 1);
return;
}
diff --git a/win/tkWinInt.h b/win/tkWinInt.h
index 892d9c6..03cd825 100644
--- a/win/tkWinInt.h
+++ b/win/tkWinInt.h
@@ -4,8 +4,8 @@
* This file contains declarations that are shared among the
* Windows-specific parts of Tk, but aren't used by the rest of Tk.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 Scriptics Corporation.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -142,6 +142,9 @@ MODULE_SCOPE const int tkpWinBltModes[];
#include "tkIntPlatDecls.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
/*
* Special proc needed as tsd accessor function between
* tkWinX.c:GenerateXEvent and tkWinClipboard.c:UpdateClipboard
@@ -201,6 +204,10 @@ MODULE_SCOPE long TkpWinToplevelOverrideRedirect(TkWindow *winPtr,
MODULE_SCOPE void TkpWinToplevelDetachWindow(TkWindow *winPtr);
MODULE_SCOPE int TkpWmGetState(TkWindow *winPtr);
+MODULE_SCOPE int TkTranslateWinEvent(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam, LRESULT *result);
+MODULE_SCOPE void TkWinPointerEvent(HWND hwnd, int x, int y);
+
/*
* The following is implemented in tkWinPointer.c and also used in tkWinWindow.c
*/
@@ -208,6 +215,24 @@ MODULE_SCOPE int TkpWmGetState(TkWindow *winPtr);
MODULE_SCOPE void TkSetCursorPos(int x, int y);
/*
+ * The following is implemented in tkWinSysTray.c
+ */
+
+MODULE_SCOPE int WinIcoInit (Tcl_Interp* interp);
+
+/*
+ * The following is implemented in tkWinGDI.c
+ */
+
+MODULE_SCOPE int Winprint_Init(Tcl_Interp* interp);
+
+/*
+ * The following is implemented in tkWinSysTray.c
+ */
+
+MODULE_SCOPE int WinIcoInit (Tcl_Interp* interp);
+
+/*
* Common routines used in Windows implementation
*/
MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError);
@@ -242,12 +267,8 @@ MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError);
#define GWLP_ID GWL_ID
#endif /* !GWLP_WNDPROC */
-/*
- * MSVC versions before 2015 don't know snprintf, but _snprintf is compatible.
- * Note that sprintf is deprecated.
- */
-#if defined(_MSC_VER) && _MSC_VER < 1900
-# define snprintf _snprintf
+#ifdef __cplusplus
+}
#endif
#endif /* _TKWININT */
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index e1ec558..02477cc 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -4,7 +4,7 @@
* This file contains X emulation routines for keyboard related
* functions.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -44,7 +44,7 @@ static const KeySym keymap[] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*75 0x4B*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*80 0x50*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*85 0x55*/
- NoSymbol, XK_Win_L, XK_Win_R, XK_App, NoSymbol, /*90 0x5A*/
+ NoSymbol, XK_Super_L, XK_Super_R, XK_Menu, NoSymbol, /*90 0x5A*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*95 0x5F*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*100 0x64*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*105 0x69*/
@@ -104,7 +104,7 @@ TkpGetString(
if (keyEv->send_event == -1) {
TkKeyEvent *ev = (TkKeyEvent *)keyEv;
if (ev->nbytes > 0) {
- Tcl_ExternalToUtfDString(TkWinGetKeyInputEncoding(),
+ (void)Tcl_ExternalToUtfDString(TkWinGetKeyInputEncoding(),
ev->trans_chars, ev->nbytes, dsPtr);
}
} else if (keyEv->send_event == -3) {
@@ -162,6 +162,21 @@ XKeycodeToKeysym(
}
return KeycodeToKeysym(keycode, state, 0);
}
+
+KeySym
+XkbKeycodeToKeysym(
+ TCL_UNUSED(Display *),
+ unsigned int keycode,
+ TCL_UNUSED(int),
+ int index)
+{
+ int state = 0;
+
+ if (index & 0x01) {
+ state |= ShiftMask;
+ }
+ return KeycodeToKeysym(keycode, state, 0);
+}
/*
*----------------------------------------------------------------------
@@ -343,9 +358,9 @@ KeycodeToKeysym(
*/
case VK_CONTROL:
- if (state & EXTENDED_MASK) {
- return XK_Control_R;
- }
+ if (state & EXTENDED_MASK) {
+ return XK_Control_R;
+ }
break;
case VK_SHIFT:
if (GetKeyState(VK_RSHIFT) & 0x80) {
@@ -353,9 +368,9 @@ KeycodeToKeysym(
}
break;
case VK_MENU:
- if (state & EXTENDED_MASK) {
- return XK_Alt_R;
- }
+ if (state & EXTENDED_MASK) {
+ return XK_Alt_R;
+ }
break;
}
return keymap[keycode];
@@ -440,7 +455,8 @@ TkpInitKeymapInfo(
XModifierKeymap *modMapPtr;
KeyCode *codePtr;
KeySym keysym;
- int count, i, j, max, arraySize;
+ int count, i, max;
+ Tcl_Size j, arraySize;
#define KEYCODE_ARRAY_SIZE 20
dispPtr->bindInfoStale = 0;
@@ -543,7 +559,7 @@ TkpInitKeymapInfo(
/*
* When mapping from a keysym to a keycode, need information about the
- * modifier state that should be used so that when they call XKeycodeToKeysym
+ * modifier state that should be used so that when they call XkbKeycodeToKeysym
* taking into account the xkey.state, they will get back the original keysym.
*/
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index cd7c4aa..163566e 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -4,8 +4,8 @@
* This module implements the Windows platform-specific features of
* menus.
*
- * Copyright (c) 1996-1998 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 Scriptics Corporation.
+ * Copyright © 1996-1998 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -176,11 +176,9 @@ static void GetTearoffEntryGeometry(TkMenu *menuPtr,
const Tk_FontMetrics *fmPtr, int *widthPtr,
int *heightPtr);
static int GetNewID(TkMenuEntry *mePtr, WORD *menuIDPtr);
-static int TkWinMenuKeyObjCmd(ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
+static Tcl_ObjCmdProc TkWinMenuKeyObjCmd;
static void MenuSelectEvent(TkMenu *menuPtr);
-static void ReconfigureWindowsMenu(ClientData clientData);
+static void ReconfigureWindowsMenu(void *clientData);
static void RecursivelyClearActiveMenu(TkMenu *menuPtr);
static void SetDefaults(int firstTime);
static LRESULT CALLBACK TkWinMenuProc(HWND hwnd, UINT message, WPARAM wParam,
@@ -334,7 +332,7 @@ TkpNewMenu(
winMenuHdl = CreatePopupMenu();
if (winMenuHdl == NULL) {
Tcl_SetObjResult(menuPtr->interp, Tcl_NewStringObj(
- "No more menus can be allocated.", -1));
+ "No more menus can be allocated.", TCL_INDEX_NONE));
Tcl_SetErrorCode(menuPtr->interp, "TK", "MENU", "SYSTEM_RESOURCES", NULL);
return TCL_ERROR;
}
@@ -511,7 +509,7 @@ GetEntryText(
: Tcl_GetString(mePtr->accelPtr);
const char *p, *next;
Tcl_DString itemString;
- Tcl_UniChar ch = 0;
+ int ch = 0;
/*
* We have to construct the string with an ampersand preceeding the
@@ -528,7 +526,7 @@ GetEntryText(
if (*p == '&') {
Tcl_DStringAppend(&itemString, "&", 1);
}
- next = p + Tcl_UtfToUniChar(p, &ch);
+ next = p + TkUtfToUniChar(p, &ch);
Tcl_DStringAppend(&itemString, p, (int) (next - p));
}
ch = 0;
@@ -538,7 +536,7 @@ GetEntryText(
if (*p == '&') {
Tcl_DStringAppend(&itemString, "&", 1);
}
- next = p + Tcl_UtfToUniChar(p, &ch);
+ next = p + TkUtfToUniChar(p, &ch);
Tcl_DStringAppend(&itemString, p, (int) (next - p));
}
}
@@ -569,7 +567,7 @@ GetEntryText(
static void
ReconfigureWindowsMenu(
- ClientData clientData) /* The menu we are rebuilding */
+ void *clientData) /* The menu we are rebuilding */
{
TkMenu *menuPtr = (TkMenu *)clientData;
TkMenuEntry *mePtr;
@@ -612,7 +610,7 @@ ReconfigureWindowsMenu(
if ((menuPtr->menuType == MENUBAR)
|| (menuPtr->menuFlags & MENU_SYSTEM_MENU)) {
Tcl_DStringInit(&translatedText);
- Tcl_UtfToWCharDString(itemText, -1, &translatedText);
+ Tcl_UtfToWCharDString(itemText, TCL_INDEX_NONE, &translatedText);
lpNewItem = (LPCWSTR) Tcl_DStringValue(&translatedText);
flags |= MF_STRING;
} else {
@@ -686,7 +684,7 @@ ReconfigureWindowsMenu(
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds,
- Tk_PathName(menuPtr->masterMenuPtr->tkwin), -1);
+ Tk_PathName(menuPtr->mainMenuPtr->tkwin), TCL_INDEX_NONE);
Tcl_DStringAppend(&ds, ".system", 7);
menuRefPtr = TkFindMenuReferences(menuPtr->interp,
@@ -697,7 +695,7 @@ ReconfigureWindowsMenu(
if ((menuRefPtr != NULL)
&& (menuRefPtr->menuPtr != NULL)
&& (menuPtr->parentTopLevelPtr != NULL)
- && (systemMenuPtr->masterMenuPtr
+ && (systemMenuPtr->mainMenuPtr
== menuRefPtr->menuPtr)) {
HMENU systemMenuHdl = (HMENU) systemMenuPtr->platformData;
HWND wrapper = TkWinGetWrapperWindow(menuPtr
@@ -764,7 +762,7 @@ int
TkpPostMenu(
TCL_UNUSED(Tcl_Interp *),
TkMenu *menuPtr,
- int x, int y, int index)
+ int x, int y, Tcl_Size index)
{
HMENU winMenuHdl = (HMENU) menuPtr->platformData;
int result, flags;
@@ -842,7 +840,7 @@ TkpPostMenu(
Tcl_SetServiceMode(oldServiceMode);
GetCursorPos(&point);
- Tk_PointerEvent(NULL, point.x, point.y);
+ TkWinPointerEvent(NULL, point.x, point.y);
if (tsdPtr->inPostMenu) {
tsdPtr->inPostMenu = 0;
@@ -874,13 +872,13 @@ int
TkpPostTearoffMenu(
TCL_UNUSED(Tcl_Interp *), /* The interpreter of the menu */
TkMenu *menuPtr, /* The menu we are posting */
- int x, int y, int index) /* The root X,Y coordinates where we are
+ int x, int y, Tcl_Size index) /* The root X,Y coordinates where we are
* posting */
{
int vRootX, vRootY, vRootWidth, vRootHeight;
int result;
- TkActivateMenuEntry(menuPtr, -1);
+ TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE);
TkRecomputeMenu(menuPtr);
result = TkPostCommand(menuPtr);
if (result != TCL_OK) {
@@ -1036,7 +1034,7 @@ TkWinMenuProc(
static void
UpdateEmbeddedMenu(
- ClientData clientData)
+ void *clientData)
{
RECT rc;
HWND hMenuWnd = (HWND)clientData;
@@ -1080,7 +1078,7 @@ TkWinEmbeddedMenuProc(
if ((wParam == MSGF_MENU) && (nIdles < 1)
&& (hwnd == tsdPtr->embeddedMenuHWND)) {
Tcl_CreateTimerHandler(200, UpdateEmbeddedMenu,
- (ClientData) lParam);
+ (void *) lParam);
nIdles++;
}
break;
@@ -1188,7 +1186,7 @@ TkWinHandleMenuEvent(
}
Tcl_Release(interp);
}
- TkActivateMenuEntry(menuPtr, -1);
+ TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE);
*plResult = 0;
returnResult = 1;
} else {
@@ -1257,7 +1255,7 @@ TkWinHandleMenuEvent(
hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
*plParam);
if (hashEntryPtr != NULL) {
- int i, len;
+ Tcl_Size i, len;
int underline;
Tcl_Obj *labelPtr;
WCHAR *wlabel;
@@ -1285,7 +1283,7 @@ TkWinHandleMenuEvent(
Tcl_DStringFree(&ds);
Tcl_DStringInit(&ds);
wlabel = Tcl_UtfToWCharDString(src, len, &ds);
- if ((underline + 1 < len + 1) && (menuChar ==
+ if ((underline < len) && (menuChar ==
Tcl_UniCharToUpper(wlabel[underline]))) {
*plResult = (2 << 16) | i;
returnResult = 1;
@@ -1345,7 +1343,7 @@ TkWinHandleMenuEvent(
if (itemPtr->itemState & ODS_SELECTED) {
TkActivateMenuEntry(menuPtr, mePtr->index);
} else {
- TkActivateMenuEntry(menuPtr, -1);
+ TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE);
}
} else {
/*
@@ -1408,19 +1406,19 @@ TkWinHandleMenuEvent(
}
if (menuPtr != NULL) {
- long entryIndex = LOWORD(*pwParam);
-
- if ((menuPtr->menuType == MENUBAR) && menuPtr->tearoff) {
- /*
- * Windows passes the entry index starting at 0 for
- * the first menu entry. However this entry #0 is the
- * tearoff entry for Tk (the menu has -tearoff 1),
- * which is ignored for MENUBAR menues on Windows.
- */
-
- entryIndex++;
- }
- mePtr = NULL;
+ Tcl_Size entryIndex = LOWORD(*pwParam);
+
+ if ((menuPtr->menuType == MENUBAR) && menuPtr->tearoff) {
+ /*
+ * Windows passes the entry index starting at 0 for
+ * the first menu entry. However this entry #0 is the
+ * tearoff entry for Tk (the menu has -tearoff 1),
+ * which is ignored for MENUBAR menues on Windows.
+ */
+
+ entryIndex++;
+ }
+ mePtr = NULL;
if (flags != 0xFFFF) {
if ((flags&MF_POPUP) && (entryIndex < menuPtr->numEntries)) {
mePtr = menuPtr->entries[entryIndex];
@@ -1434,9 +1432,9 @@ TkWinHandleMenuEvent(
}
if ((mePtr == NULL) || (mePtr->state == ENTRY_DISABLED)) {
- TkActivateMenuEntry(menuPtr, -1);
+ TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE);
} else {
- if (mePtr->index >= menuPtr->numEntries) {
+ if (mePtr->index >= (int)menuPtr->numEntries) {
Tcl_Panic("Trying to activate an entry which doesn't exist");
}
TkActivateMenuEntry(menuPtr, mePtr->index);
@@ -1473,10 +1471,10 @@ void
RecursivelyClearActiveMenu(
TkMenu *menuPtr) /* The menu to reset. */
{
- int i;
+ Tcl_Size i;
TkMenuEntry *mePtr;
- TkActivateMenuEntry(menuPtr, -1);
+ TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE);
MenuSelectEvent(menuPtr);
for (i = 0; i < menuPtr->numEntries; i++) {
mePtr = menuPtr->entries[i];
@@ -1544,7 +1542,7 @@ TkpSetWindowMenuBar(
/*
*----------------------------------------------------------------------
*
- * TkpSetMainMenubar --
+ * Tk_SetMainMenubar --
*
* Puts the menu associated with a window into the menubar. Should only
* be called when the window is in front.
@@ -1559,7 +1557,7 @@ TkpSetWindowMenuBar(
*/
void
-TkpSetMainMenubar(
+Tk_SetMainMenubar(
TCL_UNUSED(Tcl_Interp *), /* The interpreter of the application */
TCL_UNUSED(Tk_Window), /* The frame we are setting up */
TCL_UNUSED(const char *)) /* The name of the menu to put in front. If
@@ -1605,14 +1603,14 @@ GetMenuIndicatorGeometry(
menuPtr->borderWidthPtr, &borderWidth);
*widthPtr = indicatorDimensions[1] - borderWidth;
- /*
- * Quite dubious about the above (why would borderWidth play a role?)
- * and about how indicatorDimensions[1] is obtained in SetDefaults().
- * At least don't let the result be negative!
- */
- if (*widthPtr < 0) {
- *widthPtr = 0;
- }
+ /*
+ * Quite dubious about the above (why would borderWidth play a role?)
+ * and about how indicatorDimensions[1] is obtained in SetDefaults().
+ * At least don't let the result be negative!
+ */
+ if (*widthPtr < 0) {
+ *widthPtr = 0;
+ }
}
}
@@ -1643,12 +1641,12 @@ GetMenuAccelGeometry(
{
*heightPtr = fmPtr->linespace;
if (mePtr->type == CASCADE_ENTRY) {
- /*
- * Cascade entries have no accelerator but do show an arrow. Set
- * this field width to the width of the OBM_MNARROW system bitmap
- * used to display the arrow. I couldn't find how to query the
- * system for this value, therefore I resort to hardcoding.
- */
+ /*
+ * Cascade entries have no accelerator but do show an arrow. Set
+ * this field width to the width of the OBM_MNARROW system bitmap
+ * used to display the arrow. I couldn't find how to query the
+ * system for this value, therefore I resort to hardcoding.
+ */
*widthPtr = CASCADE_ARROW_WIDTH;
} else if ((menuPtr->menuType != MENUBAR) && (mePtr->accelPtr != NULL)) {
const char *accel = Tcl_GetString(mePtr->accelPtr);
@@ -1912,7 +1910,7 @@ DrawMenuEntryAccelerator(
const char *accel;
if (menuPtr->menuType == MENUBAR) {
- return;
+ return;
}
if (mePtr->accelPtr != NULL) {
@@ -1995,8 +1993,8 @@ DrawMenuEntryArrow(
*/
if ((mePtr->childMenuRefPtr == NULL)
- || (mePtr->childMenuRefPtr->menuPtr == NULL)) {
- return;
+ || (mePtr->childMenuRefPtr->menuPtr == NULL)) {
+ return;
}
oldFgColor = gc->foreground;
@@ -2106,7 +2104,7 @@ DrawMenuUnderline(
if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) {
int len;
- len = Tcl_GetCharLength(mePtr->labelPtr);
+ len = TkGetCharLength(mePtr->labelPtr);
if (mePtr->underline < len) {
const char *label, *start, *end;
int ch;
@@ -2288,28 +2286,28 @@ TkpInitializeMenuBindings(
(void) Tcl_CreateObjCommand(interp, "tk::WinMenuKey",
TkWinMenuKeyObjCmd, Tk_MainWindow(interp), NULL);
- (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ (void) Tk_CreateBinding(interp, bindingTable, (void *)uid,
"<Alt_L>", "tk::WinMenuKey %W %N", 0);
- (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ (void) Tk_CreateBinding(interp, bindingTable, (void *)uid,
"<KeyRelease-Alt_L>", "tk::WinMenuKey %W %N", 0);
- (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ (void) Tk_CreateBinding(interp, bindingTable, (void *)uid,
"<Alt_R>", "tk::WinMenuKey %W %N", 0);
- (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ (void) Tk_CreateBinding(interp, bindingTable, (void *)uid,
"<KeyRelease-Alt_R>", "tk::WinMenuKey %W %N", 0);
- (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
- "<Alt-KeyPress>", "tk::WinMenuKey %W %N", 0);
+ (void) Tk_CreateBinding(interp, bindingTable, (void *)uid,
+ "<Alt-Key>", "tk::WinMenuKey %W %N", 0);
- (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ (void) Tk_CreateBinding(interp, bindingTable, (void *)uid,
"<Alt-KeyRelease>", "tk::WinMenuKey %W %N", 0);
- (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
- "<KeyPress-F10>", "tk::WinMenuKey %W %N", 0);
+ (void) Tk_CreateBinding(interp, bindingTable, (void *)uid,
+ "<Key-F10>", "tk::WinMenuKey %W %N", 0);
- (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
+ (void) Tk_CreateBinding(interp, bindingTable, (void *)uid,
"<KeyRelease-F10>", "tk::WinMenuKey %W %N", 0);
}
@@ -2936,10 +2934,26 @@ DrawMenuEntryBackground(
{
if (mePtr->state == ENTRY_ACTIVE
|| (mePtr->entryFlags & ENTRY_PLATFORM_FLAG1)!=0 ) {
+ int relief;
+ int activeBorderWidth;
+
bgBorder = activeBorder;
+
+ if ((menuPtr->menuType == MENUBAR)
+ && ((menuPtr->postedCascade == NULL)
+ || (menuPtr->postedCascade != mePtr))) {
+ relief = TK_RELIEF_FLAT;
+ } else {
+ Tk_GetReliefFromObj(NULL, menuPtr->activeReliefPtr, &relief);
+ }
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
+ menuPtr->activeBorderWidthPtr, &activeBorderWidth);
+ Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height,
+ activeBorderWidth, relief);
+ } else {
+ Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, 0,
+ TK_RELIEF_FLAT);
}
- Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, 0,
- TK_RELIEF_FLAT);
}
/*
@@ -2968,7 +2982,7 @@ TkpComputeStandardMenuGeometry(
Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
int x, y, height, width, indicatorSpace, labelWidth, accelWidth;
int windowWidth, windowHeight, accelSpace;
- int i, j, lastColumnBreak = 0;
+ Tcl_Size i, j, lastColumnBreak = 0;
int activeBorderWidth, borderWidth;
if (menuPtr->tkwin == NULL) {
@@ -2997,7 +3011,7 @@ TkpComputeStandardMenuGeometry(
Tk_GetPixelsFromObj(menuPtr->interp, menuPtr->tkwin,
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
- for (i = 0; i < menuPtr->numEntries; i++) {
+ for (i = 0; i < (int)menuPtr->numEntries; i++) {
if (menuPtr->entries[i]->fontPtr == NULL) {
tkfont = menuFont;
fmPtr = &menuMetrics;
@@ -3081,7 +3095,7 @@ TkpComputeStandardMenuGeometry(
if (accelWidth != 0) {
labelWidth += accelSpace;
}
- for (j = lastColumnBreak; j < menuPtr->numEntries; j++) {
+ for (j = lastColumnBreak; j < (int)menuPtr->numEntries; j++) {
menuPtr->entries[j]->indicatorSpace = indicatorSpace;
menuPtr->entries[j]->labelWidth = labelWidth;
menuPtr->entries[j]->width = indicatorSpace + labelWidth
@@ -3182,7 +3196,7 @@ TkpMenuNotifyToplevelCreate(
if ((menuName != NULL) && (menuName[0] != '\0')) {
menuRefPtr = TkFindMenuReferences(interp, menuName);
if ((menuRefPtr != NULL) && (menuRefPtr->menuPtr != NULL)) {
- for (menuPtr = menuRefPtr->menuPtr->masterMenuPtr; menuPtr != NULL;
+ for (menuPtr = menuRefPtr->menuPtr->mainMenuPtr; menuPtr != NULL;
menuPtr = menuPtr->nextInstancePtr) {
if (menuPtr->menuType == MENUBAR) {
ScheduleMenuReconfigure(menuPtr);
@@ -3308,9 +3322,9 @@ TkWinGetMenuSystemDefault(
if ((strcmp(dbName, "activeBorderWidth") == 0) ||
(strcmp(dbName, "borderWidth") == 0)) {
- valuePtr = Tcl_NewIntObj(defaultBorderWidth);
+ valuePtr = Tcl_NewWideIntObj(defaultBorderWidth);
} else if (strcmp(dbName, "font") == 0) {
- valuePtr = Tcl_NewStringObj(Tcl_DStringValue(&menuFontDString), -1);
+ valuePtr = Tcl_NewStringObj(Tcl_DStringValue(&menuFontDString), TCL_INDEX_NONE);
}
return valuePtr;
@@ -3347,12 +3361,7 @@ SetDefaults(
int pointSize;
HFONT menuFont;
/* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */
- struct {
- NONCLIENTMETRICSW metrics;
-#if (WINVER < 0x0600)
- int padding;
-#endif
- } nc;
+ NONCLIENTMETRICSW metrics;
/*
* Set all of the default options. The loop will terminate when we run out
@@ -3370,15 +3379,15 @@ SetDefaults(
}
Tcl_DStringInit(&menuFontDString);
- nc.metrics.cbSize = sizeof(nc);
+ metrics.cbSize = sizeof(metrics);
if (TkWinGetPlatformTheme() != TK_THEME_WIN_VISTA) {
- nc.metrics.cbSize -= sizeof(int);
+ metrics.cbSize -= sizeof(int);
}
- SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, nc.metrics.cbSize,
- &nc.metrics, 0);
- menuFont = CreateFontIndirectW(&nc.metrics.lfMenuFont);
+ SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, metrics.cbSize,
+ &metrics, 0);
+ menuFont = CreateFontIndirectW(&metrics.lfMenuFont);
SelectObject(scratchDC, menuFont);
GetTextMetricsW(scratchDC, &tm);
GetTextFaceA(scratchDC, LF_FACESIZE, faceName);
diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c
index 9bd336a..ad26c12 100644
--- a/win/tkWinPixmap.c
+++ b/win/tkWinPixmap.c
@@ -4,7 +4,7 @@
* This file contains the Xlib emulation functions pertaining to creating
* and destroying pixmaps.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c
index 38c7311..5ccd862 100644
--- a/win/tkWinPointer.c
+++ b/win/tkWinPointer.c
@@ -3,8 +3,8 @@
*
* Windows specific mouse tracking code.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 Scriptics Corporation.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -31,7 +31,7 @@ static int mouseTimerSet = 0; /* 1 if the mouse timer is active. */
* Forward declarations of procedures used in this file.
*/
-static void MouseTimerProc(ClientData clientData);
+static void MouseTimerProc(void *clientData);
/*
*----------------------------------------------------------------------
@@ -93,7 +93,7 @@ TkWinGetModifierState(void)
/*
*----------------------------------------------------------------------
*
- * Tk_PointerEvent --
+ * TkWinPointerEvent --
*
* This procedure is called for each pointer-related event. It converts
* the position to root coords and updates the global pointer state
@@ -109,7 +109,7 @@ TkWinGetModifierState(void)
*/
void
-Tk_PointerEvent(
+TkWinPointerEvent(
HWND hwnd, /* Window for coords, or NULL for the root
* window. */
int x, int y) /* Coords relative to hwnd, or screen if hwnd
@@ -179,6 +179,12 @@ XGrabKeyboard(
int keyboard_mode,
Time time)
{
+ (void)display;
+ (void)owner_events;
+ (void)pointer_mode;
+ (void)keyboard_mode;
+ (void)time;
+
keyboardWinPtr = TkWinGetWinPtr(grab_window);
return GrabSuccess;
}
@@ -204,6 +210,9 @@ XUngrabKeyboard(
Display *display,
Time time)
{
+ (void)display;
+ (void)time;
+
keyboardWinPtr = NULL;
return Success;
}
@@ -226,14 +235,14 @@ XUngrabKeyboard(
void
MouseTimerProc(
- ClientData clientData)
+ TCL_UNUSED(void *))
{
POINT pos;
mouseTimerSet = 0;
GetCursorPos(&pos);
- Tk_PointerEvent(NULL, pos.x, pos.y);
+ TkWinPointerEvent(NULL, pos.x, pos.y);
}
/*
@@ -285,6 +294,7 @@ TkGetPointerCoords(
int *xPtr, int *yPtr) /* Store pointer coordinates here. */
{
POINT point;
+ (void)tkwin;
GetCursorPos(&point);
*xPtr = point.x;
@@ -313,13 +323,13 @@ TkGetPointerCoords(
Bool
XQueryPointer(
Display *display,
- Window w,
- Window *root_return,
- Window *child_return,
+ TCL_UNUSED(Window),
+ TCL_UNUSED(Window *),
+ TCL_UNUSED(Window *),
int *root_x_return,
int *root_y_return,
- int *win_x_return,
- int *win_y_return,
+ TCL_UNUSED(int *),
+ TCL_UNUSED(int *),
unsigned int *mask_return)
{
LastKnownRequestProcessed(display)++;
@@ -367,8 +377,8 @@ void TkSetCursorPos(
* requested position is off the primary screen.
*/
if ( x < 0 || x > xscreen || y < 0 || y > yscreen ) {
- SetCursorPos(x, y);
- return;
+ SetCursorPos(x, y);
+ return;
}
input.type = INPUT_MOUSE;
@@ -384,7 +394,7 @@ void TkSetCursorPos(
* See ticket [69b48f427e].
*/
if (input.mi.dx == 0 && input.mi.dy == 0) {
- input.mi.dx = 1;
+ input.mi.dx = 1;
}
input.mi.mouseData = 0;
@@ -407,6 +417,12 @@ XWarpPointer(
int dest_y)
{
RECT r;
+ (void)display;
+ (void)src_w;
+ (void)src_x;
+ (void)src_y;
+ (void)src_width;
+ (void)src_height;
GetWindowRect(Tk_GetHWND(dest_w), &r);
TkSetCursorPos(r.left+dest_x, r.top+dest_y);
@@ -451,7 +467,7 @@ XGetInputFocus(
{
Tk_Window tkwin = Tk_HWNDToWindow(GetFocus());
- *focus_return = tkwin ? Tk_WindowId(tkwin) : None;
+ *focus_return = tkwin ? Tk_WindowId(tkwin) : 0;
*revert_to_return = RevertToParent;
LastKnownRequestProcessed(display)++;
return Success;
@@ -478,8 +494,8 @@ int
XSetInputFocus(
Display *display,
Window focus,
- int revert_to,
- Time time)
+ TCL_UNUSED(int),
+ TCL_UNUSED(Time))
{
LastKnownRequestProcessed(display)++;
if (focus != None) {
diff --git a/win/tkWinPort.h b/win/tkWinPort.h
index e5e9e6c..b991800 100644
--- a/win/tkWinPort.h
+++ b/win/tkWinPort.h
@@ -5,7 +5,7 @@
* differences between Windows and Unix. It should be the only
* file that contains #ifdefs to handle different flavors of OS.
*
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ * Copyright © 1995-1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -24,7 +24,6 @@
#include <stdio.h>
#include <wchar.h>
#include <io.h>
-#include <stdlib.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/win/tkWinRegion.c b/win/tkWinRegion.c
index 9e9d80a..b6f87dc 100644
--- a/win/tkWinRegion.c
+++ b/win/tkWinRegion.c
@@ -3,7 +3,7 @@
*
* Tk Region emulation code.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 1995 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -11,13 +11,6 @@
#include "tkWinInt.h"
-#undef TkCreateRegion
-#undef TkDestroyRegion
-#undef TkClipBox
-#undef TkIntersectRegion
-#undef TkUnionRectWithRegion
-#undef TkRectInRegion
-#undef TkSubtractRegion
/*
*----------------------------------------------------------------------
diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c
index 4e1c733..a54deeb 100644
--- a/win/tkWinScrlbr.c
+++ b/win/tkWinScrlbr.c
@@ -4,7 +4,7 @@
* This file implements the Windows specific portion of the scrollbar
* widget.
*
- * Copyright (c) 1996 Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -61,7 +61,7 @@ TCL_DECLARE_MUTEX(winScrlbrMutex)
*/
static Window CreateProc(Tk_Window tkwin, Window parent,
- ClientData instanceData);
+ void *instanceData);
static void ModalLoop(WinScrollbar *, XEvent *eventPtr);
static LRESULT CALLBACK ScrollbarProc(HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam);
@@ -80,7 +80,7 @@ const Tk_ClassProcs tkpScrollbarProcs = {
};
static void
-WinScrollbarEventProc(ClientData clientData, XEvent *eventPtr)
+WinScrollbarEventProc(void *clientData, XEvent *eventPtr)
{
WinScrollbar *scrollPtr = (WinScrollbar *)clientData;
@@ -205,7 +205,7 @@ static Window
CreateProc(
Tk_Window tkwin, /* Token for window. */
Window parentWin, /* Parent of new window. */
- ClientData instanceData) /* Scrollbar instance data. */
+ void *instanceData) /* Scrollbar instance data. */
{
DWORD style;
Window window;
@@ -273,7 +273,7 @@ CreateProc(
void
TkpDisplayScrollbar(
- ClientData clientData) /* Information about window. */
+ void *clientData) /* Information about window. */
{
WinScrollbar *scrollPtr = (WinScrollbar *)clientData;
Tk_Window tkwin = scrollPtr->info.tkwin;
@@ -394,10 +394,6 @@ TkpComputeScrollbarGeometry(
* basic sanity checks to appease backwards compatibility.
*/
- if (scrollPtr->highlightWidth < 0) {
- scrollPtr->highlightWidth = 0;
- }
-
if (scrollPtr->vertical) {
scrollPtr->arrowLength = vArrowHeight;
fieldLength = Tk_Height(scrollPtr->tkwin);
@@ -497,7 +493,7 @@ ScrollbarProc(
int code;
GetCursorPos(&point);
- Tk_TranslateWinEvent(NULL, WM_MOUSEMOVE, 0,
+ TkTranslateWinEvent(NULL, WM_MOUSEMOVE, 0,
MAKELPARAM(point.x, point.y), &result);
if (command == SB_ENDSCROLL) {
@@ -552,7 +548,7 @@ ScrollbarProc(
}
interp = scrollPtr->info.interp;
- code = Tcl_EvalEx(interp, cmdString.string, -1, TCL_EVAL_GLOBAL);
+ code = Tcl_EvalEx(interp, cmdString.string, TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) {
Tcl_AddErrorInfo(interp, "\n (scrollbar command)");
Tcl_BackgroundException(interp, code);
@@ -564,7 +560,7 @@ ScrollbarProc(
}
default:
- if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ if (TkTranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
return result;
}
}
diff --git a/win/tkWinSend.c b/win/tkWinSend.c
index 7942cfc..630b218 100644
--- a/win/tkWinSend.c
+++ b/win/tkWinSend.c
@@ -4,8 +4,8 @@
* This file provides functions that implement the "send" command,
* allowing commands to be passed from interpreter to interpreter.
*
- * Copyright (c) 1997 Sun Microsystems, Inc.
- * Copyright (c) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * Copyright © 1997 Sun Microsystems, Inc.
+ * Copyright © 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -63,9 +63,7 @@ static Tcl_ThreadDataKey dataKey;
*/
#ifdef TK_SEND_ENABLED_ON_WINDOWS
-static void CmdDeleteProc(ClientData clientData);
-static void InterpDeleteProc(ClientData clientData,
- Tcl_Interp *interp);
+static Tcl_CmdDeleteProc CmdDeleteProc;
static void RevokeObjectRegistration(RegisteredInterp *riPtr);
#endif /* TK_SEND_ENABLED_ON_WINDOWS */
static HRESULT BuildMoniker(const char *name, LPMONIKER *pmk);
@@ -76,7 +74,7 @@ static HRESULT RegisterInterp(const char *name,
static int FindInterpreterObject(Tcl_Interp *interp,
const char *name, LPDISPATCH *ppdisp);
static int Send(LPDISPATCH pdispInterp, Tcl_Interp *interp,
- int async, ClientData clientData, int objc,
+ int async, void *clientData, Tcl_Size objc,
Tcl_Obj *const objv[]);
static void SendTrace(const char *format, ...);
static Tcl_EventProc SendEventProc;
@@ -148,7 +146,7 @@ Tk_SetAppName(
hr = CoInitialize(0);
if (FAILED(hr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "failed to initialize the COM library", -1));
+ "failed to initialize the COM library", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "SEND", "COM", NULL);
return "";
}
@@ -212,12 +210,11 @@ Tk_SetAppName(
int
TkGetInterpNames(
Tcl_Interp *interp, /* Interpreter for returning a result. */
- Tk_Window tkwin) /* Window whose display is to be used for the
+ TCL_UNUSED(Tk_Window)) /* Window whose display is to be used for the
* lookup. */
{
#ifndef TK_SEND_ENABLED_ON_WINDOWS
(void)interp;
- (void)tkwin;
/*
* Temporarily disabled for bug #858822
*/
@@ -323,7 +320,7 @@ TkGetInterpNames(
int
Tk_SendObjCmd(
- ClientData clientData, /* Information about sender (only dispPtr
+ void *clientData, /* Information about sender (only dispPtr
* field is used). */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
@@ -335,25 +332,30 @@ Tk_SendObjCmd(
static const char *const sendOptions[] = {
"-async", "-displayof", "--", NULL
};
+ const char *stringRep;
int result = TCL_OK;
- int i, optind, async = 0;
- Tcl_Obj *displayPtr = NULL;
+ int i, async = 0, index;
/*
* Process the command options.
*/
- for (i = 1; i < objc; i++) {
- if (Tcl_GetIndexFromObjStruct(NULL, objv[i], sendOptions,
- sizeof(char *), "option", 0, &optind) != TCL_OK) {
- break;
- }
- if (optind == SEND_ASYNC) {
- ++async;
- } else if (optind == SEND_DISPLAYOF) {
- displayPtr = objv[++i];
- } else if (optind == SEND_LAST) {
- i++;
+ for (i = 1; i < (objc - 1); i++) {
+ stringRep = Tcl_GetString(objv[i]);
+ if (stringRep[0] == '-') {
+ if (Tcl_GetIndexFromObjStruct(interp, objv[i], sendOptions,
+ sizeof(char *), "option", 0, &index) != TCL_OK) {
+ break;
+ }
+ if (index == SEND_ASYNC) {
+ async = 1;
+ } else if (index == SEND_DISPLAYOF) {
+ i++;
+ } else /* if (index == SEND_LAST) */ {
+ i++;
+ break;
+ }
+ } else {
break;
}
}
@@ -362,25 +364,13 @@ Tk_SendObjCmd(
* Ensure we still have a valid command.
*/
- if ((objc - i) < 2) {
+ if (objc < (i + 2)) {
Tcl_WrongNumArgs(interp, 1, objv,
"?-async? ?-displayof? ?--? interpName arg ?arg ...?");
result = TCL_ERROR;
}
/*
- * We don't support displayPtr. See TIP #150.
- */
-
- if (displayPtr) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "option not implemented: \"displayof\" is not available"
- " for this platform.", -1));
- Tcl_SetErrorCode(interp, "TK", "SEND", "DISPLAYOF_WIN", NULL);
- result = TCL_ERROR;
- }
-
- /*
* Send the arguments to the foreign interp.
*/
/* FIX ME: we need to check for local interp */
@@ -489,7 +479,7 @@ FindInterpreterObject(
#ifdef TK_SEND_ENABLED_ON_WINDOWS
static void
CmdDeleteProc(
- ClientData clientData)
+ void *clientData)
{
RegisteredInterp *riPtr = (RegisteredInterp *)clientData;
@@ -571,33 +561,6 @@ RevokeObjectRegistration(
/*
* ----------------------------------------------------------------------
*
- * InterpDeleteProc --
- *
- * This is called when the interpreter is deleted and used to unregister
- * the COM libraries.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- * ----------------------------------------------------------------------
- */
-
-#ifdef TK_SEND_ENABLED_ON_WINDOWS
-static void
-InterpDeleteProc(
- ClientData clientData,
- Tcl_Interp *interp)
-{
- CoUninitialize();
-}
-#endif /* TK_SEND_ENABLED_ON_WINDOWS */
-
-/*
- * ----------------------------------------------------------------------
- *
* BuildMoniker --
*
* Construct a moniker from the given name. This ensures that all our
@@ -626,7 +589,7 @@ BuildMoniker(
Tcl_DString dString;
Tcl_DStringInit(&dString);
- Tcl_UtfToWCharDString(name, -1, &dString);
+ Tcl_UtfToWCharDString(name, TCL_INDEX_NONE, &dString);
hr = CreateFileMoniker((LPOLESTR)Tcl_DStringValue(&dString), &pmkItem);
Tcl_DStringFree(&dString);
if (SUCCEEDED(hr)) {
@@ -678,7 +641,7 @@ RegisterInterp(
if (i > 1) {
if (i == 2) {
Tcl_DStringInit(&dString);
- Tcl_DStringAppend(&dString, name, -1);
+ Tcl_DStringAppend(&dString, name, TCL_INDEX_NONE);
Tcl_DStringAppend(&dString, " #", 2);
offset = Tcl_DStringLength(&dString);
Tcl_DStringSetLength(&dString, offset + TCL_INTEGER_SPACE);
@@ -741,7 +704,7 @@ Send(
Tcl_Interp *interp, /* The local interpreter. */
int async, /* Flag for the calling style. */
TCL_UNUSED(void *),
- int objc, /* Number of arguments to be sent. */
+ Tcl_Size objc, /* Number of arguments to be sent. */
Tcl_Obj *const objv[]) /* The arguments to be sent. */
{
VARIANT vCmd, vResult;
diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c
index 536c6c1..7bd7258 100644
--- a/win/tkWinSendCom.c
+++ b/win/tkWinSendCom.c
@@ -13,7 +13,7 @@
* In other words the Send methods takes a string and evaluates this in the
* Tcl interpreter. The result is returned as another string.
*
- * Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * Copyright © 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -144,7 +144,7 @@ static void
TkWinSendCom_Destroy(
LPDISPATCH pdisp)
{
- CoTaskMemFree((void *) pdisp);
+ CoTaskMemFree(pdisp);
}
/*
@@ -391,7 +391,7 @@ Async(
hr = VariantChangeType(&vCmd, &Cmd, 0, VT_BSTR);
if (FAILED(hr)) {
Tcl_SetObjResult(obj->interp, Tcl_NewStringObj(
- "invalid args: Async(command)", -1));
+ "invalid args: Async(command)", TCL_INDEX_NONE));
TkWinSend_SetExcepInfo(obj->interp, pExcepInfo);
hr = DISP_E_EXCEPTION;
}
@@ -432,7 +432,7 @@ Async(
static HRESULT
Send(
- TkWinSendCom *obj,
+ TkWinSendCom *comobj,
VARIANT vCmd,
VARIANT *pvResult,
EXCEPINFO *pExcepInfo,
@@ -441,7 +441,7 @@ Send(
HRESULT hr = S_OK;
int result = TCL_OK;
VARIANT v;
- Tcl_Interp *interp = obj->interp;
+ Tcl_Interp *interp = comobj->interp;
Tcl_Obj *scriptPtr;
Tcl_DString ds;
(void)puArgErr;
diff --git a/win/tkWinSendCom.h b/win/tkWinSendCom.h
index cd6ec18..73f326b 100644
--- a/win/tkWinSendCom.h
+++ b/win/tkWinSendCom.h
@@ -5,7 +5,7 @@
* command, allowing commands to be passed from interpreter to
* interpreter.
*
- * Copyright (C) 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * Copyright © 2002 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -46,11 +46,11 @@ typedef struct {
*/
MODULE_SCOPE HRESULT TkWinSendCom_CreateInstance(Tcl_Interp *interp,
- REFIID riid, void **ppv);
+ REFIID riid, void **ppv);
MODULE_SCOPE int TkWinSend_QueueCommand(Tcl_Interp *interp,
- Tcl_Obj *cmdPtr);
+ Tcl_Obj *cmdPtr);
MODULE_SCOPE void TkWinSend_SetExcepInfo(Tcl_Interp *interp,
- EXCEPINFO *pExcepInfo);
+ EXCEPINFO *pExcepInfo);
#endif /* _tkWinSendCom_h_INCLUDE */
diff --git a/win/tkWinSysTray.c b/win/tkWinSysTray.c
new file mode 100644
index 0000000..a710ee6
--- /dev/null
+++ b/win/tkWinSysTray.c
@@ -0,0 +1,1177 @@
+/*
+ * tkWinSysTray.c --
+ *
+ * tkWinSysTray.c implements a "systray" Tcl command which permits to
+ * change the system tray/taskbar icon of a Tk toplevel window and
+ * a "sysnotify" command to post system notifications.
+ *
+ * Copyright © 1995-1996 Microsoft Corp.
+ * Copyright © 1998 Brueckner & Jarosch Ing.GmbH, Erfurt, Germany
+ * Copyright © 2020 Kevin Walzer/WordTech Communications LLC.
+ * Copyright © 2020 Eric Boudaillier.
+ * Copyright © 2020 Francois Vogel.
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkInt.h"
+#include <windows.h>
+#include <shellapi.h>
+#include "tkWin.h"
+#include "tkWinInt.h"
+#include "tkWinIco.h"
+
+/*
+ * Based extensively on the winico extension and sample code from Microsoft.
+ * Some of the code was adapted into tkWinWM.c to implement the "wm iconphoto"
+ * command (TIP 159), and here we are borrowing that code to use Tk images
+ * to create system tray icons instead of ico files. Additionally, we are
+ * removing obsolete parts of the winico extension, and implementing
+ * more of the Shell_Notification API to add balloon/system notifications.
+ */
+
+#define GETHINSTANCE Tk_GetHINSTANCE()
+
+typedef struct IcoInfo {
+ HICON hIcon; /* icon handle returned by LoadIcon. */
+ unsigned id; /* Identifier for command; used to
+ * cancel it. */
+ Tcl_Obj *taskbar_txt; /* text to display in the taskbar */
+ Tcl_Interp *interp; /* interp which created the icon */
+ Tcl_Obj *taskbar_command; /* command to eval if events in the taskbar
+ * arrive */
+ int taskbar_flags; /* taskbar related flags*/
+ HWND hwndFocus;
+ struct IcoInfo *nextPtr;
+} IcoInfo;
+
+/* Per-interp struture */
+typedef struct IcoInterpInfo {
+ HWND hwnd; /* Handler window */
+ int counter; /* Counter for IcoInfo id generation */
+ IcoInfo *firstIcoPtr; /* List of created IcoInfo */
+ struct IcoInterpInfo *nextPtr;
+} IcoInterpInfo;
+
+#define TASKBAR_ICON 1
+#define ICON_MESSAGE WM_USER + 1234
+
+#define HANDLER_CLASS "Wtk_TaskbarHandler"
+static HWND CreateTaskbarHandlerWindow(void);
+
+static IcoInterpInfo *firstIcoInterpPtr = NULL;
+static Tk_EventProc WinIcoDestroy;
+
+/*
+ * If someone wants to see the several masks somewhere on the screen...
+ * set the ICO_DRAW define and feel free to make some Tcl commands
+ * for accessing it. The normal drawing of an Icon to a DC is really easy:
+ * DrawIcon(hdc,x,y,hIcon) or , more complicated
+ * DrawIconEx32PlusMoreParameters ...
+ */
+
+/* #define ICO_DRAW */
+#ifdef ICO_DRAW
+#define RectWidth(r)((r).right - (r).left + 1)
+#define RectHeight(r)((r).bottom - (r).top + 1)
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawXORMask --
+ *
+ * Using DIB functions, draw XOR mask on hDC in Rect.
+ *
+ * Results:
+ * Icon is rendered.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static BOOL
+DrawXORMask(
+ HDC hDC,
+ RECT Rect,
+ LPLPICONIMAGE lpIcon)
+{
+ int x, y;
+
+ /* Sanity checks */
+ if (lpIcon == NULL)
+ return FALSE;
+ if (lpIcon->lpBits == NULL)
+ return FALSE;
+
+ /* Account for height*2 thing */
+ lpIcon->lpbi->bmiHeader.biHeight /= 2;
+
+ /* Locate it */
+ x = Rect.left + ((RectWidth(Rect) - lpIcon->lpbi->bmiHeader.biWidth) / 2);
+ y = Rect.top + ((RectHeight(Rect) - lpIcon->lpbi->bmiHeader.biHeight) / 2);
+
+ /* Blast it to the screen */
+ SetDIBitsToDevice(hDC, x, y,
+ lpIcon->lpbi->bmiHeader.biWidth,
+ lpIcon->lpbi->bmiHeader.biHeight,
+ 0, 0, 0, lpIcon->lpbi->bmiHeader.biHeight,
+ lpIcon->lpXOR, lpIcon->lpbi, DIB_RGB_COLORS);
+
+ /* UnAccount for height*2 thing */
+ lpIcon->lpbi->bmiHeader.biHeight *= 2;
+
+ return TRUE;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawANDMask --
+ *
+ * Using DIB functions, draw AND mask on hDC in Rect.
+ *
+ * Results:
+ * Icon is rendered.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+BOOL
+DrawANDMask(
+ HDC hDC,
+ RECT Rect,
+ LPLPICONIMAGE lpIcon)
+{
+ LPBITMAPINFO lpbi;
+ int x, y;
+
+ /* Sanity checks */
+ if (lpIcon == NULL)
+ return FALSE;
+ if (lpIcon->lpBits == NULL)
+ return FALSE;
+
+ /* Need a bitmap header for the mono mask */
+ lpbi = ckalloc(sizeof(BITMAPINFO) + (2 * sizeof(RGBQUAD)));
+ lpbi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ lpbi->bmiHeader.biWidth = lpIcon->lpbi->bmiHeader.biWidth;
+ lpbi->bmiHeader.biHeight = lpIcon->lpbi->bmiHeader.biHeight / 2;
+ lpbi->bmiHeader.biPlanes = 1;
+ lpbi->bmiHeader.biBitCount = 1;
+ lpbi->bmiHeader.biCompression = BI_RGB;
+ lpbi->miHeader.biSizeImage = 0;
+ lpbi->bmiHeader.biXPelsPerMeter = 0;
+ lpbi->bmiHeader.biYPelsPerMeter = 0;
+ lpbi->bmiHeader.biClrUsed = 0;
+ lpbi->bmiHeader.biClrImportant = 0;
+ lpbi->bmiColors[0].rgbRed = 0;
+ lpbi->bmiColors[0].rgbGreen = 0;
+ lpbi->bmiColors[0].rgbBlue = 0;
+ lpbi->bmiColors[0].rgbReserved = 0;
+ lpbi->bmiColors[1].rgbRed = 255;
+ lpbi->bmiColors[1].rgbGreen = 255;
+ lpbi->bmiColors[1].rgbBlue = 255;
+ lpbi->bmiColors[1].rgbReserved = 0;
+
+ /* Locate it */
+ x = Rect.left + ((RectWidth(Rect) - lpbi->bmiHeader.biWidth) / 2);
+ y = Rect.top + ((RectHeight(Rect) - lpbi->bmiHeader.biHeight) / 2);
+
+ /* Blast it to the screen */
+ SetDIBitsToDevice(hDC, x, y,
+ lpbi->bmiHeader.biWidth,
+ lpbi->bmiHeader.biHeight,
+ 0, 0, 0, lpbi->bmiHeader.biHeight,
+ lpIcon->lpAND, lpbi, DIB_RGB_COLORS);
+
+ /* clean up */
+ ckfree(lpbi);
+
+ return TRUE;
+}
+#endif /* ICO_DRAW */
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TaskbarOperation --
+ *
+ * Management of icon display.
+ *
+ * Results:
+ * Icon is displayed or deleted.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TaskbarOperation(
+ IcoInterpInfo *icoInterpPtr,
+ IcoInfo *icoPtr,
+ int oper)
+{
+ NOTIFYICONDATAW ni;
+ WCHAR *str;
+
+ ni.cbSize = sizeof(NOTIFYICONDATAW);
+ ni.hWnd = icoInterpPtr->hwnd;
+ ni.uID = icoPtr->id;
+ ni.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
+ ni.uCallbackMessage = ICON_MESSAGE;
+ ni.hIcon = icoPtr->hIcon;
+
+ if (icoPtr->taskbar_txt != NULL) {
+ Tcl_DString dst;
+ Tcl_DStringInit(&dst);
+ str = (WCHAR *)Tcl_UtfToWCharDString(Tcl_GetString(icoPtr->taskbar_txt), TCL_INDEX_NONE, &dst);
+ wcsncpy(ni.szTip, str, (Tcl_DStringLength(&dst) + 2) / 2);
+ Tcl_DStringFree(&dst);
+ } else {
+ ni.szTip[0] = 0;
+ }
+
+ if (Shell_NotifyIconW(oper, &ni) == 1) {
+ if (oper == NIM_ADD || oper == NIM_MODIFY) {
+ icoPtr->taskbar_flags |= TASKBAR_ICON;
+ }
+ if (oper == NIM_DELETE) {
+ icoPtr->taskbar_flags &= ~TASKBAR_ICON;
+ }
+ }
+ /* Silently ignore error? */
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * NewIcon --
+ *
+ * Create icon for display in system tray.
+ *
+ * Results:
+ * Icon is created for display.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static IcoInfo *
+NewIcon(
+ Tcl_Interp *interp,
+ IcoInterpInfo *icoInterpPtr,
+ HICON hIcon)
+{
+ IcoInfo *icoPtr;
+
+ icoPtr = (IcoInfo *)ckalloc(sizeof(IcoInfo));
+ memset(icoPtr, 0, sizeof(IcoInfo));
+ icoPtr->id = ++icoInterpPtr->counter;
+ icoPtr->hIcon = hIcon;
+ icoPtr->taskbar_txt = NULL;
+ icoPtr->interp = interp;
+ icoPtr->taskbar_command = NULL;
+ icoPtr->taskbar_flags = 0;
+ icoPtr->hwndFocus = NULL;
+ icoPtr->nextPtr = icoInterpPtr->firstIcoPtr;
+ icoInterpPtr->firstIcoPtr = icoPtr;
+ return icoPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FreeIcoPtr --
+ *
+ * Delete icon and free memory.
+ *
+ * Results:
+ * Icon is removed from display.
+ *
+ * Side effects:
+ * Memory/resources freed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+FreeIcoPtr(
+ IcoInterpInfo *icoInterpPtr,
+ IcoInfo *icoPtr)
+{
+ IcoInfo *prevPtr;
+ if (icoInterpPtr->firstIcoPtr == icoPtr) {
+ icoInterpPtr->firstIcoPtr = icoPtr->nextPtr;
+ } else {
+ for (prevPtr = icoInterpPtr->firstIcoPtr; prevPtr->nextPtr != icoPtr;
+ prevPtr = prevPtr->nextPtr) {
+ /* Empty loop body. */
+ }
+ prevPtr->nextPtr = icoPtr->nextPtr;
+ }
+ if (icoPtr->taskbar_flags & TASKBAR_ICON) {
+ TaskbarOperation(icoInterpPtr, icoPtr, NIM_DELETE);
+ }
+ if (icoPtr->taskbar_txt != NULL) {
+ Tcl_DecrRefCount(icoPtr->taskbar_txt);
+ }
+ if (icoPtr->taskbar_command != NULL) {
+ Tcl_DecrRefCount(icoPtr->taskbar_command);
+ }
+ ckfree(icoPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetIcoPtr --
+ *
+ * Get pointer to icon for display.
+ *
+ * Results:
+ * Icon is obtained for display.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static IcoInfo *
+GetIcoPtr(
+ Tcl_Interp *interp,
+ IcoInterpInfo *icoInterpPtr,
+ const char *string)
+{
+ IcoInfo *icoPtr;
+ unsigned id;
+ const char *start;
+ char *end;
+
+ if (strncmp(string, "ico#", 4) != 0) {
+ goto notfound;
+ }
+ start = string + 4;
+ id = strtoul(start, &end, 10);
+ if ((end == start) || (*end != 0)) {
+ goto notfound;
+ }
+ for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) {
+ if (icoPtr->id == id) {
+ return icoPtr;
+ }
+ }
+
+notfound:
+ Tcl_AppendResult(interp, "icon \"", string,
+ "\" doesn't exist", NULL);
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetInt --
+ *
+ * Utility function for calculating buffer length.
+ *
+ * Results:
+ * Length.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GetInt(
+ long theint,
+ char *buffer,
+ size_t len)
+{
+ snprintf(buffer, len, "0x%lx", theint);
+ buffer[len - 1] = 0;
+ return (int) strlen(buffer);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetIntDec --
+ *
+ * Utility function for calculating buffer length.
+ *
+ * Results:
+ * Length.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GetIntDec(
+ long theint,
+ char *buffer,
+ size_t len)
+{
+ snprintf(buffer, len - 1, "%ld", theint);
+ buffer[len - 1] = 0;
+ return (int) strlen(buffer);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TaskbarExpandPercents --
+ *
+ * Parse strings in taskbar display.
+ *
+ * Results:
+ * Strings.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static char*
+TaskbarExpandPercents(
+ IcoInfo *icoPtr,
+ const char *msgstring,
+ WPARAM wParam,
+ LPARAM lParam,
+ char *before,
+ char *after,
+ int *aftersize)
+{
+#define SPACELEFT (*aftersize-(dst-after)-1)
+#define AFTERLEN ((*aftersize>0)?(*aftersize*2):1024)
+#define ALLOCLEN ((len>AFTERLEN)?(len*2):AFTERLEN)
+ char buffer[TCL_INTEGER_SPACE + 5];
+ char* dst;
+ dst = after;
+ while (*before) {
+ const char *ptr = before;
+ int len = 1;
+ if(*before == '%') {
+ switch(before[1]){
+ case 'M':
+ case 'm': {
+ before++;
+ len = strlen(msgstring);
+ ptr = msgstring;
+ break;
+ }
+ /* case 'W': {
+ before++;
+ len = (int)strlen(winstring);
+ ptr = winstring;
+ break;
+ }
+ */
+ case 'i': {
+ before++;
+ snprintf(buffer, sizeof(buffer) - 1, "ico#%d", icoPtr->id);
+ len = strlen(buffer);
+ ptr = buffer;
+ break;
+ }
+ case 'w': {
+ before++;
+ len = GetInt((long)wParam,buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'l': {
+ before++;
+ len = GetInt((long)lParam,buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 't': {
+ before++;
+ len = GetInt((long)GetTickCount(), buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'x': {
+ POINT pt;
+ GetCursorPos(&pt);
+ before++;
+ len = GetIntDec((long)pt.x, buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'y': {
+ POINT pt;
+ GetCursorPos(&pt);
+ before++;
+ len = GetIntDec((long)pt.y,buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'X': {
+ DWORD dw;
+ dw = GetMessagePos();
+ before++;
+ len = GetIntDec((long)LOWORD(dw),buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'Y': {
+ DWORD dw;
+ dw = GetMessagePos();
+ before++;
+ len = GetIntDec((long)HIWORD(dw),buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case 'H': {
+ before++;
+ len = GetInt(PTR2INT(icoPtr->hwndFocus), buffer, sizeof(buffer));
+ ptr = buffer;
+ break;
+ }
+ case '%': {
+ before++;
+ len = 1;
+ ptr = "%";
+ break;
+ }
+ }
+ }
+ if (SPACELEFT < len) {
+ char *newspace;
+ ptrdiff_t dist = dst - after;
+ int alloclen = ALLOCLEN;
+ newspace = (char *)ckalloc(alloclen);
+ if (dist>0)
+ memcpy(newspace, after, dist);
+ if (after && *aftersize) {
+ ckfree(after);
+ }
+ *aftersize =alloclen;
+ after = newspace;
+ dst = after + dist;
+ }
+ if (len > 0) {
+ memcpy(dst, ptr, len);
+ }
+ dst += len;
+ if ((dst-after)>(*aftersize-1)) {
+ printf("oops\n");
+ }
+ before++;
+ }
+ *dst = 0;
+ return after;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TaskbarEval --
+ *
+ * Parse mouse and keyboard events over taskbar.
+ *
+ * Results:
+ * Event processing.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TaskbarEval(
+ IcoInfo *icoPtr,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ const char *msgstring = "none";
+ char evalspace[200];
+ int evalsize = 200;
+ char *expanded;
+ int fixup = 0;
+
+ switch (lParam) {
+ case WM_MOUSEMOVE:
+ msgstring = "WM_MOUSEMOVE";
+ icoPtr->hwndFocus = GetFocus();
+ break;
+ case WM_LBUTTONDOWN:
+ msgstring = "WM_LBUTTONDOWN";
+ fixup = 1;
+ break;
+ case WM_LBUTTONUP:
+ msgstring = "WM_LBUTTONUP";
+ fixup = 1;
+ break;
+ case WM_LBUTTONDBLCLK:
+ msgstring = "WM_LBUTTONDBLCLK";
+ fixup = 1;
+ break;
+ case WM_RBUTTONDOWN:
+ msgstring = "WM_RBUTTONDOWN";
+ fixup = 1;
+ break;
+ case WM_RBUTTONUP:
+ msgstring = "WM_RBUTTONUP";
+ fixup = 1;
+ break;
+ case WM_RBUTTONDBLCLK:
+ msgstring = "WM_RBUTTONDBLCLK";
+ fixup = 1;
+ break;
+ case WM_MBUTTONDOWN:
+ msgstring = "WM_MBUTTONDOWN";
+ fixup = 1;
+ break;
+ case WM_MBUTTONUP:
+ msgstring = "WM_MBUTTONUP";
+ fixup = 1;
+ break;
+ case WM_MBUTTONDBLCLK:
+ msgstring = "WM_MBUTTONDBLCLK";
+ fixup = 1;
+ break;
+ default:
+ msgstring = "WM_NULL";
+ fixup = 0;
+ }
+ expanded = TaskbarExpandPercents(icoPtr, msgstring, wParam, lParam,
+ Tcl_GetString(icoPtr->taskbar_command), evalspace, &evalsize);
+ if (icoPtr->interp != NULL) {
+ int result;
+ HWND hwnd = NULL;
+
+ /* See http://support.microsoft.com/kb/q135788/
+ * Seems to have moved to https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/135788 */
+ if (fixup) {
+ if (icoPtr->hwndFocus != NULL && IsWindow(icoPtr->hwndFocus)) {
+ hwnd = icoPtr->hwndFocus;
+ } else {
+ Tk_Window tkwin = Tk_MainWindow(icoPtr->interp);
+ if (tkwin != NULL) {
+ hwnd = Tk_GetHWND(Tk_WindowId(tkwin));
+ }
+ }
+ if (hwnd != NULL) {
+ SetForegroundWindow(hwnd);
+ }
+ }
+
+ result = Tcl_GlobalEval(icoPtr->interp, expanded);
+
+ if (hwnd != NULL) {
+ /* See http://support.microsoft.com/kb/q135788/
+ * Seems to have moved to https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/135788 */
+ PostMessageW(hwnd, WM_NULL, 0, 0);
+ }
+ if (result != TCL_OK) {
+ char buffer[100];
+ snprintf(buffer, 100, "\n (command bound to taskbar-icon ico#%d)", icoPtr->id);
+ Tcl_AddErrorInfo(icoPtr->interp, buffer);
+ Tcl_BackgroundError(icoPtr->interp);
+ }
+ }
+ if (expanded != evalspace) {
+ ckfree(expanded);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TaskbarHandlerProc --
+ *
+ * Windows callback procedure, if ICON_MESSAGE arrives, try to execute
+ * the taskbar_command.
+ *
+ * Results:
+ * Command execution.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static LRESULT CALLBACK
+TaskbarHandlerProc(
+ HWND hwnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ static UINT msgTaskbarCreated = 0;
+ IcoInterpInfo *icoInterpPtr;
+ IcoInfo *icoPtr;
+
+ switch (message) {
+ case WM_CREATE:
+ msgTaskbarCreated = RegisterWindowMessage(TEXT("TaskbarCreated"));
+ break;
+
+ case ICON_MESSAGE:
+ for (icoInterpPtr = firstIcoInterpPtr; icoInterpPtr != NULL; icoInterpPtr = icoInterpPtr->nextPtr) {
+ if (icoInterpPtr->hwnd == hwnd) {
+ for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) {
+ if (icoPtr->id == wParam) {
+ if (icoPtr->taskbar_command != NULL) {
+ TaskbarEval(icoPtr, wParam, lParam);
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ break;
+
+ default:
+ /*
+ * Check to see if explorer has been restarted and we need to
+ * re-add our icons.
+ */
+ if (message == msgTaskbarCreated) {
+ for (icoInterpPtr = firstIcoInterpPtr; icoInterpPtr != NULL; icoInterpPtr = icoInterpPtr->nextPtr) {
+ if (icoInterpPtr->hwnd == hwnd) {
+ for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = icoPtr->nextPtr) {
+ if (icoPtr->taskbar_flags & TASKBAR_ICON) {
+ TaskbarOperation(icoInterpPtr, icoPtr, NIM_ADD);
+ }
+ }
+ break;
+ }
+ }
+ }
+ return DefWindowProc(hwnd, message, wParam, lParam);
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RegisterHandlerClass --
+ *
+ * Registers the handler window class.
+ *
+ * Results:
+ * Handler class registered.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+RegisterHandlerClass(
+ HINSTANCE hInstance)
+{
+ WNDCLASS wndclass;
+ memset(&wndclass, 0, sizeof(WNDCLASS));
+ wndclass.style = 0;
+ wndclass.lpfnWndProc = TaskbarHandlerProc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = hInstance;
+ wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wndclass.lpszMenuName = NULL;
+ wndclass.lpszClassName = HANDLER_CLASS;
+ return RegisterClass(&wndclass);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CreateTaskbarHandlerWindow --
+ *
+ * Creates a hidden window to handle taskbar messages.
+ *
+ * Results:
+ * Hidden window created.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static HWND
+CreateTaskbarHandlerWindow(void) {
+ static int registered = 0;
+ HINSTANCE hInstance = GETHINSTANCE;
+ if (!registered) {
+ if (!RegisterHandlerClass(hInstance))
+ return 0;
+ registered = 1;
+ }
+ return CreateWindow(HANDLER_CLASS, "", WS_OVERLAPPED, 0, 0,
+ CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WinIcoDestroy --
+ *
+ * Event handler to delete systray icons when interp main window
+ * is deleted, either by destroy, interp deletion or application
+ * exit.
+ *
+ * Results:
+ * Icon/window removed and memory freed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+WinIcoDestroy(
+ void *clientData,
+ XEvent *eventPtr)
+{
+ IcoInterpInfo *icoInterpPtr = (IcoInterpInfo*) clientData;
+ IcoInterpInfo *prevIcoInterpPtr;
+ IcoInfo *icoPtr;
+ IcoInfo *nextPtr;
+
+ if (eventPtr->type != DestroyNotify) {
+ return;
+ }
+
+ if (firstIcoInterpPtr == icoInterpPtr) {
+ firstIcoInterpPtr = icoInterpPtr->nextPtr;
+ } else {
+ for (prevIcoInterpPtr = firstIcoInterpPtr; prevIcoInterpPtr->nextPtr != icoInterpPtr;
+ prevIcoInterpPtr = prevIcoInterpPtr->nextPtr) {
+ /* Empty loop body. */
+ }
+ prevIcoInterpPtr->nextPtr = icoInterpPtr->nextPtr;
+ }
+
+ DestroyWindow(icoInterpPtr->hwnd);
+ for (icoPtr = icoInterpPtr->firstIcoPtr; icoPtr != NULL; icoPtr = nextPtr) {
+ nextPtr = icoPtr->nextPtr;
+ FreeIcoPtr(icoInterpPtr, icoPtr);
+ }
+ ckfree(icoInterpPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WinSystrayCmd --
+ *
+ * Main command for creating, displaying, and removing icons from taskbar.
+ *
+ * Results:
+ * Management of icon display in taskbar/system tray.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WinSystrayCmd(
+ void *clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ static const char *const cmdStrings[] = {
+ "add", "delete", "modify", NULL
+ };
+ enum { CMD_ADD, CMD_DELETE, CMD_MODIFY };
+ static const char *const optStrings[] = {
+ "-callback", "-image", "-text", NULL
+ };
+ enum { OPT_CALLBACK, OPT_IMAGE, OPT_TEXT };
+ int cmd, opt;
+
+ HICON hIcon;
+ int i;
+ IcoInterpInfo *icoInterpPtr = (IcoInterpInfo*) clientData;
+ IcoInfo *icoPtr = NULL;
+
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "command ...");
+ return TCL_ERROR;
+ }
+ if (Tcl_GetIndexFromObj(interp, objv[1], cmdStrings, "command",
+ 0, &cmd) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ switch (cmd) {
+ case CMD_ADD:
+ case CMD_MODIFY: {
+ Tcl_Obj *imageObj = NULL, *textObj = NULL, *callbackObj = NULL;
+ int optStart;
+ int oper;
+ if (cmd == CMD_ADD) {
+ optStart = 2;
+ oper = NIM_ADD;
+ } else {
+ optStart = 3;
+ oper = NIM_MODIFY;
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "id option value");
+ return TCL_ERROR;
+ }
+ icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2]));
+ if (icoPtr == NULL) {
+ return TCL_ERROR;
+ }
+ }
+ for (i = optStart; i < objc; i += 2) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], optStrings, "option",
+ 0, &opt) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (i+1 >= objc) {
+ Tcl_AppendResult(interp,
+ "missing value for option \"", Tcl_GetString(objv[i]),
+ "\"", NULL);
+ return TCL_ERROR;
+ }
+ switch (opt) {
+ case OPT_IMAGE:
+ imageObj = objv[i+1];
+ break;
+ case OPT_TEXT:
+ textObj = objv[i+1];
+ break;
+ case OPT_CALLBACK:
+ callbackObj = objv[i+1];
+ break;
+ }
+ }
+ if (cmd == CMD_ADD && imageObj == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("missing required option \"-image\"", TCL_INDEX_NONE));
+ return TCL_ERROR;
+ }
+ if (imageObj != NULL) {
+ Tk_PhotoHandle photo;
+ int width, height;
+ Tk_PhotoImageBlock block;
+
+ photo = Tk_FindPhoto(interp, Tcl_GetString(imageObj));
+ if (photo == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "image \"%s\" doesn't exist", Tcl_GetString(imageObj)));
+ return TCL_ERROR;
+ }
+ Tk_PhotoGetSize(photo, &width, &height);
+ Tk_PhotoGetImage(photo, &block);
+ hIcon = CreateIcoFromPhoto(width, height, block);
+ if (hIcon == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "failed to create an iconphoto with image \"%s\"", Tcl_GetString(imageObj)));
+ return TCL_ERROR;
+ }
+ }
+ if (cmd == CMD_ADD) {
+ icoPtr = NewIcon(interp, icoInterpPtr, hIcon);
+ } else {
+ if (imageObj != NULL) {
+ DestroyIcon(icoPtr->hIcon);
+ icoPtr->hIcon = hIcon;
+ }
+ }
+ if (callbackObj != NULL) {
+ if (icoPtr->taskbar_command != NULL) {
+ Tcl_DecrRefCount(icoPtr->taskbar_command);
+ }
+ icoPtr->taskbar_command = callbackObj;
+ Tcl_IncrRefCount(icoPtr->taskbar_command);
+ }
+ if (textObj != NULL) {
+ if (icoPtr->taskbar_txt != NULL) {
+ Tcl_DecrRefCount(icoPtr->taskbar_txt);
+ }
+ icoPtr->taskbar_txt = textObj;
+ Tcl_IncrRefCount(icoPtr->taskbar_txt);
+ }
+ TaskbarOperation(icoInterpPtr, icoPtr, oper);
+ if (cmd == CMD_ADD) {
+ char buffer[5 + TCL_INTEGER_SPACE];
+ int n;
+ n = snprintf(buffer, sizeof(buffer) - 1, "ico#%d", icoPtr->id);
+ buffer[n] = 0;
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(buffer, n));
+ }
+ return TCL_OK;
+ }
+ case CMD_DELETE:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "id");
+ return TCL_ERROR;
+ }
+ icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2]));
+ if (icoPtr == NULL) {
+ return TCL_ERROR;
+ }
+ FreeIcoPtr(icoInterpPtr, icoPtr);
+ return TCL_OK;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WinSysNotifyCmd --
+ *
+ * Main command for creating and displaying notifications/balloons from system tray.
+ *
+ * Results:
+ * Display of notifications.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WinSysNotifyCmd(
+ void *clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ IcoInterpInfo *icoInterpPtr = (IcoInterpInfo*) clientData;
+ IcoInfo *icoPtr;
+ Tcl_DString infodst;
+ Tcl_DString titledst;
+ NOTIFYICONDATAW ni;
+ char *msgtitle;
+ char *msginfo;
+
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "command ...");
+ return TCL_ERROR;
+ }
+ if (strcmp(Tcl_GetString(objv[1]), "notify") != 0) {
+ Tcl_AppendResult(interp, "unknown subcommand \"", Tcl_GetString(objv[1]),
+ "\": must be notify", NULL);
+ return TCL_ERROR;
+ }
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 2, objv, "id title detail");
+ return TCL_ERROR;
+ }
+
+ icoPtr = GetIcoPtr(interp, icoInterpPtr, Tcl_GetString(objv[2]));
+ if (icoPtr == NULL) {
+ return TCL_ERROR;
+ }
+
+ ni.cbSize = sizeof(NOTIFYICONDATAW);
+ ni.hWnd = icoInterpPtr->hwnd;
+ ni.uID = icoPtr->id;
+ ni.uFlags = NIF_INFO;
+ ni.uCallbackMessage = ICON_MESSAGE;
+ ni.hIcon = icoPtr->hIcon;
+ ni.dwInfoFlags = NIIF_INFO; /* Use a sane platform-specific icon here.*/
+
+ msgtitle = Tcl_GetString(objv[3]);
+ msginfo = Tcl_GetString(objv[4]);
+
+ /* Balloon notification for system tray icon. */
+ if (msgtitle != NULL) {
+ WCHAR *title;
+ Tcl_DStringInit(&titledst);
+ title = Tcl_UtfToWCharDString(msgtitle, TCL_INDEX_NONE, &titledst);
+ wcsncpy(ni.szInfoTitle, title, (Tcl_DStringLength(&titledst) + 2) / 2);
+ Tcl_DStringFree(&titledst);
+ }
+ if (msginfo != NULL) {
+ WCHAR *info;
+ Tcl_DStringInit(&infodst);
+ info = Tcl_UtfToWCharDString(msginfo, TCL_INDEX_NONE, &infodst);
+ wcsncpy(ni.szInfo, info, (Tcl_DStringLength(&infodst) + 2) / 2);
+ Tcl_DStringFree(&infodst);
+ }
+
+ Shell_NotifyIconW(NIM_MODIFY, &ni);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WinIcoInit --
+ *
+ * Initialize this package and create script-level commands.
+ *
+ * Results:
+ * Initialization of code.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+WinIcoInit(
+ Tcl_Interp *interp)
+{
+ IcoInterpInfo *icoInterpPtr;
+ Tk_Window mainWindow;
+
+ mainWindow = Tk_MainWindow(interp);
+ if (mainWindow == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("main window has been destroyed", TCL_INDEX_NONE));
+ return TCL_ERROR;
+ }
+
+ icoInterpPtr = (IcoInterpInfo*) ckalloc(sizeof(IcoInterpInfo));
+ icoInterpPtr->counter = 0;
+ icoInterpPtr->firstIcoPtr = NULL;
+ icoInterpPtr->hwnd = CreateTaskbarHandlerWindow();
+ icoInterpPtr->nextPtr = firstIcoInterpPtr;
+ firstIcoInterpPtr = icoInterpPtr;
+ Tcl_CreateObjCommand(interp, "::tk::systray::_systray", WinSystrayCmd,
+ icoInterpPtr, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::sysnotify::_sysnotify", WinSysNotifyCmd,
+ icoInterpPtr, NULL);
+
+ Tk_CreateEventHandler(mainWindow, StructureNotifyMask,
+ WinIcoDestroy, icoInterpPtr);
+
+ return TCL_OK;
+}
+
+/*
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index 49231d5..4e993af 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -4,9 +4,9 @@
* Contains commands for platform specific tests for the Windows
* platform.
*
- * Copyright (c) 1997 Sun Microsystems, Inc.
- * Copyright (c) 2000 Scriptics Corporation.
- * Copyright (c) 2001 ActiveState Corporation.
+ * Copyright © 1997 Sun Microsystems, Inc.
+ * Copyright © 2000 Scriptics Corporation.
+ * Copyright © 2001 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -98,10 +98,10 @@ HWND TestFindControl(HWND root, int id)
fcs.control = GetDlgItem(root, id);
if (fcs.control == NULL) {
- /* Control is not a direct child. Look in descendents */
- fcs.id = id;
- fcs.control = NULL;
- EnumChildWindows(root, TestFindControlCallback, (LPARAM) &fcs);
+ /* Control is not a direct child. Look in descendents */
+ fcs.id = id;
+ fcs.control = NULL;
+ EnumChildWindows(root, TestFindControlCallback, (LPARAM) &fcs);
}
return fcs.control;
}
@@ -280,6 +280,16 @@ TestwineventObjCmd(
static const TkStateMap messageMap[] = {
{WM_LBUTTONDOWN, "WM_LBUTTONDOWN"},
{WM_LBUTTONUP, "WM_LBUTTONUP"},
+ {WM_LBUTTONDBLCLK, "WM_LBUTTONDBLCLK"},
+ {WM_MBUTTONDOWN, "WM_MBUTTONDOWN"},
+ {WM_MBUTTONUP, "WM_MBUTTONUP"},
+ {WM_MBUTTONDBLCLK, "WM_MBUTTONDBLCLK"},
+ {WM_RBUTTONDOWN, "WM_RBUTTONDOWN"},
+ {WM_RBUTTONUP, "WM_RBUTTONUP"},
+ {WM_RBUTTONDBLCLK, "WM_RBUTTONDBLCLK"},
+ {WM_XBUTTONDOWN, "WM_XBUTTONDOWN"},
+ {WM_XBUTTONUP, "WM_XBUTTONUP"},
+ {WM_XBUTTONDBLCLK, "WM_XBUTTONDBLCLK"},
{WM_CHAR, "WM_CHAR"},
{WM_GETTEXT, "WM_GETTEXT"},
{WM_SETTEXT, "WM_SETTEXT"},
@@ -305,7 +315,7 @@ TestwineventObjCmd(
if (rest == Tcl_GetString(objv[1])) {
hwnd = FindWindowA(NULL, Tcl_GetString(objv[1]));
if (hwnd == NULL) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("no such window", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("no such window", TCL_INDEX_NONE));
return TCL_ERROR;
}
}
@@ -350,17 +360,17 @@ TestwineventObjCmd(
#if 0
GetDlgItemTextA(hwnd, id, buf, 256);
#else
- control = TestFindControl(hwnd, id);
- if (control == NULL) {
- Tcl_SetObjResult(interp,
- Tcl_ObjPrintf("Could not find control with id %d", id));
- return TCL_ERROR;
- }
- buf[0] = 0;
- SendMessageA(control, WM_GETTEXT, (WPARAM)sizeof(buf),
- (LPARAM) buf);
+ control = TestFindControl(hwnd, id);
+ if (control == NULL) {
+ Tcl_SetObjResult(interp,
+ Tcl_ObjPrintf("Could not find control with id %d", id));
+ return TCL_ERROR;
+ }
+ buf[0] = 0;
+ SendMessageA(control, WM_GETTEXT, (WPARAM)sizeof(buf),
+ (LPARAM) buf);
#endif
- Tcl_AppendResult(interp, Tcl_ExternalToUtfDString(NULL, buf, -1, &ds), NULL);
+ Tcl_AppendResult(interp, Tcl_ExternalToUtfDString(NULL, buf, TCL_INDEX_NONE, &ds), NULL);
Tcl_DStringFree(&ds);
break;
}
@@ -373,11 +383,11 @@ TestwineventObjCmd(
Tcl_ObjPrintf("Could not find control with id %d", id));
return TCL_ERROR;
}
- Tcl_UtfToExternalDString(NULL, Tcl_GetString(objv[4]), -1, &ds);
+ Tcl_UtfToExternalDString(NULL, Tcl_GetString(objv[4]), TCL_INDEX_NONE, &ds);
result = SendMessageA(control, WM_SETTEXT, 0, (LPARAM)Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
if (result == 0) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to send text to dialog: ", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to send text to dialog: ", TCL_INDEX_NONE));
AppendSystemError(interp, GetLastError());
return TCL_ERROR;
}
@@ -390,7 +400,7 @@ TestwineventObjCmd(
lParam = (LPARAM)child;
}
snprintf(buf, sizeof(buf), "%d", (int) SendMessageA(hwnd, message, wParam, lParam));
- Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE));
break;
}
default: {
@@ -398,7 +408,7 @@ TestwineventObjCmd(
snprintf(buf, sizeof(buf), "%d",
(int) SendDlgItemMessageA(hwnd, id, message, wParam, lParam));
- Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE));
break;
}
}
@@ -407,7 +417,7 @@ TestwineventObjCmd(
/*
* testfindwindow title ?class?
- * Find a Windows window using the FindWindowW API call. This takes the window
+ * Find a Windows window using the FindWindow API call. This takes the window
* title and optionally the window class and if found returns the HWND and
* raises an error if the window is not found.
* eg: testfindwindow Console TkTopLevel
@@ -433,42 +443,42 @@ TestfindwindowObjCmd(
Tcl_DStringInit(&titleString);
if (objc < 2 || objc > 3) {
- Tcl_WrongNumArgs(interp, 1, objv, "title ?class?");
- return TCL_ERROR;
+ Tcl_WrongNumArgs(interp, 1, objv, "title ?class?");
+ return TCL_ERROR;
}
Tcl_DStringInit(&titleString);
- title = Tcl_UtfToWCharDString(Tcl_GetString(objv[1]), -1, &titleString);
+ title = Tcl_UtfToWCharDString(Tcl_GetString(objv[1]), TCL_INDEX_NONE, &titleString);
if (objc == 3) {
Tcl_DStringInit(&classString);
- windowClass = Tcl_UtfToWCharDString(Tcl_GetString(objv[2]), -1, &classString);
+ windowClass = Tcl_UtfToWCharDString(Tcl_GetString(objv[2]), TCL_INDEX_NONE, &classString);
}
if (title[0] == 0)
- title = NULL;
+ title = NULL;
/* We want find a window the belongs to us and not some other process */
hwnd = NULL;
myPid = GetCurrentProcessId();
while (1) {
- DWORD pid, tid;
- hwnd = FindWindowExW(NULL, hwnd, windowClass, title);
- if (hwnd == NULL)
- break;
- tid = GetWindowThreadProcessId(hwnd, &pid);
- if (tid == 0) {
- /* Window has gone */
- hwnd = NULL;
- break;
- }
- if (pid == myPid)
- break; /* Found it */
+ DWORD pid, tid;
+ hwnd = FindWindowExW(NULL, hwnd, windowClass, title);
+ if (hwnd == NULL)
+ break;
+ tid = GetWindowThreadProcessId(hwnd, &pid);
+ if (tid == 0) {
+ /* Window has gone */
+ hwnd = NULL;
+ break;
+ }
+ if (pid == myPid)
+ break; /* Found it */
}
if (hwnd == NULL) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", TCL_INDEX_NONE));
AppendSystemError(interp, GetLastError());
r = TCL_ERROR;
} else {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(PTR2INT(hwnd)));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(PTR2INT(hwnd)));
}
Tcl_DStringFree(&titleString);
@@ -512,7 +522,7 @@ TestgetwindowinfoObjCmd(
cch = GetClassNameW((HWND)INT2PTR(hwnd), buf, cchBuf);
if (cch == 0) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to get class name: ", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to get class name: ", TCL_INDEX_NONE));
AppendSystemError(interp, GetLastError());
return TCL_ERROR;
} else {
@@ -525,7 +535,7 @@ TestgetwindowinfoObjCmd(
dictObj = Tcl_NewDictObj();
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("class", 5), classObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2),
- Tcl_NewWideIntObj(GetWindowLongPtrW((HWND)INT2PTR(hwnd), GWL_ID)));
+ Tcl_NewWideIntObj(GetWindowLongPtr((HWND)(size_t)hwnd, GWL_ID)));
cch = GetWindowTextW((HWND)INT2PTR(hwnd), buf, cchBuf);
Tcl_DStringInit(&ds);
@@ -535,11 +545,11 @@ TestgetwindowinfoObjCmd(
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6),
- Tcl_NewWideIntObj(PTR2INT(GetParent((HWND)INT2PTR(hwnd)))));
+ Tcl_NewWideIntObj(PTR2INT(GetParent((HWND)(size_t)hwnd))));
childrenObj = Tcl_NewListObj(0, NULL);
- EnumChildWindows((HWND)INT2PTR(hwnd), EnumChildrenProc, (LPARAM)childrenObj);
- Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("children", -1), childrenObj);
+ EnumChildWindows((HWND)(size_t)hwnd, EnumChildrenProc, (LPARAM)childrenObj);
+ Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("children", TCL_INDEX_NONE), childrenObj);
Tcl_SetObjResult(interp, dictObj);
return TCL_OK;
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index da92ee8..d80c017 100644
--- a/win/tkWinWindow.c
+++ b/win/tkWinWindow.c
@@ -4,7 +4,7 @@
* Xlib emulation routines for Windows related to creating, displaying
* and destroying windows.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -232,7 +232,7 @@ TkpScanWindowId(
/*
*----------------------------------------------------------------------
*
- * TkpMakeWindow --
+ * Tk_MakeWindow --
*
* Creates a Windows window object based on the current attributes of the
* specified TkWindow.
@@ -247,13 +247,14 @@ TkpScanWindowId(
*/
Window
-TkpMakeWindow(
- TkWindow *winPtr,
+Tk_MakeWindow(
+ Tk_Window tkwin,
Window parent)
{
HWND parentWin;
int style;
HWND hwnd;
+ TkWindow *winPtr = (TkWindow *)tkwin;
if (parent != None) {
parentWin = Tk_GetHWND(parent);
@@ -764,33 +765,6 @@ XChangeWindowAttributes(
/*
*----------------------------------------------------------------------
*
- * XReparentWindow --
- *
- * TODO: currently placeholder to satisfy Xlib stubs.
- *
- * Results:
- * None.
- *
- * Side effects:
- * TODO.
- *
- *----------------------------------------------------------------------
- */
-
-int
-XReparentWindow(
- Display *display,
- Window w,
- Window parent,
- int x,
- int y)
-{
- return BadWindow;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkWinSetWindowPos --
*
* Adjust the stacking order of a window relative to a second window (or
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 60554c4..7938539 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -6,16 +6,20 @@
* the "wm" command and passes geometry information to the window
* manager.
*
- * Copyright (c) 1995-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 Scriptics Corporation.
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkWinInt.h"
+#include <windows.h>
+#include <wtypes.h>
+#include <shobjidl.h>
+#include <shlguid.h>
#include <shellapi.h>
-
+#include "tkWinIco.h"
/*
* These next two defines are only valid on Win2K/XP+.
*/
@@ -66,7 +70,7 @@ typedef struct ProtocolHandler {
} ProtocolHandler;
#define HANDLER_SIZE(cmdLength) \
- ((Tk_Offset(ProtocolHandler, command) + 1) + cmdLength)
+ (offsetof(ProtocolHandler, command) + 1 + cmdLength)
/*
* Helper type passed via lParam to TkWmStackorderToplevelEnumProc
@@ -77,58 +81,6 @@ typedef struct TkWmStackorderToplevelPair {
TkWindow **windowPtr;
} TkWmStackorderToplevelPair;
-/*
- * This structure represents the contents of a icon, in terms of its image.
- * The HICON is an internal Windows format. Most of these icon-specific
- * structures originated with the Winico extension. We stripped out unused
- * parts of that code, and integrated the code more naturally with Tcl.
- */
-
-typedef struct {
- UINT Width, Height, Colors; /* Width, Height and bpp */
- LPBYTE lpBits; /* Ptr to DIB bits */
- DWORD dwNumBytes; /* How many bytes? */
- LPBITMAPINFO lpbi; /* Ptr to header */
- LPBYTE lpXOR; /* Ptr to XOR image bits */
- LPBYTE lpAND; /* Ptr to AND image bits */
- HICON hIcon; /* DAS ICON */
-} ICONIMAGE, *LPICONIMAGE;
-
-/*
- * This structure is how we represent a block of the above items. We will
- * reallocate these structures according to how many images they need to
- * contain.
- */
-
-typedef struct {
- int nNumImages; /* How many images? */
- ICONIMAGE IconImages[1]; /* Image entries */
-} BlockOfIconImages, *BlockOfIconImagesPtr;
-
-/*
- * These two structures are used to read in icons from an 'icon directory'
- * (i.e. the contents of a .icr file, say). We only use these structures
- * temporarily, since we copy the information we want into a
- * BlockOfIconImages.
- */
-
-typedef struct {
- BYTE bWidth; /* Width of the image */
- BYTE bHeight; /* Height of the image (times 2) */
- BYTE bColorCount; /* Number of colors in image (0 if >=8bpp) */
- BYTE bReserved; /* Reserved */
- WORD wPlanes; /* Color Planes */
- WORD wBitCount; /* Bits per pixel */
- DWORD dwBytesInRes; /* How many bytes in this resource? */
- DWORD dwImageOffset; /* Where in the file is this image */
-} ICONDIRENTRY, *LPICONDIRENTRY;
-
-typedef struct {
- WORD idReserved; /* Reserved */
- WORD idType; /* Resource type (1 for icons) */
- WORD idCount; /* How many images? */
- ICONDIRENTRY idEntries[1]; /* The entries for each image */
-} ICONDIR, *LPICONDIR;
/*
* A pointer to one of these structures is associated with each toplevel.
@@ -259,7 +211,7 @@ typedef struct TkWmInfo {
*/
TkWindow **cmapList; /* Array of window with private colormaps. */
- int cmapCount; /* Number of windows in array. */
+ Tcl_Size cmapCount; /* Number of windows in array. */
/*
* Miscellaneous information.
@@ -267,7 +219,7 @@ typedef struct TkWmInfo {
ProtocolHandler *protPtr; /* First in list of protocol handlers for this
* window (NULL means none). */
- int cmdArgc; /* Number of elements in cmdArgv below. */
+ Tcl_Size cmdArgc; /* Number of elements in cmdArgv below. */
const char **cmdArgv; /* Array of strings to store in the WM_COMMAND
* property. NULL means nothing available. */
char *clientMachine; /* String to store in WM_CLIENT_MACHINE
@@ -358,13 +310,13 @@ typedef struct TkWmInfo {
* of top-level windows.
*/
-static void TopLevelReqProc(void *, Tk_Window);
+static void TopLevelReqProc(void *dummy, Tk_Window tkwin);
static void RemapWindows(TkWindow *winPtr, HWND parentHWND);
static const Tk_GeomMgr wmMgrType = {
"wm", /* name */
TopLevelReqProc, /* requestProc */
- NULL, /* lostSlaveProc */
+ NULL, /* lostContentProc */
};
typedef struct {
@@ -398,6 +350,16 @@ static int initialized; /* Flag indicating whether module has been
TCL_DECLARE_MUTEX(winWmMutex)
/*
+ * The following records the "TaskbarButtonCreated" message ID
+ * for overlay icons.
+ */
+
+static UINT TaskbarButtonCreatedMessageId = WM_NULL;
+
+/* Reference to taskbarlist API for overlay icons. */
+ITaskbarList3 *ptbl;
+
+/*
* Forward declarations for functions defined in this file:
*/
@@ -448,283 +410,105 @@ static void FreeIconBlock(BlockOfIconImagesPtr lpIR);
static void DecrIconRefCount(WinIconPtr titlebaricon);
static int WmAspectCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmAttributesCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmClientCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmColormapwindowsCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmCommandCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmDeiconifyCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmFocusmodelCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmForgetCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmFrameCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmGeometryCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmGridCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmGroupCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
+ Tcl_Obj *const objv[]);
+static int WmIconbadgeCmd(Tk_Window tkwin,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmIconbitmapCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmIconifyCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmIconmaskCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmIconnameCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmIconphotoCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmIconpositionCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmIconwindowCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmManageCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmMaxsizeCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmMinsizeCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmOverrideredirectCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmPositionfromCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmProtocolCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmResizableCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmSizefromCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmStackorderCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmStateCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmTitleCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmTransientCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static int WmWithdrawCmd(Tk_Window tkwin,
- TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ TkWindow *winPtr, Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[]);
static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr);
-
-/*
- * Used in BytesPerLine
- */
-
-#define WIDTHBYTES(bits) ((((bits) + 31)>>5)<<2)
-
-/*
- *----------------------------------------------------------------------
- *
- * DIBNumColors --
- *
- * Calculates the number of entries in the color table, given by LPSTR
- * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code.
- *
- * Results:
- * WORD - Number of entries in the color table.
- *
- *----------------------------------------------------------------------
- */
-
-static WORD
-DIBNumColors(
- LPSTR lpbi)
-{
- WORD wBitCount;
- DWORD dwClrUsed;
-
- dwClrUsed = ((LPBITMAPINFOHEADER) lpbi)->biClrUsed;
-
- if (dwClrUsed) {
- return (WORD) dwClrUsed;
- }
-
- wBitCount = ((LPBITMAPINFOHEADER) lpbi)->biBitCount;
-
- switch (wBitCount) {
- case 1:
- return 2;
- case 4:
- return 16;
- case 8:
- return 256;
- default:
- return 0;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * PaletteSize --
- *
- * Calculates the number of bytes in the color table, as given by LPSTR
- * lpbi - pointer to the CF_DIB memory block. Used by titlebar icon code.
- *
- * Results:
- * Number of bytes in the color table
- *
- *----------------------------------------------------------------------
- */
-static WORD
-PaletteSize(
- LPSTR lpbi)
-{
- return (WORD) (DIBNumColors(lpbi) * sizeof(RGBQUAD));
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * FindDIBits --
- *
- * Locate the image bits in a CF_DIB format DIB, as given by LPSTR lpbi -
- * pointer to the CF_DIB memory block. Used by titlebar icon code.
- *
- * Results:
- * pointer to the image bits
- *
- * Side effects: None
- *
- *
- *----------------------------------------------------------------------
- */
-
-static LPSTR
-FindDIBBits(
- LPSTR lpbi)
-{
- return lpbi + *((LPDWORD) lpbi) + PaletteSize(lpbi);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * BytesPerLine --
- *
- * Calculates the number of bytes in one scan line, as given by
- * LPBITMAPINFOHEADER lpBMIH - pointer to the BITMAPINFOHEADER that
- * begins the CF_DIB block. Used by titlebar icon code.
- *
- * Results:
- * number of bytes in one scan line (DWORD aligned)
- *
- *----------------------------------------------------------------------
- */
-
-static DWORD
-BytesPerLine(
- LPBITMAPINFOHEADER lpBMIH)
-{
- return WIDTHBYTES(lpBMIH->biWidth * lpBMIH->biPlanes * lpBMIH->biBitCount);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * AdjustIconImagePointers --
- *
- * Adjusts internal pointers in icon resource struct, as given by
- * LPICONIMAGE lpImage - the resource to handle. Used by titlebar icon
- * code.
- *
- * Results:
- * BOOL - TRUE for success, FALSE for failure
- *
- *----------------------------------------------------------------------
- */
-
-static BOOL
-AdjustIconImagePointers(
- LPICONIMAGE lpImage)
-{
- /*
- * Sanity check.
- */
-
- if (lpImage == NULL) {
- return FALSE;
- }
-
- /*
- * BITMAPINFO is at beginning of bits.
- */
-
- lpImage->lpbi = (LPBITMAPINFO) lpImage->lpBits;
-
- /*
- * Width - simple enough.
- */
-
- lpImage->Width = lpImage->lpbi->bmiHeader.biWidth;
-
- /*
- * Icons are stored in funky format where height is doubled so account for
- * that.
- */
-
- lpImage->Height = (lpImage->lpbi->bmiHeader.biHeight)/2;
-
- /*
- * How many colors?
- */
-
- lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes
- * lpImage->lpbi->bmiHeader.biBitCount;
-
- /*
- * XOR bits follow the header and color table.
- */
-
- lpImage->lpXOR = (LPBYTE) FindDIBBits((LPSTR) lpImage->lpbi);
-
- /*
- * AND bits follow the XOR bits.
- */
-
- lpImage->lpAND = lpImage->lpXOR +
- lpImage->Height*BytesPerLine((LPBITMAPINFOHEADER) lpImage->lpbi);
- return TRUE;
-}
/*
*----------------------------------------------------------------------
@@ -1004,7 +788,7 @@ WinSetIcon(
if (!initialized) {
if (InitWindowClass(titlebaricon) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "Unable to set icon", -1));
+ "Unable to set icon", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "WM", "ICON", "FAILED", NULL);
return TCL_ERROR;
}
@@ -1061,7 +845,7 @@ WinSetIcon(
hwnd = wmPtr->wrapper;
if (hwnd == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "Can't set icon; window has no wrapper.", -1));
+ "Can't set icon; window has no wrapper.", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "WM", "ICON", "WRAPPER", NULL);
return TCL_ERROR;
}
@@ -1242,7 +1026,7 @@ ReadIconFromFile(
return NULL;
}
Tcl_DStringInit(&ds2);
- res = (DWORD *)SHGetFileInfoW(Tcl_UtfToWCharDString(file, -1, &ds2), 0, &sfiSM,
+ res = (DWORD *)SHGetFileInfoW(Tcl_UtfToWCharDString(file, TCL_INDEX_NONE, &ds2), 0, &sfiSM,
sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_ICON);
Tcl_DStringFree(&ds);
@@ -1298,6 +1082,75 @@ ReadIconFromFile(
return titlebaricon;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * AdjustIconImagePointers --
+ *
+ * Adjusts internal pointers in icon resource struct, as given by
+ * LPICONIMAGE lpImage - the resource to handle. Used by titlebar icon
+ * code.
+ *
+ * Results:
+ * BOOL - TRUE for success, FALSE for failure
+ *
+ *----------------------------------------------------------------------
+ */
+
+static BOOL
+AdjustIconImagePointers(
+ LPICONIMAGE lpImage)
+{
+ /*
+ * Sanity check.
+ */
+
+ if (lpImage == NULL) {
+ return FALSE;
+ }
+
+ /*
+ * BITMAPINFO is at beginning of bits.
+ */
+
+ lpImage->lpbi = (LPBITMAPINFO) lpImage->lpBits;
+
+ /*
+ * Width - simple enough.
+ */
+
+ lpImage->Width = lpImage->lpbi->bmiHeader.biWidth;
+
+ /*
+ * Icons are stored in funky format where height is doubled so account for
+ * that.
+ */
+
+ lpImage->Height = (lpImage->lpbi->bmiHeader.biHeight)/2;
+
+ /*
+ * How many colors?
+ */
+
+ lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes
+ * lpImage->lpbi->bmiHeader.biBitCount;
+
+ /*
+ * XOR bits follow the header and color table.
+ */
+
+ lpImage->lpXOR = (LPBYTE) FindDIBBits((LPSTR) lpImage->lpbi);
+
+ /*
+ * AND bits follow the XOR bits.
+ */
+
+ lpImage->lpAND = lpImage->lpXOR +
+ lpImage->Height*BytesPerLine((LPBITMAPINFOHEADER) lpImage->lpbi);
+ return TRUE;
+}
+
/*
*----------------------------------------------------------------------
*
@@ -1596,7 +1449,7 @@ ReadIconOrCursorFromFile(
lpIR->nNumImages = ReadICOHeader(channel);
if (lpIR->nNumImages == -1) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("Invalid file header", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("Invalid file header", TCL_INDEX_NONE));
Tcl_Close(NULL, channel);
ckfree(lpIR);
return NULL;
@@ -1666,7 +1519,7 @@ ReadIconOrCursorFromFile(
*/
dwBytesRead = Tcl_Read(channel, (char *)lpIR->IconImages[i].lpBits,
- (int)lpIDE[i].dwBytesInRes);
+ lpIDE[i].dwBytesInRes);
if (dwBytesRead != lpIDE[i].dwBytesInRes) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"error reading file: %s", Tcl_PosixError(interp)));
@@ -1679,7 +1532,7 @@ ReadIconOrCursorFromFile(
if (!AdjustIconImagePointers(&lpIR->IconImages[i])) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "Error converting to internal format", -1));
+ "Error converting to internal format", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "WM", "ICON", "FORMAT", NULL);
goto readError;
}
@@ -1876,6 +1729,12 @@ TkWinWmCleanup(
}
tsdPtr->initialized = 0;
+ /*
+ * COM library cleanup.
+ */
+
+ CoUninitialize();
+
UnregisterClassW(TK_WIN_TOPLEVEL_CLASS_NAME, hInstance);
}
@@ -1992,6 +1851,7 @@ UpdateWrapper(
WINDOWPLACEMENT place;
HICON hSmallIcon = NULL;
HICON hBigIcon = NULL;
+ HRESULT hr;
Tcl_DString titleString;
int *childStateInfo = NULL;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
@@ -2118,7 +1978,7 @@ UpdateWrapper(
tsdPtr->createWindow = winPtr;
Tcl_DStringInit(&titleString);
Tcl_UtfToWCharDString(((wmPtr->title != NULL) ?
- wmPtr->title : winPtr->nameUid), -1, &titleString);
+ wmPtr->title : winPtr->nameUid), TCL_INDEX_NONE, &titleString);
wmPtr->wrapper = CreateWindowExW(wmPtr->exStyle,
TK_WIN_TOPLEVEL_CLASS_NAME,
@@ -2320,6 +2180,35 @@ UpdateWrapper(
} else if (focusHWND) {
SetFocus(focusHWND);
}
+
+ /*
+ * Initialize hooks for overlay icon.
+ * Start with TaskbarButtonCreated message.
+ */
+
+ TaskbarButtonCreatedMessageId = RegisterWindowMessage(TEXT("TaskbarButtonCreated"));
+
+ /*
+ * In case the application is run elevated, allow the
+ * TaskbarButtonCreated message through.
+ */
+
+ ChangeWindowMessageFilter(TaskbarButtonCreatedMessageId, MSGFLT_ADD);
+
+ /*
+ * Load COM library for icon overlay.
+ */
+
+ hr = CoInitialize(0);
+ if (SUCCEEDED(hr)) {
+ hr = CoCreateInstance(&CLSID_TaskbarList, NULL,
+ CLSCTX_INPROC_SERVER, &IID_ITaskbarList3, (void **) &ptbl);
+ if (FAILED(hr)) {
+ printf("Unable to initialize ITaskbarList3 API");
+ ptbl->lpVtbl->Release(NULL);
+ ptbl = NULL;
+ }
+ }
}
/*
@@ -2769,7 +2658,7 @@ Tk_WmObjCmd(
static const char *const optionStrings[] = {
"aspect", "attributes", "client", "colormapwindows",
"command", "deiconify", "focusmodel", "forget", "frame",
- "geometry", "grid", "group", "iconbitmap",
+ "geometry", "grid", "group", "iconbadge", "iconbitmap",
"iconify", "iconmask", "iconname",
"iconphoto", "iconposition",
"iconwindow", "manage", "maxsize", "minsize", "overrideredirect",
@@ -2781,7 +2670,7 @@ Tk_WmObjCmd(
WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS,
WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FORGET,
WMOPT_FRAME,
- WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP, WMOPT_ICONBITMAP,
+ WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP, WMOPT_ICONBADGE, WMOPT_ICONBITMAP,
WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME,
WMOPT_ICONPHOTO, WMOPT_ICONPOSITION,
WMOPT_ICONWINDOW, WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE,
@@ -2791,7 +2680,7 @@ Tk_WmObjCmd(
WMOPT_WITHDRAW
};
int index;
- int length;
+ Tcl_Size length;
const char *argv1;
TkWindow *winPtr, **winPtrPtr = &winPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -2874,6 +2763,8 @@ Tk_WmObjCmd(
return WmGridCmd(tkwin, winPtr, interp, objc, objv);
case WMOPT_GROUP:
return WmGroupCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONBADGE:
+ return WmIconbadgeCmd(tkwin, winPtr, interp, objc, objv);
case WMOPT_ICONBITMAP:
return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv);
case WMOPT_ICONIFY:
@@ -2942,7 +2833,7 @@ WmAspectCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -2957,10 +2848,10 @@ WmAspectCmd(
if (wmPtr->sizeHintsFlags & PAspect) {
Tcl_Obj *results[4];
- results[0] = Tcl_NewIntObj(wmPtr->minAspect.x);
- results[1] = Tcl_NewIntObj(wmPtr->minAspect.y);
- results[2] = Tcl_NewIntObj(wmPtr->maxAspect.x);
- results[3] = Tcl_NewIntObj(wmPtr->maxAspect.y);
+ results[0] = Tcl_NewWideIntObj(wmPtr->minAspect.x);
+ results[1] = Tcl_NewWideIntObj(wmPtr->minAspect.y);
+ results[2] = Tcl_NewWideIntObj(wmPtr->maxAspect.x);
+ results[3] = Tcl_NewWideIntObj(wmPtr->maxAspect.y);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, results));
}
return TCL_OK;
@@ -2976,7 +2867,7 @@ WmAspectCmd(
}
if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) || (denom2 <= 0)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "aspect number can't be <= 0", -1));
+ "aspect number can't be <= 0", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "VALUE", "ASPECT", NULL);
return TCL_ERROR;
}
@@ -3012,14 +2903,14 @@ WmAttributesCmd(
Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
LONG style, exStyle, styleBit, *stylePtr = NULL;
const char *string;
int boolValue;
- int i, length;
+ Tcl_Size i, length;
int config_fullscreen = 0, updatewrapper = 0;
int fullscreen_attr_changed = 0, fullscreen_attr = 0;
@@ -3040,26 +2931,26 @@ WmAttributesCmd(
if (objc == 3) {
Tcl_Obj *objPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewStringObj("-alpha", -1));
+ Tcl_NewStringObj("-alpha", TCL_INDEX_NONE));
Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewDoubleObj(wmPtr->alpha));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewStringObj("-transparentcolor", -1));
+ Tcl_NewStringObj("-transparentcolor", TCL_INDEX_NONE));
Tcl_ListObjAppendElement(NULL, objPtr,
wmPtr->crefObj ? wmPtr->crefObj : Tcl_NewObj());
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewStringObj("-disabled", -1));
+ Tcl_NewStringObj("-disabled", TCL_INDEX_NONE));
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewBooleanObj(style & WS_DISABLED));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewStringObj("-fullscreen", -1));
+ Tcl_NewStringObj("-fullscreen", TCL_INDEX_NONE));
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewBooleanObj(wmPtr->flags & WM_FULLSCREEN));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewStringObj("-toolwindow", -1));
+ Tcl_NewStringObj("-toolwindow", TCL_INDEX_NONE));
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewBooleanObj(exStyle & WS_EX_TOOLWINDOW));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewStringObj("-topmost", -1));
+ Tcl_NewStringObj("-topmost", TCL_INDEX_NONE));
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewBooleanObj(exStyle & WS_EX_TOPMOST));
Tcl_SetObjResult(interp, objPtr);
@@ -3101,7 +2992,7 @@ WmAttributesCmd(
}
} else if (i == 3) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad attribute \"%s\": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost",
+ "bad attribute \"%s\": must be -alpha, -disabled, -fullscreen, -toolwindow, -topmost, or -transparentcolor",
string));
Tcl_SetErrorCode(interp, "TK", "WM", "ATTR", "UNRECOGNIZED", NULL);
return TCL_ERROR;
@@ -3200,8 +3091,8 @@ WmAttributesCmd(
}
if (config_fullscreen) {
if (objc == 4) {
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- wmPtr->flags & WM_FULLSCREEN));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
+ (wmPtr->flags & WM_FULLSCREEN) != 0));
} else {
fullscreen_attr_changed = 1;
fullscreen_attr = boolValue;
@@ -3311,12 +3202,12 @@ WmClientCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
+ Tcl_Size length;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
@@ -3325,7 +3216,7 @@ WmClientCmd(
if (objc == 3) {
if (wmPtr->clientMachine != NULL) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(wmPtr->clientMachine, -1));
+ Tcl_NewStringObj(wmPtr->clientMachine, TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -3353,7 +3244,7 @@ WmClientCmd(
!= 0) {
XSetWMClientMachine(winPtr->display, winPtr->window,
&textProp);
- XFree((char *)textProp.value);
+ XFree(textProp.value);
}
}
return TCL_OK;
@@ -3381,12 +3272,12 @@ WmColormapwindowsCmd(
Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
TkWindow **cmapList, *winPtr2, **winPtr2Ptr = &winPtr2;
- int i, windowObjc;
+ Tcl_Size i, windowObjc;
int gotToplevel;
Tcl_Obj **windowObjv, *resultObj;
@@ -3403,7 +3294,7 @@ WmColormapwindowsCmd(
break;
}
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj((Tk_Window) wmPtr->cmapList[i]));
+ Tk_NewWindowObj((Tk_Window) wmPtr->cmapList[i]));
}
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
@@ -3476,12 +3367,12 @@ WmCommandCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int cmdArgc;
+ Tcl_Size cmdArgc;
const char **cmdArgv;
if ((objc != 3) && (objc != 4)) {
@@ -3492,7 +3383,7 @@ WmCommandCmd(
if (wmPtr->cmdArgv != NULL) {
char *merged = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv);
- Tcl_SetObjResult(interp, Tcl_NewStringObj(merged, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(merged, TCL_INDEX_NONE));
ckfree(merged);
}
return TCL_OK;
@@ -3545,7 +3436,7 @@ WmDeiconifyCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -3597,7 +3488,7 @@ WmFocusmodelCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -3615,7 +3506,7 @@ WmFocusmodelCmd(
}
if (objc == 3) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- wmPtr->hints.input ? "passive" : "active", -1));
+ wmPtr->hints.input ? "passive" : "active", TCL_INDEX_NONE));
return TCL_OK;
}
@@ -3653,7 +3544,7 @@ WmForgetCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel or Frame to work with */
TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */
- TCL_UNUSED(int), /* Number of arguments. */
+ TCL_UNUSED(Tcl_Size), /* Number of arguments. */
TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */
{
Tk_Window frameWin = (Tk_Window) winPtr;
@@ -3701,7 +3592,7 @@ WmFrameCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -3720,7 +3611,7 @@ WmFrameCmd(
hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) winPtr));
}
snprintf(buf, sizeof(buf), "0x%" TCL_Z_MODIFIER "x", (size_t)hwnd);
- Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE));
return TCL_OK;
}
@@ -3746,7 +3637,7 @@ WmGeometryCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -3814,7 +3705,7 @@ WmGridCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -3829,10 +3720,10 @@ WmGridCmd(
if (wmPtr->sizeHintsFlags & PBaseSize) {
Tcl_Obj *results[4];
- results[0] = Tcl_NewIntObj(wmPtr->reqGridWidth);
- results[1] = Tcl_NewIntObj(wmPtr->reqGridHeight);
- results[2] = Tcl_NewIntObj(wmPtr->widthInc);
- results[3] = Tcl_NewIntObj(wmPtr->heightInc);
+ results[0] = Tcl_NewWideIntObj(wmPtr->reqGridWidth);
+ results[1] = Tcl_NewWideIntObj(wmPtr->reqGridHeight);
+ results[2] = Tcl_NewWideIntObj(wmPtr->widthInc);
+ results[3] = Tcl_NewWideIntObj(wmPtr->heightInc);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, results));
}
return TCL_OK;
@@ -3861,25 +3752,25 @@ WmGridCmd(
}
if (reqWidth < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "baseWidth can't be < 0", -1));
+ "baseWidth can't be < 0", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL);
return TCL_ERROR;
}
if (reqHeight < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "baseHeight can't be < 0", -1));
+ "baseHeight can't be < 0", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL);
return TCL_ERROR;
}
if (widthInc <= 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "widthInc can't be <= 0", -1));
+ "widthInc can't be <= 0", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL);
return TCL_ERROR;
}
if (heightInc <= 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "heightInc can't be <= 0", -1));
+ "heightInc can't be <= 0", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "VALUE", "GRID", NULL);
return TCL_ERROR;
}
@@ -3912,13 +3803,13 @@ WmGroupCmd(
Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
const char *argv3;
- int length;
+ Tcl_Size length;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?");
@@ -3926,7 +3817,7 @@ WmGroupCmd(
}
if (objc == 3) {
if (wmPtr->hints.flags & WindowGroupHint) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -3956,6 +3847,117 @@ WmGroupCmd(
/*
*----------------------------------------------------------------------
*
+ * WmIconbadgeCmd --
+ *
+ * This function is invoked to process the "wm iconbadge" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmIconbadgeCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TCL_UNUSED(TkWindow *), /* Toplevel to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ Tcl_Size objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+ HWND hwnd;
+ Tk_PhotoHandle photo;
+ Tk_PhotoImageBlock block;
+ int width, height;
+ HICON overlayicon;
+ int badgenumber;
+ char *badgestring = NULL;
+ char photoname[4096];
+ LPCWSTR string;
+ HRESULT hr;
+ Tk_Window badgewindow;
+ WmInfo *wmPtr;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window badge");
+ return TCL_ERROR;
+ }
+
+ /*
+ * Parse args, get native wrapper window, and determine image.
+ */
+
+ badgewindow = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
+ wmPtr = ((TkWindow *) badgewindow)->wmInfoPtr;
+ hwnd = wmPtr->wrapper;
+ badgestring = Tcl_GetString(objv[3]);
+
+ badgenumber = atoi(badgestring);
+ if (badgenumber > 9) {
+ strcpy(photoname, "::tk::icons::9plus-badge");
+ } else {
+ strcpy(photoname, "::tk::icons::");
+ strcat(photoname, badgestring);
+ strcat(photoname, "-badge");
+ }
+
+ /*
+ * If badgestring is empty string, remove icon.
+ */
+
+ if (strcmp("", badgestring) == 0) {
+ ptbl->lpVtbl->SetOverlayIcon(ptbl, hwnd, NULL, NULL);
+ return TCL_OK;
+ }
+
+ /*
+ * If photo does not exist, return error. This means we do not have
+ * to test for decimal or negative values; no photo for such values
+ * is present.
+ */
+
+ photo = Tk_FindPhoto(interp, photoname);
+ if (photo == NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "can't use \"%s\" as icon badge", badgestring));
+ return TCL_ERROR;
+ }
+
+ /*
+ * We have found the image. Convert to icon.
+ */
+
+ Tk_PhotoGetSize(photo, &width, &height);
+ Tk_PhotoGetImage(photo, &block);
+
+ overlayicon = CreateIcoFromPhoto(width, height, block);
+ if (overlayicon == NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("Failed to create badge icon", TCL_INDEX_NONE));
+ return TCL_ERROR;
+ }
+
+ /*
+ * Place overlay icon on taskbar icon.
+ */
+
+ string = L"Alert";
+ hr = ptbl->lpVtbl->SetOverlayIcon(ptbl, hwnd, overlayicon, string);
+ if (hr != S_OK) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("Failed to create badge icon", TCL_INDEX_NONE));
+ return TCL_ERROR;
+ }
+ DestroyIcon(overlayicon);
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* WmIconbitmapCmd --
*
* This function is invoked to process the "wm iconbitmap" Tcl command.
@@ -3975,7 +3977,7 @@ WmIconbitmapCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4111,7 +4113,7 @@ WmIconifyCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4123,7 +4125,7 @@ WmIconifyCmd(
if (winPtr->flags & TK_EMBEDDED) {
if (!SendMessageW(wmPtr->wrapper, TK_ICONIFY, 0, 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: the container does not support the request",
+ "can't iconify \"%s\": the container does not support the request",
winPtr->pathName));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL);
return TCL_ERROR;
@@ -4146,7 +4148,7 @@ WmIconifyCmd(
}
if (wmPtr->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't iconify %s: it is an icon for %s",
+ "can't iconify \"%s\": it is an icon for \"%s\"",
winPtr->pathName, Tk_PathName(wmPtr->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL);
return TCL_ERROR;
@@ -4177,7 +4179,7 @@ WmIconmaskCmd(
Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4235,12 +4237,12 @@ WmIconnameCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
+ Tcl_Size length;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?");
@@ -4286,22 +4288,18 @@ WmIconphotoCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */
Tk_PhotoHandle photo;
Tk_PhotoImageBlock block;
- int i;
- int width, height, idx, bufferSize, startObj = 3;
- union {unsigned char *ptr; void *voidPtr;} bgraPixel;
- union {unsigned char *ptr; void *voidPtr;} bgraMask;
+ Tcl_Size i;
+ int width, height, startObj = 3;
BlockOfIconImagesPtr lpIR;
WinIconPtr titlebaricon = NULL;
HICON hIcon;
unsigned size;
- BITMAPINFO bmInfo;
- ICONINFO iconInfo;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -4345,95 +4343,16 @@ WmIconphotoCmd(
}
memset(lpIR, 0, size);
- lpIR->nNumImages = objc - startObj;
-
for (i = startObj; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
Tk_PhotoGetSize(photo, &width, &height);
Tk_PhotoGetImage(photo, &block);
- /*
- * Don't use CreateIcon to create the icon, as it requires color
- * bitmap data in device-dependent format. Instead we use
- * CreateIconIndirect which takes device-independent bitmaps and
- * converts them as required. Initialise icon info structure.
- */
-
- memset(&iconInfo, 0, sizeof(iconInfo));
- iconInfo.fIcon = TRUE;
-
- /*
- * Create device-independent color bitmap.
- */
-
- memset(&bmInfo, 0, sizeof(bmInfo));
- bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- bmInfo.bmiHeader.biWidth = width;
- bmInfo.bmiHeader.biHeight = -height;
- bmInfo.bmiHeader.biPlanes = 1;
- bmInfo.bmiHeader.biBitCount = 32;
- bmInfo.bmiHeader.biCompression = BI_RGB;
-
- iconInfo.hbmColor = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS,
- &bgraPixel.voidPtr, NULL, 0);
- if (!iconInfo.hbmColor) {
- ckfree(lpIR);
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "failed to create an iconphoto with image \"%s\"",
- Tcl_GetString(objv[i])));
- Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "IMAGE", NULL);
- return TCL_ERROR;
- }
-
- /*
- * Convert the photo image data into BGRA format (RGBQUAD).
- */
-
- bufferSize = height * width * 4;
- for (idx = 0 ; idx < bufferSize ; idx += 4) {
- bgraPixel.ptr[idx] = block.pixelPtr[idx+2];
- bgraPixel.ptr[idx+1] = block.pixelPtr[idx+1];
- bgraPixel.ptr[idx+2] = block.pixelPtr[idx+0];
- bgraPixel.ptr[idx+3] = block.pixelPtr[idx+3];
- }
-
- /*
- * Create a dummy mask bitmap. The contents of this don't appear to
- * matter, as CreateIconIndirect will setup the icon mask based on the
- * alpha channel in our color bitmap.
- */
-
- bmInfo.bmiHeader.biBitCount = 1;
-
- iconInfo.hbmMask = CreateDIBSection(NULL, &bmInfo, DIB_RGB_COLORS,
- &bgraMask.voidPtr, NULL, 0);
- if (!iconInfo.hbmMask) {
- DeleteObject(iconInfo.hbmColor);
- ckfree(lpIR);
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "failed to create mask bitmap for \"%s\"",
- Tcl_GetString(objv[i])));
- Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "MASK", NULL);
- return TCL_ERROR;
- }
-
- memset(bgraMask.ptr, 0, width*height/8);
-
- /*
- * Create an icon from the bitmaps.
- */
-
- hIcon = CreateIconIndirect(&iconInfo);
- DeleteObject(iconInfo.hbmColor);
- DeleteObject(iconInfo.hbmMask);
+ hIcon = CreateIcoFromPhoto(width, height, block);
if (hIcon == NULL) {
- /*
- * XXX should free up created icons.
- */
-
- ckfree(lpIR);
+ FreeIconBlock(lpIR);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "failed to create icon for \"%s\"",
+ "failed to create an iconphoto with image \"%s\"",
Tcl_GetString(objv[i])));
Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "ICON", NULL);
return TCL_ERROR;
@@ -4442,6 +4361,7 @@ WmIconphotoCmd(
lpIR->IconImages[i-startObj].Height = height;
lpIR->IconImages[i-startObj].Colors = 4;
lpIR->IconImages[i-startObj].hIcon = hIcon;
+ lpIR->nNumImages++;
}
titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance));
@@ -4458,6 +4378,8 @@ WmIconphotoCmd(
return TCL_OK;
}
+
+
/*
*----------------------------------------------------------------------
*
@@ -4480,7 +4402,7 @@ WmIconpositionCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4494,8 +4416,8 @@ WmIconpositionCmd(
if (wmPtr->hints.flags & IconPositionHint) {
Tcl_Obj *results[2];
- results[0] = Tcl_NewIntObj(wmPtr->hints.icon_x);
- results[1] = Tcl_NewIntObj(wmPtr->hints.icon_y);
+ results[0] = Tcl_NewWideIntObj(wmPtr->hints.icon_x);
+ results[1] = Tcl_NewWideIntObj(wmPtr->hints.icon_y);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
}
return TCL_OK;
@@ -4536,7 +4458,7 @@ WmIconwindowCmd(
Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4550,7 +4472,7 @@ WmIconwindowCmd(
}
if (objc == 3) {
if (wmPtr->icon != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj(wmPtr->icon));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(wmPtr->icon));
}
return TCL_OK;
}
@@ -4646,7 +4568,7 @@ WmManageCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel or Frame to work with */
Tcl_Interp *interp, /* Current interpreter. */
- TCL_UNUSED(int), /* Number of arguments. */
+ TCL_UNUSED(Tcl_Size), /* Number of arguments. */
TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */
{
Tk_Window frameWin = (Tk_Window) winPtr;
@@ -4697,10 +4619,10 @@ WmManageCmd(
static int
WmMaxsizeCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4714,13 +4636,13 @@ WmMaxsizeCmd(
Tcl_Obj *results[2];
GetMaxSize(wmPtr, &width, &height);
- results[0] = Tcl_NewIntObj(width);
- results[1] = Tcl_NewIntObj(height);
+ results[0] = Tcl_NewWideIntObj(width);
+ results[1] = Tcl_NewWideIntObj(height);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
- if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) {
+ if ((Tk_GetPixelsFromObj(interp, tkwin, objv[3], &width) != TCL_OK)
+ || (Tk_GetPixelsFromObj(interp, tkwin, objv[4], &height) != TCL_OK)) {
return TCL_ERROR;
}
wmPtr->maxWidth = width;
@@ -4748,10 +4670,10 @@ WmMaxsizeCmd(
static int
WmMinsizeCmd(
- TCL_UNUSED(Tk_Window), /* Main window of the application. */
+ Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4765,13 +4687,13 @@ WmMinsizeCmd(
Tcl_Obj *results[2];
GetMinSize(wmPtr, &width, &height);
- results[0] = Tcl_NewIntObj(width);
- results[1] = Tcl_NewIntObj(height);
+ results[0] = Tcl_NewWideIntObj(width);
+ results[1] = Tcl_NewWideIntObj(height);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, results));
return TCL_OK;
}
- if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK)
- || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) {
+ if ((Tk_GetPixelsFromObj(interp, tkwin, objv[3], &width) != TCL_OK)
+ || (Tk_GetPixelsFromObj(interp, tkwin, objv[4], &height) != TCL_OK)) {
return TCL_ERROR;
}
wmPtr->minWidth = width;
@@ -4802,11 +4724,11 @@ WmOverrideredirectCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
- int boolValue, curValue;
+ Bool boolValue, curValue;
XSetWindowAttributes atts;
if ((objc != 3) && (objc != 4)) {
@@ -4817,7 +4739,7 @@ WmOverrideredirectCmd(
curValue = SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, -1, -1)-1;
if (curValue < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "Container does not support overrideredirect", -1));
+ "Container does not support overrideredirect", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL);
return TCL_ERROR;
}
@@ -4840,7 +4762,7 @@ WmOverrideredirectCmd(
* some funky stuff to occur.
*/
- atts.override_redirect = boolValue ? True : False;
+ atts.override_redirect = boolValue;
Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect,
&atts);
if (!(wmPtr->flags & (WM_NEVER_MAPPED))
@@ -4874,7 +4796,7 @@ WmPositionfromCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -4898,7 +4820,7 @@ WmPositionfromCmd(
} else if (wmPtr->sizeHintsFlags & PPosition) {
sourceStr = "program";
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, TCL_INDEX_NONE));
return TCL_OK;
}
if (*Tcl_GetString(objv[3]) == '\0') {
@@ -4942,14 +4864,14 @@ WmProtocolCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
ProtocolHandler *protPtr, *prevPtr;
Atom protocol;
const char *cmd;
- int cmdLength;
+ Tcl_Size cmdLength;
Tcl_Obj *resultObj;
if ((objc < 3) || (objc > 5)) {
@@ -4965,7 +4887,7 @@ WmProtocolCmd(
for (protPtr = wmPtr->protPtr; protPtr != NULL;
protPtr = protPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
- Tk_GetAtomName((Tk_Window)winPtr, protPtr->protocol), -1));
+ Tk_GetAtomName((Tk_Window)winPtr, protPtr->protocol), TCL_INDEX_NONE));
}
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
@@ -4980,7 +4902,7 @@ WmProtocolCmd(
protPtr = protPtr->nextPtr) {
if (protPtr->protocol == protocol) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(protPtr->command, -1));
+ Tcl_NewStringObj(protPtr->command, TCL_INDEX_NONE));
return TCL_OK;
}
}
@@ -5038,7 +4960,7 @@ WmResizableCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -5100,7 +5022,7 @@ WmSizefromCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -5124,7 +5046,7 @@ WmSizefromCmd(
} else if (wmPtr->sizeHintsFlags & PSize) {
sourceStr = "program";
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(sourceStr, TCL_INDEX_NONE));
return TCL_OK;
}
@@ -5169,7 +5091,7 @@ WmStackorderCmd(
Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
TkWindow **windows, **windowPtr;
@@ -5193,7 +5115,7 @@ WmStackorderCmd(
resultObj = Tcl_NewObj();
for (windowPtr = windows; *windowPtr ; windowPtr++) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj((Tk_Window) *windowPtr));
+ Tk_NewWindowObj((Tk_Window) *windowPtr));
}
Tcl_SetObjResult(interp, resultObj);
ckfree(windows);
@@ -5240,7 +5162,7 @@ WmStackorderCmd(
windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
if (windows == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "TkWmStackorderToplevel failed", -1));
+ "TkWmStackorderToplevel failed", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL);
return TCL_ERROR;
}
@@ -5270,7 +5192,7 @@ WmStackorderCmd(
} else { /* OPT_ISBELOW */
result = index1 < index2;
}
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(result));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result));
return TCL_OK;
}
}
@@ -5297,15 +5219,15 @@ WmStateCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
static const char *const optionStrings[] = {
- "normal", "iconic", "withdrawn", "zoomed", NULL
+ "iconic", "normal", "withdrawn", "zoomed", NULL
};
enum options {
- OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED
+ OPT_ICONIC, OPT_NORMAL, OPT_WITHDRAWN, OPT_ZOOMED
};
int index;
@@ -5410,7 +5332,7 @@ WmStateCmd(
case ZoomState: stateStr = "zoomed"; break;
}
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(stateStr, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(stateStr, TCL_INDEX_NONE));
}
return TCL_OK;
}
@@ -5437,12 +5359,12 @@ WmTitleCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
+ Tcl_Size length;
HWND wrapper;
if (objc > 4) {
@@ -5470,7 +5392,7 @@ WmTitleCmd(
Tcl_DStringFree(&titleString);
} else {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- (wmPtr->title ? wmPtr->title : winPtr->nameUid), -1));
+ (wmPtr->title ? wmPtr->title : winPtr->nameUid), TCL_INDEX_NONE));
}
} else {
if (wmPtr->title != NULL) {
@@ -5484,7 +5406,7 @@ WmTitleCmd(
Tcl_DString titleString;
Tcl_DStringInit(&titleString);
- Tcl_UtfToWCharDString(wmPtr->title, -1, &titleString);
+ Tcl_UtfToWCharDString(wmPtr->title, TCL_INDEX_NONE, &titleString);
SetWindowTextW(wrapper, (LPCWSTR) Tcl_DStringValue(&titleString));
Tcl_DStringFree(&titleString);
}
@@ -5514,7 +5436,7 @@ WmTransientCmd(
Tk_Window tkwin, /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -5522,12 +5444,12 @@ WmTransientCmd(
WmInfo *wmPtr2;
if ((objc != 3) && (objc != 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?master?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?window?");
return TCL_ERROR;
}
if (objc == 3) {
if (containerPtr != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) containerPtr));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) containerPtr));
}
return TCL_OK;
}
@@ -5571,7 +5493,7 @@ WmTransientCmd(
if (wmPtr2->iconFor != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't make \"%s\" a master: it is an icon for %s",
+ "can't make \"%s\" a container: it is an icon for %s",
Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL);
return TCL_ERROR;
@@ -5580,7 +5502,7 @@ WmTransientCmd(
w = (TkWindow *)w->wmInfoPtr->containerPtr) {
if (w == winPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "setting \"%s\" as master creates a transient/master cycle",
+ "can't set \"%s\" as container: would cause management loop",
Tk_PathName(containerPtr)));
Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL);
return TCL_ERROR;
@@ -5642,7 +5564,7 @@ WmWithdrawCmd(
TCL_UNUSED(Tk_Window), /* Main window of the application. */
TkWindow *winPtr, /* Toplevel to work with */
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
@@ -5953,7 +5875,7 @@ TopLevelEventProc(
static void
TopLevelReqProc(
- TCL_UNUSED(void *),
+ TCL_UNUSED(void *), /* Not used. */
Tk_Window tkwin) /* Information about window. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
@@ -6617,7 +6539,7 @@ TkWmProtocolEventProc(
Tcl_Preserve(protPtr);
interp = protPtr->interp;
Tcl_Preserve(interp);
- result = Tcl_EvalEx(interp, protPtr->command, -1, TCL_EVAL_GLOBAL);
+ result = Tcl_EvalEx(interp, protPtr->command, TCL_INDEX_NONE, TCL_EVAL_GLOBAL);
if (result != TCL_OK) {
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (command for \"%s\" window manager protocol)",
@@ -6670,7 +6592,7 @@ TkWmStackorderToplevelEnumProc(
/*fprintf(stderr, "Looking up HWND %d\n", hwnd);*/
- hPtr = Tcl_FindHashEntry(pair->table, (char *)hwnd);
+ hPtr = Tcl_FindHashEntry(pair->table, hwnd);
if (hPtr != NULL) {
childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr);
@@ -7370,7 +7292,7 @@ InstallColormaps(
* WM_QUERYNEWPALETTE */
int isForemost) /* 1 if window is foremost, else 0 */
{
- int i;
+ Tcl_Size i;
HDC dc;
HPALETTE oldPalette;
TkWindow *winPtr = GetTopLevel(hwnd);
@@ -7479,7 +7401,7 @@ RefreshColormap(
TkDisplay *dispPtr)
{
WmInfo *wmPtr;
- int i;
+ Tcl_Size i;
for (wmPtr = dispPtr->firstWmPtr; wmPtr != NULL; wmPtr = wmPtr->nextPtr) {
if (wmPtr->cmapCount > 0) {
@@ -8089,7 +8011,7 @@ WmProc(
if (message == WM_SETFOCUS) {
SetFocus(child);
result = 0;
- } else if (!Tk_TranslateWinEvent(child, message, wParam, lParam,
+ } else if (!TkTranslateWinEvent(child, message, wParam, lParam,
&result)) {
result = DefWindowProcW(hwnd, message, wParam, lParam);
}
diff --git a/win/tkWinX.c b/win/tkWinX.c
index ad0c4d2..2047536 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -3,9 +3,9 @@
*
* This file contains Windows emulation procedures for X routines.
*
- * Copyright (c) 1995-1996 Sun Microsystems, Inc.
- * Copyright (c) 1994 Software Research Associates, Inc.
- * Copyright (c) 1998-2000 Scriptics Corporation.
+ * Copyright © 1995-1996 Sun Microsystems, Inc.
+ * Copyright © 1994 Software Research Associates, Inc.
+ * Copyright © 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -14,22 +14,13 @@
#define XLIB_ILLEGAL_ACCESS
#include "tkWinInt.h"
-/*
- * The w32api 1.1 package (included in Mingw 1.1) does not define _WIN32_IE by
- * default. Define it here to gain access to the InitCommonControlsEx API in
- * commctrl.h.
- */
-
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x0550 /* IE 5.5 */
-#endif
-
#include <commctrl.h>
#ifdef _MSC_VER
# pragma comment (lib, "comctl32.lib")
# pragma comment (lib, "advapi32.lib")
#endif
+
/*
* The zmouse.h file includes the definition for WM_MOUSEWHEEL.
*/
@@ -45,6 +36,31 @@
#define WM_MOUSEHWHEEL 0x020E
#endif
+/* A WM_MOUSEWHEEL message sent by a trackpad contains the number of pixels as
+ * the delta value, while low precision scrollwheels always send an integer
+ * multiple of WHEELDELTA (= 120) as the delta value.
+ */
+
+#define WHEELDELTA 120
+
+/*
+ * Our heuristic for deciding whether a WM_MOUSEWHEEL message
+ * comes from a high resolution scrolling device is that we
+ * assume it is high resolution unless there are two consecutive
+ * delta values that are both multiples of 120. This is static,
+ * rather than thread-specific, since input devices are shared
+ * by all threads.
+ */
+
+static int lastMod = 0;
+
+/*
+ * The serial field of TouchpadScroll events is a counter for
+ * events of this type only.
+ */
+
+static unsigned long scrollCounter = 0;
+
/*
* imm.h is needed by HandleIMEComposition
*/
@@ -91,10 +107,6 @@ typedef struct {
* screen. */
int updatingClipboard; /* If 1, we are updating the clipboard. */
int surrogateBuffer; /* Buffer for first of surrogate pair. */
- DWORD vWheelTickPrev; /* For high resolution wheels (vertical). */
- DWORD hWheelTickPrev; /* For high resolution wheels (horizontal). */
- short vWheelAcc; /* For high resolution wheels (vertical). */
- short hWheelAcc; /* For high resolution wheels (horizontal). */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -138,13 +150,7 @@ TkGetServerInfo(
OSVERSIONINFOW os;
if (!buffer[0]) {
- HANDLE handle = GetModuleHandleW(L"NTDLL");
- int(__stdcall *getversion)(void *) = (int(__stdcall *)(void *))
- (void *)GetProcAddress(handle, "RtlGetVersion");
- os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
- if (!getversion || getversion(&os)) {
- GetVersionExW(&os);
- }
+ GetVersionExW(&os);
/* Write the first character last, preventing multi-thread issues. */
snprintf(buffer+1, sizeof(buffer)-1, "indows %d.%d %d %s", (int)os.dwMajorVersion,
(int)os.dwMinorVersion, (int)os.dwBuildNumber,
@@ -299,7 +305,7 @@ TkWinXInit(
void
TkWinXCleanup(
- ClientData clientData)
+ void *clientData)
{
HINSTANCE hInstance = (HINSTANCE)clientData;
@@ -391,30 +397,6 @@ TkWinGetPlatformTheme(void)
/*
*----------------------------------------------------------------------
*
- * TkWinGetPlatformId --
- *
- * Determines whether running under NT, 95, or Win32s, to allow runtime
- * conditional code. Win32s is no longer supported.
- *
- * Results:
- * The return value is always:
- * VER_PLATFORM_WIN32_NT Win32 on Windows XP, Vista, Windows 7, Windows 8
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkWinGetPlatformId(void)
-{
- return VER_PLATFORM_WIN32_NT;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkGetDefaultScreenName --
*
* Returns the name of the screen that Tk should use during
@@ -464,10 +446,10 @@ TkWinDisplayChanged(
HDC dc;
Screen *screen;
- if (display == NULL || ScreenOfDisplay(display, 0) == NULL) {
+ if (display == NULL || (((_XPrivDisplay)(display))->screens) == NULL) {
return;
}
- screen = ScreenOfDisplay(display, 0);
+ screen = (((_XPrivDisplay)(display))->screens);
dc = GetDC(NULL);
WidthOfScreen(screen) = GetDeviceCaps(dc, HORZRES);
@@ -487,13 +469,13 @@ TkWinDisplayChanged(
*/
screen->ext_data = (XExtData *)INT2PTR(GetDeviceCaps(dc, PLANES));
- DefaultDepthOfScreen(screen) = GetDeviceCaps(dc, BITSPIXEL) * PTR2INT(screen->ext_data);
+ screen->root_depth = GetDeviceCaps(dc, BITSPIXEL) * PTR2INT(screen->ext_data);
- if (DefaultVisualOfScreen(screen) != NULL) {
- ckfree(DefaultVisualOfScreen(screen));
+ if (screen->root_visual != NULL) {
+ ckfree(screen->root_visual);
}
- DefaultVisualOfScreen(screen) = (Visual *)ckalloc(sizeof(Visual));
- DefaultVisualOfScreen(screen)->visualid = 0;
+ screen->root_visual = (Visual *)ckalloc(sizeof(Visual));
+ screen->root_visual->visualid = 0;
if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) {
DefaultVisualOfScreen(screen)->map_entries = GetDeviceCaps(dc, SIZEPALETTE);
DefaultVisualOfScreen(screen)->c_class = PseudoColor;
@@ -538,7 +520,7 @@ TkWinDisplayChanged(
/*
*----------------------------------------------------------------------
*
- * TkpOpenDisplay --
+ * TkpOpenDisplay/XkbOpenDisplay --
*
* Create the Display structure and fill it with device specific
* information.
@@ -557,46 +539,53 @@ TkpOpenDisplay(
const char *display_name)
{
Display *display;
- Screen *screen;
- TkWinDrawable *twdPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- DWORD initialWheelTick;
if (tsdPtr->winDisplay != NULL) {
- if (!strcmp(tsdPtr->winDisplay->display->display_name, display_name)) {
+ if (!strcmp(DisplayString(tsdPtr->winDisplay->display), display_name)) {
return tsdPtr->winDisplay;
} else {
return NULL;
}
}
- display = ckalloc(sizeof(Display));
- memset(display, 0, sizeof(Display));
-
- display->display_name = ckalloc(strlen(display_name) + 1);
- strcpy(display->display_name, display_name);
+ display = XkbOpenDisplay(display_name, NULL, NULL, NULL, NULL, NULL);
+ TkWinDisplayChanged(display);
- display->nscreens = 1;
- LastKnownRequestProcessed(display) = 1;
- display->qlen = 0;
+ tsdPtr->winDisplay =(TkDisplay *) ckalloc(sizeof(TkDisplay));
+ memset(tsdPtr->winDisplay, 0, sizeof(TkDisplay));
+ tsdPtr->winDisplay->display = display;
+ tsdPtr->updatingClipboard = FALSE;
- screen = ckalloc(sizeof(Screen));
- memset(screen, 0, sizeof(Screen));
- DisplayOfScreen(screen) = display;
+ /*
+ * Key map info must be available immediately, because of "send event".
+ */
+ TkpInitKeymapInfo(tsdPtr->winDisplay);
/*
- * Set up the root window.
+ * Key map info must be available immediately, because of "send event".
*/
+ TkpInitKeymapInfo(tsdPtr->winDisplay);
- twdPtr = ckalloc(sizeof(TkWinDrawable));
- if (twdPtr == NULL) {
- return NULL;
- }
- twdPtr->type = TWD_WINDOW;
- twdPtr->window.winPtr = NULL;
- twdPtr->window.handle = NULL;
- RootWindowOfScreen(screen) = (Window)twdPtr;
+ return tsdPtr->winDisplay;
+}
+
+Display *
+XkbOpenDisplay(
+ const char *name,
+ int *ev_rtrn,
+ int *err_rtrn,
+ int *major_rtrn,
+ int *minor_rtrn,
+ int *reason)
+{
+ _XPrivDisplay display = (_XPrivDisplay)ckalloc(sizeof(Display));
+ Screen *screen = (Screen *)ckalloc(sizeof(Screen));
+ TkWinDrawable *twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable));
+
+ memset(screen, 0, sizeof(Screen));
+ memset(display, 0, sizeof(Display));
/*
* Note that these pixel values are not palette relative.
@@ -610,24 +599,26 @@ TkpOpenDisplay(
display->nscreens = 1;
display->default_screen = 0;
- TkWinDisplayChanged(display);
+ twdPtr->type = TWD_WINDOW;
+ twdPtr->window.winPtr = NULL;
+ twdPtr->window.handle = NULL;
+ screen->root = (Window)twdPtr;
+ screen->display = (Display *)display;
- tsdPtr->winDisplay = ckalloc(sizeof(TkDisplay));
- memset(tsdPtr->winDisplay, 0, sizeof(TkDisplay));
- tsdPtr->winDisplay->display = display;
- tsdPtr->updatingClipboard = FALSE;
- initialWheelTick = GetTickCount();
- tsdPtr->vWheelTickPrev = initialWheelTick;
- tsdPtr->hWheelTickPrev = initialWheelTick;
- tsdPtr->vWheelAcc = 0;
- tsdPtr->hWheelAcc = 0;
+ display->display_name = (char *)ckalloc(strlen(name) + 1);
+ strcpy(display->display_name, name);
- /*
- * Key map info must be available immediately, because of "send event".
- */
- TkpInitKeymapInfo(tsdPtr->winDisplay);
+ display->nscreens = 1;
+ display->request = 1;
+ display->qlen = 0;
- return tsdPtr->winDisplay;
+ if (ev_rtrn) *ev_rtrn = 0;
+ if (err_rtrn) *err_rtrn = 0;
+ if (major_rtrn) *major_rtrn = 0;
+ if (minor_rtrn) *minor_rtrn = 0;
+ if (reason) *reason = 0;
+
+ return (Display *)display;
}
/*
@@ -651,7 +642,7 @@ void
TkpCloseDisplay(
TkDisplay *dispPtr)
{
- Display *display = dispPtr->display;
+ _XPrivDisplay display = (_XPrivDisplay)dispPtr->display;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -670,7 +661,7 @@ TkpCloseDisplay(
ckfree(DefaultVisualOfScreen(ScreenOfDisplay(display, 0)));
}
if (RootWindowOfScreen(ScreenOfDisplay(display, 0)) != None) {
- ckfree(RootWindowOfScreen(ScreenOfDisplay(display, 0)));
+ ckfree((char *)RootWindowOfScreen(ScreenOfDisplay(display, 0)));
}
if (DefaultColormapOfScreen(ScreenOfDisplay(display, 0)) != None) {
XFreeColormap(display, DefaultColormapOfScreen(ScreenOfDisplay(display, 0)));
@@ -815,22 +806,22 @@ TkWinChildProc(
break;
case WM_UNICHAR:
- if (wParam == UNICODE_NOCHAR) {
+ if (wParam == UNICODE_NOCHAR) {
/* If wParam is UNICODE_NOCHAR and the application processes
* this message, then return TRUE. */
result = 1;
} else {
/* If the event was translated, we must return 0 */
- if (Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
- result = 0;
+ if (TkTranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ result = 0;
} else {
- result = 1;
+ result = 1;
}
}
break;
default:
- if (!Tk_TranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
+ if (!TkTranslateWinEvent(hwnd, message, wParam, lParam, &result)) {
result = DefWindowProcW(hwnd, message, wParam, lParam);
}
break;
@@ -847,7 +838,7 @@ TkWinChildProc(
/*
*----------------------------------------------------------------------
*
- * Tk_TranslateWinEvent --
+ * TkTranslateWinEvent --
*
* This function is called by widget window functions to handle the
* translation from Win32 events to Tk events.
@@ -862,7 +853,7 @@ TkWinChildProc(
*/
int
-Tk_TranslateWinEvent(
+TkTranslateWinEvent(
HWND hwnd,
UINT message,
WPARAM wParam,
@@ -881,20 +872,20 @@ Tk_TranslateWinEvent(
}
case WM_RENDERALLFORMATS: {
- TkWindow *winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
-
- if (winPtr && OpenClipboard(hwnd)) {
- /*
- * Make sure that nobody had taken ownership of the clipboard
- * before we opened it.
- */
-
- if (GetClipboardOwner() == hwnd) {
- TkWinClipboardRender(winPtr->dispPtr, CF_TEXT);
- }
- CloseClipboard();
- }
- return 1;
+ TkWindow *winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
+
+ if (winPtr && OpenClipboard(hwnd)) {
+ /*
+ * Make sure that nobody had taken ownership of the clipboard
+ * before we opened it.
+ */
+
+ if (GetClipboardOwner() == hwnd) {
+ TkWinClipboardRender(winPtr->dispPtr, CF_TEXT);
+ }
+ CloseClipboard();
+ }
+ return 1;
}
case WM_COMMAND:
@@ -931,7 +922,7 @@ Tk_TranslateWinEvent(
case WM_RBUTTONUP:
case WM_XBUTTONUP:
case WM_MOUSEMOVE:
- Tk_PointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam));
+ TkWinPointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam));
return 1;
case WM_SYSKEYDOWN:
@@ -1155,68 +1146,65 @@ GenerateXEvent(
switch (message) {
case WM_MOUSEWHEEL: {
- /*
- * Support for high resolution wheels (vertical).
- */
-
- DWORD wheelTick = GetTickCount();
-
- if (wheelTick - tsdPtr->vWheelTickPrev < 1500) {
- tsdPtr->vWheelAcc += (short) HIWORD(wParam);
- } else {
- tsdPtr->vWheelAcc = (short) HIWORD(wParam);
- }
- tsdPtr->vWheelTickPrev = wheelTick;
- if (abs(tsdPtr->vWheelAcc) < WHEEL_DELTA) {
- return;
- }
/*
- * We have invented a new X event type to handle this event. It
- * still uses the KeyPress struct. However, the keycode field has
- * been overloaded to hold the zDelta of the wheel. Set nbytes to
- * 0 to prevent conversion of the keycode to a keysym in
+ * Send an Xevent using a KeyPress struct, but with the type field
+ * set to MouseWheelEvent for low resolution scrolls and to
+ * TouchpadScroll for high resolution scroll events. The Y delta
+ * is stored in the low order 16 bits of the keycode field. Set
+ * nbytes to 0 to prevent conversion of the keycode to a keysym in
* TkpGetString. [Bug 1118340].
*/
- event.x.type = MouseWheelEvent;
- event.x.xany.send_event = -1;
- event.key.nbytes = 0;
- event.x.xkey.keycode = tsdPtr->vWheelAcc / WHEEL_DELTA * WHEEL_DELTA;
- tsdPtr->vWheelAcc = tsdPtr->vWheelAcc % WHEEL_DELTA;
+ int delta = (short) HIWORD(wParam);
+ int mod = delta % WHEELDELTA;
+ if ( mod != 0 || lastMod != 0) {
+ /* High resolution. */
+ event.x.type = TouchpadScroll;
+ event.x.xany.send_event = -1;
+ event.key.nbytes = 0;
+ event.x.xkey.state = state;
+ event.x.xany.serial = scrollCounter++;
+ event.x.xkey.keycode = (unsigned int) delta;
+ } else {
+ event.x.type = MouseWheelEvent;
+ event.x.xany.send_event = -1;
+ event.key.nbytes = 0;
+ event.x.xkey.keycode = (unsigned int) delta;
+ }
+ lastMod = mod;
break;
}
case WM_MOUSEHWHEEL: {
+
/*
- * Support for high resolution wheels (horizontal).
+ * Send an Xevent using a KeyPress struct, but with the type field
+ * set to MouseWheelEvent for low resolution scrolls and to
+ * TouchpadScroll for high resolution scroll events. For low
+ * resolution scrolls the X delta is stored in the keycode field
+ * and For high resolution scrolls the X delta is in the high word
+ * of the keycode. Set nbytes to 0 to prevent conversion of the
+ * keycode to a keysym in TkpGetString. [Bug 1118340].
*/
- DWORD wheelTick = GetTickCount();
-
- if (wheelTick - tsdPtr->hWheelTickPrev < 1500) {
- tsdPtr->hWheelAcc -= (short) HIWORD(wParam);
+ int delta = (short) HIWORD(wParam);
+ int mod = delta % WHEELDELTA;
+ if ( mod != 0 || lastMod != 0) {
+ /* High resolution. */
+ event.x.type = TouchpadScroll;
+ event.x.xany.send_event = -1;
+ event.key.nbytes = 0;
+ event.x.xkey.state = state;
+ event.x.xany.serial = scrollCounter++;
+ event.x.xkey.keycode = (unsigned int)(-(delta << 16));
} else {
- tsdPtr->hWheelAcc = -((short) HIWORD(wParam));
- }
- tsdPtr->hWheelTickPrev = wheelTick;
- if (abs(tsdPtr->hWheelAcc) < WHEEL_DELTA) {
- return;
+ event.x.type = MouseWheelEvent;
+ event.x.xany.send_event = -1;
+ event.key.nbytes = 0;
+ event.x.xkey.state |= ShiftMask;
+ event.x.xkey.keycode = delta;
}
-
- /*
- * We have invented a new X event type to handle this event. It
- * still uses the KeyPress struct. However, the keycode field has
- * been overloaded to hold the zDelta of the wheel. Set nbytes to
- * 0 to prevent conversion of the keycode to a keysym in
- * TkpGetString. [Bug 1118340].
- */
-
- event.x.type = MouseWheelEvent;
- event.x.xany.send_event = -1;
- event.key.nbytes = 0;
- event.x.xkey.state |= ShiftMask;
- event.x.xkey.keycode = tsdPtr->hWheelAcc / WHEEL_DELTA * WHEEL_DELTA;
- tsdPtr->hWheelAcc = tsdPtr->hWheelAcc % WHEEL_DELTA;
+ lastMod = mod;
break;
}
case WM_SYSKEYDOWN:
@@ -1233,7 +1221,7 @@ GenerateXEvent(
event.x.xany.send_event = -1;
event.x.xkey.keycode = wParam;
GetTranslatedKey(&event.key, (message == WM_KEYDOWN) ? WM_CHAR :
- WM_SYSCHAR);
+ WM_SYSCHAR);
break;
case WM_SYSKEYUP:
@@ -1306,7 +1294,7 @@ GenerateXEvent(
MSG msg;
if ((PeekMessageW(&msg, NULL, WM_CHAR, WM_CHAR,
- PM_NOREMOVE) != 0)
+ PM_NOREMOVE) != 0)
&& (msg.message == WM_CHAR)) {
GetMessageW(&msg, NULL, WM_CHAR, WM_CHAR);
event.key.nbytes = 2;
@@ -1718,30 +1706,6 @@ HandleIMEComposition(
/*
*----------------------------------------------------------------------
*
- * Tk_FreeXId --
- *
- * This interface is not needed under Windows.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-Tk_FreeXId(
- Display *display,
- XID xid)
-{
- /* Do nothing */
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkWinResendEvent --
*
* This function converts an X event into a Windows event and invokes the
@@ -1783,11 +1747,11 @@ TkWinResendEvent(
msg = WM_RBUTTONDOWN;
wparam = MK_RBUTTON;
break;
- case Button4:
+ case Button8:
msg = WM_XBUTTONDOWN;
wparam = MAKEWPARAM(MK_XBUTTON1, XBUTTON1);
break;
- case Button5:
+ case Button9:
msg = WM_XBUTTONDOWN;
wparam = MAKEWPARAM(MK_XBUTTON2, XBUTTON2);
break;
diff --git a/win/tktest.exe.manifest.in b/win/tktest.exe.manifest.in
deleted file mode 100644
index 62b585e..0000000
--- a/win/tktest.exe.manifest.in
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"
- xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
- <assemblyIdentity
- version="@TK_WIN_VERSION@"
- processorArchitecture="@MACHINE@"
- name="Tcl.Tk.tktest"
- type="win32"
- />
- <description>Tcl/Tk test (tktest)</description>
- <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
- <security>
- <requestedPrivileges>
- <requestedExecutionLevel
- level="asInvoker"
- uiAccess="false"
- />
- </requestedPrivileges>
- </security>
- </trustInfo>
- <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
- <application>
- <!-- Windows 10 -->
- <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
- <!-- Windows 8.1 -->
- <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
- <!-- Windows 8 -->
- <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
- <!-- Windows 7 -->
- <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
- <!-- Windows Vista -->
- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
- </application>
- </compatibility>
- <asmv3:application>
- <asmv3:windowsSettings
- xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
- <dpiAware>true</dpiAware>
- </asmv3:windowsSettings>
- </asmv3:application>
- <dependency>
- <dependentAssembly>
- <assemblyIdentity
- type="win32"
- name="Microsoft.Windows.Common-Controls"
- version="6.0.0.0"
- processorArchitecture="@MACHINE@"
- publicKeyToken="6595b64144ccf1df"
- language="*"
- />
- </dependentAssembly>
- </dependency>
-</assembly>
diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c
index ae026b3..32d2a07 100644
--- a/win/ttkWinMonitor.c
+++ b/win/ttkWinMonitor.c
@@ -2,7 +2,7 @@
#define WIN32_LEAN_AND_MEAN
#endif
-#include <tkWinInt.h>
+#include "tkWinInt.h"
#include "ttk/ttkTheme.h"
#if !defined(WM_THEMECHANGED)
@@ -22,7 +22,7 @@ typedef struct {
int index;
} SystemColorEntry;
-static SystemColorEntry sysColors[] = {
+static const SystemColorEntry sysColors[] = {
{ "System3dDarkShadow", COLOR_3DDKSHADOW },
{ "System3dLight", COLOR_3DLIGHT },
{ "SystemActiveBorder", COLOR_ACTIVEBORDER },
@@ -55,7 +55,7 @@ static SystemColorEntry sysColors[] = {
static void RegisterSystemColors(Tcl_Interp *interp)
{
Ttk_ResourceCache cache = Ttk_GetResourceCache(interp);
- SystemColorEntry *sysColor;
+ const SystemColorEntry *sysColor;
for (sysColor = sysColors; sysColor->name; ++sysColor) {
DWORD pixel = GetSysColor(sysColor->index);
@@ -122,12 +122,12 @@ WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
case WM_THEMECHANGED:
/*
- * Reset the application theme.
- * On windows, it is possible to sign in as a second user, change
- * the theme to 'winnative' (by setting the ui to 'best performance'),
- * which is a machine-wide change, and then sign back on to the original user.
- * Ttk_UseTheme needs to be executed again in order to process the fallback
- * from vista/xpnative to winnative.
+ * Reset the application theme.
+ * On windows, it is possible to sign in as a second user, change
+ * the theme to 'winnative' (by setting the ui to 'best performance'),
+ * which is a machine-wide change, and then sign back on to the original user.
+ * Ttk_UseTheme needs to be executed again in order to process the fallback
+ * from vista/xpnative to winnative.
*/
theme = Ttk_GetCurrentTheme(interp);
@@ -146,13 +146,14 @@ WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
MODULE_SCOPE int TtkWinTheme_Init(Tcl_Interp *, HWND hwnd);
MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *, HWND hwnd);
+MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp);
MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp)
{
HWND hwnd;
hwnd = CreateThemeMonitorWindow(Tk_GetHINSTANCE(), interp);
- Ttk_RegisterCleanup(interp, (ClientData)hwnd, DestroyThemeMonitorWindow);
+ Ttk_RegisterCleanup(interp, hwnd, DestroyThemeMonitorWindow);
TtkWinTheme_Init(interp, hwnd);
TtkXPTheme_Init(interp, hwnd);
diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c
index 79f115f..8e67b4d 100644
--- a/win/ttkWinTheme.c
+++ b/win/ttkWinTheme.c
@@ -1,4 +1,4 @@
-/* winTheme.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net>
+/* winTheme.c - Copyright © 2004 Pat Thoyts <patthoyts@users.sf.net>
*/
#ifdef _MSC_VER
@@ -54,7 +54,7 @@ static unsigned int ReliefToEdge(int relief)
* +++ State tables for FrameControlElements.
*/
-static Ttk_StateTable checkbutton_statemap[] = { /* see also SF#1865898 */
+static const Ttk_StateTable checkbutton_statemap[] = { /* see also SF#1865898 */
{ DFCS_BUTTON3STATE|DFCS_CHECKED|DFCS_INACTIVE,
TTK_STATE_ALTERNATE|TTK_STATE_DISABLED, 0 },
{ DFCS_BUTTON3STATE|DFCS_CHECKED|DFCS_PUSHED,
@@ -75,14 +75,14 @@ static Ttk_StateTable checkbutton_statemap[] = { /* see also SF#1865898 */
{ 0, 0, 0 },
};
-static Ttk_StateTable pushbutton_statemap[] = {
+static const Ttk_StateTable pushbutton_statemap[] = {
{ DFCS_INACTIVE, TTK_STATE_DISABLED, 0 },
{ DFCS_PUSHED, TTK_STATE_PRESSED, 0 },
{ DFCS_HOT, TTK_STATE_ACTIVE, 0 },
{ 0, 0, 0 }
};
-static Ttk_StateTable arrow_statemap[] = {
+static const Ttk_StateTable arrow_statemap[] = {
{ DFCS_INACTIVE, TTK_STATE_DISABLED, 0 },
{ DFCS_PUSHED | DFCS_FLAT, TTK_STATE_PRESSED, 0 },
{ 0, 0, 0 }
@@ -98,11 +98,11 @@ typedef struct {
int partId; /* part id for DrawFrameControl */
unsigned cxId; /* system metric ids for width/height... */
unsigned cyId; /* ... or size if FIXEDSIZE bit set */
- Ttk_StateTable *stateMap; /* map Tk states to Win32 flags */
+ const Ttk_StateTable *stateMap; /* map Tk states to Win32 flags */
Ttk_Padding margins; /* additional placement padding */
} FrameControlElementData;
-#define BASE_DIM 13
+#define BASE_DIM 16
#define _FIXEDSIZE 0x80000000UL
#define _HALFMETRIC 0x40000000UL
#define FIXEDSIZE(id) (id|_FIXEDSIZE)
@@ -156,6 +156,18 @@ static void FrameControlElementSize(
int cx = GETMETRIC(p->cxId);
int cy = GETMETRIC(p->cyId);
+ if ((p->cxId & _FIXEDSIZE) && cx == BASE_DIM) {
+ double scalingLevel = TkScalingLevel(tkwin);
+ cx *= scalingLevel;
+ cy *= scalingLevel;
+
+ /*
+ * Update the corresponding element of the array FrameControlElements
+ */
+ p->cxId = FIXEDSIZE(cx);
+ p->cyId = FIXEDSIZE(cy);
+ }
+
if (p->cxId & _HALFMETRIC) cx /= 2;
if (p->cyId & _HALFMETRIC) cy /= 2;
@@ -182,7 +194,7 @@ static void FrameControlElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec FrameControlElementSpec = {
+static const Ttk_ElementSpec FrameControlElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -198,8 +210,8 @@ typedef struct {
Tcl_Obj *reliefObj;
} BorderElement;
-static Ttk_ElementOptionSpec BorderElementOptions[] = {
- { "-relief", TK_OPTION_RELIEF, Tk_Offset(BorderElement,reliefObj), "flat" },
+static const Ttk_ElementOptionSpec BorderElementOptions[] = {
+ { "-relief",TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" },
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
@@ -239,7 +251,7 @@ static void BorderElementDraw(
}
}
-static Ttk_ElementSpec BorderElementSpec = {
+static const Ttk_ElementSpec BorderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(BorderElement),
BorderElementOptions,
@@ -256,9 +268,9 @@ typedef struct {
Tcl_Obj *backgroundObj;
} FieldElement;
-static Ttk_ElementOptionSpec FieldElementOptions[] = {
+static const Ttk_ElementOptionSpec FieldElementOptions[] = {
{ "-fieldbackground", TK_OPTION_BORDER,
- Tk_Offset(FieldElement,backgroundObj), "white" },
+ offsetof(FieldElement,backgroundObj), "white" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -296,7 +308,7 @@ static void FieldElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec FieldElementSpec = {
+static const Ttk_ElementSpec FieldElementSpec = {
TK_STYLE_VERSION_2,
sizeof(FieldElement),
FieldElementOptions,
@@ -315,13 +327,13 @@ typedef struct {
Tcl_Obj *defaultStateObj;
} ButtonBorderElement;
-static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = {
+static const Ttk_ElementOptionSpec ButtonBorderElementOptions[] = {
{ "-relief",TK_OPTION_RELIEF,
- Tk_Offset(ButtonBorderElement,reliefObj), "flat" },
+ offsetof(ButtonBorderElement,reliefObj), "flat" },
{ "-highlightcolor",TK_OPTION_COLOR,
- Tk_Offset(ButtonBorderElement,highlightColorObj), "black" },
+ offsetof(ButtonBorderElement,highlightColorObj), "black" },
{ "-default", TK_OPTION_ANY,
- Tk_Offset(ButtonBorderElement,defaultStateObj), "disabled" },
+ offsetof(ButtonBorderElement,defaultStateObj), "disabled" },
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
@@ -335,7 +347,7 @@ static void ButtonBorderElementSize(
{
ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord;
int relief = TK_RELIEF_RAISED;
- int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED;
short int cx, cy;
Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief);
@@ -367,7 +379,7 @@ static void ButtonBorderElementDraw(
{
ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord;
int relief = TK_RELIEF_FLAT;
- int defaultState = TTK_BUTTON_DEFAULT_DISABLED;
+ Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED;
TkWinDCState dcState;
HDC hdc;
RECT rc;
@@ -402,7 +414,7 @@ static void ButtonBorderElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec ButtonBorderElementSpec = {
+static const Ttk_ElementSpec ButtonBorderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ButtonBorderElement),
ButtonBorderElementOptions,
@@ -443,7 +455,7 @@ static void FocusElementDraw(
}
}
-static Ttk_ElementSpec FocusElementSpec = {
+static const Ttk_ElementSpec FocusElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -459,9 +471,9 @@ typedef struct {
Tcl_Obj *fillColorObj;
} FillFocusElement;
-static Ttk_ElementOptionSpec FillFocusElementOptions[] = {
+static const Ttk_ElementOptionSpec FillFocusElementOptions[] = {
{ "-focusfill", TK_OPTION_COLOR,
- Tk_Offset(FillFocusElement,fillColorObj), "white" },
+ offsetof(FillFocusElement,fillColorObj), "white" },
{NULL, TK_OPTION_BOOLEAN, 0, NULL}
};
@@ -503,7 +515,7 @@ static void ComboboxFocusElementDraw(
}
}
-static Ttk_ElementSpec ComboboxFocusElementSpec = {
+static const Ttk_ElementSpec ComboboxFocusElementSpec = {
TK_STYLE_VERSION_2,
sizeof(FillFocusElement),
FillFocusElementOptions,
@@ -577,7 +589,7 @@ static void TroughElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec TroughElementSpec = {
+static const Ttk_ElementSpec TroughElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -593,8 +605,8 @@ typedef struct {
Tcl_Obj *orientObj;
} ThumbElement;
-static Ttk_ElementOptionSpec ThumbElementOptions[] = {
- { "-orient", TK_OPTION_ANY, Tk_Offset(ThumbElement,orientObj),"horizontal"},
+static const Ttk_ElementOptionSpec ThumbElementOptions[] = {
+ { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"},
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -607,9 +619,9 @@ static void ThumbElementSize(
TCL_UNUSED(Ttk_Padding *))
{
ThumbElement *thumbPtr = (ThumbElement *)elementRecord;
- int orient;
+ Ttk_Orient orient;
- Ttk_GetOrientFromObj(NULL, thumbPtr->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, thumbPtr->orientObj, &orient);
if (orient == TTK_ORIENT_HORIZONTAL) {
*widthPtr = GetSystemMetrics(SM_CXHTHUMB);
*heightPtr = GetSystemMetrics(SM_CYHSCROLL);
@@ -640,7 +652,7 @@ static void ThumbElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec ThumbElementSpec = {
+static const Ttk_ElementSpec ThumbElementSpec = {
TK_STYLE_VERSION_2,
sizeof(ThumbElement),
ThumbElementOptions,
@@ -657,8 +669,8 @@ typedef struct {
Tcl_Obj *orientObj; /* orientation of the slider widget */
} SliderElement;
-static Ttk_ElementOptionSpec SliderElementOptions[] = {
- { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj),
+static const Ttk_ElementOptionSpec SliderElementOptions[] = {
+ { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj),
"horizontal" },
{ NULL, TK_OPTION_BOOLEAN, 0, NULL }
};
@@ -672,9 +684,9 @@ static void SliderElementSize(
TCL_UNUSED(Ttk_Padding *))
{
SliderElement *slider = (SliderElement *)elementRecord;
- int orient;
+ Ttk_Orient orient;
- Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient);
+ TtkGetOrientFromObj(NULL, slider->orientObj, &orient);
if (orient == TTK_ORIENT_HORIZONTAL) {
*widthPtr = (GetSystemMetrics(SM_CXHTHUMB) / 2) | 1;
*heightPtr = GetSystemMetrics(SM_CYHSCROLL);
@@ -701,7 +713,7 @@ static void SliderElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec SliderElementSpec = {
+static const Ttk_ElementSpec SliderElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SliderElement),
SliderElementOptions,
@@ -718,11 +730,11 @@ typedef struct {
Tcl_Obj *backgroundObj;
} TabElement;
-static Ttk_ElementOptionSpec TabElementOptions[] = {
+static const Ttk_ElementOptionSpec TabElementOptions[] = {
{ "-borderwidth", TK_OPTION_PIXELS,
- Tk_Offset(TabElement,borderWidthObj), "1" },
+ offsetof(TabElement,borderWidthObj), "1" },
{ "-background", TK_OPTION_BORDER,
- Tk_Offset(TabElement,backgroundObj), DEFAULT_BACKGROUND },
+ offsetof(TabElement,backgroundObj), DEFAULT_BACKGROUND },
{0,TK_OPTION_BOOLEAN,0,0}
};
@@ -776,7 +788,8 @@ static void TabElementDraw(
TabElement *tab = (TabElement *)elementRecord;
Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj);
XPoint pts[6];
- int cut = 2;
+ double scalingLevel = TkScalingLevel(tkwin);
+ int cut = round(2 * scalingLevel);
Display *disp = Tk_Display(tkwin);
int borderWidth = 1;
@@ -874,7 +887,7 @@ static void TabElementDraw(
}
}
-static Ttk_ElementSpec TabElementSpec = {
+static const Ttk_ElementSpec TabElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TabElement),
TabElementOptions,
@@ -910,7 +923,7 @@ static void ClientElementDraw(
TkWinReleaseDrawableDC(d, hdc, &dcState);
}
-static Ttk_ElementSpec ClientElementSpec = {
+static const Ttk_ElementSpec ClientElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -951,7 +964,7 @@ TtkWinTheme_Init(
parentPtr = Ttk_GetTheme(interp, "alt");
themePtr = Ttk_CreateTheme(interp, "winnative", parentPtr);
if (!themePtr) {
- return TCL_ERROR;
+ return TCL_ERROR;
}
Ttk_RegisterElementSpec(themePtr, "border", &BorderElementSpec, NULL);
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index b01bdcd..4b868aa 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -2,9 +2,9 @@
* Tk theme engine which uses the Windows XP "Visual Styles" API
* Adapted from Georgios Petasis' XP theme patch.
*
- * Copyright (c) 2003 Georgios Petasis, petasis@iit.demokritos.gr.
- * Copyright (c) 2003 Joe English
- * Copyright (c) 2003 Pat Thoyts
+ * Copyright © 2003 Georgios Petasis, petasis@iit.demokritos.gr.
+ * Copyright © 2003 Joe English
+ * Copyright © 2003 Pat Thoyts
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -15,30 +15,18 @@
* shellcc/platform/commctls/userex/refentry.asp >
*/
-#define WINVER 0x0501 /* Requires Windows XP APIs */
-
#include "tkWinInt.h"
-#ifndef HAVE_UXTHEME_H
-/* Stub for platforms that lack the XP theme API headers: */
-int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; }
-#else
-
#include <windows.h>
#include <uxtheme.h>
-#if defined(HAVE_VSSYM32_H) || _MSC_VER > 1500
-# include <vssym32.h>
-#else
-# include <tmschema.h>
-#endif
-
-#include "ttk/ttkTheme.h"
+#include <vssym32.h>
+#include "ttk/ttkThemeInt.h"
typedef HTHEME (STDAPICALLTYPE OpenThemeDataProc)(HWND hwnd,
LPCWSTR pszClassList);
typedef HRESULT (STDAPICALLTYPE CloseThemeDataProc)(HTHEME hTheme);
typedef HRESULT (STDAPICALLTYPE DrawThemeBackgroundProc)(HTHEME hTheme,
- HDC hdc, int iPartId, int iStateId, const RECT *pRect,
- OPTIONAL const RECT *pClipRect);
+ HDC hdc, int iPartId, int iStateId, const RECT *pRect,
+ OPTIONAL const RECT *pClipRect);
typedef HRESULT (STDAPICALLTYPE DrawThemeEdgeProc)(HTHEME hTheme,
HDC hdc, int iPartId, int iStateId, const RECT *pDestRect,
unsigned int uEdge, unsigned int uFlags,
@@ -177,12 +165,12 @@ BoxToRect(Ttk_Box b)
/*
* Map Tk state bitmaps to XP style enumerated values.
*/
-static Ttk_StateTable null_statemap[] = { {0,0,0} };
+static const Ttk_StateTable null_statemap[] = { {0,0,0} };
/*
* Pushbuttons (Tk: "Button")
*/
-static Ttk_StateTable pushbutton_statemap[] =
+static const Ttk_StateTable pushbutton_statemap[] =
{
{ PBS_DISABLED, TTK_STATE_DISABLED, 0 },
{ PBS_PRESSED, TTK_STATE_PRESSED, 0 },
@@ -194,7 +182,7 @@ static Ttk_StateTable pushbutton_statemap[] =
/*
* Checkboxes (Tk: "Checkbutton")
*/
-static Ttk_StateTable checkbox_statemap[] =
+static const Ttk_StateTable checkbox_statemap[] =
{
{CBS_MIXEDDISABLED, TTK_STATE_ALTERNATE|TTK_STATE_DISABLED, 0},
{CBS_MIXEDPRESSED, TTK_STATE_ALTERNATE|TTK_STATE_PRESSED, 0},
@@ -213,7 +201,7 @@ static Ttk_StateTable checkbox_statemap[] =
/*
* Radiobuttons:
*/
-static Ttk_StateTable radiobutton_statemap[] =
+static const Ttk_StateTable radiobutton_statemap[] =
{
{RBS_UNCHECKEDDISABLED, TTK_STATE_ALTERNATE|TTK_STATE_DISABLED, 0},
{RBS_UNCHECKEDNORMAL, TTK_STATE_ALTERNATE, 0},
@@ -230,7 +218,7 @@ static Ttk_StateTable radiobutton_statemap[] =
/*
* Groupboxes (tk: "frame")
*/
-static Ttk_StateTable groupbox_statemap[] =
+static const Ttk_StateTable groupbox_statemap[] =
{
{GBS_DISABLED, TTK_STATE_DISABLED, 0},
{GBS_NORMAL, 0,0 }
@@ -239,7 +227,7 @@ static Ttk_StateTable groupbox_statemap[] =
/*
* Edit fields (tk: "entry")
*/
-static Ttk_StateTable edittext_statemap[] =
+static const Ttk_StateTable edittext_statemap[] =
{
{ ETS_DISABLED, TTK_STATE_DISABLED, 0 },
{ ETS_READONLY, TTK_STATE_READONLY, 0 },
@@ -254,7 +242,7 @@ static Ttk_StateTable edittext_statemap[] =
* Same as edittext_statemap, but doesn't use ETS_READONLY
* (fixes: #1032409)
*/
-static Ttk_StateTable combotext_statemap[] =
+static const Ttk_StateTable combotext_statemap[] =
{
{ ETS_DISABLED, TTK_STATE_DISABLED, 0 },
{ ETS_FOCUSED, TTK_STATE_FOCUS, 0 },
@@ -265,7 +253,7 @@ static Ttk_StateTable combotext_statemap[] =
/*
* Combobox button: (CBP_DROPDOWNBUTTON)
*/
-static Ttk_StateTable combobox_statemap[] = {
+static const Ttk_StateTable combobox_statemap[] = {
{ CBXS_DISABLED, TTK_STATE_DISABLED, 0 },
{ CBXS_PRESSED, TTK_STATE_PRESSED, 0 },
{ CBXS_HOT, TTK_STATE_ACTIVE, 0 },
@@ -276,7 +264,7 @@ static Ttk_StateTable combobox_statemap[] = {
/*
* Toolbar buttons (TP_BUTTON):
*/
-static Ttk_StateTable toolbutton_statemap[] = {
+static const Ttk_StateTable toolbutton_statemap[] = {
{ TS_DISABLED, TTK_STATE_DISABLED, 0 },
{ TS_PRESSED, TTK_STATE_PRESSED, 0 },
{ TS_HOTCHECKED, TTK_STATE_SELECTED|TTK_STATE_ACTIVE, 0 },
@@ -288,7 +276,7 @@ static Ttk_StateTable toolbutton_statemap[] = {
/*
* Scrollbars (Tk: "Scrollbar.thumb")
*/
-static Ttk_StateTable scrollbar_statemap[] =
+static const Ttk_StateTable scrollbar_statemap[] =
{
{ SCRBS_DISABLED, TTK_STATE_DISABLED, 0 },
{ SCRBS_PRESSED, TTK_STATE_PRESSED, 0 },
@@ -296,7 +284,7 @@ static Ttk_StateTable scrollbar_statemap[] =
{ SCRBS_NORMAL, 0, 0 }
};
-static Ttk_StateTable uparrow_statemap[] =
+static const Ttk_StateTable uparrow_statemap[] =
{
{ ABS_UPDISABLED, TTK_STATE_DISABLED, 0 },
{ ABS_UPPRESSED, TTK_STATE_PRESSED, 0 },
@@ -304,7 +292,7 @@ static Ttk_StateTable uparrow_statemap[] =
{ ABS_UPNORMAL, 0, 0 }
};
-static Ttk_StateTable downarrow_statemap[] =
+static const Ttk_StateTable downarrow_statemap[] =
{
{ ABS_DOWNDISABLED, TTK_STATE_DISABLED, 0 },
{ ABS_DOWNPRESSED, TTK_STATE_PRESSED, 0 },
@@ -312,7 +300,7 @@ static Ttk_StateTable downarrow_statemap[] =
{ ABS_DOWNNORMAL, 0, 0 }
};
-static Ttk_StateTable leftarrow_statemap[] =
+static const Ttk_StateTable leftarrow_statemap[] =
{
{ ABS_LEFTDISABLED, TTK_STATE_DISABLED, 0 },
{ ABS_LEFTPRESSED, TTK_STATE_PRESSED, 0 },
@@ -320,7 +308,7 @@ static Ttk_StateTable leftarrow_statemap[] =
{ ABS_LEFTNORMAL, 0, 0 }
};
-static Ttk_StateTable rightarrow_statemap[] =
+static const Ttk_StateTable rightarrow_statemap[] =
{
{ ABS_RIGHTDISABLED,TTK_STATE_DISABLED, 0 },
{ ABS_RIGHTPRESSED, TTK_STATE_PRESSED, 0 },
@@ -328,7 +316,7 @@ static Ttk_StateTable rightarrow_statemap[] =
{ ABS_RIGHTNORMAL, 0, 0 }
};
-static Ttk_StateTable spinbutton_statemap[] =
+static const Ttk_StateTable spinbutton_statemap[] =
{
{ DNS_DISABLED, TTK_STATE_DISABLED, 0 },
{ DNS_PRESSED, TTK_STATE_PRESSED, 0 },
@@ -339,7 +327,7 @@ static Ttk_StateTable spinbutton_statemap[] =
/*
* Trackbar thumb: (Tk: "scale slider")
*/
-static Ttk_StateTable scale_statemap[] =
+static const Ttk_StateTable scale_statemap[] =
{
{ TUS_DISABLED, TTK_STATE_DISABLED, 0 },
{ TUS_PRESSED, TTK_STATE_PRESSED, 0 },
@@ -348,7 +336,7 @@ static Ttk_StateTable scale_statemap[] =
{ TUS_NORMAL, 0, 0 }
};
-static Ttk_StateTable tabitem_statemap[] =
+static const Ttk_StateTable tabitem_statemap[] =
{
{ TIS_DISABLED, TTK_STATE_DISABLED, 0 },
{ TIS_SELECTED, TTK_STATE_SELECTED, 0 },
@@ -383,11 +371,11 @@ static Ttk_StateTable tabitem_statemap[] =
typedef struct /* XP element specifications */
{
const char *elementName; /* Tk theme engine element name */
- Ttk_ElementSpec *elementSpec;
+ const Ttk_ElementSpec *elementSpec;
/* Element spec (usually GenericElementSpec) */
LPCWSTR className; /* Windows window class name */
int partId; /* BP_PUSHBUTTON, BP_CHECKBUTTON, etc. */
- Ttk_StateTable *statemap; /* Map Tk states to XP states */
+ const Ttk_StateTable *statemap; /* Map Tk states to XP states */
Ttk_Padding padding; /* See NOTE-GetThemeMargins */
unsigned flags;
# define IGNORE_THEMESIZE 0x80000000U /* See NOTE-GetThemePartSize */
@@ -571,7 +559,7 @@ static void GenericElementDraw(
FreeElementData(elementData);
}
-static Ttk_ElementSpec GenericElementSpec =
+static const Ttk_ElementSpec GenericElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -611,7 +599,7 @@ GenericSizedElementSize(
*widthPtr /= 2;
}
-static Ttk_ElementSpec GenericSizedElementSpec = {
+static const Ttk_ElementSpec GenericSizedElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -641,7 +629,7 @@ SpinboxArrowElementSize(
*heightPtr /= 2;
}
-static Ttk_ElementSpec SpinboxArrowElementSpec = {
+static const Ttk_ElementSpec SpinboxArrowElementSpec = {
TK_STYLE_VERSION_2,
sizeof(NullElement),
TtkNullElementOptions,
@@ -682,7 +670,7 @@ static void ThumbElementDraw(
FreeElementData(elementData);
}
-static Ttk_ElementSpec ThumbElementSpec =
+static const Ttk_ElementSpec ThumbElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -714,7 +702,7 @@ static void PbarElementSize(
}
}
-static Ttk_ElementSpec PbarElementSpec =
+static const Ttk_ElementSpec PbarElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -788,7 +776,6 @@ static void TabElementDraw(
int partId = elementData->info->partId;
int isSelected = (state & TTK_STATE_SELECTED);
int stateId = Ttk_StateTableLookup(elementData->info->statemap, state);
- RECT rc;
if (mainInfoPtr != NULL) {
nbTabsStickBit = (Ttk_PositionSpec) mainInfoPtr->ttkNbTabsStickBit;
@@ -812,13 +799,13 @@ static void TabElementDraw(
break;
}
- rc = BoxToRect(b);
+ RECT rc = BoxToRect(b);
if (!InitElementData(elementData, tkwin, d))
return;
if (nbTabsStickBit == TTK_STICK_S) {
- if (state & TTK_STATE_USER1) {
+ if (state & TTK_STATE_FIRST) {
partId = TABP_TABITEMLEFTEDGE;
}
@@ -864,7 +851,7 @@ static void TabElementDraw(
FreeElementData(elementData);
}
-static Ttk_ElementSpec TabElementSpec =
+static const Ttk_ElementSpec TabElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -879,17 +866,14 @@ static Ttk_ElementSpec TabElementSpec =
* Generic element, but don't display at all if TTK_STATE_LEAF (=USER2) set
*/
-#define TTK_STATE_OPEN TTK_STATE_USER1
-#define TTK_STATE_LEAF TTK_STATE_USER2
-
-static Ttk_StateTable header_statemap[] =
+static const Ttk_StateTable header_statemap[] =
{
{ HIS_PRESSED, TTK_STATE_PRESSED, 0 },
{ HIS_HOT, TTK_STATE_ACTIVE, 0 },
{ HIS_NORMAL, 0,0 },
};
-static Ttk_StateTable treeview_statemap[] =
+static const Ttk_StateTable treeview_statemap[] =
{
{ TREIS_DISABLED, TTK_STATE_DISABLED, 0 },
{ TREIS_SELECTED, TTK_STATE_SELECTED, 0},
@@ -897,7 +881,7 @@ static Ttk_StateTable treeview_statemap[] =
{ TREIS_NORMAL, 0,0 },
};
-static Ttk_StateTable tvpglyph_statemap[] =
+static const Ttk_StateTable tvpglyph_statemap[] =
{
{ GLPS_OPENED, TTK_STATE_OPEN, 0 },
{ GLPS_CLOSED, 0,0 },
@@ -908,11 +892,11 @@ static void TreeIndicatorElementDraw(
Drawable d, Ttk_Box b, Ttk_State state)
{
if (!(state & TTK_STATE_LEAF)) {
- GenericElementDraw(clientData,elementRecord,tkwin,d,b,state);
+ GenericElementDraw(clientData,elementRecord,tkwin,d,b,state);
}
}
-static Ttk_ElementSpec TreeIndicatorElementSpec =
+static const Ttk_ElementSpec TreeIndicatorElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(NullElement),
@@ -943,9 +927,9 @@ typedef struct
static const Ttk_ElementOptionSpec TextElementOptions[] =
{
{ "-text", TK_OPTION_STRING,
- Tk_Offset(TextElement,textObj), "" },
+ offsetof(TextElement,textObj), "" },
{ "-font", TK_OPTION_FONT,
- Tk_Offset(TextElement,fontObj), DEFAULT_FONT },
+ offsetof(TextElement,fontObj), DEFAULT_FONT },
{ NULL }
};
@@ -958,7 +942,7 @@ static void TextElementSize(
RECT rc = {0, 0};
HRESULT hr = S_OK;
const char *src;
- int len;
+ Tcl_Size len;
Tcl_DString ds;
if (!InitElementData(elementData, tkwin, 0))
@@ -997,7 +981,7 @@ static void TextElementDraw(
RECT rc = BoxToRect(b);
HRESULT hr = S_OK;
const char *src;
- int len;
+ Tcl_Size len;
Tcl_DString ds;
if (!InitElementData(elementData, tkwin, d))
@@ -1020,7 +1004,7 @@ static void TextElementDraw(
FreeElementData(elementData);
}
-static Ttk_ElementSpec TextElementSpec =
+static const Ttk_ElementSpec TextElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(TextElement),
@@ -1047,7 +1031,7 @@ TTK_LAYOUT("TMenubutton",
TTK_NODE("Menubutton.dropdown", TTK_PACK_RIGHT|TTK_FILL_Y)
TTK_GROUP("Menubutton.button", TTK_FILL_BOTH,
TTK_GROUP("Menubutton.padding", TTK_FILL_X,
- TTK_NODE("Menubutton.label", 0))))
+ TTK_NODE("Menubutton.label", 0))))
TTK_LAYOUT("Horizontal.TScrollbar",
TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X,
@@ -1086,7 +1070,7 @@ TTK_END_LAYOUT_TABLE
/* name spec className partId statemap padding flags */
-static ElementInfo ElementInfoTable[] = {
+static const ElementInfo ElementInfoTable[] = {
{ "Checkbutton.indicator", &GenericElementSpec, L"BUTTON",
BP_CHECKBOX, checkbox_statemap, PAD(0, 0, 4, 0), PAD_MARGINS },
{ "Radiobutton.indicator", &GenericElementSpec, L"BUTTON",
@@ -1198,12 +1182,12 @@ GetSysFlagFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr)
};
Tcl_Obj **objv;
- int i, objc;
+ Tcl_Size i, objc;
if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK)
return TCL_ERROR;
if (objc != 2) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args", -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL);
return TCL_ERROR;
}
@@ -1235,7 +1219,7 @@ Ttk_CreateVsapiElement(
void *clientData,
Ttk_Theme theme,
const char *elementName,
- int objc,
+ Tcl_Size objc,
Tcl_Obj *const objv[])
{
XPThemeData *themeData = (XPThemeData *)clientData;
@@ -1246,21 +1230,21 @@ Ttk_CreateVsapiElement(
Ttk_StateTable *stateTable;
Ttk_Padding pad = {0, 0, 0, 0};
int flags = 0;
- int length = 0;
+ Tcl_Size length = 0;
char *name;
LPWSTR wname;
- Ttk_ElementSpec *elementSpec = &GenericElementSpec;
+ const Ttk_ElementSpec *elementSpec = &GenericElementSpec;
Tcl_DString classBuf;
static const char *const optionStrings[] =
- { "-padding","-width","-height","-margins", "-syssize",
- "-halfheight", "-halfwidth", NULL };
- enum { O_PADDING, O_WIDTH, O_HEIGHT, O_MARGINS, O_SYSSIZE,
- O_HALFHEIGHT, O_HALFWIDTH };
+ { "-halfheight", "-halfwidth", "-height", "-margins", "-padding",
+ "-syssize", "-width", NULL };
+ enum { O_HALFHEIGHT, O_HALFWIDTH, O_HEIGHT, O_MARGINS, O_PADDING,
+ O_SYSSIZE, O_WIDTH };
if (objc < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "missing required arguments 'class' and/or 'partId'", -1));
+ "missing required arguments 'class' and/or 'partId'", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TTK", "VSAPI", "REQUIRED", NULL);
return TCL_ERROR;
}
@@ -1274,7 +1258,7 @@ Ttk_CreateVsapiElement(
/* flags or padding */
if (objc > 3) {
- int i = 3;
+ Tcl_Size i = 3;
int option = 0;
for (i = 3; i < objc; i += 2) {
int tmp = 0;
@@ -1342,7 +1326,7 @@ Ttk_CreateVsapiElement(
/* convert a statemap into a state table */
if (objc > 2) {
Tcl_Obj **specs;
- int n, j, count;
+ Tcl_Size n, j, count;
int status = TCL_OK;
if (Tcl_ListObjGetElements(interp, objv[2], &count, &specs) != TCL_OK)
goto retErr;
@@ -1391,7 +1375,7 @@ Ttk_CreateVsapiElement(
theme, elementName, elementPtr->elementSpec, elementData);
Ttk_RegisterCleanup(interp, elementData, DestroyElementData);
- Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1));
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, TCL_INDEX_NONE));
Tcl_DStringFree(&classBuf);
return TCL_OK;
@@ -1425,7 +1409,7 @@ TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd)
themePtr = Ttk_CreateTheme(interp, "xpnative", parentPtr);
if (!themePtr)
- return TCL_ERROR;
+ return TCL_ERROR;
/*
* Set theme data and cleanup proc
@@ -1472,5 +1456,3 @@ TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd)
return TCL_OK;
}
-
-#endif /* HAVE_UXTHEME_H */
diff --git a/win/winMain.c b/win/winMain.c
index 14eb718..90324b6 100644
--- a/win/winMain.c
+++ b/win/winMain.c
@@ -4,9 +4,9 @@
* Provides a default version of the main program and Tcl_AppInit
* procedure for wish and other Tk-based applications.
*
- * Copyright (c) 1993 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 Scriptics Corporation.
+ * Copyright © 1993 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -28,10 +28,11 @@
int _CRT_glob = 0;
#endif /* __GNUC__ */
-#ifdef TK_TEST
#ifdef __cplusplus
extern "C" {
#endif
+
+#ifdef TK_TEST
extern Tcl_LibraryInitProc Tktest_Init;
#endif /* TK_TEST */
@@ -171,6 +172,9 @@ _tWinMain(
#ifdef TK_LOCAL_MAIN_HOOK
TK_LOCAL_MAIN_HOOK(&argc, &argv);
+#elif defined(UNICODE) && ((TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION > 6))
+ /* This doesn't work on Windows without UNICODE, neither does it work with Tcl 8.6 */
+ TclZipfs_AppHook(&argc, &argv);
#endif
Tk_Main(argc, argv, TK_LOCAL_APPINIT);
diff --git a/win/wish.exe.manifest.in b/win/wish.exe.manifest.in
index 4829471..20a79a4 100644
--- a/win/wish.exe.manifest.in
+++ b/win/wish.exe.manifest.in
@@ -28,8 +28,6 @@
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
- <!-- Windows Vista -->
- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
<asmv3:application>
@@ -37,6 +35,10 @@
xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
+ <asmv3:windowsSettings
+ xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">
+ <activeCodePage>UTF-8</activeCodePage>
+ </asmv3:windowsSettings>
</asmv3:application>
<dependency>
<dependentAssembly>
diff --git a/win/x86_64-w64-mingw32-nmakehlp.exe b/win/x86_64-w64-mingw32-nmakehlp.exe
index 2564ec9..f821add 100755
--- a/win/x86_64-w64-mingw32-nmakehlp.exe
+++ b/win/x86_64-w64-mingw32-nmakehlp.exe
Binary files differ